Use Short.MAX_VALUE, as it accurately represents what we're trying to limit ourselves to

This commit is contained in:
Luke Wood 2013-02-22 15:23:47 +00:00
parent 0bfa9159e3
commit f6d88ca5bf

View File

@ -67,12 +67,12 @@ public class SnappyFramedEncoder extends ByteToByteEncoder {
}
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);