Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public boolean needsInput() {
}

// have we consumed all input
if (keepUncompressedBuf && uncompressedDirectBufLen > 0) {
if (keepUncompressedBuf && uncompressedDirectBufLen - uncompressedDirectBufOff > 0) {
return false;
}

Expand Down Expand Up @@ -223,7 +223,7 @@ public int compress(byte[] b, int off, int len) throws IOException {
compressedDirectBuf.limit(n);

// Check if we have consumed all input buffer
if (uncompressedDirectBufLen <= 0) {
if (uncompressedDirectBufLen - uncompressedDirectBufOff <= 0) {
// consumed all input buffer
keepUncompressedBuf = false;
uncompressedDirectBuf.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ JNIEXPORT jint Java_org_apache_hadoop_io_compress_zstd_ZStandardCompressor_defla
return (jint) 0;
}

bytes_read += input.pos;
bytes_read += input.pos - uncompressed_direct_buf_off;
bytes_written += output.pos;
(*env)->SetLongField(env, this, ZStandardCompressor_bytesRead, bytes_read);
(*env)->SetLongField(env, this, ZStandardCompressor_bytesWritten, bytes_written);

(*env)->SetIntField(env, this, ZStandardCompressor_uncompressedDirectBufOff, input.pos);
(*env)->SetIntField(env, this, ZStandardCompressor_uncompressedDirectBufLen, input.size - input.pos);
(*env)->SetIntField(env, this, ZStandardCompressor_uncompressedDirectBufLen, input.size);
return (jint) output.pos;
}

Expand Down