Branch Coverage

deps/libgit2/deps/zlib/trees.c
Criterion Covered Total %
branch 177 222 79.7


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 55981 15564 while (j <= s->heap_len) {
460 52248 3733 if (j < s->heap_len &&
46033 6215 if (j < s->heap_len &&
461 24287 21746 smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
20190 4097 smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
465 53694 2287 if (smaller(tree, v, s->heap[j], s->depth)) break;
9217 44477 if (smaller(tree, v, s->heap[j], s->depth)) break;
3816 5401 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 18436 642 for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
513 0 18436 if (bits > max_length) bits = max_length, overflow++;
517 8576 9860 if (n > max_code) continue; /* not a leaf node */
521 2747 7113 if (n >= base) xbits = extra[n-base];
524 8232 1628 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 62431 642 for (n = 0; n <= max_code; n++) {
598 52571 9860 if (len == 0) continue;
632 71690 642 for (n = 0; n < elems; n++) {
633 9698 61992 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 4816 642 for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
673 7540 1678 s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
686 8576 642 } while (s->heap_len >= 2);
716 67 361 if (nextlen == 0) max_count = 138, min_count = 3;
719 58366 428 for (n = 0; n <= max_code; n++) {
721 58291 75 if (++count < max_count && curlen == nextlen) {
47075 11216 if (++count < max_count && curlen == nextlen) {
723 8530 2761 } else if (count < min_count) {
725 76 2685 } else if (curlen != 0) {
726 76 0 if (curlen != prevlen) s->bl_tree[curlen].Freq++;
728 1722 963 } else if (count <= 10) {
734 4488 6803 if (nextlen == 0) {
736 2 6801 } else if (curlen == nextlen) {
762 18 106 if (nextlen == 0) max_count = 138, min_count = 3;
764 17945 124 for (n = 0; n <= max_code; n++) {
766 17938 7 if (++count < max_count && curlen == nextlen) {
14158 3780 if (++count < max_count && curlen == nextlen) {
768 3146 641 } else if (count < min_count) {
769 642 3127 do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
623 3146 do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
771 49 592 } else if (curlen != 0) {
772 49 0 if (curlen != prevlen) {
773 11 38 send_code(s, curlen, s->bl_tree); count--;
776 17 32 send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
5 44 send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
778 349 243 } else if (count <= 10) {
779 59 290 send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
70 279 send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
782 84 159 send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
102 141 send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
785 1201 2586 if (nextlen == 0) {
787 2 2584 } else if (curlen == nextlen) {
818 566 0 for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
819 214 352 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 996 62 for (rank = 0; rank < blcodes; rank++) {
849 181 815 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 16175 624 if (dist == 0) {
1079 6290 9885 send_code(s, lc, ltree); /* send a literal byte */
1084 284 340 send_code(s, code+LITERALS+1, ltree); /* send the length code */
1086 115 509 if (extra != 0) {
1088 18 97 send_bits(s, lc, extra); /* send the extra length bits */
1091 622 2 code = d_code(dist);
1094 114 510 send_code(s, code, dtree); /* send the distance code */
1096 498 126 if (extra != 0) {
1098 112 386 send_bits(s, dist, extra); /* send the extra distance bits */
1106 16587 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 39489 9860 } 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) {