Artifact [2536b9c03b]

Artifact 2536b9c03b9abcf4738b8028054223a734a5abce:

Ticket change [2536b9c03b] - Ticket [bd6188edd4] dir2c: Output data as character array and not as string status still Open with 4 other changes by anonymous on 2020-05-11 16:40:12.
D 2020-05-11T16:40:12.682
J icomment I\swould\slove\sto\sbe\sable\sto\sedit\smy\sown\sbad\sstuff.\r\n\r\nThe\sdiff\swas\sin\sthe\swrong\sdirection.\sHere\sis\sthe\scorrected\sdiff:\r\n\r\n<verbatim>\r\n\r\n---\sC:/oehhar/elmicron/projekte/el1005_scanlink_dll/source/c-vfs/dir2c_ori.tcl\tWed\sJan\s22\s20:53:52\s2020\r\n+++\sC:/oehhar/elmicron/projekte/el1005_scanlink_dll/source/c-vfs/dir2c.tcl\tMon\sMay\s11\s07:31:09\s2020\r\n@@\s-70,7\s+70,7\s@@\r\n\s\r\n\s\t\tappend\sret\s"\\\\x${char}"\r\n\s\r\n-\t\tif\s{($idx\s%\s20)\s==\s0\s&&\s$idx\s!=\s0}\s{\r\n+\t\tif\s{(($idx+1)\s%\s20)\s==\s0}\s{\r\n\s\t\t\tappend\sret\s"\\"\\n\\""\r\n\s\t\t}\r\n\s\t}\r\n@@\s-82,6\s+82,24\s@@\r\n\s\treturn\s$ret\r\n\s}\r\n\s\r\n+#\sConvert\sdata\sto\sa\scharacter\sarray\r\n+proc\scharacter_array\s{data}\s{\r\n+\tset\sret\s"\\{\\n\\t"\r\n+\tfor\s{set\sidx\s0}\s{$idx\s<\s[string\slength\s$data]}\s{incr\sidx}\s{\r\n+\t\tbinary\sscan\s[string\sindex\s$data\s$idx]\sH*\schar\r\n+\t\tappend\sret\s"0x${char},\s"\r\n+\r\n+\t\tif\s{(($idx+1)\s%\s16)\s==\s0\s}\s{\r\n+\t\t\tappend\sret\s"\\n\\t"\r\n+\t\t}\r\n+\t}\r\n+\tset\sret\s[string\strimright\s$ret\s"\\n,\s\\t"]\r\n+\r\n+\tappend\sret\s"\\n\\}"\r\n+\r\n+\treturn\s$ret\r\n+}\r\n+\r\n\s#\sEncrypt\sthe\sdata\r\n\sproc\srandom_byte\s{}\s{\r\n\s\tset\svalue\s[expr\s{int(256\s*\srand())}]\r\n@@\s-307,16\s+325,9\s@@\r\n\s#\s\sendif\s/*\s!LOADED_CVFS_COMMON\s*/}\r\n\sputs\s""\r\n\s\r\n-puts\s"static\sstruct\scvfs_data\s${code_tag}_data\\[\\]\s=\s{"\r\n-puts\s"\\t{"\r\n-puts\s"\\t\\t/*\sIndex\s0\scannot\sbe\sused\sbecause\swe\suse\sthe\svalue\s0\sto\srepresent\sfailure\s*/"\r\n-puts\s"\\t\\t.name\s\s=\sNULL,"\r\n-puts\s"\\t\\t.index\s=\s0,"\r\n-puts\s"\\t\\t.type\s\s=\s0,"\r\n-puts\s"\\t\\t.size\s\s=\s0,"\r\n-puts\s"\\t\\t.data\s\s=\sNULL,"\r\n-puts\s"\\t\\t.free\s\s=\s0,"\r\n-puts\s"\\t},"\r\n+#\sC\sstruct\sdata\soutput\sbuffer\s(must\sbe\sdelayed\safter\sdefinition\sof\sfile\sdata)\r\n+set\sstruct_data\s""\r\n+\r\n\sfor\s{set\sidx\s1}\s{$idx\s<\s[llength\s$files]}\s{incr\sidx}\s{\r\n\s\tset\sfile\s[lindex\s$files\s$idx]\r\n\s\tset\sshortfile\s[shorten_file\s$startdir\s$file]\r\n@@\s-330,15\s+341,28\s@@\r\n\s\r\n\s\t\t\tset\sfd\s[open\s$file]\r\n\s\t\t\tfconfigure\s$fd\s-translation\sbinary\r\n-\t\t\tset\sdata\s[read\s$fd]\r\n+\t\t\tset\sdata_in\s[read\s$fd]\r\n\s\t\t\tclose\s$fd\r\n\s\r\n\s\t\t\tif\s{$obsfucate}\s{\r\n\s\t\t\t\tset\stype\s"CVFS_FILETYPE_ENCRYPTED_FILE"\r\n-\t\t\t\tset\sdata\s"(unsigned\schar\s*)\s[stringify\s[encrypt\s$data\s$obsfucation_key]]"\r\n+\t\t\t\tset\sdata_in\s[encrypt\s$data_in\s$obsfucation_key]\r\n\s\t\t\t}\selse\s{\r\n\s\t\t\t\tset\stype\s"CVFS_FILETYPE_FILE"\r\n-\t\t\t\tset\sdata\s"(unsigned\schar\s*)\s[stringify\s$data]"\r\n+\t\t\t}\r\n+\t\t\t#\sMicrosoft\sVC9\scompiler\shas\sa\sstring\slimit\sof\s65535\sbytes\r\n+\t\t\t#\sso\sput\sall\slarger\sfiles\sinto\san\sarray\swhich\shas\sa\shigher\r\n+\t\t\t#\sstring\slimit\r\n+\t\t\t#\sFor\sinstance,\sthe\sextra\svariable\sis\sused\sfor\sall\sfiles.\r\n+\t\t\t#\sthis\smay\sbe\sdeactivated\sby\sremoving\s"0\s&"\sbelow\r\n+\t\t\tif\s{\s0\s&\s$size\s<=\s65535}\s{\r\n+\t\t\t\tset\sdata\s"(unsigned\schar\s*)\s[stringify\s$data_in]"\r\n+\t\t\t}\selse\s{\r\n+\t\t\t\tputs\s"/*\sData\sof\s$shortfile\s*/"\r\n+\t\t\t\tset\svariable_name\scvfs_data_$idx\r\n+\t\t\t\tset\sdata\s$variable_name\r\n+\t\t\t\tputs\s"static\sunsigned\schar\s${variable_name}\\[\\]\s=\\\r\n+\t\t\t\t\t\t[character_array\s$data_in];"\r\n\s\t\t\t}\r\n\s\t\t}\r\n\s\t\t"directory"\s{\r\n@@\s-348,15\s+372,27\s@@\r\n\s\t\t}\r\n\s\t}\r\n\s\r\n-\tputs\s"\\t{"\r\n-\tputs\s"\\t\\t.name\s\s=\s\\"$shortfile\\","\r\n-\tputs\s"\\t\\t.index\s=\s$idx,"\r\n-\tputs\s"\\t\\t.type\s\s=\s$type,"\r\n-\tputs\s"\\t\\t.size\s\s=\s$size,"\r\n-\tputs\s"\\t\\t.data\s\s=\s$data,"\r\n-\tputs\s"\\t\\t.free\s\s=\s0,"\r\n-\tputs\s"\\t},"\r\n+\tappend\sstruct_data\s"\\t{\\n"\\\r\n+\t\t\t"\\t\\t/*\sname\s\s*/\s\\"$shortfile\\",\\n"\\\r\n+\t\t\t"\\t\\t/*\sindex\s*/\s$idx,\\n"\\\r\n+\t\t\t"\\t\\t/*\ssize\s\s*/\s$size,\\n"\\\r\n+\t\t\t"\\t\\t/*\stype\s\s*/\s$type,\\n"\\\r\n+\t\t\t"\\t\\t/*\sdata\s\s*/\s$data,\\n"\\\r\n+\t\t\t"\\t\\t/*\sfree\s\s*/\s0,\\n"\\\r\n+\t\t\t"\\t},\\n"\r\n\s}\r\n+puts\s""\r\n+puts\s"static\sstruct\scvfs_data\s${code_tag}_data\\[\\]\s=\s{"\r\n+puts\s"\\t{"\r\n+puts\s"\\t\\t/*\sIndex\s0\scannot\sbe\sused\sbecause\swe\suse\sthe\svalue\s0\sto\srepresent\sfailure\s*/"\r\n+puts\s"\\t\\t/*\sname\s\s*/\sNULL,"\r\n+puts\s"\\t\\t/*\sindex\s*/\s0,"\r\n+puts\s"\\t\\t/*\stype\s\s*/\s0,"\r\n+puts\s"\\t\\t/*\ssize\s\s*/\s0,"\r\n+puts\s"\\t\\t/*\sdata\s\s*/\sNULL,"\r\n+puts\s"\\t\\t/*\sfree\s\s*/\s0,"\r\n+puts\s"\\t},"\r\n+puts\s-nonewline\s$struct_data\r\n\sputs\s"};"\r\n\sputs\s""\r\n\r\n</verbatim>
J login anonymous
J mimetype text/x-fossil-wiki
J username oehhar
K bd6188edd4290bfdcff4a8ef9355f5280496eda5
U anonymous
Z 134669378caa928d390ac2dc7d49dac4