Branch Coverage

Gzip.xs
Criterion Covered Total %
branch 113 174 64.9


line true false branch
43 541 1 for (p = VALID_OPT_KEYS; *p; p++) {
44 123 418 if (strlen(*p) == klen && memcmp(*p, key, klen) == 0) return 1;
123 0 if (strlen(*p) == klen && memcmp(*p, key, klen) == 0) return 1;
52 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;
53 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;
54 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;
55 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;
62 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;
63 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;
64 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;
65 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;
66 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;
73 0 74 if (!opts_hv) return;
77 124 65 while ((he = hv_iternext(opts_hv))) {
83 1 123 if (!known_opt(key, klen)) {
87 0 123 if (!SvOK(val)) continue;
89 5 118 if (klen == 5 && memcmp(key, "level", 5) == 0) {
5 0 if (klen == 5 && memcmp(key, "level", 5) == 0) {
91 4 1 if (n < 0 || n > 9)
1 3 if (n < 0 || n > 9)
94 42 76 } else if (klen == 4 && memcmp(key, "mode", 4) == 0) {
42 0 } else if (klen == 4 && memcmp(key, "mode", 4) == 0) {
98 1 41 if ((int)m < 0)
102 2 74 } else if (klen == 10 && memcmp(key, "chunk_size", 10) == 0) {
2 0 } else if (klen == 10 && memcmp(key, "chunk_size", 10) == 0) {
104 0 2 if (n <= 0 || n > (IV)(64 * 1024 * 1024))
0 0 if (n <= 0 || n > (IV)(64 * 1024 * 1024))
107 1 73 } else if (klen == 8 && memcmp(key, "strategy", 8) == 0) {
1 0 } else if (klen == 8 && memcmp(key, "strategy", 8) == 0) {
111 1 0 if (s < 0)
115 2 71 } else if (klen == 9 && memcmp(key, "mem_level", 9) == 0) {
2 0 } else if (klen == 9 && memcmp(key, "mem_level", 9) == 0) {
117 1 1 if (n < 1 || n > 9)
1 0 if (n < 1 || n > 9)
135 35 0 if (ctx->options) decode_opts(aTHX_ ctx->options, &opts);
137 0 31 if (!ctx->data) return &PL_sv_undef;
145 2 29 if (rc != GZ_OK) {
150 23 6 SV *result = newSVpvn(out_len ? (const char *)out : "", out_len);
162 30 0 if (ctx->options) decode_opts(aTHX_ ctx->options, &opts);
164 0 25 if (!ctx->data) return &PL_sv_undef;
172 1 24 if (rc != GZ_OK) {
177 24 0 SV *result = newSVpvn(out_len ? (const char *)out : "", out_len);
219 0 8 if (!st) return;
220 8 0 if (st->zs_inited) { inflateEnd(&st->zs); st->zs_inited = 0; }
221 3 5 if (st->carry) { Safefree(st->carry); st->carry = NULL; }
222 8 0 if (st->line_sv) { SvREFCNT_dec(st->line_sv); st->line_sv = NULL; }
229 0 70 if (!n) return;
230 4 66 if (st->carry_len + n > st->carry_cap) {
231 1 3 size_t want = st->carry_cap ? st->carry_cap : 256;
232 1 4 while (want < st->carry_len + n) want *= 2;
246 70 20386 if (st->carry_len) {
248 68 2 if (n) sv_catpvn(st->line_sv, (const char *)buf, n);
257 20456 0 DEFSV = st->line_sv;
258 0 20456 PUSHMARK(SP);
260 0 20455 FREETMPS;
272 20525 6 while (p < end) {
275 70 20455 if (!nl) {
293 9 7 if (!st) {
297 9 0 if (ctx->options) decode_opts(aTHX_ ctx->options, &opts);
304 0 9 if (z_rc != Z_OK) {
313 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) {
316 78 0 while (st->zs.avail_in > 0 && !st->stream_end) {
78 0 while (st->zs.avail_in > 0 && !st->stream_end) {
322 77 1 if (produced) gz_split_and_emit(aTHX_ st, cb, zout, produced);
324 7 70 if (z_rc == Z_STREAM_END) { st->stream_end = 1; break; }
325 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) {
329 1 69 if (z_rc != Z_OK) {
338 7 7 if (eof) {
341 0 7 if (!st->stream_end) {
348 0 0 if (produced) gz_split_and_emit(aTHX_ st, cb, zout, produced);
350 0 0 if (z_rc == Z_STREAM_END) { st->stream_end = 1; break; }
351 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;
352 0 0 if (z_rc == Z_OK) continue;
360 1 6 if (st->carry_len) {