ZLib header is technically a separate spec, but it's simpler to just skip the whole header here */
| 71 | |
| 72 | /* ZLib header is technically a separate spec, but it's simpler to just skip the whole header here */ |
| 73 | static 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 | /*########################################################################################################################* |