Skip to content

Commit

Permalink
Use Short.MAX_VALUE, as it accurately represents what we're trying to…
Browse files Browse the repository at this point in the history
… limit ourselves to
  • Loading branch information
lw346 committed Feb 22, 2013
1 parent 0bfa915 commit f6d88ca
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws
}

out.writeInt(0);
if (dataLength >= 32768) {
ByteBuf slice = in.readSlice(32767);
if (dataLength > Short.MAX_VALUE) {
ByteBuf slice = in.readSlice(Short.MAX_VALUE);
calculateAndWriteChecksum(slice, out);
snappy.encode(slice, out, 32767);
snappy.encode(slice, out, Short.MAX_VALUE);
setChunkLength(out, lengthIdx);
dataLength -= 32767;
dataLength -= Short.MAX_VALUE;
} else {
ByteBuf slice = in.readSlice(dataLength);
calculateAndWriteChecksum(slice, out);
Expand Down

0 comments on commit f6d88ca

Please sign in to comment.