MCPcopy Create free account
hub / github.com/F-Stack/f-stack / send_all_trees

Function send_all_trees

freebsd/contrib/zlib/trees.c:834–858  ·  view source on GitHub ↗

=========================================================================== * Send the header for a block using dynamic Huffman trees: the counts, the * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */

(s, lcodes, dcodes, blcodes)

Source from the content-addressed store, hash-verified

832 * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
833 */
834local void send_all_trees(s, lcodes, dcodes, blcodes)
835 deflate_state *s;
836 int lcodes, dcodes, blcodes; /* number of codes for each tree */
837{
838 int rank; /* index in bl_order */
839
840 Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
841 Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
842 "too many codes");
843 Tracev((stderr, "\nbl counts: "));
844 send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
845 send_bits(s, dcodes-1, 5);
846 send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
847 for (rank = 0; rank < blcodes; rank++) {
848 Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
849 send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
850 }
851 Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
852
853 send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
854 Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
855
856 send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
857 Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
858}
859
860/* ===========================================================================
861 * Send a stored block

Callers 1

trees.cFile · 0.85

Calls 2

send_bitsFunction · 0.85
send_treeFunction · 0.85

Tested by

no test coverage detected