Branch Coverage

deps/libgit2/deps/zlib/trees.c
Criterion Covered Total %
branch 179 222 80.6


line true false branch
413 130130 455 for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
414 13650 455 for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
415 8645 455 for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
458 55885 15548 while (j <= s->heap_len) {
460 52185 3700 if (j < s->heap_len &&
45879 6306 if (j < s->heap_len &&
461 24173 21706 smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
20079 4094 smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
465 53666 2219 if (smaller(tree, v, s->heap[j], s->depth)) break;
9306 44360 if (smaller(tree, v, s->heap[j], s->depth)) break;
3858 5448 if (smaller(tree, v, s->heap[j], s->depth)) break;
503 10272 642 for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
510 18408 642 for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
513 0 18408 if (bits > max_length) bits = max_length, overflow++;
517 8562 9846 if (n > max_code) continue; /* not a leaf node */
521 2740 7106 if (n >= base) xbits = extra[n-base];
524 8233 1613 if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits);
526 642 0 if (overflow == 0) return;
534 0 0 while (s->bl_count[bits] == 0) bits--;
542 0 0 } while (overflow > 0);
549 0 0 for (bits = max_length; bits != 0; bits--) {
551 0 0 while (n != 0) {
553 0 0 if (m > max_code) continue;
554 0 0 if ((unsigned) tree[m].Len != (unsigned) bits) {
585 9630 642 for (bits = 1; bits <= MAX_BITS; bits++) {
596 62430 642 for (n = 0; n <= max_code; n++) {
598 52584 9846 if (len == 0) continue;
632 71690 642 for (n = 0; n < elems; n++) {
633 9684 62006 if (tree[n].Freq != 0) {
646 162 642 while (s->heap_len < 2) {
647 115 47 node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
650 162 0 s->opt_len--; if (stree) s->static_len -= stree[node].Len;
658 4807 642 for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
673 7571 1633 s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
686 8562 642 } while (s->heap_len >= 2);
716 67 361 if (nextlen == 0) max_count = 138, min_count = 3;
719 58365 428 for (n = 0; n <= max_code; n++) {
721 58292 73 if (++count < max_count && curlen == nextlen) {
47022 11270 if (++count < max_count && curlen == nextlen) {
723 8591 2752 } else if (count < min_count) {
725 66 2686 } else if (curlen != 0) {
726 65 1 if (curlen != prevlen) s->bl_tree[curlen].Freq++;
728 1723 963 } else if (count <= 10) {
734 4498 6845 if (nextlen == 0) {
736 2 6843 } else if (curlen == nextlen) {
762 18 106 if (nextlen == 0) max_count = 138, min_count = 3;
764 17944 124 for (n = 0; n <= max_code; n++) {
766 17939 5 if (++count < max_count && curlen == nextlen) {
14103 3836 if (++count < max_count && curlen == nextlen) {
768 3211 630 } else if (count < min_count) {
769 622 3214 do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
625 3211 do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
771 37 593 } else if (curlen != 0) {
772 36 1 if (curlen != prevlen) {
773 8 28 send_code(s, curlen, s->bl_tree); count--;
776 17 20 send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
6 31 send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
778 350 243 } else if (count <= 10) {
779 69 281 send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
77 273 send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
782 77 166 send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
114 129 send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
785 1213 2628 if (nextlen == 0) {
787 2 2626 } else if (curlen == nextlen) {
818 572 0 for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
819 214 358 if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
844 0 62 send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
845 0 62 send_bits(s, dcodes-1, 5);
846 62 0 send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
847 990 62 for (rank = 0; rank < blcodes; rank++) {
849 180 810 send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
869 0 0 send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
899 0 0 send_bits(s, STATIC_TREES<<1, 3);
900 0 0 send_code(s, END_BLOCK, static_ltree);
921 214 0 if (s->level > 0) {
924 214 0 if (s->strm->data_type == Z_UNKNOWN)
952 152 62 if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
962 0 214 if (stored_len+4 <= opt_lenb && buf != (char*)0) {
0 0 if (stored_len+4 <= opt_lenb && buf != (char*)0) {
976 214 0 } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
152 62 } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
978 0 152 send_bits(s, (STATIC_TREES<<1)+last, 3);
985 0 62 send_bits(s, (DYN_TREES<<1)+last, 3);
1000 214 0 if (last) {
1021 0 0 if (dist == 0) {
1033 0 0 s->dyn_dtree[d_code(dist)].Freq++;
1075 212 2 if (s->last_lit != 0) do {
1078 16164 627 if (dist == 0) {
1079 6290 9874 send_code(s, lc, ltree); /* send a literal byte */
1084 271 356 send_code(s, code+LITERALS+1, ltree); /* send the length code */
1086 115 512 if (extra != 0) {
1088 17 98 send_bits(s, lc, extra); /* send the extra length bits */
1091 625 2 code = d_code(dist);
1094 117 510 send_code(s, code, dtree); /* send the distance code */
1096 502 125 if (extra != 0) {
1098 114 388 send_bits(s, dist, extra); /* send the extra distance bits */
1106 16579 212 } while (lx < s->last_lit);
1108 103 111 send_code(s, END_BLOCK, ltree);
1135 1398 38 for (n = 0; n <= 31; n++, black_mask >>= 1)
1136 1056 342 if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
176 880 if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
1140 38 0 if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
23 15 if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
1141 0 23 || s->dyn_ltree[13].Freq != 0)
1143 535 2 for (n = 32; n < LITERALS; n++)
1144 21 514 if (s->dyn_ltree[n].Freq != 0)
1166 39430 9846 } while (--len > 0);
1176 0 645 if (s->bi_valid == 16) {
1180 0 645 } else if (s->bi_valid >= 8) {
1193 100 114 if (s->bi_valid > 8) {
1195 114 0 } else if (s->bi_valid > 0) {