[Zlib-devel] zlib 1.2.3.4 Winter Solstice Edition

Hiroshi Kuno hkuno-zlib at microhouse.co.jp
Sun Dec 27 20:39:02 EST 2009


(2009/12/26 4:52), Gilles Vollant wrote:
> here is the real mail I answered.
> I just integrated Hiroshi Kuno and Rolf Kalbermatter suggestion

Gilles, My patch is not merged on minizip101g. is it?

I make a patch again for minizip101g.
The patch avoid to over-write "err" from "ZIP_ERRNO" to "ZIP_OK".
When disk-full or other I/O error occurs, zipFlushWriteBuffer() returns "ZIP_ERRNO", and deflateEnd() returns "ZIP_OK".
In this case, the error is lost and Minizip will make a broken zip file with "ZIP_OK".

*** minizip101g/zip.c	Mon Dec 28 01:07:38 2009
--- mypatch/zip.c	Fri Dec 25 08:27:15 2009
***************
*** 1073,1085 ****
      if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
          if (zipFlushWriteBuffer(zi)==ZIP_ERRNO)
              err = ZIP_ERRNO;
  
      if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
      {
!         err=deflateEnd(&zi->ci.stream);
          zi->ci.stream_initialised = 0;
      }
  
      if (!zi->ci.raw)
      {
          crc32 = (uLong)zi->ci.crc32;
--- 1075,1088 ----
      if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
          if (zipFlushWriteBuffer(zi)==ZIP_ERRNO)
              err = ZIP_ERRNO;
  
      if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
      {
!         int tmperr=deflateEnd(&zi->ci.stream);
!         if (err==ZIP_OK) err = tmperr;
          zi->ci.stream_initialised = 0;
      }
  
      if (!zi->ci.raw)
      {
          crc32 = (uLong)zi->ci.crc32;




More information about the Zlib-devel mailing list