Refresh JS/TS/KT

PiperOrigin-RevId: 769617330
This commit is contained in:
Evgenii Kliuchnikov
2025-06-10 07:07:49 -07:00
committed by Copybara-Service
parent 08bdaebbf8
commit ee5f3bb959
8 changed files with 1080 additions and 538 deletions

View File

@@ -190,7 +190,7 @@ final class BitReader {
private static int prepare(State s) {
if (s.halfOffset > BitReader.HALF_WATERLINE) {
int result = readMoreInput(s);
final int result = readMoreInput(s);
if (result != BROTLI_OK) {
return result;
}

View File

@@ -342,10 +342,9 @@ final class Decode {
if (s.runningState == UNINITIALIZED) {
return Utils.makeError(s, BROTLI_PANIC_STATE_NOT_INITIALIZED);
}
if (s.runningState == CLOSED) {
return Utils.makeError(s, BROTLI_PANIC_ALREADY_CLOSED);
if (s.runningState > 0) {
s.runningState = CLOSED;
}
s.runningState = CLOSED;
return BROTLI_OK;
}
@@ -473,7 +472,7 @@ final class Decode {
while (symbol < numSymbols && space > 0) {
if (s.halfOffset > BitReader.HALF_WATERLINE) {
int result = BitReader.readMoreInput(s);
final int result = BitReader.readMoreInput(s);
if (result < BROTLI_OK) {
return result;
}
@@ -557,7 +556,7 @@ final class Decode {
}
symbols[i] = symbol;
}
int result = checkDupes(s, symbols, numSymbols);
final int result = checkDupes(s, symbols, numSymbols);
if (result < BROTLI_OK) {
return result;
}
@@ -634,7 +633,7 @@ final class Decode {
return Utils.makeError(s, BROTLI_ERROR_CORRUPTED_HUFFMAN_CODE_HISTOGRAM);
}
int result = readHuffmanCodeLengths(codeLengthCodeLengths, alphabetSizeLimit, codeLengths, s);
final int result = readHuffmanCodeLengths(codeLengthCodeLengths, alphabetSizeLimit, codeLengths, s);
if (result < BROTLI_OK) {
return result;
}
@@ -651,7 +650,7 @@ final class Decode {
private static int readHuffmanCode(int alphabetSizeMax, int alphabetSizeLimit,
int[] tableGroup, int tableIdx, State s) {
if (s.halfOffset > BitReader.HALF_WATERLINE) {
int result = BitReader.readMoreInput(s);
final int result = BitReader.readMoreInput(s);
if (result < BROTLI_OK) {
return result;
}
@@ -1097,7 +1096,7 @@ final class Decode {
int next = n;
for (int i = 0; i < n; ++i) {
group[i] = next;
int result = readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, group, i, s);
final int result = readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, group, i, s);
if (result < BROTLI_OK) {
return result;
}
@@ -1121,7 +1120,7 @@ final class Decode {
}
final int address = s.distance - s.maxDistance - 1 - s.cdTotalSize;
if (address < 0) {
int result = initializeCompoundDictionaryCopy(s, -address - 1, s.copyLength);
final int result = initializeCompoundDictionaryCopy(s, -address - 1, s.copyLength);
if (result < BROTLI_OK) {
return result;
}

View File

@@ -64,7 +64,6 @@ public final class Dictionary {
dictionarySizeBits[i] = newSizeBits[i];
}
int pos = 0;
final int limit = newData.capacity();
for (int i = 0; i < newSizeBits.length; ++i) {
dictionaryOffsets[i] = pos;
final int bits = dictionarySizeBits[i];
@@ -74,7 +73,7 @@ public final class Dictionary {
if (bits >= 31) {
throw new BrotliRuntimeException("newSizeBits values must be less than 31");
}
if (pos <= 0 || pos > limit) {
if (pos <= 0 || pos > newData.capacity()) {
throw new BrotliRuntimeException("newSizeBits is inconsistent: overflow");
}
}
@@ -84,7 +83,7 @@ public final class Dictionary {
dictionaryOffsets[i] = pos;
}
if (DICTIONARY_DEBUG != 0) {
if (pos != limit) {
if (pos != newData.capacity()) {
throw new BrotliRuntimeException("newSizeBits is inconsistent: underflow");
}
}

View File

@@ -71,6 +71,7 @@ constructor(source: InputStream, byteReadBufferSize: Int = DEFAULT_INTERNAL_BUFF
@Throws(IOException::class)
override fun close() {
close(state)
closeInput(state)
}
/** {@inheritDoc} */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2
js/decode.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff