diff options
author | jfrijters <jfrijters> | 2010-01-11 17:30:16 +0300 |
---|---|---|
committer | jfrijters <jfrijters> | 2010-01-11 17:30:16 +0300 |
commit | 56080735b2597b62e16afedd783a483c645ea37d (patch) | |
tree | 31e1bb202ca31cdbc4c3433b371dcd80b7c2535e /openjdk/java/util/zip/Inflater.java | |
parent | 57c90fefb45609696e4ef67d14e443942c808243 (diff) |
Fix for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41696
Diffstat (limited to 'openjdk/java/util/zip/Inflater.java')
-rw-r--r-- | openjdk/java/util/zip/Inflater.java | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/openjdk/java/util/zip/Inflater.java b/openjdk/java/util/zip/Inflater.java index 8a5e949e..65bdd86b 100644 --- a/openjdk/java/util/zip/Inflater.java +++ b/openjdk/java/util/zip/Inflater.java @@ -311,37 +311,29 @@ public class Inflater */ public int inflate (byte[] buf, int off, int len) throws DataFormatException { - /* Special case: len may be zero */ - if (len == 0) - return 0; /* Check for correct buff, off, len triple */ if (0 > off || off > off + len || off + len > buf.length) throw new ArrayIndexOutOfBoundsException(); int count = 0; - int more; - do + for (;;) { - if (mode != DECODE_CHKSUM) + if (outputWindow.getAvailable() == 0) { - /* Don't give away any output, if we are waiting for the - * checksum in the input stream. - * - * With this trick we have always: - * needsInput() and not finished() - * implies more output can be produced. - */ - more = outputWindow.copyOutput(buf, off, len); + if (!decode()) + break; + } + else if (len > 0) + { + int more = outputWindow.copyOutput(buf, off, len); adler.update(buf, off, more); off += more; count += more; totalOut += more; len -= more; - if (len == 0) - return count; } + else + break; } - while (decode() || (outputWindow.getAvailable() > 0 - && mode != DECODE_CHKSUM)); return count; } |