| 89 | } |
| 90 | |
| 91 | static int checkHealth(State s, int endOfStream) { |
| 92 | if (s.endOfStreamReached == 0) { |
| 93 | return BROTLI_OK; |
| 94 | } |
| 95 | final int byteOffset = (s.halfOffset << LOG_HALF_SIZE) + ((s.bitOffset + 7) >> 3) - BYTENESS; |
| 96 | if (byteOffset > s.tailBytes) { |
| 97 | return Utils.makeError(s, BROTLI_ERROR_READ_AFTER_END); |
| 98 | } |
| 99 | if ((endOfStream != 0) && (byteOffset != s.tailBytes)) { |
| 100 | return Utils.makeError(s, BROTLI_ERROR_UNUSED_BYTES_AFTER_END); |
| 101 | } |
| 102 | return BROTLI_OK; |
| 103 | } |
| 104 | |
| 105 | static void assertAccumulatorHealthy(State s) { |
| 106 | if (s.bitOffset > BITNESS) { |