Skip to content

Commit

Permalink
Issue #6050 - use compressed and decompressed as variable names
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
  • Loading branch information
lachlan-roberts committed Mar 17, 2021
1 parent 2f2b6ba commit 2c5ab59
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -199,13 +199,13 @@ protected void decompress(ByteAccumulator accumulator, ByteBuffer buf) throws Da
{
// The buffer returned by the accumulator might not be empty, so we must append starting from the limit.
ByteBuffer buffer = accumulator.ensureBuffer(DECOMPRESS_BUF_SIZE);
int written = inflater.inflate(buffer.array(), buffer.arrayOffset() + buffer.limit(), buffer.capacity() - buffer.limit());
buffer.limit(buffer.limit() + written);
accumulator.addLength(written);
int decompressed = inflater.inflate(buffer.array(), buffer.arrayOffset() + buffer.limit(), buffer.capacity() - buffer.limit());
buffer.limit(buffer.limit() + decompressed);
accumulator.addLength(decompressed);
if (LOG.isDebugEnabled())
LOG.debug("Decompressed {} bytes into buffer {} from {}", written, BufferUtil.toDetailString(buffer), toDetail(inflater));
LOG.debug("Decompressed {} bytes into buffer {} from {}", decompressed, BufferUtil.toDetailString(buffer), toDetail(inflater));

if (written <= 0)
if (decompressed <= 0)
break;
}
}
Expand Down Expand Up @@ -498,13 +498,13 @@ private void compress(FrameEntry entry, boolean first)
{
// The buffer returned by the accumulator might not be empty, so we must append starting from the limit.
ByteBuffer buffer = accumulator.ensureBuffer(8, outputLength);
int written = deflater.deflate(buffer.array(), buffer.arrayOffset() + buffer.limit(), buffer.capacity() - buffer.limit(), Deflater.SYNC_FLUSH);
buffer.limit(buffer.limit() + written);
int compressed = deflater.deflate(buffer.array(), buffer.arrayOffset() + buffer.limit(), buffer.capacity() - buffer.limit(), Deflater.SYNC_FLUSH);
buffer.limit(buffer.limit() + compressed);

if (LOG.isDebugEnabled())
LOG.debug("Wrote {} bytes to output buffer", accumulator);

if (written <= 0)
if (compressed <= 0)
break;
}

Expand Down

0 comments on commit 2c5ab59

Please sign in to comment.