(State s)
| 364 | } |
| 365 | |
| 366 | private static int decodeMetaBlockLength(State s) { |
| 367 | BitReader.fillBitWindow(s); |
| 368 | s.inputEnd = BitReader.readFewBits(s, 1); |
| 369 | s.metaBlockLength = 0; |
| 370 | s.isUncompressed = 0; |
| 371 | s.isMetadata = 0; |
| 372 | if ((s.inputEnd != 0) && BitReader.readFewBits(s, 1) != 0) { |
| 373 | return BROTLI_OK; |
| 374 | } |
| 375 | final int sizeNibbles = BitReader.readFewBits(s, 2) + 4; |
| 376 | if (sizeNibbles == 7) { |
| 377 | s.isMetadata = 1; |
| 378 | if (BitReader.readFewBits(s, 1) != 0) { |
| 379 | return Utils.makeError(s, BROTLI_ERROR_CORRUPTED_RESERVED_BIT); |
| 380 | } |
| 381 | final int sizeBytes = BitReader.readFewBits(s, 2); |
| 382 | if (sizeBytes == 0) { |
| 383 | return BROTLI_OK; |
| 384 | } |
| 385 | for (int i = 0; i < sizeBytes; ++i) { |
| 386 | BitReader.fillBitWindow(s); |
| 387 | final int bits = BitReader.readFewBits(s, 8); |
| 388 | if (bits == 0 && i + 1 == sizeBytes && sizeBytes > 1) { |
| 389 | return Utils.makeError(s, BROTLI_ERROR_EXUBERANT_NIBBLE); |
| 390 | } |
| 391 | s.metaBlockLength += bits << (i * 8); |
| 392 | } |
| 393 | } else { |
| 394 | for (int i = 0; i < sizeNibbles; ++i) { |
| 395 | BitReader.fillBitWindow(s); |
| 396 | final int bits = BitReader.readFewBits(s, 4); |
| 397 | if (bits == 0 && i + 1 == sizeNibbles && sizeNibbles > 4) { |
| 398 | return Utils.makeError(s, BROTLI_ERROR_EXUBERANT_NIBBLE); |
| 399 | } |
| 400 | s.metaBlockLength += bits << (i * 4); |
| 401 | } |
| 402 | } |
| 403 | s.metaBlockLength++; |
| 404 | if (s.inputEnd == 0) { |
| 405 | s.isUncompressed = BitReader.readFewBits(s, 1); |
| 406 | } |
| 407 | return BROTLI_OK; |
| 408 | } |
| 409 | |
| 410 | /** |
| 411 | * Decodes the next Huffman code from bit-stream. |
no test coverage detected