< prev index next >

src/share/native/java/util/zip/Deflater.c

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -162,21 +162,18 @@
         strm->avail_in = this_len;
         strm->avail_out = len;
         res = deflateParams(strm, level, strategy);
         (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
         (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
-
         switch (res) {
         case Z_OK:
             (*env)->SetBooleanField(env, this, setParamsID, JNI_FALSE);
+        case Z_BUF_ERROR:
             this_off += this_len - strm->avail_in;
             (*env)->SetIntField(env, this, offID, this_off);
             (*env)->SetIntField(env, this, lenID, strm->avail_in);
             return (jint) (len - strm->avail_out);
-        case Z_BUF_ERROR:
-            (*env)->SetBooleanField(env, this, setParamsID, JNI_FALSE);
-            return 0;
         default:
             JNU_ThrowInternalError(env, strm->msg);
             return 0;
         }
     } else {

@@ -201,22 +198,20 @@
         strm->avail_in = this_len;
         strm->avail_out = len;
         res = deflate(strm, finish ? Z_FINISH : flush);
         (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
         (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
-
         switch (res) {
         case Z_STREAM_END:
             (*env)->SetBooleanField(env, this, finishedID, JNI_TRUE);
             /* fall through */
         case Z_OK:
+        case Z_BUF_ERROR:
             this_off += this_len - strm->avail_in;
             (*env)->SetIntField(env, this, offID, this_off);
             (*env)->SetIntField(env, this, lenID, strm->avail_in);
             return len - strm->avail_out;
-        case Z_BUF_ERROR:
-            return 0;
             default:
             JNU_ThrowInternalError(env, strm->msg);
             return 0;
         }
     }
< prev index next >