pack_tag.c

filter: Statementstmt 50.0% 9 / 18 Branchbran 16.6% 2 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 36.6% 11 / 30 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« scan_result_response.c ↑ Summary scan_bind_request.c »
1 #include "pack.h"
2  
3 STRLEN
4 257 pack_tag_p(char *p, U8 type, U32 tag) {
5 257 ▶ if (tag < 0x1f) {
Branch: 1 branch
BranchTrueFalseTotal
if (tag < 0x1f) { 257 0 257
6 257 *p = type + tag;
7 257 return 1;
8 }
9 else {
10 0 char *p1 = p;
11 0 int i = (sizeof(U32) * 8 + 6) / 7;
12  
13 0 *p1++ = type + 0x1f;
14  
15 0 ▶ while (--i > 0)
Branch: 1 branch
BranchTrueFalseTotal
while (--i > 0) 0 0 0
16 0 ▶ if (tag >> (i * 7)) break;
Branch: 1 branch
BranchTrueFalseTotal
if (tag >> (i * 7)) break; 0 0 0
17  
18 do {
19 0 ▶ *p1++ = (((tag >> (i * 7)) & 0x7f) | (i ? 0x80 : 0));
Branch: 1 branch
BranchTrueFalseTotal
*p1++ = (((tag >> (i * 7)) & 0x7f) | (i ? 0x80 : 0)); 0 0 0
20 0 ▶ } while (--i >= 0);
Branch: 1 branch
BranchTrueFalseTotal
} while (--i >= 0); 0 0 0
21
22 0 return p1 - p;
23 }
24 }
25  
26 257 void pack_tag(SV* dest, U8 type, U32 tag) {
27 char buffer[12];
28 257 STRLEN len = pack_tag_p(buffer, type, tag);
29 257 ▶ if (len > sizeof(buffer))
Branch: 1 branch
BranchTrueFalseTotal
if (len > sizeof(buffer)) 0 257 257
30 0 croak("pack_tag_p: internal error, overflow");
31 257 sv_catpvn(dest, buffer, len);
32 257 }
« scan_result_response.c ↑ Summary scan_bind_request.c »