Branch Coverage

cbor_free_decode.c
Criterion Covered Total %
branch 175 200 87.5


line true false branch
85 23 0 return my_snprintf( numstr, strlen, UV_TO_STR_TMPL, num );
0 23 return my_snprintf( numstr, strlen, UV_TO_STR_TMPL, num );
89 2 0 return my_snprintf( numstr, strlen, IV_TO_STR_TMPL, num );
0 2 return my_snprintf( numstr, strlen, IV_TO_STR_TMPL, num );
93 195 11 if (!(decstate->flags & CBF_FLAG_PERSIST_STATE)) {
179 0 0 my_snprintf( bytebuf, 5, "0x%02x", byte );
227 0 33 my_snprintf( tmpl, sizeof(tmpl), "Ignoring unrecognized CBOR tag #%s (major type %%u, %%s)!", UV_TO_STR_TMPL );
236 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)) {
252 6 258 _RETURN_IF_INCOMPLETE( decstate, 2, 0 );
263 10 46 _RETURN_IF_INCOMPLETE( decstate, 3, 0);
274 34 128 _RETURN_IF_INCOMPLETE( decstate, 5, 0);
285 40 19 _RETURN_IF_INCOMPLETE( decstate, 9, 0);
326 39 132 if (CONTROL_BYTE_LENGTH_TYPE(*decstate->curbyte) == CBOR_LENGTH_INDEFINITE) {
330 4 79 _RETURN_IF_INCOMPLETE( decstate, 1, NULL );
332 12 67 if ( decstate->curbyte[0] == '\xff') {
339 23 44 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
346 2 127 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
348 108 19 if (array_length) {
352 533 54 for (i=0; i
354 5 479 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
356 0 479 if (!av_store(array, i, cur)) {
369 1 1908 if (CONTROL_BYTE_LENGTH_TYPE(*decstate->curbyte) == CBOR_LENGTH_INDEFINITE) {
379 1 45 if (CONTROL_BYTE_LENGTH_TYPE(*decstate->curbyte) == CBOR_LENGTH_INDEFINITE) {
384 16 26 _RETURN_IF_SET_INCOMPLETE(decstate, 0);
387 1 25 if (positive >= 0x8000000000000000U) {
412 11 3715 if (CONTROL_BYTE_LENGTH_TYPE(*decstate->curbyte) == CBOR_LENGTH_INDEFINITE) {
420 2 21 _RETURN_IF_INCOMPLETE( decstate, 1, false );
422 7 14 if (decstate->curbyte[0] == '\xff') {
431 2 12 _RETURN_IF_SET_INCOMPLETE( decstate, false );
444 41 3668 _RETURN_IF_SET_INCOMPLETE(decstate, false);
446 31 3637 _RETURN_IF_INCOMPLETE( decstate, string_u->numbuf.num.uv, false );
457 2 2559 _RETURN_IF_INCOMPLETE( decstate, 1, );
474 1 22 _RETURN_IF_SET_INCOMPLETE(decstate, );
484 1 2 _RETURN_IF_SET_INCOMPLETE(decstate, );
494 3 2522 _RETURN_IF_SET_INCOMPLETE(decstate, );
496 2519 3 if (!my_key_has_sv) {
497 0 2519 if (my_key.numbuf.num.uv > 0x7fffffffU) {
503 2489 30 if (SHOULD_VALIDATE_UTF8(decstate, major_type)) {
0 2489 if (SHOULD_VALIDATE_UTF8(decstate, major_type)) {
506 0 29 keylen = decstate->string_decode_mode == CBF_STRING_DECODE_NEVER ? my_key.numbuf.num.uv : -my_key.numbuf.num.uv;
522 3 2542 if (decstate->incomplete_by) {
523 1 2 if (my_key_has_sv) {
527 2 2540 else if (my_key_has_sv) {
541 8 59 if (CONTROL_BYTE_LENGTH_TYPE(*decstate->curbyte) == CBOR_LENGTH_INDEFINITE) {
545 2 11 _RETURN_IF_INCOMPLETE( decstate, 1, NULL );
547 4 7 if (decstate->curbyte[0] == '\xff') {
555 2 5 if ( decstate->incomplete_by ) {
562 5 51 if ( decstate->incomplete_by ) {
566 39 12 if (keycount) {
567 2554 22 while (keycount > 0) {
571 8 2537 if ( decstate->incomplete_by ) {
591 0 7 if (exp == 0) val = ldexp(mant, -24);
592 1 6 else if (exp != 31) val = ldexp(mant + 1024, exp - 25);
593 4 2 else val = mant == 0 ? INFINITY : NAN;
594 2 5 return half & 0x8000 ? -val : val;
622 4 1191 if (_decode_str( aTHX_ decstate, &string )) {
626 73 1118 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
635 11 3938 _RETURN_IF_INCOMPLETE( decstate, 1, NULL );
644 15 1867 if ( decstate->incomplete_by ) {
652 15 23 if ( decstate->incomplete_by ) {
661 73 1122 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
663 1058 64 if (SHOULD_VALIDATE_UTF8(decstate, CONTROL_BYTE_MAJOR_TYPE(control_byte))) {
2 1056 if (SHOULD_VALIDATE_UTF8(decstate, CONTROL_BYTE_MAJOR_TYPE(control_byte))) {
664 66 0 _validate_utf8_string_if_needed( aTHX_ decstate, SvPV_nolen(ret), SvCUR(ret));
669 63 2 if (decstate->string_decode_mode != CBF_STRING_DECODE_NEVER) SvUTF8_on(ret);
675 34 85 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
680 17 38 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
685 1 197 if (CONTROL_BYTE_LENGTH_TYPE(control_byte) == CBOR_LENGTH_INDEFINITE) {
690 15 179 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
694 24 155 if (tagnum == CBOR_TAG_SHAREDREF && decstate->reflist) {
12 12 if (tagnum == CBOR_TAG_SHAREDREF && decstate->reflist) {
695 0 12 if (value_major_type != CBOR_TYPE_UINT) {
697 0 0 my_snprintf( tmpl, sizeof(tmpl), "Shared ref type must be uint, not %%u (%%s)!" );
702 0 12 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
704 0 12 if (refnum >= decstate->reflistlen) {
713 5 162 _RETURN_IF_SET_INCOMPLETE(decstate, NULL);
715 17 145 if (tagnum == CBOR_TAG_INDIRECTION) {
718 24 121 else if (tagnum == CBOR_TAG_SHAREABLE && decstate->reflist) {
12 12 else if (tagnum == CBOR_TAG_SHAREABLE && decstate->reflist) {
720 0 12 Renew( decstate->reflist, decstate->reflistlen, void * );
725 102 31 else if (decstate->tag_handler) {
730 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)) {
762 2 7 _RETURN_IF_INCOMPLETE( decstate, 3, NULL );
770 4 24 _RETURN_IF_INCOMPLETE( decstate, 5, NULL );
786 8 63 _RETURN_IF_INCOMPLETE( decstate, 9, NULL );
828 599 30 if (decode_state->curbyte == NULL) {
854 472 107 if (cbor) {
859 0 579 if (NULL != tag_handler) {
870 0 579 if (flags & CBF_FLAG_PRESERVE_REFERENCES) {
878 4 0 if (NULL == decode_state->reflist) {
884 4 579 if (NULL != decode_state->reflist) {
892 2 2 if (decode_state->reflistlen) {
901 102 477 if (NULL != decode_state->tag_handler) {
912 146 384 if (decode_state->incomplete_by) {
916 1 383 if (decode_state->curbyte != decode_state->end) {