.
D 2010-02-23T05:59:40
J icomment Now\sI\sunderstand.\sHere\sis\sa\strace\sI\smade\swith\sfprintf\sat\sstrategic\splaces\sin\sthe\sZlib\sand\sgeneral\sIO\scode.\n\n\s\s\s\sCompressed\ssize\sis\s41\n\s\s\s\sIO\sChanRead\s(4096)\n\s\s\s\sIO\sgot\s48\n\s\s\s\sIO\sOK\n\s\s\s\sHEADER:hahaha\n\s\s\s\sZ\sINFLATE\s0x804cdc0\n\s\s\s\sZ\sPUSH\s\s0x80681a8\n\s\s\s\sNow\sreading\sthrough\sgunzip\n\s\s\s\sIO\sDoReadChars\sc0\s-1\s/loop\s4294967295\n\s\s\s\sIO\sDOReadChars\sCopied\s-1\n\s\s\s\sIO\sChanRead\s(4096)\n\s\s\s\sZ\sINPUT\s0x80681a8\s4096\n\s\s\s\sZ\sGET\sRAW\s0x80738e0\s4096\n\s\s\s\sIO\sChanRead\s(4055)\n\s\s\s\sZ\s\s\s\s\s\s\s\s\s41\n\s\s\s\sZ\sprocessing\s41,\sspace\sfor\s4096\n\s\s\s\sZ\s0\sleft\s10,\sremaining\s0\s/1/0\n\s\s\s\sZ\sreturning\s4096\n\s\s\s\sIO\sgot\s4096\n\s\s\s\sIO\sOK\n\s\s\s\sIO\sDoReadChars\sc0\s-1\s/loop\s4294967295\n\s\s\s\sIO\sDoReadChars\sQueued\sData\n\s\s\s\sIO\sDOReadChars\sCopied\s4096\n\s\s\s\sIO\sDoReadChars\sc4096\s-4097\s/loop\s4294963199\n\s\s\s\sIO\sDOReadChars\sCopied\s-1\n*\s\s\sIO\sDOReadChars\sEOF\n\s\s\s\sReceived\s4096\sout\sof\s5000\n\s\s\s\sZ\sCLOSE\s0x80681a8\n\nThe\sproblem\sis\sshown\sby\sthe\s*'d\sline.\s\n\n(1)\sWe\shave\sa\sbase\schannel,\sand\n(2)\sa\stransformation\son\stop\n(3)\sBy\sreading\sfrom\sthe\stransformation\swe\scause\sit\sto\n(4)\sread\sfrom\sthe\sbase\schannel.\n(5)\sThe\sbase\schannel\shits\sEOF\sin\sthat\sread.\n(6)\sThe\sloop\sin\sDoReadChars()\ssees\sthat\sEOF\sflag\sand\saborts,\n(7)\snever\smind\sthat\sdata\sis\sin\sthe\stransform\swhich\swe\scould\sread.\n\nThe\sgeneric\sIO\scode\sthinks\sthat\sthe\sEOF\sflag\sapplies\sto\sthe\swhole\sstack,\swhile\sit\sactually\sapplies\sonly\sto\sthe\sbase\schannel.\sThe\sflags,\sincluding\sEOF\sare\smanaged\sin\sthe\sChannelState,\swhich\sis\sshared\sbetween\sall\schannels\sin\sthe\sstack.\n\nTo\struly\sfix\sthis\swe\shave\sto\smanage\ssome\sEOF\sflag\son\sa\sper-channel/transform\sbase,\sand\slook\sonly\sat\sthe\sflag\sof\sthe\stopmost\schannel\sinstead\sof\sthe\sshared\sone.\n\nThis\sis\san\sissue\sany\sand\sall\stransforms\scan\srun\sinto,\scausing\sloss\sof\sthe\slast\spart\sof\stheir\sinfo.\n\nA\srelated\sproblem\swhich\scan\soccur\sin\sthe\smiddle\sof\sa\schannel\sis\sif\syou\shave,\sfor\sexample\smultiple\sdeflated\sstreams\sin\sthe\ssame\schannel,\sthen\sreading\sdata\sfor\sthe\sfirst\sstream\smay\sread\sahead\sinto\sdata\sof\sthe\snext,\sand\syou\scannot\sunread\sthis\spart,\sit\sis\sin\sthe\sbuffers\shigh\sup\sand\scannot\sbe\spushed\sback\sfor\sthe\snext\sstream\sto\sbe\sprocessed.\n\nI\sbelieve\sthat\sis\sthe\sreason\sfor\sTIP\s230\shaving\sthe\s'limit'\smethod.\sIt\scan\sbe\sused\sto\slimit\sthe\samount\sof\sread-ahead.\sIn\sthe\scase\sof\slimit=1\snothing\sis\sread\sbeyond\sthe\send\sof\sa\sstream,\sso\sthe\snext\sstream\sis\sok,\snothing\sto\sunread.\n\nThis\shelps\sin\sour\scase\sactually\sas\swell.\sBecause\sreading\sthe\sZ_STREAM_END\smarker\sbyte(s)\sdoes\snot\syet\strigger\seof\sin\sthe\sbase\schannel,\sallowing\sthe\souter\sDoReadChars()\sloop\sto\srun\sfine.\n\nThus,\schanging\sTcl_ReadRaw(...,\scd->inAllocated);\sin\stclZLib.c\sto\sTcl_ReadRaw(...,\s1);\sis\sa\squick\sfix\sfor\sthe\sissue.\sCorrect\sbehaviour\sat\sthe\sexpense\sof\smore\scalls\sto\sthe\sbase\schannels.\n\n
J login andreas_kupries
J mimetype text/plain
J username andreas_kupries
K 2762041fffffffffffffffffffffffffffffffff
U andreas_kupries
Z dfa0a9ad8772d5eb38dfad287f1d1b9d