Branch Coverage

Gzip.xs
Criterion Covered Total %
branch 113 174 64.9


line true false branch
57 523 1 for (p = VALID_OPT_KEYS; *p; p++) {
58 120 403 if (strlen(*p) == klen && memcmp(*p, key, klen) == 0) return 1;
120 0 if (strlen(*p) == klen && memcmp(*p, key, klen) == 0) return 1;
66 28 14 if (len == 4 && memcmp(s, "gzip", 4) == 0) return GZ_MODE_GZIP;
12 16 if (len == 4 && memcmp(s, "gzip", 4) == 0) return GZ_MODE_GZIP;
67 16 14 if (len == 4 && memcmp(s, "zlib", 4) == 0) return GZ_MODE_ZLIB;
14 2 if (len == 4 && memcmp(s, "zlib", 4) == 0) return GZ_MODE_ZLIB;
68 14 2 if (len == 3 && memcmp(s, "raw", 3) == 0) return GZ_MODE_RAW;
13 1 if (len == 3 && memcmp(s, "raw", 3) == 0) return GZ_MODE_RAW;
69 2 1 if (len == 4 && memcmp(s, "auto", 4) == 0) return GZ_MODE_AUTO;
2 0 if (len == 4 && memcmp(s, "auto", 4) == 0) return GZ_MODE_AUTO;
76 0 1 if (len == 7 && memcmp(s, "default", 7) == 0) return Z_DEFAULT_STRATEGY;
0 0 if (len == 7 && memcmp(s, "default", 7) == 0) return Z_DEFAULT_STRATEGY;
77 0 1 if (len == 8 && memcmp(s, "filtered", 8) == 0) return Z_FILTERED;
0 0 if (len == 8 && memcmp(s, "filtered", 8) == 0) return Z_FILTERED;
78 0 1 if (len == 12 && memcmp(s, "huffman_only",12) == 0) return Z_HUFFMAN_ONLY;
0 0 if (len == 12 && memcmp(s, "huffman_only",12) == 0) return Z_HUFFMAN_ONLY;
79 0 1 if (len == 3 && memcmp(s, "rle", 3) == 0) return Z_RLE;
0 0 if (len == 3 && memcmp(s, "rle", 3) == 0) return Z_RLE;
80 0 1 if (len == 5 && memcmp(s, "fixed", 5) == 0) return Z_FIXED;
0 0 if (len == 5 && memcmp(s, "fixed", 5) == 0) return Z_FIXED;
87 0 74 if (!opts_hv) return;
91 121 65 while ((he = hv_iternext(opts_hv))) {
97 1 120 if (!known_opt(key, klen)) {
101 0 120 if (!SvOK(val)) continue;
103 5 115 if (klen == 5 && memcmp(key, "level", 5) == 0) {
5 0 if (klen == 5 && memcmp(key, "level", 5) == 0) {
105 4 1 if (n < 0 || n > 9)
1 3 if (n < 0 || n > 9)
108 42 73 } else if (klen == 4 && memcmp(key, "mode", 4) == 0) {
42 0 } else if (klen == 4 && memcmp(key, "mode", 4) == 0) {
112 1 41 if ((int)m < 0)
116 2 71 } else if (klen == 10 && memcmp(key, "chunk_size", 10) == 0) {
2 0 } else if (klen == 10 && memcmp(key, "chunk_size", 10) == 0) {
118 0 2 if (n <= 0 || n > (IV)(64 * 1024 * 1024))
0 0 if (n <= 0 || n > (IV)(64 * 1024 * 1024))
121 1 70 } else if (klen == 8 && memcmp(key, "strategy", 8) == 0) {
1 0 } else if (klen == 8 && memcmp(key, "strategy", 8) == 0) {
125 1 0 if (s < 0)
129 2 68 } else if (klen == 9 && memcmp(key, "mem_level", 9) == 0) {
2 0 } else if (klen == 9 && memcmp(key, "mem_level", 9) == 0) {
131 1 1 if (n < 1 || n > 9)
1 0 if (n < 1 || n > 9)
149 35 0 if (ctx->options) decode_opts(aTHX_ ctx->options, &opts);
151 0 31 if (!ctx->data) return &PL_sv_undef;
159 2 29 if (rc != GZ_OK) {
164 23 6 SV *result = newSVpvn(out_len ? (const char *)out : "", out_len);
176 30 0 if (ctx->options) decode_opts(aTHX_ ctx->options, &opts);
178 0 25 if (!ctx->data) return &PL_sv_undef;
186 1 24 if (rc != GZ_OK) {
191 24 0 SV *result = newSVpvn(out_len ? (const char *)out : "", out_len);
233 0 8 if (!st) return;
234 8 0 if (st->zs_inited) { inflateEnd(&st->zs); st->zs_inited = 0; }
235 3 5 if (st->carry) { Safefree(st->carry); st->carry = NULL; }
236 8 0 if (st->line_sv) { SvREFCNT_dec(st->line_sv); st->line_sv = NULL; }
243 0 70 if (!n) return;
244 4 66 if (st->carry_len + n > st->carry_cap) {
245 1 3 size_t want = st->carry_cap ? st->carry_cap : 256;
246 1 4 while (want < st->carry_len + n) want *= 2;
260 70 20386 if (st->carry_len) {
262 68 2 if (n) sv_catpvn(st->line_sv, (const char *)buf, n);
271 20456 0 DEFSV = st->line_sv;
272 0 20456 PUSHMARK(SP);
274 0 20455 FREETMPS;
286 20525 6 while (p < end) {
289 70 20455 if (!nl) {
307 9 7 if (!st) {
311 9 0 if (ctx->options) decode_opts(aTHX_ ctx->options, &opts);
318 0 9 if (z_rc != Z_OK) {
327 9 7 if (chunk && len > 0 && !st->stream_end) {
9 0 if (chunk && len > 0 && !st->stream_end) {
9 0 if (chunk && len > 0 && !st->stream_end) {
330 78 0 while (st->zs.avail_in > 0 && !st->stream_end) {
78 0 while (st->zs.avail_in > 0 && !st->stream_end) {
336 77 1 if (produced) gz_split_and_emit(aTHX_ st, cb, zout, produced);
338 7 70 if (z_rc == Z_STREAM_END) { st->stream_end = 1; break; }
339 0 70 if (z_rc == Z_BUF_ERROR && st->zs.avail_out > 0) {
0 0 if (z_rc == Z_BUF_ERROR && st->zs.avail_out > 0) {
343 1 69 if (z_rc != Z_OK) {
352 7 7 if (eof) {
355 0 7 if (!st->stream_end) {
362 0 0 if (produced) gz_split_and_emit(aTHX_ st, cb, zout, produced);
364 0 0 if (z_rc == Z_STREAM_END) { st->stream_end = 1; break; }
365 0 0 if (z_rc == Z_BUF_ERROR && st->zs.avail_out == 0) continue;
0 0 if (z_rc == Z_BUF_ERROR && st->zs.avail_out == 0) continue;
366 0 0 if (z_rc == Z_OK) continue;
374 1 6 if (st->carry_len) {