<i>zlib transform issue, multi-stream inflate ignores streams after first</i> status still Open with 3 other changes
by
.
D 2020-04-16T06:53:41.913
J icomment Updated\spatch.\sIn\saddition\sto\ssignaling\sthe\sstream\send\sit\salso\srecords\show\smuch\sof\sthe\slast\sread\swas\sprocessed,\sand\show\smuch\swas\snot,\si.e.\sread\sbeyond\sthe\send\sof\sthe\sstream\s(over'shot).\sWhen\sthe\stransform\scloses\s(is\spopped\soff)\sthis\sexcess\sdata\sis\sstashed\sback\sinto\sthe\sunderlying\schannel,\sto\sbe\sread\seither\splain,\sor\sby\sthe\snext\stransform\spush\sonto\sit.\r\n\r\nThis\schange\smakes\sthe\s`-limit`\soption\ssuperfluous.\r\n\r\nWe\scan\sread\sas\smuch\sas\swe\slike.\r\n\r\nFor\sbackward\scompatibility\swe\sshould\skeep\saccepting\sit\sin\sall\sreleases\sbefore\sv9,\sjust\signore\sthe\svalue,\suse\ssomething\sautomatic\s(buffer\ssize\s?).\sIn\sv9\swe\scan\sdrop\sit.\r\n\r\nPasses\s`make\stest`.\sEven\sso,\sthis\sand\sprevious\sticket\sreally\sneed\stest\scases\sto\sdemo\sthem\sadded\sto\szlib.test.\sNot\stoday\showever,\sneed\ssleep.\r\n\r\n<pre>\r\nIndex:\sgeneric/tclZlib.c\r\n==================================================================\r\n---\sgeneric/tclZlib.c\r\n+++\sgeneric/tclZlib.c\r\n@@\s-126,10\s+126,16\s@@\r\n\s\s\s\s\sTcl_TimerToken\stimer;\t/*\sTimer\sused\sfor\skeeping\sevents\sfresh.\s*/\r\n\s\s\s\s\sTcl_DString\sdecompressed;\t/*\sBuffer\sfor\sdecompression\sresults.\s*/\r\n\s\s\s\s\sTcl_Obj\s*compDictObj;\t/*\sByte-array\sobject\scontaining\scompression\r\n\s\t\t\t\t\s*\sdictionary\s(not\sdictObj!)\sto\suse\sif\r\n\s\t\t\t\t\s*\snecessary.\s*/\r\n+\s\s\s\sint\sdone;\t\t\t/*\sFlag\sto\ssignal\sstream\send\sup\sto\stransform\r\n+\t\t\t\t\s*\sinput\s*/\r\n+\s\s\s\sint\sover;\t\t\t/*\sNumber\sof\sbytes\swe\sread\sto\sfar\sin\sthe\r\n+\t\t\t\t\s*\sunderlying\sstream\s*/\r\n+\s\s\s\sint\sskip;\t\t\t/*\sBytes\sprocessed\sin\sthe\slast\sread\sbefore\r\n+\t\t\t\t\s*\sthe\sovershot\s*/\r\n\s}\sZlibChannelData;\r\n\s\r\n\s/*\r\n\s\s*\sValue\sbits\sfor\sthe\sflags\sfield.\sDefinitions\sare:\r\n\s\s*\tASYNC\s-\t\tWhether\sthis\sis\san\sasynchronous\schannel.\r\n@@\s-2946,10\s+2952,14\s@@\r\n\s\t}\swhile\s(e\s!=\sZ_STREAM_END);\r\n\s\t(void)\sdeflateEnd(&cd->outStream);\r\n\s\s\s\s\s}\selse\s{\r\n\s\t(void)\sinflateEnd(&cd->inStream);\r\n\s\s\s\s\s}\r\n+\r\n+\s\s\s\sif\s(cd->over)\s{\r\n+\tTcl_Ungets\s(cd->parent,\scd->inBuffer\s+\scd->skip,\scd->over,\s0);\r\n+\s\s\s\s}\r\n\s\r\n\s\s\s\s\s/*\r\n\s\s\s\s\s\s*\sRelease\sall\smemory.\r\n\s\s\s\s\s\s*/\r\n\s\r\n@@\s-3011,10\s+3021,14\s@@\r\n\s\tgotBytes\s+=\scopied;\r\n\s\r\n\s\tif\s(toRead\s==\s0)\s{\r\n\s\t\s\s\s\sreturn\sgotBytes;\r\n\s\t}\r\n+\r\n+\tif\s(cd->done)\s{\r\n+\t\s\s\s\sreturn\sgotBytes;\r\n+\t}\r\n\s\r\n\s\t/*\r\n\s\t\s*\sThe\sbuffer\sis\sexhausted,\sbut\sthe\scaller\swants\seven\smore.\sWe\snow\r\n\s\t\s*\shave\sto\sgo\sto\sthe\sunderlying\schannel,\sget\smore\sbytes\sand\sthen\r\n\s\t\s*\stransform\sthem\sfor\sdelivery.\sWe\smay\snot\sget\swhat\swe\swant\s(full\sEOF\r\n@@\s-3831,10\s+3845,15\s@@\r\n\s\t\s*/\r\n\s\r\n\s\tif\s(((flush\s==\sZ_SYNC_FLUSH)\s&&\s(e\s==\sZ_BUF_ERROR))\r\n\s\t\t||\s(e\s==\sZ_STREAM_END)\r\n\s\t\t||\s(e\s==\sZ_OK\s&&\swritten\s==\s0))\s{\r\n+\t\s\s\s\sif\s(e\s==\sZ_STREAM_END)\s{\r\n+\t\tcd->done\s=\s1;\r\n+\t\tcd->over\s=\scd->inStream.avail_in;\r\n+\t\tcd->skip\s=\sn\s-\scd->over;\r\n+\t\s\s\s\s}\r\n\s\t\s\s\s\sreturn\sTCL_OK;\r\n\s\t}\r\n\s\r\n\s\t/*\r\n\s\t\s*\sZ_BUF_ERROR\scan\sbe\signored\sas\sper\shttp://www.zlib.net/zlib_how.html\r\n\r\n</pre>
J login aku
J mimetype text/x-fossil-wiki
K f70ce1feadf55c2f0fd142bdc20fbdcae5698495
U aku
Z 349939f0ad2f32041aeae1d3efde4f94