ZipEntry.java (setCompressedSize): Allow any argument.
authorTom Tromey <tromey@redhat.com>
Wed, 5 Jan 2005 20:41:27 +0000 (20:41 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 5 Jan 2005 20:41:27 +0000 (20:41 +0000)
* java/util/zip/ZipEntry.java (setCompressedSize): Allow any
argument.
(compressedSize): Now 'long'.  Default to -1.
(getCompressedSize): Rewrote.
* java/util/zip/DeflaterOutputStream.java (deflate): Don't
deflate at all if we need input.

From-SVN: r92969

libjava/ChangeLog
libjava/java/util/zip/DeflaterOutputStream.java
libjava/java/util/zip/ZipEntry.java

index b4f7e8edd8fab0b859863161c64e32c46dd6cbb6..d3d419106a39b06ef03f1f172ddda30d19a2925d 100644 (file)
@@ -1,3 +1,12 @@
+2005-01-05  Tom Tromey  <tromey@redhat.com>
+
+       * java/util/zip/ZipEntry.java (setCompressedSize): Allow any
+       argument.
+       (compressedSize): Now 'long'.  Default to -1.
+       (getCompressedSize): Rewrote.
+       * java/util/zip/DeflaterOutputStream.java (deflate): Don't
+       deflate at all if we need input.
+
 2005-01-05  Tom Tromey  <tromey@redhat.com>
 
        PR libgcj/15719:
index 4d84f2a3f57b9020d28962f9e75efc7dd28f2ee1..d8a330d9b6a96128006c3e9563bbe6e413a7764c 100644 (file)
@@ -79,13 +79,12 @@ public class DeflaterOutputStream extends FilterOutputStream
    */
   protected void deflate() throws IOException
   {
-    do
+    while (! def.needsInput())
       {
        int len = def.deflate(buf, 0, buf.length);
        if (len > 0)
          out.write(buf, 0, len);
        }
-    while (! def.needsInput());
   }
 
   /** 
index 201a671bc155f7cbc12212b254db01fc4a41ed8b..603432778040583e68d4d50a6c81b43ac5852247 100644 (file)
@@ -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.
 
@@ -60,7 +60,7 @@ public class ZipEntry implements ZipConstants, Cloneable
 
   private String name;
   private int size;
-  private int compressedSize;
+  private long compressedSize = -1;
   private int crc;
   private int dostime;
   private short known = 0;
@@ -242,14 +242,10 @@ public class ZipEntry implements ZipConstants, Cloneable
 
   /**
    * 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;
   }
 
   /**
@@ -258,7 +254,7 @@ public class ZipEntry implements ZipConstants, Cloneable
    */
   public long getCompressedSize()
   {
-    return (known & KNOWN_CSIZE) != 0 ? compressedSize & 0xffffffffL : -1L;
+    return compressedSize;
   }
 
   /**