Branch Coverage

deps/libgit2/deps/zlib/trees.c
Criterion Covered Total %
branch 179 224 79.9


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 55864 15514 while (j <= s->heap_len) {
460 52121 3743 if (j < s->heap_len &&
45951 6170 if (j < s->heap_len &&
461 24246 21705 smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
20129 4117 smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
465 53602 2262 if (smaller(tree, v, s->heap[j], s->depth)) break;
9254 44348 if (smaller(tree, v, s->heap[j], s->depth)) break;
3812 5442 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 2737 7109 if (n >= base) xbits = extra[n-base];
524 8224 1622 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 52585 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 4810 642 for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
673 7553 1651 s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
686 8562 642 } while (s->heap_len >= 2);
716 66 362 if (nextlen == 0) max_count = 138, min_count = 3;
719 58366 428 for (n = 0; n <= max_code; n++) {
721 58289 77 if (++count < max_count && curlen == nextlen) {
47022 11267 if (++count < max_count && curlen == nextlen) {
723 8587 2757 } else if (count < min_count) {
725 68 2689 } else if (curlen != 0) {
726 67 1 if (curlen != prevlen) s->bl_tree[curlen].Freq++;
728 1726 963 } else if (count <= 10) {
734 4495 6849 if (nextlen == 0) {
736 5 6844 } else if (curlen == nextlen) {
762 17 107 if (nextlen == 0) max_count = 138, min_count = 3;
764 17945 124 for (n = 0; n <= max_code; n++) {
766 17936 9 if (++count < max_count && curlen == nextlen) {
14108 3828 if (++count < max_count && curlen == nextlen) {
768 3200 637 } else if (count < min_count) {
769 625 3173 do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
598 3200 do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
771 41 596 } else if (curlen != 0) {
772 40 1 if (curlen != prevlen) {
773 7 33 send_code(s, curlen, s->bl_tree); count--;
776 23 18 send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
4 37 send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
778 353 243 } else if (count <= 10) {
779 56 297 send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
79 274 send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
782 89 154 send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
103 140 send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
785 1208 2629 if (nextlen == 0) {
787 5 2624 } else if (curlen == nextlen) {
818 568 0 for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
819 214 354 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 994 62 for (rank = 0; rank < blcodes; rank++) {
849 182 812 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 */
873 0 0 if (stored_len)
900 0 0 send_bits(s, STATIC_TREES<<1, 3);
901 0 0 send_code(s, END_BLOCK, static_ltree);
922 214 0 if (s->level > 0) {
925 214 0 if (s->strm->data_type == Z_UNKNOWN)
953 152 62 if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
963 0 214 if (stored_len+4 <= opt_lenb && buf != (char*)0) {
0 0 if (stored_len+4 <= opt_lenb && buf != (char*)0) {
977 214 0 } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
152 62 } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
979 0 152 send_bits(s, (STATIC_TREES<<1)+last, 3);
986 0 62 send_bits(s, (DYN_TREES<<1)+last, 3);
1001 214 0 if (last) {
1023 0 0 if (dist == 0) {
1035 0 0 s->dyn_dtree[d_code(dist)].Freq++;
1054 212 2 if (s->sym_next != 0) do {
1058 16179 617 if (dist == 0) {
1059 6275 9904 send_code(s, lc, ltree); /* send a literal byte */
1064 278 339 send_code(s, code+LITERALS+1, ltree); /* send the length code */
1066 115 502 if (extra != 0) {
1068 15 100 send_bits(s, lc, extra); /* send the extra length bits */
1071 615 2 code = d_code(dist);
1074 117 500 send_code(s, code, dtree); /* send the distance code */
1076 490 127 if (extra != 0) {
1078 118 372 send_bits(s, dist, extra); /* send the extra distance bits */
1085 16584 212 } while (sx < s->sym_next);
1087 113 101 send_code(s, END_BLOCK, ltree);
1114 1398 38 for (n = 0; n <= 31; n++, block_mask >>= 1)
1115 1056 342 if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
176 880 if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
1119 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
1120 0 23 || s->dyn_ltree[13].Freq != 0)
1122 535 2 for (n = 32; n < LITERALS; n++)
1123 21 514 if (s->dyn_ltree[n].Freq != 0)
1145 39442 9846 } while (--len > 0);
1155 0 645 if (s->bi_valid == 16) {
1159 0 645 } else if (s->bi_valid >= 8) {
1172 91 123 if (s->bi_valid > 8) {
1174 123 0 } else if (s->bi_valid > 0) {