classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: ZipEntry fixlet


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: ZipEntry fixlet
Date: 05 Jan 2005 13:43:01 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

I'm checking this in.

This fixes a ZipEntry buglet -- no range checking should be done on
the compressed size.  At least one real program (OOo) uses
setCompressedSize(-1).  There's a Mauve test for this behavior as
well.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * java/util/zip/ZipEntry.java (setCompressedSize): Allow any
        argument.
        (compressedSize): Now 'long'.  Default to -1.
        (getCompressedSize): Rewrote.

Index: java/util/zip/ZipEntry.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/zip/ZipEntry.java,v
retrieving revision 1.16
diff -u -r1.16 ZipEntry.java
--- java/util/zip/ZipEntry.java 12 Dec 2004 19:10:29 -0000 1.16
+++ java/util/zip/ZipEntry.java 5 Jan 2005 20:46:40 -0000
@@ -1,5 +1,5 @@
 /* ZipEntry.java --
-   Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -61,7 +61,7 @@
 
   private String name;
   private int size;
-  private int compressedSize;
+  private long compressedSize = -1;
   private int crc;
   private int dostime;
   private short known = 0;
@@ -251,14 +251,10 @@
 
   /**
    * Sets the size of the compressed data.
-   * @exception IllegalArgumentException if size is not in 0..0xffffffffL
    */
   public void setCompressedSize(long csize)
   {
-    if ((csize & 0xffffffff00000000L) != 0)
-       throw new IllegalArgumentException();
-    this.compressedSize = (int) csize;
-    this.known |= KNOWN_CSIZE;
+    this.compressedSize = csize;
   }
 
   /**
@@ -267,7 +263,7 @@
    */
   public long getCompressedSize()
   {
-    return (known & KNOWN_CSIZE) != 0 ? compressedSize & 0xffffffffL : -1L;
+    return compressedSize;
   }
 
   /**




reply via email to

[Prev in Thread] Current Thread [Next in Thread]