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

Method checkHealth

java/org/brotli/dec/BitReader.java:91–103  ·  view source on GitHub ↗
(State s, int endOfStream)

Source from the content-addressed store, hash-verified

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) {

Callers 4

prepareMethod · 0.95
copyRawBytesMethod · 0.95
decompressMethod · 0.95
testReadAfterEosMethod · 0.95

Calls 1

makeErrorMethod · 0.95

Tested by 1

testReadAfterEosMethod · 0.76