get the distance code tree of a deflated block with fixed tree, as specified in the deflate specification*/
| 1078 | |
| 1079 | /*get the distance code tree of a deflated block with fixed tree, as specified in the deflate specification*/ |
| 1080 | static unsigned generateFixedDistanceTree(HuffmanTree* tree) { |
| 1081 | unsigned i, error = 0; |
| 1082 | unsigned* bitlen = (unsigned*)lodepng_malloc(NUM_DISTANCE_SYMBOLS * sizeof(unsigned)); |
| 1083 | if(!bitlen) return 83; /*alloc fail*/ |
| 1084 | |
| 1085 | /*there are 32 distance codes, but 30-31 are unused*/ |
| 1086 | for(i = 0; i != NUM_DISTANCE_SYMBOLS; ++i) bitlen[i] = 5; |
| 1087 | error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DISTANCE_SYMBOLS, 15); |
| 1088 | |
| 1089 | lodepng_free(bitlen); |
| 1090 | return error; |
| 1091 | } |
| 1092 | |
| 1093 | #ifdef LODEPNG_COMPILE_DECODER |
| 1094 |
no test coverage detected