| 4478 | */ |
| 4479 | |
| 4480 | static int stbi__parse_zlib(stbi__zbuf *a, int parse_header) |
| 4481 | { |
| 4482 | int final, type; |
| 4483 | if (parse_header) |
| 4484 | if (!stbi__parse_zlib_header(a)) return 0; |
| 4485 | a->num_bits = 0; |
| 4486 | a->code_buffer = 0; |
| 4487 | a->hit_zeof_once = 0; |
| 4488 | do { |
| 4489 | final = stbi__zreceive(a,1); |
| 4490 | type = stbi__zreceive(a,2); |
| 4491 | if (type == 0) { |
| 4492 | if (!stbi__parse_uncompressed_block(a)) return 0; |
| 4493 | } else if (type == 3) { |
| 4494 | return 0; |
| 4495 | } else { |
| 4496 | if (type == 1) { |
| 4497 | // use fixed code lengths |
| 4498 | if (!stbi__zbuild_huffman(&a->z_length , stbi__zdefault_length , STBI__ZNSYMS)) return 0; |
| 4499 | if (!stbi__zbuild_huffman(&a->z_distance, stbi__zdefault_distance, 32)) return 0; |
| 4500 | } else { |
| 4501 | if (!stbi__compute_huffman_codes(a)) return 0; |
| 4502 | } |
| 4503 | if (!stbi__parse_huffman_block(a)) return 0; |
| 4504 | } |
| 4505 | } while (!final); |
| 4506 | return 1; |
| 4507 | } |
| 4508 | |
| 4509 | static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, int parse_header) |
| 4510 | { |
no test coverage detected