[Kaffe] default crc patch for ZipOutputStream.java

Moses DeJong dejong at cs.umn.edu
Tue Feb 22 17:06:54 PST 2000


This patch fixes a problem when writing a ZipEntry before setting
the crc value. This can happen with a compressed entry for instance.
I do have a test case for this but it is in flux at the current
time.

Tue Feb 22 17:02:40 CET 2000  Moses DeJong <dejong at cs.umn.edu>

	* libraries/javalib/java/util/zip/ZipOutputStream.java: Fixed
	bug caused by writing the default crc value of a compressed
	ZipEntry. Output now matches Sun output.


Mo DeJong
Red Hat Inc.
-------------- next part --------------
Index: libraries/javalib/java/util/zip/ZipOutputStream.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/util/zip/ZipOutputStream.java,v
retrieving revision 1.9
diff -u -r1.9 ZipOutputStream.java
--- libraries/javalib/java/util/zip/ZipOutputStream.java        2000/02/16 23:57:36     1.9
+++ libraries/javalib/java/util/zip/ZipOutputStream.java        2000/02/23 00:50:14
@@ -259,11 +259,12 @@
        put16(lh, LOC_METHOD, ze.method);
        put32(lh, LOC_TIME, ze.dosTime);
 
-       put32(lh, LOC_CRC, (int) ze.crc);
        if (ze.method == STORED) {
+               put32(lh, LOC_CRC, (int) ze.crc);
                put32(lh, LOC_COMPRESSEDSIZE, (int) ze.csize);
                put32(lh, LOC_UNCOMPRESSEDSIZE, (int) ze.size);
        } else {
+               put32(lh, LOC_CRC, 0);
                put32(lh, LOC_COMPRESSEDSIZE, 0);
                put32(lh, LOC_UNCOMPRESSEDSIZE, 0);
        }



More information about the kaffe mailing list