Skip to content

Commit ee771da

Browse files
eustascopybara-github
authored andcommitted
fix copy-paste in Java decoder
PiperOrigin-RevId: 822024938
1 parent 42aee32 commit ee771da

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

java/org/brotli/dec/BitReader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ static int readMoreInput(State s) {
7272
while (bytesInBuffer < CAPACITY) {
7373
final int spaceLeft = CAPACITY - bytesInBuffer;
7474
final int len = Utils.readInput(s, s.byteBuffer, bytesInBuffer, spaceLeft);
75-
// EOF is -1 in Java, but 0 in C#.
7675
if (len < BROTLI_ERROR) {
7776
return len;
7877
}
78+
// EOF is -1 in Java, but 0 in C#.
7979
if (len <= 0) {
8080
s.endOfStreamReached = 1;
8181
s.tailBytes = bytesInBuffer;
@@ -276,10 +276,10 @@ static int copyRawBytes(State s, byte[] data, int offset, int length) {
276276
// Now it is possible to copy bytes directly.
277277
while (len > 0) {
278278
final int chunkLen = Utils.readInput(s, data, pos, len);
279-
// EOF is -1 in Java, but 0 in C#.
280-
if (len < BROTLI_ERROR) {
281-
return len;
279+
if (chunkLen < BROTLI_ERROR) {
280+
return chunkLen;
282281
}
282+
// EOF is -1 in Java, but 0 in C#.
283283
if (chunkLen <= 0) {
284284
return Utils.makeError(s, BROTLI_ERROR_TRUNCATED_INPUT);
285285
}

0 commit comments

Comments
 (0)