MCPcopy
hub / github.com/google/brotli / initState

Method initState

java/org/brotli/dec/Decode.java:318–339  ·  view source on GitHub ↗

Associate input with decoder state. @param s uninitialized state without associated input

(State s)

Source from the content-addressed store, hash-verified

316 * @param s uninitialized state without associated input
317 */
318 static int initState(State s) {
319 if (s.runningState != UNINITIALIZED) {
320 return Utils.makeError(s, BROTLI_PANIC_STATE_NOT_UNINITIALIZED);
321 }
322 /* 6 trees + 1 extra "offset" slot to simplify table decoding logic. */
323 s.blockTrees = new int[7 + 3 * (HUFFMAN_TABLE_SIZE_258 + HUFFMAN_TABLE_SIZE_26)];
324 s.blockTrees[0] = 7;
325 s.distRbIdx = 3;
326 int result = calculateDistanceAlphabetLimit(s, MAX_ALLOWED_DISTANCE, 3, 15 << 3);
327 if (result < BROTLI_OK) {
328 return result;
329 }
330 final int maxDistanceAlphabetLimit = result;
331 s.distExtraBits = new byte[maxDistanceAlphabetLimit];
332 s.distOffset = new int[maxDistanceAlphabetLimit];
333 result = BitReader.initBitReader(s);
334 if (result < BROTLI_OK) {
335 return result;
336 }
337 s.runningState = INITIALIZED;
338 return BROTLI_OK;
339 }
340
341 static int close(State s) {
342 if (s.runningState == UNINITIALIZED) {

Callers 3

BrotliInputStreamMethod · 0.95
testReadAfterEosMethod · 0.95

Calls 3

makeErrorMethod · 0.95
initBitReaderMethod · 0.95

Tested by 2

testReadAfterEosMethod · 0.76