summaryrefslogtreecommitdiffstats
path: root/luni/src/main/native/java_util_zip_Deflater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'luni/src/main/native/java_util_zip_Deflater.cpp')
-rw-r--r--luni/src/main/native/java_util_zip_Deflater.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/luni/src/main/native/java_util_zip_Deflater.cpp b/luni/src/main/native/java_util_zip_Deflater.cpp
index 1afd36e..d963824 100644
--- a/luni/src/main/native/java_util_zip_Deflater.cpp
+++ b/luni/src/main/native/java_util_zip_Deflater.cpp
@@ -28,11 +28,11 @@ static void Deflater_setDictionaryImpl(JNIEnv* env, jobject, jbyteArray dict, in
}
static jlong Deflater_getTotalInImpl(JNIEnv*, jobject, jlong handle) {
- return toNativeZipStream(handle)->stream.total_in;
+ return toNativeZipStream(handle)->totalIn;
}
static jlong Deflater_getTotalOutImpl(JNIEnv*, jobject, jlong handle) {
- return toNativeZipStream(handle)->stream.total_out;
+ return toNativeZipStream(handle)->totalOut;
}
static jint Deflater_getAdlerImpl(JNIEnv*, jobject, jlong handle) {
@@ -40,7 +40,7 @@ static jint Deflater_getAdlerImpl(JNIEnv*, jobject, jlong handle) {
}
static jlong Deflater_createStream(JNIEnv * env, jobject, jint level, jint strategy, jboolean noHeader) {
- UniquePtr<NativeZipStream> jstream(new NativeZipStream);
+ std::unique_ptr<NativeZipStream> jstream(new NativeZipStream);
if (jstream.get() == NULL) {
jniThrowOutOfMemoryError(env, NULL);
return -1;
@@ -101,6 +101,9 @@ static jint Deflater_deflateImpl(JNIEnv* env, jobject recv, jbyteArray buf, int
jint bytesRead = stream->stream.next_in - initialNextIn;
jint bytesWritten = stream->stream.next_out - initialNextOut;
+ stream->totalIn += bytesRead;
+ stream->totalOut += bytesWritten;
+
static jfieldID inReadField = env->GetFieldID(JniConstants::deflaterClass, "inRead", "I");
jint inReadValue = env->GetIntField(recv, inReadField);
inReadValue += bytesRead;
@@ -116,6 +119,8 @@ static void Deflater_endImpl(JNIEnv*, jobject, jlong handle) {
static void Deflater_resetImpl(JNIEnv* env, jobject, jlong handle) {
NativeZipStream* stream = toNativeZipStream(handle);
+ stream->totalIn = 0;
+ stream->totalOut = 0;
int err = deflateReset(&stream->stream);
if (err != Z_OK) {
throwExceptionForZlibError(env, "java/lang/IllegalArgumentException", err, stream);