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) {
430 2 21 _RETURN_IF_INCOMPLETE( decstate, 1, false );
432 7 14 if (decstate->curbyte[0] == '\xff') {
441 2 12 _RETURN_IF_SET_INCOMPLETE( decstate, false );
454 41 3668 _RETURN_IF_SET_INCOMPLETE(decstate, false);
456 31 3637 _RETURN_IF_INCOMPLETE( decstate, string_u->numbuf.num.uv, false );
467 2 2559 _RETURN_IF_INCOMPLETE( decstate, 1, );
484 1 22 _RETURN_IF_SET_INCOMPLETE(decstate, );
494 1 2 _RETURN_IF_SET_INCOMPLETE(decstate, );
504 3 2522 _RETURN_IF_SET_INCOMPLETE(decstate, );
506 2519 3 if (!my_key_has_sv) {
507 0 2519 if (my_key.numbuf.num.uv > 0x7fffffffU) {
513 2489 30 if (SHOULD_VALIDATE_UTF8(decstate, control->pieces.major_type)) {
0 2489 if (SHOULD_VALIDATE_UTF8(decstate, control->pieces.major_type)) {
516 0 29 keylen = decstate->string_decode_mode == CBF_STRING_DECODE_NEVER ? my_key.numbuf.num.uv : -my_key.numbuf.num.uv;
532 3 2542 if (decstate->incomplete_by) {
533 1 2 if (my_key_has_sv) {
537 2 2540 else if (my_key_has_sv) {
552 8 59 if (control->pieces.length_type == CBOR_LENGTH_INDEFINITE) {
556 2 11 _RETURN_IF_INCOMPLETE( decstate, 1, NULL );
558 4 7 if (decstate->curbyte[0] == '\xff') {
566 2 5 if ( decstate->incomplete_by ) {
573 5 51 if ( decstate->incomplete_by ) {
577 39 12 if (keycount) {
578 2554 22 while (keycount > 0) {
582 8 2537 if ( decstate->incomplete_by ) {
602 0 7 if (exp == 0) val = ldexp(mant, -24);
603 1 6 else if (exp != 31) val = ldexp(mant + 1024, exp - 25);
604 4 2 else val = mant == 0 ? INFINITY : NAN;
605 2 5 return half & 0x8000 ? -val : val;
633 4 1191 if (_decode_str( aTHX_ decstate, &string )) {
637 73 1118 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
646 11 3938 _RETURN_IF_INCOMPLETE( decstate, 1, NULL );
655 15 1867 if ( decstate->incomplete_by ) {
663 15 23 if ( decstate->incomplete_by ) {
672 73 1122 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
674 1058 64 if (SHOULD_VALIDATE_UTF8(decstate, control->pieces.major_type)) {
2 1056 if (SHOULD_VALIDATE_UTF8(decstate, control->pieces.major_type)) {
675 66 0 _validate_utf8_string_if_needed( aTHX_ decstate, SvPV_nolen(ret), SvCUR(ret));
680 63 2 if (decstate->string_decode_mode != CBF_STRING_DECODE_NEVER) SvUTF8_on(ret);
686 34 85 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
691 17 38 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
696 1 197 if (control->pieces.length_type == CBOR_LENGTH_INDEFINITE) {
701 15 179 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
705 24 155 if (tagnum == CBOR_TAG_SHAREDREF && decstate->reflist) {
12 12 if (tagnum == CBOR_TAG_SHAREDREF && decstate->reflist) {
706 0 12 if (value_major_type != CBOR_TYPE_UINT) {
708 0 0 my_snprintf( tmpl, sizeof(tmpl), "Shared ref type must be uint, not %%u (%%s)!" );
713 0 12 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
715 0 12 if (refnum >= decstate->reflistlen) {
724 5 162 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
726 17 145 if (tagnum == CBOR_TAG_INDIRECTION) {
729 24 121 else if (tagnum == CBOR_TAG_SHAREABLE && decstate->reflist) {
12 12 else if (tagnum == CBOR_TAG_SHAREABLE && decstate->reflist) {
731 0 12 Renew( decstate->reflist, decstate->reflistlen, void * );
736 102 31 else if (decstate->tag_handler) {
741 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)) {
773 2 7 _RETURN_IF_INCOMPLETE( decstate, 3, NULL );
781 4 24 _RETURN_IF_INCOMPLETE( decstate, 5, NULL );
797 8 63 _RETURN_IF_INCOMPLETE( decstate, 9, NULL );
839 599 30 if (decode_state->curbyte == NULL) {
865 472 107 if (cbor) {
870 0 579 if (NULL != tag_handler) {
881 0 579 if (flags & CBF_FLAG_PRESERVE_REFERENCES) {
889 4 0 if (NULL == decode_state->reflist) {
895 4 579 if (NULL != decode_state->reflist) {
903 2 2 if (decode_state->reflistlen) {
912 102 477 if (NULL != decode_state->tag_handler) {
923 146 384 if (decode_state->incomplete_by) {
927 1 383 if (decode_state->curbyte != decode_state->end) {