MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / ZLibHeader_Read

Function ZLibHeader_Read

src/Bitmap.c:73–91  ·  view source on GitHub ↗

ZLib header is technically a separate spec, but it's simpler to just skip the whole header here */

Source from the content-addressed store, hash-verified

71
72/* ZLib header is technically a separate spec, but it's simpler to just skip the whole header here */
73static cc_result ZLibHeader_Read(struct Stream* s, int* state) {
74 cc_uint8 tmp;
75 cc_result res;
76 switch (*state) {
77
78 case ZLIB_STATE_COMPRESSION_METHOD:
79 Header_ReadU8(tmp);
80 if ((tmp & 0x0F) != 0x08) return ZLIB_ERR_METHOD;
81 /* Upper 4 bits are window size (ignored) */
82 (*state)++;
83
84 /* FALLTHRU */
85 case ZLIB_STATE_FLAGS:
86 Header_ReadU8(tmp);
87 if (tmp & 0x20) return ZLIB_ERR_FLAGS;
88 (*state)++;
89 }
90 return 0;
91}
92
93
94/*########################################################################################################################*

Callers 1

Png_DecodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected