<i>Tcl 8.6.11: Incompatible Tcl_GetRange()</i> status still Closed with 5 other changes
by
.
D 2022-03-13T01:05:59.438
J closedate 2459651.54582683
J closer jan.nijtmans
J icomment @dgp,\sthe\sdefections\syou\sare\smentioning\sare\sin\spast\sversions\sof\sTcl_GetRange()\sright?\sThe\scurrent\simplementation\sdoesn't\shave\sthose\sdefects\sany\smore,\sright?\r\n\r\nWhat\sis\sdone\snow\sis\sroughly:\r\n<pre>\r\n\tif\s(last\s<\s0\s||\slast\s>=\slength)\s{\r\n\t\s\s\s\slast\s=\slength\s-\s1;\r\n\t}\r\n\tif\s(last\s<\sfirst)\s{\r\n\t\s\s\s\sTclNewObj(newObjPtr);\r\n\t\s\s\s\sreturn\snewObjPtr;\r\n\t}\r\n\t....\r\n</pre>\r\n\r\nSo,\sif\s'last'\sis\s<\s0,\sit\swill\sbe\simmediately\sreplated\swith\slength\s-1.\sIf\sthat's\sstill\snegative\s(then\slength\s=\s0,\sbecause\s'first'\sis\snever\snegative),\sthen\slast\s<\sfirst,\sso\sthe\sempty\sstring\sis\sproduced:\scorrect.\r\n\r\nAlso,\safter\sthis,\slast\s>=\sfirst,\sso\slast\s-\sfirst\s+\s1\s>=\s1.\sThis\smeans\sTcl_NewByteArrayObj()\swill\snever\sbe\scalled\swith\sa\snegative\slength,\sneither\swill\sTcl_New(String|Unicode)Obj().\r\n\r\nMy\sconclusion:\sThe\scurrent\scode\sis\sconsistant\sand\scorrect,\sprevious\sversions\swere\snot.\sWe\scould\sadd\ssome\smore\stestcases\sfor\sTcl_GetRange(),\sto\sprove\severything\sis\scorrect,\sbut\sI\swould\skeep\sthe\scode\sas\sit\sis\snow.\sOK?\r\n\r\nI'll\sclose\sthe\s"bug-e9a2715d91"\sbranch,\swhich\scontains\sthe\s8.6.10\scode,\swhich\shad\sthe\sdefects\syou\smention.\score-8-6-branch\sdoesn't\shave\sthose\sdefects.\r\n\r\nThanks!
J login jan.nijtmans
J mimetype text/x-fossil-wiki
K e9a2715d912d86448a2ed18b2d25788cd50769b4
U jan.nijtmans
Z 782ad5eff2c11436783ea03f5a6d1cc1