Branch Coverage

cbor_free_decode.c
Criterion Covered Total %
branch 175 200 87.5


line true false branch
89 23 0 return my_snprintf( numstr, strlen, UV_TO_STR_TMPL, num );
0 23 return my_snprintf( numstr, strlen, UV_TO_STR_TMPL, num );
93 2 0 return my_snprintf( numstr, strlen, IV_TO_STR_TMPL, num );
0 2 return my_snprintf( numstr, strlen, IV_TO_STR_TMPL, num );
97 195 11 if (!(decstate->flags & CBF_FLAG_PERSIST_STATE)) {
183 0 0 my_snprintf( bytebuf, 5, "0x%02x", byte );
231 0 33 my_snprintf( tmpl, sizeof(tmpl), "Ignoring unrecognized CBOR tag #%s (major type %%u, %%s)!", UV_TO_STR_TMPL );
240 93 3 if (!(decstate->flags & CBF_FLAG_NAIVE_UTF8) && !is_utf8_string( (U8 *)buffer, len)) {
2 91 if (!(decstate->flags & CBF_FLAG_NAIVE_UTF8) && !is_utf8_string( (U8 *)buffer, len)) {
258 6 258 _RETURN_IF_INCOMPLETE( decstate, 2, 0 );
269 10 46 _RETURN_IF_INCOMPLETE( decstate, 3, 0);
280 34 128 _RETURN_IF_INCOMPLETE( decstate, 5, 0);
291 40 19 _RETURN_IF_INCOMPLETE( decstate, 9, 0);
334 39 132 if (control->pieces.length_type == CBOR_LENGTH_INDEFINITE) {
338 4 79 _RETURN_IF_INCOMPLETE( decstate, 1, NULL );
340 12 67 if ( decstate->curbyte[0] == '\xff') {
347 23 44 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
354 2 127 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
356 108 19 if (array_length) {
360 533 54 for (i=0; i
362 5 479 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
364 0 479 if (!av_store(array, i, cur)) {
378 1 1908 if (control->pieces.length_type == CBOR_LENGTH_INDEFINITE) {
389 1 45 if (control->pieces.length_type == CBOR_LENGTH_INDEFINITE) {
394 16 26 _RETURN_IF_SET_INCOMPLETE(decstate, 0);
397 1 25 if (positive >= 0x8000000000000000U) {
423 11 3715 if (control->pieces.length_type == CBOR_LENGTH_INDEFINITE) {
431 2 21 _RETURN_IF_INCOMPLETE( decstate, 1, false );
433 7 14 if (decstate->curbyte[0] == '\xff') {
442 2 12 _RETURN_IF_SET_INCOMPLETE( decstate, false );
455 41 3668 _RETURN_IF_SET_INCOMPLETE(decstate, false);
457 31 3637 _RETURN_IF_INCOMPLETE( decstate, string_u->numbuf.num.uv, false );
468 2 2559 _RETURN_IF_INCOMPLETE( decstate, 1, );
485 1 22 _RETURN_IF_SET_INCOMPLETE(decstate, );
495 1 2 _RETURN_IF_SET_INCOMPLETE(decstate, );
505 3 2522 _RETURN_IF_SET_INCOMPLETE(decstate, );
507 2519 3 if (!my_key_has_sv) {
508 0 2519 if (my_key.numbuf.num.uv > 0x7fffffffU) {
514 2489 30 if (SHOULD_VALIDATE_UTF8(decstate, control->pieces.major_type)) {
0 2489 if (SHOULD_VALIDATE_UTF8(decstate, control->pieces.major_type)) {
517 0 29 keylen = decstate->string_decode_mode == CBF_STRING_DECODE_NEVER ? my_key.numbuf.num.uv : -my_key.numbuf.num.uv;
533 3 2542 if (decstate->incomplete_by) {
534 1 2 if (my_key_has_sv) {
538 2 2540 else if (my_key_has_sv) {
553 8 59 if (control->pieces.length_type == CBOR_LENGTH_INDEFINITE) {
557 2 11 _RETURN_IF_INCOMPLETE( decstate, 1, NULL );
559 4 7 if (decstate->curbyte[0] == '\xff') {
567 2 5 if ( decstate->incomplete_by ) {
574 5 51 if ( decstate->incomplete_by ) {
578 39 12 if (keycount) {
579 2554 22 while (keycount > 0) {
583 8 2537 if ( decstate->incomplete_by ) {
603 0 7 if (exp == 0) val = ldexp(mant, -24);
604 1 6 else if (exp != 31) val = ldexp(mant + 1024, exp - 25);
605 4 2 else val = mant == 0 ? INFINITY : NAN;
606 2 5 return half & 0x8000 ? -val : val;
634 4 1191 if (_decode_str( aTHX_ decstate, &string )) {
638 73 1118 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
647 11 3938 _RETURN_IF_INCOMPLETE( decstate, 1, NULL );
656 15 1867 if ( decstate->incomplete_by ) {
664 15 23 if ( decstate->incomplete_by ) {
673 73 1122 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
675 1058 64 if (SHOULD_VALIDATE_UTF8(decstate, control->pieces.major_type)) {
2 1056 if (SHOULD_VALIDATE_UTF8(decstate, control->pieces.major_type)) {
676 66 0 _validate_utf8_string_if_needed( aTHX_ decstate, SvPV_nolen(ret), SvCUR(ret));
681 63 2 if (decstate->string_decode_mode != CBF_STRING_DECODE_NEVER) SvUTF8_on(ret);
687 34 85 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
692 17 38 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
697 1 197 if (control->pieces.length_type == CBOR_LENGTH_INDEFINITE) {
702 15 179 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
706 24 155 if (tagnum == CBOR_TAG_SHAREDREF && decstate->reflist) {
12 12 if (tagnum == CBOR_TAG_SHAREDREF && decstate->reflist) {
707 0 12 if (value_major_type != CBOR_TYPE_UINT) {
709 0 0 my_snprintf( tmpl, sizeof(tmpl), "Shared ref type must be uint, not %%u (%%s)!" );
714 0 12 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
716 0 12 if (refnum >= decstate->reflistlen) {
725 5 162 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
727 17 145 if (tagnum == CBOR_TAG_INDIRECTION) {
730 24 121 else if (tagnum == CBOR_TAG_SHAREABLE && decstate->reflist) {
12 12 else if (tagnum == CBOR_TAG_SHAREABLE && decstate->reflist) {
732 0 12 Renew( decstate->reflist, decstate->reflistlen, void * );
737 102 31 else if (decstate->tag_handler) {
742 101 1 if (handler_cr && *handler_cr && SvOK(*handler_cr)) {
101 0 if (handler_cr && *handler_cr && SvOK(*handler_cr)) {
1 100 if (handler_cr && *handler_cr && SvOK(*handler_cr)) {
1 0 if (handler_cr && *handler_cr && SvOK(*handler_cr)) {
0 1 if (handler_cr && *handler_cr && SvOK(*handler_cr)) {
774 2 7 _RETURN_IF_INCOMPLETE( decstate, 3, NULL );
782 4 24 _RETURN_IF_INCOMPLETE( decstate, 5, NULL );
798 8 63 _RETURN_IF_INCOMPLETE( decstate, 9, NULL );
840 599 30 if (decode_state->curbyte == NULL) {
866 472 107 if (cbor) {
871 0 579 if (NULL != tag_handler) {
882 0 579 if (flags & CBF_FLAG_PRESERVE_REFERENCES) {
890 4 0 if (NULL == decode_state->reflist) {
896 4 579 if (NULL != decode_state->reflist) {
904 2 2 if (decode_state->reflistlen) {
913 102 477 if (NULL != decode_state->tag_handler) {
924 146 384 if (decode_state->incomplete_by) {
928 1 383 if (decode_state->curbyte != decode_state->end) {