Branch Coverage

UTF8.xs
Criterion Covered Total %
branch 190 262 72.5


line true false branch
36 1024 2048 if (cp > 0x10FFFF) {
40 2048 0 else if ((cp & 0xF800) == 0xD800) {
63 7284 6136 while (len-- > 0) {
67 1148 6136 if (len) {
69 0 1148 if (d == dstop) {
77 287 5849 if (fatal)
91 281 70401 : "Can't decode ill-formed UTF-8 octet sequence <%s>";
93 70934 70682 while (n-- > 0) {
97 252 70682 if (n)
118 0 21 PUSHMARK(SP);
119 0 21 EXTEND(SP, 2);
129 0 21 if (count != 1)
134 9 12 if (SvUTF8(str))
140 21 0 FREETMPS;
151 2340 1802 (void)SvUPGRADE(dsv, SVt_PV);
152 4140 2 (void)SvGROW(dsv, off + 1);
2341 1799 (void)SvGROW(dsv, off + 1);
163 5849 2578 if (do_warn) {
169 16 6076 if (fallback) {
181 1807 4285 if (off == len) {
185 4285 0 } while (len);
199 3361 2 (void)SvUPGRADE(dsv, SVt_PV);
200 3363 0 (void)SvGROW(dsv, off + 1);
3361 2 (void)SvGROW(dsv, off + 1);
210 287 3080 if (skip == (STRLEN) -1) {
212 286 1 if (UTF8_IS_START(*src)) {
214 272 14 if (n > len)
216 579 286 while (skip < n && UTF8_IS_CONTINUATION(src[skip]))
579 0 while (skip < n && UTF8_IS_CONTINUATION(src[skip]))
221 3072 8 if (do_warn)
226 5 3 if (fallback) {
228 0 5 UV usv = (v <= 0x10FFFF && (v & 0xF800) != 0xD800) ? v : 0;
0 0 UV usv = (v <= 0x10FFFF && (v & 0xF800) != 0xD800) ? v : 0;
239 4 4 if (off == len) {
243 4 0 } while (len);
252 12 3 if (append)
255 3 12 (void)SvUPGRADE(dsv, SVt_PV);
256 15 0 (void)SvGROW(dsv, off + len * 2 + 1);
3 12 (void)SvGROW(dsv, off + len * 2 + 1);
259 37 15 for (; src < end; src++) {
261 23 14 if (c < 0x80)
278 0 0 while (p < e && *p < 0x80)
0 0 while (p < e && *p < 0x80)
281 0 0 if (p != e) {
287 0 0 while (p < e)
290 0 0 if (SvLEN(sv) < size + 1) {
297 0 0 for (s += off, e--; e >= s; e--) {
299 0 0 if (c < 0x80)
316 3 0 (void)SvUPGRADE(dsv, SVt_PV);
317 3 0 (void)SvGROW(dsv, len + 1);
3 0 (void)SvGROW(dsv, len + 1);
320 26 2 while (s < e) {
322 14 12 if (c < 0x80)
325 1 11 if ((c & 0xFE) != 0xC2)
329 0 11 if ((c & 0xC0) != 0x80)
334 1 1 if (s < e + 1) {
335 1 0 if (*s < 0x80)
358 5 310834 if (length < 0)
361 310820 14 if (!SvOK(bufsv))
366 14 310820 if (offset != 0) {
369 4 10 if (offset < 0) {
371 0 4 if (back > chars)
375 5 5 else if ((size_t)offset == chars) {
378 0 5 else if ((size_t)offset < chars) {
389 310834 0 buf = SvGROW(bufsv, base + (STRLEN)length * 4 + 1);
19 310815 buf = SvGROW(bufsv, base + (STRLEN)length * 4 + 1);
392 5 310829 if (pad) {
403 233193 77641 if (PerlIO_fast_gets(fh)) {
404 234029 231315 while (got < length) {
407 2680 231349 if (PerlIO_get_cnt(fh) <= 0 && PerlIO_fill(fh) != 0) {
1878 802 if (PerlIO_get_cnt(fh) <= 0 && PerlIO_fill(fh) != 0) {
408 0 1878 if (PerlIO_error(fh))
417 1878 232151 if (avail == 0)
424 24246 262593 if (got >= length)
431 249832 12761 if (span > room) {
442 247130 15463 if (r.consumed) {
457 207069 40061 if (got >= length)
461 2244 53280 if (r.status == UTF8_VALID_STREAM_OK)
464 259 53021 if (r.status == UTF8_VALID_STREAM_PARTIAL) {
476 53012 9 if (ckWARN_d(WARN_UTF8)) {
479 211 52801 if (r.carried)
481 52801 211 if (r.advance)
494 211 52810 if (r.status == UTF8_VALID_STREAM_TRUNCATED)
498 232151 1878 if (avail)
501 1878 232151 if (eof)
506 142058 77028 while (got < (size_t)length) {
510 142058 0 if (count < 0 || (count == 0 && PerlIO_error(fh)))
613 141445 if (count < 0 || (count == 0 && PerlIO_error(fh)))
0 613 if (count < 0 || (count == 0 && PerlIO_error(fh)))
523 142058 17602 if (r.status == UTF8_VALID_STREAM_ILLFORMED ||
524 70 141988 r.status == UTF8_VALID_STREAM_TRUNCATED) {
529 17670 2 if (ckWARN_d(WARN_UTF8))
532 17662 10 if (delta) { // make room, then write FFFD
542 70 17602 if (r.status == UTF8_VALID_STREAM_TRUNCATED)
556 613 141445 if (eof)
563 53 77588 if (s.pending) {
572 0 310834 SvSETMAGIC(bufsv);
595 0 4522 reuse_sv = SvPV_stealable(octets);
0 0 reuse_sv = SvPV_stealable(octets);
0 0 reuse_sv = SvPV_stealable(octets);
0 0 reuse_sv = SvPV_stealable(octets);
596 3 4519 if (SvUTF8(octets)) {
597 3 0 if (!reuse_sv) {
602 0 2 if (SvCUR(octets) == len) {
609 379 4142 if (utf8_check_ascii((const char *)src, len, &off)) {
610 2 377 if (reuse_sv) {
616 377 0 dXSTARG;
619 0 377 PUSHTARG;
623 4142 0 dXSTARG;
626 0 1807 PUSHTARG;
639 0 3708 reuse_sv = SvPV_stealable(string);
0 0 reuse_sv = SvPV_stealable(string);
0 0 reuse_sv = SvPV_stealable(string);
0 0 reuse_sv = SvPV_stealable(string);
640 3 3705 if (!SvUTF8(string)) {
641 0 3 if (reuse_sv) {
647 3 0 dXSTARG;
649 0 3 SvTAINT(TARG);
0 0 SvTAINT(TARG);
650 0 3 PUSHTARG;
655 342 3363 if (utf8_check_ascii((const char *)src, len, &off)) {
656 0 342 if (reuse_sv) {
662 342 0 dXSTARG;
665 0 342 PUSHTARG;
669 3363 0 dXSTARG;
671 0 4 PUSHTARG;
686 0 310834 if (got < 0)
688 310807 27 RETVAL = (IV)got;
701 2 2674 if (SvUTF8(octets)) {
703 1 1 if (!sv_utf8_downgrade(octets, TRUE))
707 340 2335 ST(0) = boolSV(utf8_valid_ascii(src, len));