Branch Coverage

Zlib.xs
Criterion Covered Total %
branch 211 494 42.7


line true false branch
433 0 350 if (error_no == Z_ERRNO) {
467 0 0 while (a && b)
0 0 while (a && b)
468 0 0 if (a > b) {
470 0 0 while (a - c >= c)
476 0 0 while (b - c >= c)
499 0 0 if (len < 2) return;
500 0 0 if (rot >= len) rot %= len;
501 0 0 if (rot == 0) return;
507 0 0 if (rot == 1) {
515 0 0 if (rot == len - 1) {
530 0 0 if (from > last) from -= len; /* (pointer better not wrap) */
531 0 0 if (from == start) break; /* all but one shifted */
535 0 0 } while (--cycles);
551 0 0 for (i = 0; i < length; ++i) {
575 0 0 if (message)
579 0 0 if (!s) {
588 0 0 if (s->stream.msg)
593 0 0 if (s->stream.next_in){
600 0 0 if (s->stream.next_out){
622 0 0 printf(" APPEND %s\n", EnDis(FLAG_APPEND));
623 0 0 printf(" CRC32 %s\n", EnDis(FLAG_CRC32));
624 0 0 printf(" ADLER32 %s\n", EnDis(FLAG_ADLER32));
625 0 0 printf(" CONSUME %s\n", EnDis(FLAG_CONSUME_INPUT));
626 0 0 printf(" LIMIT %s\n", EnDis(FLAG_LIMIT_OUTPUT));
692 0 78 if (flags & FLAG_CRC32)
694 0 78 if (flags & FLAG_ADLER32)
709 6 50970 SvGETMAGIC(sv);
0 6 SvGETMAGIC(sv);
711 0 50976 if (SvROK(sv)) {
713 0 0 SvGETMAGIC(sv);
0 0 SvGETMAGIC(sv);
714 0 0 switch(SvTYPE(sv)) {
722 0 0 if (SvROK(sv))
726 0 50976 if (!SvOK(sv))
0 0 if (!SvOK(sv))
0 0 if (!SvOK(sv))
745 228 50605 SvGETMAGIC(sv);
0 228 SvGETMAGIC(sv);
746 51 50782 wipe = ! SvOK(sv) ;
51 0 wipe = ! SvOK(sv) ;
51 0 wipe = ! SvOK(sv) ;
748 141 50692 if (SvROK(sv)) {
750 0 141 SvGETMAGIC(sv);
0 0 SvGETMAGIC(sv);
751 0 141 wipe = ! SvOK(sv) ;
0 0 wipe = ! SvOK(sv) ;
0 0 wipe = ! SvOK(sv) ;
753 0 141 switch(SvTYPE(sv)) {
761 0 141 if (SvROK(sv))
765 0 50833 if (SvREADONLY(sv) && PL_curcop != &PL_compiling)
0 0 if (SvREADONLY(sv) && PL_curcop != &PL_compiling)
768 45 50788 SvUPGRADE(sv, SVt_PV);
770 51 50782 if (wipe)
773 50537 245 (void)SvPVbyte_force(sv, na) ;
843 1 3 if (output)
855 0 4 if (ret == Z_STREAM_ERROR)
862 0 4 } while (ret == Z_BUF_ERROR) ;
864 0 4 if(ret == Z_STREAM_ERROR)
888 0 6 if (CRZ_zlibVersion()[0] != '1')
979 0 3 if (DO_UTF8(sv) && !sv_utf8_downgrade(sv, 1))
0 0 if (DO_UTF8(sv) && !sv_utf8_downgrade(sv, 1))
0 0 if (DO_UTF8(sv) && !sv_utf8_downgrade(sv, 1))
982 3 0 buf = (Byte*)SvPVbyte(sv, len) ;
984 3 0 if (items < 2)
986 0 0 else if (SvOK(ST(1)))
0 0 else if (SvOK(ST(1)))
0 0 else if (SvOK(ST(1)))
987 0 0 adler = SvUV(ST(1)) ;
1006 0 5 if (DO_UTF8(sv) && !sv_utf8_downgrade(sv, 1))
0 0 if (DO_UTF8(sv) && !sv_utf8_downgrade(sv, 1))
0 0 if (DO_UTF8(sv) && !sv_utf8_downgrade(sv, 1))
1009 5 0 buf = (Byte*)SvPVbyte(sv, len) ;
1011 1 4 if (offset > len)
1014 3 1 if (items < 2)
1016 0 1 else if (SvOK(ST(1)))
0 0 else if (SvOK(ST(1)))
0 0 else if (SvOK(ST(1)))
1017 0 1 crc = SvUV(ST(1)) ;
1072 33 0 if ((s = InitStream() )) {
1089 0 33 SvGETMAGIC(dictionary);
0 0 SvGETMAGIC(dictionary);
1090 33 0 if (err == Z_OK && SvPOK(dictionary) && SvCUR(dictionary)) {
32 1 if (err == Z_OK && SvPOK(dictionary) && SvCUR(dictionary)) {
1 31 if (err == Z_OK && SvPOK(dictionary) && SvCUR(dictionary)) {
1092 0 1 if (DO_UTF8(dictionary) && !sv_utf8_downgrade(dictionary, 1))
0 0 if (DO_UTF8(dictionary) && !sv_utf8_downgrade(dictionary, 1))
0 0 if (DO_UTF8(dictionary) && !sv_utf8_downgrade(dictionary, 1))
1101 0 33 if (err != Z_OK) {
1115 0 33 XPUSHs(obj);
1117 0 33 if (GIMME_V == G_ARRAY) {
22 11 if (GIMME_V == G_ARRAY) {
1119 0 22 setDUALstatus(sv, err);
1120 0 22 XPUSHs(sv) ;
1142 45 0 if ((s = InitStream() )) {
1147 0 45 if (err != Z_OK) {
1151 2 43 else if (sv_len(dictionary)) {
1154 0 2 if (s->WindowBits < 0) {
1156 0 0 const Bytef* b = (const Bytef*)SvPVbyte(dictionary, dlen);
1159 0 0 if (err != Z_OK) {
1169 45 0 if (s) {
1172 1 44 if (ix == 1)
1183 1 44 SV* obj = sv_setref_pv(sv_newmortal(),
1188 0 45 XPUSHs(obj);
1190 0 45 if (GIMME_V == G_ARRAY) {
31 14 if (GIMME_V == G_ARRAY) {
1192 0 31 setDUALstatus(sv, err);
1193 0 31 XPUSHs(sv) ;
1210 0 0 if (RETVAL == Z_OK) {
1235 0 243 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
0 0 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
0 0 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
1238 239 4 s->stream.next_in = (Bytef*)SvPV_nomg(buf, origlen) ;
1241 0 243 if (s->flags & FLAG_CRC32)
1244 0 243 if (s->flags & FLAG_ADLER32)
1250 0 243 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
0 0 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
0 0 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
1254 163 80 if((s->flags & FLAG_APPEND) == FLAG_APPEND) {
1255 1 162 SvOOK_off(output);
1273 3 240 if (s->deflateParams_out_length) {
1276 3 0 if (s->stream.avail_out < plen) {
1296 248 243 while (s->stream.avail_in != 0) {
1298 5 243 if (s->stream.avail_out == 0) {
1329 0 248 if (RETVAL != Z_OK)
1337 243 0 if (RETVAL == Z_OK) {
1340 96 147 SvSETMAGIC(output);
1353 0 33 if (s->dictionary)
1356 0 33 if (s->deflateParams_out_buffer)
1380 0 36 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
0 0 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
0 0 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
1383 22 14 if((s->flags & FLAG_APPEND) == FLAG_APPEND) {
1384 1 21 SvOOK_off(output);
1402 0 36 if (s->deflateParams_out_length) {
1405 0 0 if (s->stream.avail_out < plen) {
1426 63 34 if (s->stream.avail_out == 0) {
1461 2 95 if (availableout == s->stream.avail_out && RETVAL == Z_BUF_ERROR)
2 0 if (availableout == s->stream.avail_out && RETVAL == Z_BUF_ERROR)
1467 61 36 if (s->stream.avail_out != 0 || RETVAL != Z_OK )
61 0 if (s->stream.avail_out != 0 || RETVAL != Z_OK )
1471 6 30 RETVAL = (RETVAL == Z_STREAM_END ? Z_OK : RETVAL) ;
1476 36 0 if (RETVAL == Z_OK) {
1479 4 32 SvSETMAGIC(output);
1496 3 1 if (flags & 1 && level != s->Level) {
3 0 if (flags & 1 && level != s->Level) {
1500 3 1 if (flags & 2 && strategy != s->Strategy) {
3 0 if (flags & 2 && strategy != s->Strategy) {
1504 2 2 if (flags & 4)
1506 4 0 if (changed) {
1655 0 0 if (RETVAL == Z_OK) {
1682 50547 8 if (s->flags & FLAG_CONSUME_INPUT) {
1683 1 50546 if (SvREADONLY(buf))
1685 50539 7 SvPV_force(buf, na);
1688 0 50554 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
0 0 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
0 0 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
1693 50550 4 s->stream.next_in = (Bytef*)SvPV_nomg(buf, origlen) ;
1699 0 50554 if (DO_UTF8(output))
0 0 if (DO_UTF8(output))
1701 0 50554 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
0 0 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
0 0 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
1704 50421 133 if((s->flags & FLAG_APPEND) == FLAG_APPEND) {
1705 1 50420 SvOOK_off(output);
1714 50554 0 if (SvLEN(output)) {
1717 147 50407 if (s->flags & FLAG_LIMIT_OUTPUT && SvLEN(output) - cur_length - 1 < bufinc)
144 3 if (s->flags & FLAG_LIMIT_OUTPUT && SvLEN(output) - cur_length - 1 < bufinc)
1725 50554 0 if (SvLEN(output) > cur_length + 1)
1727 50426 128 s->stream.next_out = (Bytef*) SvPV_nomg_nolen(output) + cur_length;
1738 100954 0 while (RETVAL == Z_OK) {
1739 71 100883 if (s->stream.avail_out == 0) {
1758 1 100953 if (RETVAL == Z_NEED_DICT && s->dictionary) {
1 0 if (RETVAL == Z_NEED_DICT && s->dictionary) {
1760 1 0 const Bytef* b = (const Bytef*)SvPV(s->dictionary, dlen) ;
1764 1 0 if (RETVAL == Z_OK)
1768 147 100806 if (s->flags & FLAG_LIMIT_OUTPUT &&
7 140 if (s->flags & FLAG_LIMIT_OUTPUT &&
1769 0 7 (RETVAL == Z_OK || RETVAL == Z_BUF_ERROR )) {
1770 140 0 if (s->stream.avail_out == 0)
1774 7 100806 if (s->flags & FLAG_LIMIT_OUTPUT &&
7 0 if (s->flags & FLAG_LIMIT_OUTPUT &&
1775 7 0 (RETVAL == Z_OK || RETVAL == Z_BUF_ERROR ))
1778 100813 0 if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
100813 0 if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
100810 3 if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
1779 100771 39 RETVAL == Z_DATA_ERROR || RETVAL == Z_STREAM_END )
1782 50372 50399 if (RETVAL == Z_BUF_ERROR) {
1783 0 50372 if (s->stream.avail_out == 0)
1785 50372 0 if (s->stream.avail_in == 0) {
1815 182 50372 if (RETVAL == Z_OK || RETVAL == Z_STREAM_END || RETVAL == Z_BUF_ERROR || RETVAL == Z_DATA_ERROR) {
143 39 if (RETVAL == Z_OK || RETVAL == Z_STREAM_END || RETVAL == Z_BUF_ERROR || RETVAL == Z_DATA_ERROR) {
3 140 if (RETVAL == Z_OK || RETVAL == Z_STREAM_END || RETVAL == Z_BUF_ERROR || RETVAL == Z_DATA_ERROR) {
3 0 if (RETVAL == Z_OK || RETVAL == Z_STREAM_END || RETVAL == Z_BUF_ERROR || RETVAL == Z_DATA_ERROR) {
1826 0 50554 if (out_utf8)
1829 128 50426 SvSETMAGIC(output);
1831 0 50554 if (s->flags & FLAG_CRC32 )
1836 0 50554 if (s->flags & FLAG_ADLER32)
1842 8 50546 if (s->flags & FLAG_CONSUME_INPUT || s->flags & FLAG_LIMIT_OUTPUT) {
0 8 if (s->flags & FLAG_CONSUME_INPUT || s->flags & FLAG_LIMIT_OUTPUT) {
1845 146 50400 if (in)
1848 3 50543 SvSETMAGIC(buf);
1889 0 170 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
0 0 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
0 0 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
1894 169 1 s->stream.next_in = (Bytef*)SvPV_force_nomg_nolen(buf) ;
1908 1 169 if (in)
1911 0 170 SvSETMAGIC(buf);
1921 2 42 if (s->dictionary)
1924 0 44 if (s->deflateParams_out_buffer)
1928 0 44 if (s->window)
2005 0 0 if (mode)
2019 0 1 if (s->dictionary)
2022 0 1 if (s->deflateParams_out_buffer)
2026 1 0 if (s->window)
2041 0 0 if (RETVAL == Z_OK) {
2065 0 0 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
0 0 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
0 0 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
2069 0 0 s->stream.next_in = (Bytef*)SvPV_force_nomg_nolen(buf) ;
2075 0 0 if (s->stream.avail_in == 0) {
2089 0 0 if (start_len > 1 && ! eof_mode)
0 0 if (start_len > 1 && ! eof_mode)
2092 0 0 if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
0 0 if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
0 0 if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
2096 0 0 if (s->flags & FLAG_CRC32 )
2100 0 0 if (s->flags & FLAG_ADLER32)
2107 0 0 if (s->stream.avail_out)
2115 0 0 if (s->stream.data_type & 128) {
2116 0 0 if (s->stream.data_type & 64) {
2125 0 0 } while (RETVAL != Z_STREAM_END);
2131 0 0 if (RETVAL == Z_STREAM_END)
2138 0 0 if (s->window_left)
2144 0 0 if (s->window_full) {
2153 0 0 if (in)
2156 0 0 SvSETMAGIC(buf);
2237 0 1 if (byte != NULL)
2270 0 0 if ((s = InitStream() )) {
2281 0 0 if (err == Z_OK) {
2286 0 0 if (err != Z_OK) {
2297 0 0 if (inf_s->window_left) {
2306 0 0 XPUSHs(sv_setref_pv(sv_newmortal(),
2308 0 0 if (GIMME_V == G_ARRAY) {
0 0 if (GIMME_V == G_ARRAY) {
2310 0 0 setDUALstatus(sv, err);
2311 0 0 XPUSHs(sv) ;