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

Method readNextMetablockHeader

java/org/brotli/dec/Decode.java:799–849  ·  view source on GitHub ↗
(State s)

Source from the content-addressed store, hash-verified

797 }
798
799 private static int readNextMetablockHeader(State s) {
800 if (s.inputEnd != 0) {
801 s.nextRunningState = FINISHED;
802 s.runningState = INIT_WRITE;
803 return BROTLI_OK;
804 }
805 // TODO(eustas): Reset? Do we need this?
806 s.literalTreeGroup = new int[0];
807 s.commandTreeGroup = new int[0];
808 s.distanceTreeGroup = new int[0];
809
810 int result;
811 if (s.halfOffset > BitReader.HALF_WATERLINE) {
812 result = BitReader.readMoreInput(s);
813 if (result < BROTLI_OK) {
814 return result;
815 }
816 }
817 result = decodeMetaBlockLength(s);
818 if (result < BROTLI_OK) {
819 return result;
820 }
821 if ((s.metaBlockLength == 0) && (s.isMetadata == 0)) {
822 return BROTLI_OK;
823 }
824 if ((s.isUncompressed != 0) || (s.isMetadata != 0)) {
825 result = BitReader.jumpToByteBoundary(s);
826 if (result < BROTLI_OK) {
827 return result;
828 }
829 if (s.isMetadata == 0) {
830 s.runningState = COPY_UNCOMPRESSED;
831 } else {
832 s.runningState = READ_METADATA;
833 }
834 } else {
835 s.runningState = COMPRESSED_BLOCK_START;
836 }
837
838 if (s.isMetadata != 0) {
839 return BROTLI_OK;
840 }
841 s.expectedTotalSize += s.metaBlockLength;
842 if (s.expectedTotalSize > 1 << 30) {
843 s.expectedTotalSize = 1 << 30;
844 }
845 if (s.ringBufferSize < s.maxRingBufferSize) {
846 maybeReallocateRingBuffer(s);
847 }
848 return BROTLI_OK;
849 }
850
851 private static int readMetablockPartition(State s, int treeType, int numBlockTypes) {
852 int offset = s.blockTrees[2 * treeType];

Callers 1

decompressMethod · 0.95

Calls 4

readMoreInputMethod · 0.95
decodeMetaBlockLengthMethod · 0.95
jumpToByteBoundaryMethod · 0.95

Tested by

no test coverage detected