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')
968 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))
971 3 0 buf = (Byte*)SvPVbyte(sv, len) ;
973 3 0 if (items < 2)
975 0 0 else if (SvOK(ST(1)))
0 0 else if (SvOK(ST(1)))
0 0 else if (SvOK(ST(1)))
976 0 0 adler = SvUV(ST(1)) ;
995 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))
998 5 0 buf = (Byte*)SvPVbyte(sv, len) ;
1000 1 4 if (offset > len)
1003 3 1 if (items < 2)
1005 0 1 else if (SvOK(ST(1)))
0 0 else if (SvOK(ST(1)))
0 0 else if (SvOK(ST(1)))
1006 0 1 crc = SvUV(ST(1)) ;
1061 33 0 if ((s = InitStream() )) {
1078 0 33 SvGETMAGIC(dictionary);
0 0 SvGETMAGIC(dictionary);
1079 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)) {
1081 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))
1090 0 33 if (err != Z_OK) {
1104 0 33 XPUSHs(obj);
1106 0 33 if (GIMME_V == G_ARRAY) {
22 11 if (GIMME_V == G_ARRAY) {
1108 0 22 setDUALstatus(sv, err);
1109 0 22 XPUSHs(sv) ;
1131 45 0 if ((s = InitStream() )) {
1136 0 45 if (err != Z_OK) {
1140 2 43 else if (sv_len(dictionary)) {
1143 0 2 if (s->WindowBits < 0) {
1145 0 0 const Bytef* b = (const Bytef*)SvPVbyte(dictionary, dlen);
1148 0 0 if (err != Z_OK) {
1158 45 0 if (s) {
1161 1 44 if (ix == 1)
1172 1 44 SV* obj = sv_setref_pv(sv_newmortal(),
1177 0 45 XPUSHs(obj);
1179 0 45 if (GIMME_V == G_ARRAY) {
31 14 if (GIMME_V == G_ARRAY) {
1181 0 31 setDUALstatus(sv, err);
1182 0 31 XPUSHs(sv) ;
1199 0 0 if (RETVAL == Z_OK) {
1224 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))
1227 239 4 s->stream.next_in = (Bytef*)SvPV_nomg(buf, origlen) ;
1230 0 243 if (s->flags & FLAG_CRC32)
1233 0 243 if (s->flags & FLAG_ADLER32)
1239 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))
1243 163 80 if((s->flags & FLAG_APPEND) == FLAG_APPEND) {
1244 1 162 SvOOK_off(output);
1262 3 240 if (s->deflateParams_out_length) {
1265 3 0 if (s->stream.avail_out < plen) {
1285 248 243 while (s->stream.avail_in != 0) {
1287 5 243 if (s->stream.avail_out == 0) {
1318 0 248 if (RETVAL != Z_OK)
1326 243 0 if (RETVAL == Z_OK) {
1329 96 147 SvSETMAGIC(output);
1342 0 33 if (s->dictionary)
1345 0 33 if (s->deflateParams_out_buffer)
1369 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))
1372 22 14 if((s->flags & FLAG_APPEND) == FLAG_APPEND) {
1373 1 21 SvOOK_off(output);
1391 0 36 if (s->deflateParams_out_length) {
1394 0 0 if (s->stream.avail_out < plen) {
1415 63 34 if (s->stream.avail_out == 0) {
1450 2 95 if (availableout == s->stream.avail_out && RETVAL == Z_BUF_ERROR)
2 0 if (availableout == s->stream.avail_out && RETVAL == Z_BUF_ERROR)
1456 61 36 if (s->stream.avail_out != 0 || RETVAL != Z_OK )
61 0 if (s->stream.avail_out != 0 || RETVAL != Z_OK )
1460 6 30 RETVAL = (RETVAL == Z_STREAM_END ? Z_OK : RETVAL) ;
1465 36 0 if (RETVAL == Z_OK) {
1468 4 32 SvSETMAGIC(output);
1485 3 1 if (flags & 1 && level != s->Level) {
3 0 if (flags & 1 && level != s->Level) {
1489 3 1 if (flags & 2 && strategy != s->Strategy) {
3 0 if (flags & 2 && strategy != s->Strategy) {
1493 2 2 if (flags & 4)
1495 4 0 if (changed) {
1644 0 0 if (RETVAL == Z_OK) {
1671 50547 8 if (s->flags & FLAG_CONSUME_INPUT) {
1672 1 50546 if (SvREADONLY(buf))
1674 50539 7 SvPV_force(buf, na);
1677 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))
1682 50550 4 s->stream.next_in = (Bytef*)SvPV_nomg(buf, origlen) ;
1688 0 50554 if (DO_UTF8(output))
0 0 if (DO_UTF8(output))
1690 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))
1693 50421 133 if((s->flags & FLAG_APPEND) == FLAG_APPEND) {
1694 1 50420 SvOOK_off(output);
1703 50554 0 if (SvLEN(output)) {
1706 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)
1714 50554 0 if (SvLEN(output) > cur_length + 1)
1716 50426 128 s->stream.next_out = (Bytef*) SvPV_nomg_nolen(output) + cur_length;
1727 100954 0 while (RETVAL == Z_OK) {
1728 71 100883 if (s->stream.avail_out == 0) {
1747 1 100953 if (RETVAL == Z_NEED_DICT && s->dictionary) {
1 0 if (RETVAL == Z_NEED_DICT && s->dictionary) {
1749 1 0 const Bytef* b = (const Bytef*)SvPV(s->dictionary, dlen) ;
1753 1 0 if (RETVAL == Z_OK)
1757 147 100806 if (s->flags & FLAG_LIMIT_OUTPUT &&
7 140 if (s->flags & FLAG_LIMIT_OUTPUT &&
1758 0 7 (RETVAL == Z_OK || RETVAL == Z_BUF_ERROR )) {
1759 140 0 if (s->stream.avail_out == 0)
1763 7 100806 if (s->flags & FLAG_LIMIT_OUTPUT &&
7 0 if (s->flags & FLAG_LIMIT_OUTPUT &&
1764 7 0 (RETVAL == Z_OK || RETVAL == Z_BUF_ERROR ))
1767 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 ||
1768 100771 39 RETVAL == Z_DATA_ERROR || RETVAL == Z_STREAM_END )
1771 50372 50399 if (RETVAL == Z_BUF_ERROR) {
1772 0 50372 if (s->stream.avail_out == 0)
1774 50372 0 if (s->stream.avail_in == 0) {
1804 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) {
1815 0 50554 if (out_utf8)
1818 128 50426 SvSETMAGIC(output);
1820 0 50554 if (s->flags & FLAG_CRC32 )
1825 0 50554 if (s->flags & FLAG_ADLER32)
1831 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) {
1834 146 50400 if (in)
1837 3 50543 SvSETMAGIC(buf);
1878 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))
1883 169 1 s->stream.next_in = (Bytef*)SvPV_force_nomg_nolen(buf) ;
1897 1 169 if (in)
1900 0 170 SvSETMAGIC(buf);
1910 2 42 if (s->dictionary)
1913 0 44 if (s->deflateParams_out_buffer)
1917 0 44 if (s->window)
1994 0 0 if (mode)
2008 0 1 if (s->dictionary)
2011 0 1 if (s->deflateParams_out_buffer)
2015 1 0 if (s->window)
2030 0 0 if (RETVAL == Z_OK) {
2054 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))
2058 0 0 s->stream.next_in = (Bytef*)SvPV_force_nomg_nolen(buf) ;
2064 0 0 if (s->stream.avail_in == 0) {
2078 0 0 if (start_len > 1 && ! eof_mode)
0 0 if (start_len > 1 && ! eof_mode)
2081 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 ||
2085 0 0 if (s->flags & FLAG_CRC32 )
2089 0 0 if (s->flags & FLAG_ADLER32)
2096 0 0 if (s->stream.avail_out)
2104 0 0 if (s->stream.data_type & 128) {
2105 0 0 if (s->stream.data_type & 64) {
2114 0 0 } while (RETVAL != Z_STREAM_END);
2120 0 0 if (RETVAL == Z_STREAM_END)
2127 0 0 if (s->window_left)
2133 0 0 if (s->window_full) {
2142 0 0 if (in)
2145 0 0 SvSETMAGIC(buf);
2226 0 1 if (byte != NULL)
2259 0 0 if ((s = InitStream() )) {
2270 0 0 if (err == Z_OK) {
2275 0 0 if (err != Z_OK) {
2286 0 0 if (inf_s->window_left) {
2295 0 0 XPUSHs(sv_setref_pv(sv_newmortal(),
2297 0 0 if (GIMME_V == G_ARRAY) {
0 0 if (GIMME_V == G_ARRAY) {
2299 0 0 setDUALstatus(sv, err);
2300 0 0 XPUSHs(sv) ;