Artifact c42011c7c358a64b3b4ef26d680361abcf8b0eee
Ticket change
[c42011c7c3]
- Ticket 923a912309 osx will not unzip the zip files created by fossil status still Open with 1 other change
by
anonymous on
2009-10-18 15:31:44.
D 2009-10-18T15:31:44
J +comment \n\n<hr><i>anonymous\sclaiming\sto\sbe\sDmitry\sChestnykh\sadded\son\s2009-10-18\s15:31:44:</i><br>\nIf\swe\suse\sdeflateInit2\sinstead\sof\sdeflateInit,\szlib\swill\snot\sappend\sAdler32\sCRC\sto\sthe\send\sof\scompressed\sstream,\sand\salso\sit\swill\snot\sprepend\s2-byte\ssignature\sto\sthe\sbeginning\sof\scompressed\sstream.\r\n\r\nThis\sfixes\sthe\sissue\swith\sditto.\r\n\r\n(As\sdiscussed\s[http://www.mail-archive.com/fossil-users@lists.fossil-scm.org/msg00644.html\s|\shere])\r\n\r\n<verbatim>\r\n---\ssrc/zip.c\r\n+++\ssrc/zip.c\r\n@@\s-126,11\s+126,10\s@@\r\n\s**\sthat\sthe\sfile\sshould\sbe\ssaved\sas.\r\n\s*/\r\n\svoid\szip_add_file(const\schar\s*zName,\sconst\sBlob\s*pFile){\r\n\s\s\sz_stream\sstream;\r\n\s\s\sint\snameLen;\r\n-\s\sint\sskip;\r\n\s\s\sint\stoOut;\r\n\s\s\sint\siStart;\r\n\s\s\sint\siCRC\s=\s0;\r\n\s\s\sint\snByte\s=\s0;\r\n\s\s\sint\snByteCompr\s=\s0;\r\n@@\s-177,53\s+176,37\s@@\r\n\s\s\sblob_append(&body,\szHdr,\s30);\r\n\s\s\sblob_append(&body,\szName,\snameLen);\r\n\s\s\sblob_append(&body,\szExTime,\s13);\r\n\s\r\n\s\s\sif(\snBlob>0\s){\r\n-\s\s\s\s/*\sThe\sfirst\stwo\sbytes\sthat\scome\sout\sof\sthe\sdeflate\scompressor\sare\r\n-\s\s\s\s**\ssome\skind\sof\sheader\sthat\sZIP\sdoes\snot\suse.\s\sSo\sskip\sthe\sfirst\stwo\r\n-\s\s\s\s**\soutput\sbytes.\r\n-\s\s\s\s*/\r\n-\s\s\s\sskip\s=\s2;\r\n-\r\n\s\s\s\s\s/*\sWrite\sthe\scompressed\sfile.\s\sCompute\sthe\sCRC\sas\swe\sprogress.\r\n\s\s\s\s\s*/\r\n\s\s\s\s\sstream.zalloc\s=\s(alloc_func)0;\r\n\s\s\s\s\sstream.zfree\s=\s(free_func)0;\r\n\s\s\s\s\sstream.opaque\s=\s0;\r\n\s\s\s\s\sstream.avail_in\s=\sblob_size(pFile);\r\n\s\s\s\s\sstream.next_in\s=\s(unsigned\schar*)blob_buffer(pFile);\r\n\s\s\s\s\sstream.avail_out\s=\ssizeof(zOutBuf);\r\n\s\s\s\s\sstream.next_out\s=\s(unsigned\schar*)zOutBuf;\r\n-\s\s\s\sdeflateInit(&stream,\s9);\r\n+\s\s\s\sdeflateInit2(&stream,\s9,\sZ_DEFLATED,\s-MAX_WBITS,\s8,\sZ_DEFAULT_STRATEGY);\r\n\s\s\s\s\siCRC\s=\scrc32(0,\sstream.next_in,\sstream.avail_in);\r\n\s\s\s\s\swhile(\sstream.avail_in>0\s){\r\n\s\s\s\s\s\s\sdeflate(&stream,\s0);\r\n\s\s\s\s\s\s\stoOut\s=\ssizeof(zOutBuf)\s-\sstream.avail_out;\r\n-\s\s\s\s\s\sif(\stoOut>skip\s){\r\n-\s\s\s\s\s\s\s\sblob_append(&body,\s&zOutBuf[skip],\stoOut\s-\sskip);\r\n-\s\s\s\s\s\s\s\sskip\s=\s0;\r\n-\s\s\s\s\s\s}else{\r\n-\s\s\s\s\s\s\s\sskip\s-=\stoOut;\r\n-\s\s\s\s\s\s}\r\n+\s\s\s\s\s\sblob_append(&body,\szOutBuf,\stoOut);\r\n\s\s\s\s\s\s\sstream.avail_out\s=\ssizeof(zOutBuf);\r\n\s\s\s\s\s\s\sstream.next_out\s=\s(unsigned\schar*)zOutBuf;\r\n\s\s\s\s\s}\r\n\s\s\s\s\sdo{\r\n\s\s\s\s\s\s\sstream.avail_out\s=\ssizeof(zOutBuf);\r\n\s\s\s\s\s\s\sstream.next_out\s=\s(unsigned\schar*)zOutBuf;\r\n\s\s\s\s\s\s\sdeflate(&stream,\sZ_FINISH);\r\n\s\s\s\s\s\s\stoOut\s=\ssizeof(zOutBuf)\s-\sstream.avail_out;\r\n-\s\s\s\s\s\sif(\stoOut>skip\s){\r\n-\s\s\s\s\s\s\s\sblob_append(&body,\s&zOutBuf[skip],\stoOut\s-\sskip);\r\n-\s\s\s\s\s\s\s\sskip\s=\s0;\r\n-\s\s\s\s\s\s}else{\r\n-\s\s\s\s\s\s\s\sskip\s-=\stoOut;\r\n-\s\s\s\s\s\s}\r\n+\s\s\s\s\s\sblob_append(&body,\szOutBuf,\stoOut);\r\n\s\s\s\s\s}while(\sstream.avail_out==0\s);\r\n\s\s\s\s\snByte\s=\sstream.total_in;\r\n-\s\s\s\snByteCompr\s=\sstream.total_out\s-\s2;\r\n+\s\s\s\snByteCompr\s=\sstream.total_out;\r\n\s\s\s\s\sdeflateEnd(&stream);\r\n\s\r\n\s\s\s\s\s/*\sGo\sback\sand\swrite\sthe\sheader,\snow\sthat\swe\sknow\sthe\scompressed\sfile\ssize.\r\n\s\s\s\s\s*/\r\n\s\s\s\s\sz\s=\s&blob_buffer(&body)[iStart];\r\n</verbatim>
K 923a9123096ae70e565558a274522fecc5c73771
U anonymous
Z d946c349f7ef39e0b0543496f0af5ff2