netSerial

serializer producing compact bitstreams
git clone https://noulin.net/git/netSerial.git
Log | Files | Refs | README | LICENSE

commit a3829964691443e3b355e50ea3d5d94aa70bb2d8
parent cba128ef0ebcc5db8aef466767db9f6eef8d82ef
Author: Remy Noulin <loader2x@gmail.com>
Date:   Sat,  2 Mar 2019 03:12:52 -0500

fix bug in varint. Stop losing bit 63

memcheckNetSerial.c |    20 +-
netSerial.c         |    93 +-
netSerial.c.gcov    | 10629 +++++++++++++++++++++++++-------------------------
package.yml         |     2 +-
testNetSerial.c     |    20 +-
5 files changed, 5397 insertions(+), 5367 deletions(-)

Diffstat:
MmemcheckNetSerial.c | 20+++++++++++++++++---
MnetSerial.c | 93++++++++++++++++++++++++++++++++++++++++---------------------------------------
MnetSerial.c.gcov | 10629++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mpackage.yml | 2+-
MtestNetSerial.c | 20+++++++++++++++++---
5 files changed, 5397 insertions(+), 5367 deletions(-)

diff --git a/memcheckNetSerial.c b/memcheckNetSerial.c @@ -93,9 +93,23 @@ void topT(void) { terminateG(B); freeManyG(&n, &ds); - // 64 bit int test - u64 val = 12000000000UL; - logVarG(val); + // TODO test with 0x8000000000000000 and 0x7FFFFFFFFFFFFFFF + // 64 bit int test with bit 63 set + setTopG(&n, -8030967404224553996); + B = serialG(&n); + logSI("%s",toHexSepS(getValG(B), lenG(B), " ")); + s = sToString((smallt *) B->B); + ck_assert_str_eq(s, "[-12,-12,-46,-11,-57,-73,-46,-69,-18,27]"); + free(s); + deserialG(&ds, B); + s = toStringG(&ds); + logVarG(s); + ck_assert_str_eq(s, "-8030967404224553996"); + free(s); + terminateG(B); + freeManyG(&n, &ds); + + // 64 bit int test large positive value setTopG(&n, 12000000000UL); B = serialG(&n); logSI("%s",toHexSepS(getValG(B), lenG(B), " ")); diff --git a/netSerial.c b/netSerial.c @@ -318,7 +318,8 @@ internal u64 varintToUint(u8 **buf) { u8 c = 1; while (**buf & 0x80) { (*buf)++; - r |= (**buf & 0x7F) << (7*c); + // note: keep 0x7FUL to use 64 bit shift operation, without UL a 32 bit shift operation is use and then casted to 64 bit + r |= (**buf & 0x7FUL) << (7*c); c++; } (*buf)++; @@ -2812,8 +2813,8 @@ internal smallt* netDeserialLevel0(sBytest *obj) { break; case S_INT: data = &(obj->data); - i64 v = netTypeVarintToUint((u8**)&data); - v = (v >> 1) ^ ((v << 63) >> 63); + u64 v = netTypeVarintToUint((u8**)&data); + v = (v >> 1) ^ (~(v & 1) + 1); r = (smallt *) allocSInt(v); break; case S_STRING: @@ -2897,8 +2898,8 @@ internal void dictNetDeserialLevel0(sDictt **dict, char **data) { sDictPushTiny(dict, key, (smallt *) Do); break; case S_INT: { - i64 v = netTypeVarintToUint((u8**)data); - v = (v >> 1) ^ ((v << 63) >> 63); + u64 v = netTypeVarintToUint((u8**)data); + v = (v >> 1) ^ (~(v & 1) + 1); io = allocSInt(v); sDictPushTiny(dict, key, (smallt *) io); } @@ -2984,8 +2985,8 @@ internal void arrayNetDeserialLevel0(sArrayt **array, char **data) { sArrayPushTiny(array, (smallt *) Do); break; case S_INT: { - i64 v = netTypeVarintToUint((u8**)data); - v = (v >> 1) ^ ((v << 63) >> 63); + u64 v = netTypeVarintToUint((u8**)data); + v = (v >> 1) ^ (~(v & 1) + 1); io = allocSInt(v); sArrayPushTiny(array, (smallt *) io); } @@ -3066,8 +3067,8 @@ internal smallt* netDeserialLevel1(sBytest *obj) { break; case S_INT: data = &(obj->data); - i64 v = netTypeVarintToUint((u8**)&data); - v = (v >> 1) ^ ((v << 63) >> 63); + u64 v = netTypeVarintToUint((u8**)&data); + v = (v >> 1) ^ (~(v & 1) + 1); r = (smallt *) allocSInt(v); break; case S_STRING: @@ -3230,7 +3231,7 @@ internal void dictNetDeserialLevel1(sDictt **dict, u8 **data, contextt *ctx) { sDictPushTiny(dict, key, (smallt *) Do); break; case S_INT: { - i64 v; + u64 v; if (ctx->nibble == lowNbl) { v = netTypeVarintToUint((u8**)data); } @@ -3239,8 +3240,8 @@ internal void dictNetDeserialLevel1(sDictt **dict, u8 **data, contextt *ctx) { readTypeInHighNbl; v = varintToUint(data); } - v = (v >> 1) ^ ((v << 63) >> 63); - io = allocSInt(v); + v = (v >> 1) ^ (~(v & 1) + 1); + io = allocSInt(v); sDictPushTiny(dict, key, (smallt *) io); } break; @@ -3398,7 +3399,7 @@ internal void arrayNetDeserialLevel1(sArrayt **array, u8 **data, contextt *ctx) sArrayPushTiny(array, (smallt *) Do); break; case S_INT: { - i64 v; + u64 v; if (ctx->nibble == lowNbl) { v = netTypeVarintToUint((u8**)data); } @@ -3407,8 +3408,8 @@ internal void arrayNetDeserialLevel1(sArrayt **array, u8 **data, contextt *ctx) readTypeInHighNbl; v = varintToUint(data); } - v = (v >> 1) ^ ((v << 63) >> 63); - io = allocSInt(v); + v = (v >> 1) ^ (~(v & 1) + 1); + io = allocSInt(v); sArrayPushTiny(array, (smallt *) io); } break; @@ -3501,8 +3502,8 @@ internal smallt* netDeserialLevel2(sBytest *obj) { break; case S_INT: data = &(obj->data); - i64 v = netTypeVarintToUint((u8**)&data); - v = (v >> 1) ^ ((v << 63) >> 63); + u64 v = netTypeVarintToUint((u8**)&data); + v = (v >> 1) ^ (~(v & 1) + 1); r = (smallt *) allocSInt(v); break; case S_STRING: @@ -3680,7 +3681,7 @@ internal void dictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, boo sDictPushTiny(dict, key, (smallt *) Do); break; case S_INT: { - i64 v; + u64 v; if (ctx->nibble == lowNbl) { v = netTypeVarintToUint((u8**)data); } @@ -3689,8 +3690,8 @@ internal void dictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, boo readTypeInHighNbl; v = varintToUint(data); } - v = (v >> 1) ^ ((v << 63) >> 63); - io = allocSInt(v); + v = (v >> 1) ^ (~(v & 1) + 1); + io = allocSInt(v); sDictPushTiny(dict, key, (smallt *) io); } break; @@ -3840,8 +3841,8 @@ internal void uniformDictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *c loop(dictCount) { char *key = (char*)*data; *data += strlen(key)+1; - i64 v = varintToUint(data); - v = (v >> 1) ^ ((v << 63) >> 63); + u64 v = varintToUint(data); + v = (v >> 1) ^ (~(v & 1) + 1); io = allocSInt(v); sDictPushTiny(dict, key, (smallt *) io); } @@ -4020,7 +4021,7 @@ internal void arrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, sArrayPushTiny(array, (smallt *) Do); break; case S_INT: { - i64 v; + u64 v; if (ctx->nibble == lowNbl) { v = netTypeVarintToUint((u8**)data); } @@ -4029,8 +4030,8 @@ internal void arrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, readTypeInHighNbl; v = varintToUint(data); } - v = (v >> 1) ^ ((v << 63) >> 63); - io = allocSInt(v); + v = (v >> 1) ^ (~(v & 1) + 1); + io = allocSInt(v); sArrayPushTiny(array, (smallt *) io); } break; @@ -4157,9 +4158,9 @@ internal void uniformArrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt break; case S_INT: loop(arrayCount) { - i64 v = varintToUint(data); - v = (v >> 1) ^ ((v << 63) >> 63); - io = allocSInt(v); + u64 v = varintToUint(data); + v = (v >> 1) ^ (~(v & 1) + 1); + io = allocSInt(v); sArrayPushTiny(array, (smallt *) io); } break; @@ -4257,8 +4258,8 @@ internal smallt* netDeserial(sBytest *obj) { break; case S_INT: data = &(obj->data); - i64 v = netTypeVarintToUint((u8**)&data); - v = (v >> 1) ^ ((v << 63) >> 63); + u64 v = netTypeVarintToUint((u8**)&data); + v = (v >> 1) ^ (~(v & 1) + 1); r = (smallt *) allocSInt(v); break; case S_STRING: @@ -4445,7 +4446,7 @@ internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool pack sDictPushTiny(dict, key, (smallt *) Do); break; case S_INT: { - i64 v; + u64 v; if (ctx->nibble == lowNbl) { v = netTypeVarintToUint((u8**)data); } @@ -4454,8 +4455,8 @@ internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool pack readTypeInHighNbl; v = varintToUint(data); } - v = (v >> 1) ^ ((v << 63) >> 63); - io = allocSInt(v); + v = (v >> 1) ^ (~(v & 1) + 1); + io = allocSInt(v); sDictPushTiny(dict, key, (smallt *) io); } break; @@ -4548,9 +4549,9 @@ internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool pack packedType = PK_INT; } - i64 v = varintToUint(data); - v = (v >> 1) ^ ((v << 63) >> 63); - io = allocSInt(v); + u64 v = varintToUint(data); + v = (v >> 1) ^ (~(v & 1) + 1); + io = allocSInt(v); sDictPushTiny(dict, key, (smallt *) io); // stop unpacking when packCount == 0 packCount--; @@ -4736,8 +4737,8 @@ internal void uniformDictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bo loop(dictCount) { char *key = (char*)*data; *data += strlen(key)+1; - i64 v = varintToUint(data); - v = (v >> 1) ^ ((v << 63) >> 63); + u64 v = varintToUint(data); + v = (v >> 1) ^ (~(v & 1) + 1); io = allocSInt(v); sDictPushTiny(dict, key, (smallt *) io); } @@ -4924,7 +4925,7 @@ internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool p sArrayPushTiny(array, (smallt *) Do); break; case S_INT: { - i64 v; + u64 v; if (ctx->nibble == lowNbl) { v = netTypeVarintToUint((u8**)data); } @@ -4933,8 +4934,8 @@ internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool p readTypeInHighNbl; v = varintToUint(data); } - v = (v >> 1) ^ ((v << 63) >> 63); - io = allocSInt(v); + v = (v >> 1) ^ (~(v & 1) + 1); + io = allocSInt(v); sArrayPushTiny(array, (smallt *) io); } break; @@ -5027,8 +5028,8 @@ internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool p packedType = PK_INT; } - i64 v = varintToUint(data); - v = (v >> 1) ^ ((v << 63) >> 63); + u64 v = varintToUint(data); + v = (v >> 1) ^ (~(v & 1) + 1); io = allocSInt(v); sArrayPushTiny(array, (smallt *) io); // stop unpacking when packCount == 0 @@ -5192,9 +5193,9 @@ internal void uniformArrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, break; case S_INT: loop(arrayCount) { - i64 v = varintToUint(data); - v = (v >> 1) ^ ((v << 63) >> 63); - io = allocSInt(v); + u64 v = varintToUint(data); + v = (v >> 1) ^ (~(v & 1) + 1); + io = allocSInt(v); sArrayPushTiny(array, (smallt *) io); } break; diff --git a/netSerial.c.gcov b/netSerial.c.gcov @@ -366,36 +366,36 @@ function helpNetSerial called 0 returned 0% blocks executed 0% -: 245:/** -: 246: * encode type in lower nibble, uint value in high nibble and next bytes as varuint -: 247: */ -function uintToNetTypeVarint called 107 returned 100% blocks executed 100% - 107: 248:internal void uintToNetTypeVarint(sBytest **buf, u8 type, u64 value) { - 107: 249: u64 c = value; +function uintToNetTypeVarint called 108 returned 100% blocks executed 100% + 108: 248:internal void uintToNetTypeVarint(sBytest **buf, u8 type, u64 value) { + 108: 249: u64 c = value; -: 250: /* encode b0..2 */ - 107: 251: u8 b = type + ((c & 0x7) << 4); - 107: 252: if (c & 0xFFFFFFFFFFFFFFF8) { -branch 0 taken 10% (fallthrough) -branch 1 taken 90% - 11: 253: b |= 0x80; - 11: 254: sBytesPush(buf, b); -call 0 returned 100% - 11: 255: c >>=3; + 108: 251: u8 b = type + ((c & 0x7) << 4); + 108: 252: if (c & 0xFFFFFFFFFFFFFFF8) { +branch 0 taken 11% (fallthrough) +branch 1 taken 89% + 12: 253: b |= 0x80; + 12: 254: sBytesPush(buf, b); +call 0 returned 100% + 12: 255: c >>=3; -: 256: /* encode b3..9 ...*/ - 38: 257: while(c) { -branch 0 taken 59% -branch 1 taken 41% - 16: 258: b = c & 0x7F; - 16: 259: if (c & 0xFFFFFFFFFFFFFF80) -branch 0 taken 31% (fallthrough) -branch 1 taken 69% - 5: 260: b |= 0x80; - 16: 261: sBytesPush(buf, b); -call 0 returned 100% - 16: 262: c >>=7; + 49: 257: while(c) { +branch 0 taken 68% +branch 1 taken 32% + 25: 258: b = c & 0x7F; + 25: 259: if (c & 0xFFFFFFFFFFFFFF80) +branch 0 taken 52% (fallthrough) +branch 1 taken 48% + 13: 260: b |= 0x80; + 25: 261: sBytesPush(buf, b); +call 0 returned 100% + 25: 262: c >>=7; -: 263: } -: 264: } -: 265: else 96: 266: sBytesPush(buf, b); call 0 returned 100% - 107: 267:} + 108: 267:} -: 268: -: 269:/** -: 270: * encode uint as varuint @@ -433,23 +433,23 @@ call 0 returned 100% -: 292:/** -: 293: * decode type and varuint to uint -: 294: */ -function netTypeVarintToUint called 107 returned 100% blocks executed 100% - 107: 295:internal u64 netTypeVarintToUint(u8 **buf) { - 107: 296: u64 r = 0; +function netTypeVarintToUint called 108 returned 100% blocks executed 100% + 108: 295:internal u64 netTypeVarintToUint(u8 **buf) { + 108: 296: u64 r = 0; -: 297: - 107: 298: r = (**buf >> 4) & 0x7; + 108: 298: r = (**buf >> 4) & 0x7; -: 299: - 107: 300: u8 c = 0; - 230: 301: while (**buf & 0x80) { -branch 0 taken 13% -branch 1 taken 87% (fallthrough) - 16: 302: (*buf)++; + 108: 300: u8 c = 0; + 241: 301: while (**buf & 0x80) { +branch 0 taken 19% +branch 1 taken 81% (fallthrough) + 25: 302: (*buf)++; -: 303: // note: keep 0x7FUL to use 64 bit shift operation, without UL a 32 bit shift operation is use and then casted to 64 bit - 16: 304: r |= (**buf & 0x7FUL) << (7*c+3); - 16: 305: c++; + 25: 304: r |= (**buf & 0x7FUL) << (7*c+3); + 25: 305: c++; -: 306: } - 107: 307: (*buf)++; - 107: 308: ret r; + 108: 307: (*buf)++; + 108: 308: ret r; -: 309:} -: 310: -: 311:/** @@ -465,28 +465,29 @@ function varintToUint called 180 returned 100% blocks executed 100% branch 0 taken 2% branch 1 taken 98% (fallthrough) 3: 320: (*buf)++; - 3: 321: r |= (**buf & 0x7F) << (7*c); - 3: 322: c++; - -: 323: } - 180: 324: (*buf)++; - 180: 325: ret r; - -: 326:} - -: 327: - -: 328:// ------------------------------------- - -: 329:// Serializers - -: 330: - -: 331:// level 0 - -: 332:// like smallJson with ints and length encoded as varints - -: 333: - -: 334:/** - -: 335: * serializer top function - -: 336: */ + -: 321: // note: keep 0x7FUL to use 64 bit shift operation, without UL a 32 bit shift operation is use and then casted to 64 bit + 3: 322: r |= (**buf & 0x7FUL) << (7*c); + 3: 323: c++; + -: 324: } + 180: 325: (*buf)++; + 180: 326: ret r; + -: 327:} + -: 328: + -: 329:// ------------------------------------- + -: 330:// Serializers + -: 331: + -: 332:// level 0 + -: 333:// like smallJson with ints and length encoded as varints + -: 334: + -: 335:/** + -: 336: * serializer top function + -: 337: */ function netSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 337:internal sBytest* netSerialLevel0(smallt *o) { - #####: 338: sBytest *r = NULL; - #####: 339: sBytest *B = NULL; - -: 340: - #####: 341: switch(o->type) { + #####: 338:internal sBytest* netSerialLevel0(smallt *o) { + #####: 339: sBytest *r = NULL; + #####: 340: sBytest *B = NULL; + -: 341: + #####: 342: switch(o->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -497,95 +498,95 @@ branch 6 never executed branch 7 never executed branch 8 never executed branch 9 never executed - -: 342: case UNDEFINED: - #####: 343: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 344: break; - -: 345: case BOOL: { - #####: 346: u8 c = NET_SERIAL_TYPES[(u8)o->type]; - -: 347: // set bit 4 when true - #####: 348: if (((sBoolt *)&(o->type))->value) -branch 0 never executed -branch 1 never executed - #####: 349: c |= (1<<4); - #####: 350: sBytesPush(&r, c); -call 0 never executed - -: 351: } - #####: 352: break; - -: 353: case CONTAINER: - -: 354: // undefined - #####: 355: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 356: break; - -: 357: case DICT: - #####: 358: dictNetSerialLevel0(&r, (sDictt *)&(o->type)); -call 0 never executed - #####: 359: break; - -: 360: case DOUBLE: - #####: 361: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 362: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); -call 0 never executed - #####: 363: break; - -: 364: case INT: { - -: 365: // encode int to varint - -: 366: // v is int64_t to convert to varint - #####: 367: i64 v = ((sIntt *)&(o->type))->value; - -: 368: // encode v with arithmetic shifts - #####: 369: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 370: } - #####: 371: break; - -: 372: case STRING: - #####: 373: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 374: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); -call 0 never executed - #####: 375: break; - -: 376: case ARRAY: - #####: 377: arrayNetSerialLevel0(&r, (sArrayt *)&(o->type)); -call 0 never executed - #####: 378: break; - -: 379: case BYTES: - #####: 380: B = (sBytest *)&(o->type); - #####: 381: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); -call 0 never executed - #####: 382: sBytesPushBuffer(&r, &(B->data), B->count); -call 0 never executed - #####: 383: break; - -: 384: } - #####: 385: ret r; - -: 386:} - -: 387: - -: 388:/** - -: 389: * serialize dictionary - -: 390: * - -: 391: * the serialized dict is pushed to r. - -: 392: * All elements are serialized recursively - -: 393: * - -: 394: * the data in containers is not serialized - -: 395: * - -: 396: * \param - -: 397: * r small bytes object - -: 398: * dict dictionary to serialize - -: 399: */ + -: 343: case UNDEFINED: + #####: 344: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 345: break; + -: 346: case BOOL: { + #####: 347: u8 c = NET_SERIAL_TYPES[(u8)o->type]; + -: 348: // set bit 4 when true + #####: 349: if (((sBoolt *)&(o->type))->value) +branch 0 never executed +branch 1 never executed + #####: 350: c |= (1<<4); + #####: 351: sBytesPush(&r, c); +call 0 never executed + -: 352: } + #####: 353: break; + -: 354: case CONTAINER: + -: 355: // undefined + #####: 356: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 357: break; + -: 358: case DICT: + #####: 359: dictNetSerialLevel0(&r, (sDictt *)&(o->type)); +call 0 never executed + #####: 360: break; + -: 361: case DOUBLE: + #####: 362: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 363: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); +call 0 never executed + #####: 364: break; + -: 365: case INT: { + -: 366: // encode int to varint + -: 367: // v is int64_t to convert to varint + #####: 368: i64 v = ((sIntt *)&(o->type))->value; + -: 369: // encode v with arithmetic shifts + #####: 370: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); +call 0 never executed + -: 371: } + #####: 372: break; + -: 373: case STRING: + #####: 374: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 375: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); +call 0 never executed + #####: 376: break; + -: 377: case ARRAY: + #####: 378: arrayNetSerialLevel0(&r, (sArrayt *)&(o->type)); +call 0 never executed + #####: 379: break; + -: 380: case BYTES: + #####: 381: B = (sBytest *)&(o->type); + #####: 382: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); +call 0 never executed + #####: 383: sBytesPushBuffer(&r, &(B->data), B->count); +call 0 never executed + #####: 384: break; + -: 385: } + #####: 386: ret r; + -: 387:} + -: 388: + -: 389:/** + -: 390: * serialize dictionary + -: 391: * + -: 392: * the serialized dict is pushed to r. + -: 393: * All elements are serialized recursively + -: 394: * + -: 395: * the data in containers is not serialized + -: 396: * + -: 397: * \param + -: 398: * r small bytes object + -: 399: * dict dictionary to serialize + -: 400: */ function dictNetSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 400:internal void dictNetSerialLevel0(sBytest **r, sDictt *dict) { - #####: 401: sBytest *B = NULL; - -: 402: - #####: 403: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); + #####: 401:internal void dictNetSerialLevel0(sBytest **r, sDictt *dict) { + #####: 402: sBytest *B = NULL; + -: 403: + #####: 404: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); call 0 never executed - -: 404: - #####: 405: forEachSDict(dict, e) { + -: 405: + #####: 406: forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 406: if (e->key) { + #####: 407: if (e->key) { branch 0 never executed branch 1 never executed - #####: 407: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 408: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 408: - #####: 409: switch(e->data->type) { + -: 409: + #####: 410: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -596,99 +597,99 @@ branch 6 never executed branch 7 never executed branch 8 never executed branch 9 never executed - -: 410: case UNDEFINED: - #####: 411: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); -call 0 never executed - #####: 412: break; - -: 413: case BOOL: { - #####: 414: u8 c = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 415: // set bit 4 when true - #####: 416: if (((sBoolt *)(e->data))->value) -branch 0 never executed -branch 1 never executed - #####: 417: c |= (1<<4); - #####: 418: sBytesPush(r, c); -call 0 never executed - -: 419: } - #####: 420: break; - -: 421: case CONTAINER: - -: 422: // undefined - #####: 423: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); -call 0 never executed - #####: 424: break; - -: 425: case DICT: - #####: 426: dictNetSerialLevel0(r, (sDictt *)(e->data)); -call 0 never executed - #####: 427: break; - -: 428: case DOUBLE: - #####: 429: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); -call 0 never executed - #####: 430: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 never executed - #####: 431: break; - -: 432: case INT: { - -: 433: // encode int to varint - -: 434: // v is int64_t to convert to varint - #####: 435: i64 v = ((sIntt *)(e->data))->value; - -: 436: // encode v with arithmetic shifts - #####: 437: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 438: } - #####: 439: break; - -: 440: case STRING: - #####: 441: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); -call 0 never executed - #####: 442: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 never executed - #####: 443: break; - -: 444: case ARRAY: - #####: 445: arrayNetSerialLevel0(r, (sArrayt *)(e->data)); -call 0 never executed - #####: 446: break; - -: 447: case BYTES: - #####: 448: B = (sBytest *)(e->data); - #####: 449: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); -call 0 never executed - #####: 450: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - #####: 451: break; - -: 452: } - -: 453: } - -: 454: } - #####: 455: ret; - -: 456:} - -: 457: - -: 458:/** - -: 459: * serialize array - -: 460: * - -: 461: * the serialized array is pushed to r. - -: 462: * All elements are serialized recursively - -: 463: * - -: 464: * the data in containers is not serialized - -: 465: * - -: 466: * \param - -: 467: * r small bytes object - -: 468: * array to serialize - -: 469: */ + -: 411: case UNDEFINED: + #####: 412: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); +call 0 never executed + #####: 413: break; + -: 414: case BOOL: { + #####: 415: u8 c = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 416: // set bit 4 when true + #####: 417: if (((sBoolt *)(e->data))->value) +branch 0 never executed +branch 1 never executed + #####: 418: c |= (1<<4); + #####: 419: sBytesPush(r, c); +call 0 never executed + -: 420: } + #####: 421: break; + -: 422: case CONTAINER: + -: 423: // undefined + #####: 424: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); +call 0 never executed + #####: 425: break; + -: 426: case DICT: + #####: 427: dictNetSerialLevel0(r, (sDictt *)(e->data)); +call 0 never executed + #####: 428: break; + -: 429: case DOUBLE: + #####: 430: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); +call 0 never executed + #####: 431: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); +call 0 never executed + #####: 432: break; + -: 433: case INT: { + -: 434: // encode int to varint + -: 435: // v is int64_t to convert to varint + #####: 436: i64 v = ((sIntt *)(e->data))->value; + -: 437: // encode v with arithmetic shifts + #####: 438: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); +call 0 never executed + -: 439: } + #####: 440: break; + -: 441: case STRING: + #####: 442: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); +call 0 never executed + #####: 443: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); +call 0 never executed + #####: 444: break; + -: 445: case ARRAY: + #####: 446: arrayNetSerialLevel0(r, (sArrayt *)(e->data)); +call 0 never executed + #####: 447: break; + -: 448: case BYTES: + #####: 449: B = (sBytest *)(e->data); + #####: 450: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); +call 0 never executed + #####: 451: sBytesPushBuffer(r, &(B->data), B->count); +call 0 never executed + #####: 452: break; + -: 453: } + -: 454: } + -: 455: } + #####: 456: ret; + -: 457:} + -: 458: + -: 459:/** + -: 460: * serialize array + -: 461: * + -: 462: * the serialized array is pushed to r. + -: 463: * All elements are serialized recursively + -: 464: * + -: 465: * the data in containers is not serialized + -: 466: * + -: 467: * \param + -: 468: * r small bytes object + -: 469: * array to serialize + -: 470: */ function arrayNetSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 470:internal void arrayNetSerialLevel0(sBytest **r, sArrayt *array) { - #####: 471: sBytest *B = NULL; - -: 472: - #####: 473: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); + #####: 471:internal void arrayNetSerialLevel0(sBytest **r, sArrayt *array) { + #####: 472: sBytest *B = NULL; + -: 473: + #####: 474: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); call 0 never executed - -: 474: - #####: 475: forEachSArray(array, e) { + -: 475: + #####: 476: forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 476: if (!e) { + #####: 477: if (!e) { branch 0 never executed branch 1 never executed - -: 477: // empty slots are represented as undefined elements - #####: 478: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); + -: 478: // empty slots are represented as undefined elements + #####: 479: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); call 0 never executed - -: 479: } - -: 480: else { - #####: 481: switch(e->type) { + -: 480: } + -: 481: else { + #####: 482: switch(e->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -699,107 +700,107 @@ branch 6 never executed branch 7 never executed branch 8 never executed branch 9 never executed - -: 482: case UNDEFINED: - #####: 483: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); -call 0 never executed - #####: 484: break; - -: 485: case BOOL: { - #####: 486: u8 c = NET_SERIAL_TYPES[(u8)e->type]; - -: 487: // set bit 4 when true - #####: 488: if (((sBoolt *)&(e->type))->value) -branch 0 never executed -branch 1 never executed - #####: 489: c |= (1<<4); - #####: 490: sBytesPush(r, c); -call 0 never executed - -: 491: } - #####: 492: break; - -: 493: case CONTAINER: - -: 494: // undefined - #####: 495: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); -call 0 never executed - #####: 496: break; - -: 497: case DICT: - #####: 498: dictNetSerialLevel0(r, (sDictt *)e); -call 0 never executed - #####: 499: break; - -: 500: case DOUBLE: - #####: 501: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); -call 0 never executed - #####: 502: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); -call 0 never executed - #####: 503: break; - -: 504: case INT: { - -: 505: // encode int to varint - -: 506: // v is int64_t to convert to varint - #####: 507: i64 v = ((sIntt *)&(e->type))->value; - -: 508: // encode v with arithmetic shifts - #####: 509: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 510: } - #####: 511: break; - -: 512: case STRING: - #####: 513: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); -call 0 never executed - #####: 514: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); -call 0 never executed - #####: 515: break; - -: 516: case ARRAY: - #####: 517: arrayNetSerialLevel0(r, (sArrayt *)e); -call 0 never executed - #####: 518: break; - -: 519: case BYTES: - #####: 520: B = (sBytest *)e; - #####: 521: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); -call 0 never executed - #####: 522: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - #####: 523: break; - -: 524: } - -: 525: } - -: 526: } - #####: 527: ret; - -: 528:} - -: 529: + -: 483: case UNDEFINED: + #####: 484: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); +call 0 never executed + #####: 485: break; + -: 486: case BOOL: { + #####: 487: u8 c = NET_SERIAL_TYPES[(u8)e->type]; + -: 488: // set bit 4 when true + #####: 489: if (((sBoolt *)&(e->type))->value) +branch 0 never executed +branch 1 never executed + #####: 490: c |= (1<<4); + #####: 491: sBytesPush(r, c); +call 0 never executed + -: 492: } + #####: 493: break; + -: 494: case CONTAINER: + -: 495: // undefined + #####: 496: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); +call 0 never executed + #####: 497: break; + -: 498: case DICT: + #####: 499: dictNetSerialLevel0(r, (sDictt *)e); +call 0 never executed + #####: 500: break; + -: 501: case DOUBLE: + #####: 502: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); +call 0 never executed + #####: 503: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); +call 0 never executed + #####: 504: break; + -: 505: case INT: { + -: 506: // encode int to varint + -: 507: // v is int64_t to convert to varint + #####: 508: i64 v = ((sIntt *)&(e->type))->value; + -: 509: // encode v with arithmetic shifts + #####: 510: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); +call 0 never executed + -: 511: } + #####: 512: break; + -: 513: case STRING: + #####: 514: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); +call 0 never executed + #####: 515: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); +call 0 never executed + #####: 516: break; + -: 517: case ARRAY: + #####: 518: arrayNetSerialLevel0(r, (sArrayt *)e); +call 0 never executed + #####: 519: break; + -: 520: case BYTES: + #####: 521: B = (sBytest *)e; + #####: 522: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); +call 0 never executed + #####: 523: sBytesPushBuffer(r, &(B->data), B->count); +call 0 never executed + #####: 524: break; + -: 525: } + -: 526: } + -: 527: } + #####: 528: ret; + -: 529:} + -: 530: function serialNetSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 530:internal smallBytest* serialNetSerialLevel0(smallJsont *self) { - -: 531: - #####: 532: smallt *o = getsoG(self); + #####: 531:internal smallBytest* serialNetSerialLevel0(smallJsont *self) { + -: 532: + #####: 533: smallt *o = getsoG(self); call 0 never executed - -: 533: - #####: 534: if (o == NULL) + -: 534: + #####: 535: if (o == NULL) branch 0 never executed branch 1 never executed - #####: 535: ret NULL; - -: 536: - #####: 537: sBytest *B = netSerialLevel0(o); + #####: 536: ret NULL; + -: 537: + #####: 538: sBytest *B = netSerialLevel0(o); call 0 never executed - -: 538: - #####: 539: if (!B) { + -: 539: + #####: 540: if (!B) { branch 0 never executed branch 1 never executed - #####: 540: ret NULL; - -: 541: } - -: 542: - #####: 543: createAllocateSmallBytes(r); + #####: 541: ret NULL; + -: 542: } + -: 543: + #####: 544: createAllocateSmallBytes(r); call 0 never executed - #####: 544: r->B = B; - #####: 545: ret r; - -: 546:} - -: 547: - -: 548:// level 1 - -: 549:// like level 0 with type encoded in nibbles and bools are packed - -: 550: - -: 551:/** - -: 552: * serializer top function - -: 553: */ + #####: 545: r->B = B; + #####: 546: ret r; + -: 547:} + -: 548: + -: 549:// level 1 + -: 550:// like level 0 with type encoded in nibbles and bools are packed + -: 551: + -: 552:/** + -: 553: * serializer top function + -: 554: */ function netSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 554:internal sBytest* netSerialLevel1(smallt *o) { - #####: 555: sBytest *r = NULL; - #####: 556: sBytest *B = NULL; - #####: 557: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; - -: 558: - #####: 559: switch(o->type) { + #####: 555:internal sBytest* netSerialLevel1(smallt *o) { + #####: 556: sBytest *r = NULL; + #####: 557: sBytest *B = NULL; + #####: 558: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; + -: 559: + #####: 560: switch(o->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -809,106 +810,106 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 560: case UNDEFINED: - -: 561: case CONTAINER: - #####: 562: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 563: break; - -: 564: case BOOL: { - #####: 565: u8 c = NET_SERIAL_TYPES[(u8)o->type]; - -: 566: // set bit 4 when true - #####: 567: if (((sBoolt *)&(o->type))->value) -branch 0 never executed -branch 1 never executed - #####: 568: c |= (1<<4); - #####: 569: sBytesPush(&r, c); -call 0 never executed - -: 570: } - #####: 571: break; - -: 572: case DICT: - #####: 573: dictNetSerialLevel1(&r, (sDictt *)&(o->type), &ctx); -call 0 never executed - #####: 574: break; - -: 575: case DOUBLE: - #####: 576: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 577: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); -call 0 never executed - #####: 578: break; - -: 579: case INT: { - -: 580: // encode int to varint - -: 581: // v is int64_t to convert to varint - #####: 582: i64 v = ((sIntt *)&(o->type))->value; - -: 583: // encode v with arithmetic shifts - #####: 584: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 585: } - #####: 586: break; - -: 587: case STRING: - #####: 588: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 589: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); -call 0 never executed - #####: 590: break; - -: 591: case ARRAY: - #####: 592: arrayNetSerialLevel1(&r, (sArrayt *)&(o->type), &ctx); -call 0 never executed - #####: 593: break; - -: 594: case BYTES: - #####: 595: B = (sBytest *)&(o->type); - #####: 596: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); -call 0 never executed - #####: 597: sBytesPushBuffer(&r, &(B->data), B->count); -call 0 never executed - #####: 598: break; - -: 599: } - #####: 600: ret r; - -: 601:} - -: 602: - -: 603:/** - -: 604: * serialize dictionary - -: 605: * - -: 606: * the serialized dict is pushed to r. - -: 607: * All elements are serialized recursively - -: 608: * - -: 609: * the data in containers is not serialized - -: 610: * - -: 611: * \param - -: 612: * r small bytes object - -: 613: * dict dictionary to serialize - -: 614: */ + -: 561: case UNDEFINED: + -: 562: case CONTAINER: + #####: 563: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 564: break; + -: 565: case BOOL: { + #####: 566: u8 c = NET_SERIAL_TYPES[(u8)o->type]; + -: 567: // set bit 4 when true + #####: 568: if (((sBoolt *)&(o->type))->value) +branch 0 never executed +branch 1 never executed + #####: 569: c |= (1<<4); + #####: 570: sBytesPush(&r, c); +call 0 never executed + -: 571: } + #####: 572: break; + -: 573: case DICT: + #####: 574: dictNetSerialLevel1(&r, (sDictt *)&(o->type), &ctx); +call 0 never executed + #####: 575: break; + -: 576: case DOUBLE: + #####: 577: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 578: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); +call 0 never executed + #####: 579: break; + -: 580: case INT: { + -: 581: // encode int to varint + -: 582: // v is int64_t to convert to varint + #####: 583: i64 v = ((sIntt *)&(o->type))->value; + -: 584: // encode v with arithmetic shifts + #####: 585: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); +call 0 never executed + -: 586: } + #####: 587: break; + -: 588: case STRING: + #####: 589: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 590: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); +call 0 never executed + #####: 591: break; + -: 592: case ARRAY: + #####: 593: arrayNetSerialLevel1(&r, (sArrayt *)&(o->type), &ctx); +call 0 never executed + #####: 594: break; + -: 595: case BYTES: + #####: 596: B = (sBytest *)&(o->type); + #####: 597: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); +call 0 never executed + #####: 598: sBytesPushBuffer(&r, &(B->data), B->count); +call 0 never executed + #####: 599: break; + -: 600: } + #####: 601: ret r; + -: 602:} + -: 603: + -: 604:/** + -: 605: * serialize dictionary + -: 606: * + -: 607: * the serialized dict is pushed to r. + -: 608: * All elements are serialized recursively + -: 609: * + -: 610: * the data in containers is not serialized + -: 611: * + -: 612: * \param + -: 613: * r small bytes object + -: 614: * dict dictionary to serialize + -: 615: */ function dictNetSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 615:internal void dictNetSerialLevel1(sBytest **r, sDictt *dict, contextt *ctx) { - #####: 616: sBytest *B = NULL; - #####: 617: char *data = NULL; - -: 618: - #####: 619: if (ctx->nibble == lowNbl) { + #####: 616:internal void dictNetSerialLevel1(sBytest **r, sDictt *dict, contextt *ctx) { + #####: 617: sBytest *B = NULL; + #####: 618: char *data = NULL; + -: 619: + #####: 620: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 620: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); + #####: 621: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); call 0 never executed - -: 621: } - -: 622: else { - -: 623: // high nibble - -: 624: #define storeTypeInHighNbl(o)\ - -: 625: ctx->nibble = lowNbl;\ - -: 626: data = (char *)&((*r)->data) + ctx->nblOffset;\ - -: 627: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 - #####: 628: storeTypeInHighNbl(dict); - #####: 629: uintToVarint(r, dict->count); + -: 622: } + -: 623: else { + -: 624: // high nibble + -: 625: #define storeTypeInHighNbl(o)\ + -: 626: ctx->nibble = lowNbl;\ + -: 627: data = (char *)&((*r)->data) + ctx->nblOffset;\ + -: 628: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 + #####: 629: storeTypeInHighNbl(dict); + #####: 630: uintToVarint(r, dict->count); call 0 never executed - -: 630: } - -: 631: - #####: 632: forEachSDict(dict, e) { + -: 631: } + -: 632: + #####: 633: forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 633: if (e->key) { + #####: 634: if (e->key) { branch 0 never executed branch 1 never executed - #####: 634: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 635: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 635: - #####: 636: switch(e->data->type) { + -: 636: + #####: 637: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -918,240 +919,240 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 637: case UNDEFINED: - -: 638: case CONTAINER: - #####: 639: if (ctx->nibble == lowNbl) { + -: 638: case UNDEFINED: + -: 639: case CONTAINER: + #####: 640: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 640: #define storeTypeOnly(o)\ - -: 641: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ - -: 642: ctx->nibble = highNbl;\ - -: 643: ctx->nblOffset = (*r)->count -1 - #####: 644: storeTypeOnly(e->data); + -: 641: #define storeTypeOnly(o)\ + -: 642: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ + -: 643: ctx->nibble = highNbl;\ + -: 644: ctx->nblOffset = (*r)->count -1 + #####: 645: storeTypeOnly(e->data); call 0 never executed - -: 645: } - -: 646: else { - #####: 647: storeTypeInHighNbl(e->data); - -: 648: } - #####: 649: break; - -: 650: case BOOL: - #####: 651: if (!ctx->boolOffset) { + -: 646: } + -: 647: else { + #####: 648: storeTypeInHighNbl(e->data); + -: 649: } + #####: 650: break; + -: 651: case BOOL: + #####: 652: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 652: // new packed bools - #####: 653: if (ctx->nibble == lowNbl) { + -: 653: // new packed bools + #####: 654: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 654: #define storeNew4bPackedBool(o)\ - -: 655: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ - -: 656: /* set bit 4 when true */\ - -: 657: if (((sBoolt *)(o))->value)\ - -: 658: c |= (1<<4);\ - -: 659: sBytesPush(r, c);\ - -: 660: ctx->boolShift = 5;\ - -: 661: ctx->boolOffset = (*r)->count -1 - #####: 662: storeNew4bPackedBool(e->data); + -: 655: #define storeNew4bPackedBool(o)\ + -: 656: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ + -: 657: /* set bit 4 when true */\ + -: 658: if (((sBoolt *)(o))->value)\ + -: 659: c |= (1<<4);\ + -: 660: sBytesPush(r, c);\ + -: 661: ctx->boolShift = 5;\ + -: 662: ctx->boolOffset = (*r)->count -1 + #####: 663: storeNew4bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 663: } - -: 664: else { - -: 665: // high nibble, next byte is packed bools - #####: 666: storeTypeInHighNbl(e->data); - -: 667: #define storeNew8bPackedBool(o)\ - -: 668: u8 c = 0;\ - -: 669: if (((sBoolt *)(o))->value)\ - -: 670: c = 1;\ - -: 671: sBytesPush(r, c);\ - -: 672: ctx->boolShift = 1;\ - -: 673: ctx->boolOffset = (*r)->count -1 - #####: 674: storeNew8bPackedBool(e->data); + -: 664: } + -: 665: else { + -: 666: // high nibble, next byte is packed bools + #####: 667: storeTypeInHighNbl(e->data); + -: 668: #define storeNew8bPackedBool(o)\ + -: 669: u8 c = 0;\ + -: 670: if (((sBoolt *)(o))->value)\ + -: 671: c = 1;\ + -: 672: sBytesPush(r, c);\ + -: 673: ctx->boolShift = 1;\ + -: 674: ctx->boolOffset = (*r)->count -1 + #####: 675: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 675: } - -: 676: } - -: 677: else { - -: 678: // there was a bool before this one, fill bits in nibbles - #####: 679: if (ctx->nibble == lowNbl) { + -: 676: } + -: 677: } + -: 678: else { + -: 679: // there was a bool before this one, fill bits in nibbles + #####: 680: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 680: if (ctx->boolShift == 8) { + #####: 681: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 681: // previous packed bool is full - -: 682: // this byte is the new packed bools - #####: 683: storeNew4bPackedBool(e->data); + -: 682: // previous packed bool is full + -: 683: // this byte is the new packed bools + #####: 684: storeNew4bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 684: } - -: 685: else { - #####: 686: storeTypeOnly(e->data); + -: 685: } + -: 686: else { + #####: 687: storeTypeOnly(e->data); call 0 never executed - -: 687: #define storeBool(o)\ - -: 688: data = (char *)&((*r)->data) + ctx->boolOffset;\ - -: 689: if (((sBoolt *)(o))->value)\ - -: 690: *data |= 1 << ctx->boolShift;\ - -: 691: ctx->boolShift++ - #####: 692: storeBool(e->data); + -: 688: #define storeBool(o)\ + -: 689: data = (char *)&((*r)->data) + ctx->boolOffset;\ + -: 690: if (((sBoolt *)(o))->value)\ + -: 691: *data |= 1 << ctx->boolShift;\ + -: 692: ctx->boolShift++ + #####: 693: storeBool(e->data); branch 0 never executed branch 1 never executed - -: 693: } - -: 694: } - -: 695: else { - -: 696: // high nibble - #####: 697: storeTypeInHighNbl(e->data); - #####: 698: if (ctx->boolShift == 8) { + -: 694: } + -: 695: } + -: 696: else { + -: 697: // high nibble + #####: 698: storeTypeInHighNbl(e->data); + #####: 699: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 699: // previous packed bool is full - -: 700: // next byte is the new packed bools - #####: 701: storeNew8bPackedBool(e->data); + -: 700: // previous packed bool is full + -: 701: // next byte is the new packed bools + #####: 702: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 702: } - -: 703: else { - #####: 704: storeBool(e->data); -branch 0 never executed -branch 1 never executed - -: 705: } - -: 706: } - -: 707: } - #####: 708: break; - -: 709: case DICT: - #####: 710: dictNetSerialLevel1(r, (sDictt *)(e->data), ctx); -call 0 never executed - #####: 711: break; - -: 712: case DOUBLE: - #####: 713: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 714: storeTypeOnly(e->data); -call 0 never executed - -: 715: } - -: 716: else { - -: 717: // high nibble - #####: 718: storeTypeInHighNbl(e->data); - -: 719: } - #####: 720: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 never executed - #####: 721: break; - -: 722: case INT: { - -: 723: // encode int to varint - -: 724: // v is int64_t to convert to varint - #####: 725: i64 v = ((sIntt *)(e->data))->value; - #####: 726: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - -: 727: // encode v with arithmetic shifts - #####: 728: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 729: } - -: 730: else { - -: 731: // high nibble - #####: 732: storeTypeInHighNbl(e->data); - #####: 733: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 never executed - -: 734: } - -: 735: } - #####: 736: break; - -: 737: case STRING: - #####: 738: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 739: storeTypeOnly(e->data); -call 0 never executed - -: 740: } - -: 741: else { - -: 742: // high nibble - #####: 743: storeTypeInHighNbl(e->data); - -: 744: } - #####: 745: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 never executed - #####: 746: break; - -: 747: case ARRAY: - #####: 748: arrayNetSerialLevel1(r, (sArrayt *)(e->data), ctx); -call 0 never executed - #####: 749: break; - -: 750: case BYTES: - #####: 751: B = (sBytest *)(e->data); - #####: 752: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 753: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); -call 0 never executed - -: 754: } - -: 755: else { - -: 756: // high nibble - #####: 757: storeTypeInHighNbl(e->data); - #####: 758: uintToVarint(r, B->count); -call 0 never executed - -: 759: } - #####: 760: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - #####: 761: break; - -: 762: } - -: 763: } - -: 764: } - #####: 765: ret; - -: 766:} - -: 767: - -: 768:/** - -: 769: * serialize array - -: 770: * - -: 771: * the serialized array is pushed to r. - -: 772: * All elements are serialized recursively - -: 773: * - -: 774: * the data in containers is not serialized - -: 775: * - -: 776: * \param - -: 777: * r small bytes object - -: 778: * array to serialize - -: 779: */ + -: 703: } + -: 704: else { + #####: 705: storeBool(e->data); +branch 0 never executed +branch 1 never executed + -: 706: } + -: 707: } + -: 708: } + #####: 709: break; + -: 710: case DICT: + #####: 711: dictNetSerialLevel1(r, (sDictt *)(e->data), ctx); +call 0 never executed + #####: 712: break; + -: 713: case DOUBLE: + #####: 714: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 715: storeTypeOnly(e->data); +call 0 never executed + -: 716: } + -: 717: else { + -: 718: // high nibble + #####: 719: storeTypeInHighNbl(e->data); + -: 720: } + #####: 721: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); +call 0 never executed + #####: 722: break; + -: 723: case INT: { + -: 724: // encode int to varint + -: 725: // v is int64_t to convert to varint + #####: 726: i64 v = ((sIntt *)(e->data))->value; + #####: 727: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + -: 728: // encode v with arithmetic shifts + #####: 729: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); +call 0 never executed + -: 730: } + -: 731: else { + -: 732: // high nibble + #####: 733: storeTypeInHighNbl(e->data); + #####: 734: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 never executed + -: 735: } + -: 736: } + #####: 737: break; + -: 738: case STRING: + #####: 739: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 740: storeTypeOnly(e->data); +call 0 never executed + -: 741: } + -: 742: else { + -: 743: // high nibble + #####: 744: storeTypeInHighNbl(e->data); + -: 745: } + #####: 746: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); +call 0 never executed + #####: 747: break; + -: 748: case ARRAY: + #####: 749: arrayNetSerialLevel1(r, (sArrayt *)(e->data), ctx); +call 0 never executed + #####: 750: break; + -: 751: case BYTES: + #####: 752: B = (sBytest *)(e->data); + #####: 753: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 754: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); +call 0 never executed + -: 755: } + -: 756: else { + -: 757: // high nibble + #####: 758: storeTypeInHighNbl(e->data); + #####: 759: uintToVarint(r, B->count); +call 0 never executed + -: 760: } + #####: 761: sBytesPushBuffer(r, &(B->data), B->count); +call 0 never executed + #####: 762: break; + -: 763: } + -: 764: } + -: 765: } + #####: 766: ret; + -: 767:} + -: 768: + -: 769:/** + -: 770: * serialize array + -: 771: * + -: 772: * the serialized array is pushed to r. + -: 773: * All elements are serialized recursively + -: 774: * + -: 775: * the data in containers is not serialized + -: 776: * + -: 777: * \param + -: 778: * r small bytes object + -: 779: * array to serialize + -: 780: */ function arrayNetSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 780:internal void arrayNetSerialLevel1(sBytest **r, sArrayt *array, contextt *ctx) { - #####: 781: sBytest *B = NULL; - #####: 782: char *data = NULL; - -: 783: - #####: 784: if (ctx->nibble == lowNbl) { + #####: 781:internal void arrayNetSerialLevel1(sBytest **r, sArrayt *array, contextt *ctx) { + #####: 782: sBytest *B = NULL; + #####: 783: char *data = NULL; + -: 784: + #####: 785: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 785: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); + #####: 786: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); call 0 never executed - -: 786: } - -: 787: else { - -: 788: // high nibble - #####: 789: storeTypeInHighNbl(array); - #####: 790: uintToVarint(r, array->count); + -: 787: } + -: 788: else { + -: 789: // high nibble + #####: 790: storeTypeInHighNbl(array); + #####: 791: uintToVarint(r, array->count); call 0 never executed - -: 791: } - -: 792: - #####: 793: forEachSArray(array, e) { + -: 792: } + -: 793: + #####: 794: forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 794: if (!e) { + #####: 795: if (!e) { branch 0 never executed branch 1 never executed - -: 795: // empty slots are represented as undefined elements - #####: 796: if (ctx->nibble == lowNbl) { + -: 796: // empty slots are represented as undefined elements + #####: 797: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 797: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); + #####: 798: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); call 0 never executed - #####: 798: ctx->nibble = highNbl; - #####: 799: ctx->nblOffset = (*r)->count -1; - -: 800: } - -: 801: else { - -: 802: // high nibble - #####: 803: ctx->nibble = lowNbl; - #####: 804: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 805: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; - -: 806: } - -: 807: } - -: 808: else { - #####: 809: switch(e->type) { + #####: 799: ctx->nibble = highNbl; + #####: 800: ctx->nblOffset = (*r)->count -1; + -: 801: } + -: 802: else { + -: 803: // high nibble + #####: 804: ctx->nibble = lowNbl; + #####: 805: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 806: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; + -: 807: } + -: 808: } + -: 809: else { + #####: 810: switch(e->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -1161,202 +1162,202 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 810: case UNDEFINED: - -: 811: case CONTAINER: - #####: 812: if (ctx->nibble == lowNbl) { + -: 811: case UNDEFINED: + -: 812: case CONTAINER: + #####: 813: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 813: storeTypeOnly(e); + #####: 814: storeTypeOnly(e); call 0 never executed - -: 814: } - -: 815: else { - -: 816: // high nibble - #####: 817: storeTypeInHighNbl(e); - -: 818: } - #####: 819: break; - -: 820: case BOOL: - #####: 821: if (!ctx->boolOffset) { + -: 815: } + -: 816: else { + -: 817: // high nibble + #####: 818: storeTypeInHighNbl(e); + -: 819: } + #####: 820: break; + -: 821: case BOOL: + #####: 822: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 822: // new packed bools - #####: 823: if (ctx->nibble == lowNbl) { + -: 823: // new packed bools + #####: 824: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 824: storeNew4bPackedBool(e); + #####: 825: storeNew4bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 825: } - -: 826: else { - -: 827: // high nibble, next byte is packed bools - #####: 828: storeTypeInHighNbl(e); - #####: 829: storeNew8bPackedBool(e); + -: 826: } + -: 827: else { + -: 828: // high nibble, next byte is packed bools + #####: 829: storeTypeInHighNbl(e); + #####: 830: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 830: } - -: 831: } - -: 832: else { - -: 833: // there was a bool before this one, fill bits in nibbles - #####: 834: if (ctx->nibble == lowNbl) { + -: 831: } + -: 832: } + -: 833: else { + -: 834: // there was a bool before this one, fill bits in nibbles + #####: 835: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 835: if (ctx->boolShift == 8) { + #####: 836: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 836: // previous packed bool is full - -: 837: // this byte is the new packed bools - #####: 838: storeNew4bPackedBool(e); + -: 837: // previous packed bool is full + -: 838: // this byte is the new packed bools + #####: 839: storeNew4bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 839: } - -: 840: else { - #####: 841: storeTypeOnly(e); + -: 840: } + -: 841: else { + #####: 842: storeTypeOnly(e); call 0 never executed - #####: 842: storeBool(e); + #####: 843: storeBool(e); branch 0 never executed branch 1 never executed - -: 843: } - -: 844: } - -: 845: else { - -: 846: // high nibble - #####: 847: storeTypeInHighNbl(e); - #####: 848: if (ctx->boolShift == 8) { + -: 844: } + -: 845: } + -: 846: else { + -: 847: // high nibble + #####: 848: storeTypeInHighNbl(e); + #####: 849: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 849: // previous packed bool is full - -: 850: // next byte is the new packed bools - #####: 851: storeNew8bPackedBool(e); + -: 850: // previous packed bool is full + -: 851: // next byte is the new packed bools + #####: 852: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 852: } - -: 853: else { - #####: 854: storeBool(e); + -: 853: } + -: 854: else { + #####: 855: storeBool(e); branch 0 never executed branch 1 never executed - -: 855: } - -: 856: } - -: 857: } - #####: 858: break; - -: 859: case DICT: - #####: 860: dictNetSerialLevel1(r, (sDictt *)e, ctx); + -: 856: } + -: 857: } + -: 858: } + #####: 859: break; + -: 860: case DICT: + #####: 861: dictNetSerialLevel1(r, (sDictt *)e, ctx); call 0 never executed - #####: 861: break; - -: 862: case DOUBLE: - #####: 863: if (ctx->nibble == lowNbl) { + #####: 862: break; + -: 863: case DOUBLE: + #####: 864: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 864: storeTypeOnly(e); + #####: 865: storeTypeOnly(e); call 0 never executed - -: 865: } - -: 866: else { - -: 867: // high nibble - #####: 868: storeTypeInHighNbl(e); - -: 869: } - #####: 870: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); + -: 866: } + -: 867: else { + -: 868: // high nibble + #####: 869: storeTypeInHighNbl(e); + -: 870: } + #####: 871: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); call 0 never executed - #####: 871: break; - -: 872: case INT: { - -: 873: // encode int to varint - -: 874: // v is int64_t to convert to varint - #####: 875: i64 v = ((sIntt *)&(e->type))->value; - #####: 876: if (ctx->nibble == lowNbl) { + #####: 872: break; + -: 873: case INT: { + -: 874: // encode int to varint + -: 875: // v is int64_t to convert to varint + #####: 876: i64 v = ((sIntt *)&(e->type))->value; + #####: 877: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 877: // encode v with arithmetic shifts - #####: 878: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); + -: 878: // encode v with arithmetic shifts + #####: 879: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); call 0 never executed - -: 879: } - -: 880: else { - -: 881: // high nibble - #####: 882: storeTypeInHighNbl(e); - #####: 883: uintToVarint(r, (v << 1) ^ (v >> 63)); + -: 880: } + -: 881: else { + -: 882: // high nibble + #####: 883: storeTypeInHighNbl(e); + #####: 884: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 never executed - -: 884: } - -: 885: } - #####: 886: break; - -: 887: case STRING: - #####: 888: if (ctx->nibble == lowNbl) { + -: 885: } + -: 886: } + #####: 887: break; + -: 888: case STRING: + #####: 889: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 889: storeTypeOnly(e); + #####: 890: storeTypeOnly(e); call 0 never executed - -: 890: } - -: 891: else { - -: 892: // high nibble - #####: 893: storeTypeInHighNbl(e); - -: 894: } - #####: 895: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); + -: 891: } + -: 892: else { + -: 893: // high nibble + #####: 894: storeTypeInHighNbl(e); + -: 895: } + #####: 896: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); call 0 never executed - #####: 896: break; - -: 897: case ARRAY: - #####: 898: arrayNetSerialLevel1(r, (sArrayt *)e, ctx); + #####: 897: break; + -: 898: case ARRAY: + #####: 899: arrayNetSerialLevel1(r, (sArrayt *)e, ctx); call 0 never executed - #####: 899: break; - -: 900: case BYTES: - #####: 901: B = (sBytest *)e; - #####: 902: if (ctx->nibble == lowNbl) { + #####: 900: break; + -: 901: case BYTES: + #####: 902: B = (sBytest *)e; + #####: 903: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 903: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); + #####: 904: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); call 0 never executed - -: 904: } - -: 905: else { - -: 906: // high nibble - #####: 907: storeTypeInHighNbl(e); - #####: 908: uintToVarint(r, B->count); + -: 905: } + -: 906: else { + -: 907: // high nibble + #####: 908: storeTypeInHighNbl(e); + #####: 909: uintToVarint(r, B->count); call 0 never executed - -: 909: } - #####: 910: sBytesPushBuffer(r, &(B->data), B->count); + -: 910: } + #####: 911: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - #####: 911: break; - -: 912: } - -: 913: } - -: 914: } - #####: 915: ret; - -: 916:} - -: 917: + #####: 912: break; + -: 913: } + -: 914: } + -: 915: } + #####: 916: ret; + -: 917:} + -: 918: function serialNetSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 918:internal smallBytest* serialNetSerialLevel1(smallJsont *self) { - -: 919: - #####: 920: smallt *o = getsoG(self); + #####: 919:internal smallBytest* serialNetSerialLevel1(smallJsont *self) { + -: 920: + #####: 921: smallt *o = getsoG(self); call 0 never executed - -: 921: - #####: 922: if (o == NULL) + -: 922: + #####: 923: if (o == NULL) branch 0 never executed branch 1 never executed - #####: 923: ret NULL; - -: 924: - #####: 925: sBytest *B = netSerialLevel1(o); + #####: 924: ret NULL; + -: 925: + #####: 926: sBytest *B = netSerialLevel1(o); call 0 never executed - -: 926: - #####: 927: if (!B) { + -: 927: + #####: 928: if (!B) { branch 0 never executed branch 1 never executed - #####: 928: ret NULL; - -: 929: } - -: 930: - #####: 931: createAllocateSmallBytes(r); + #####: 929: ret NULL; + -: 930: } + -: 931: + #####: 932: createAllocateSmallBytes(r); call 0 never executed - #####: 932: r->B = B; - #####: 933: ret r; - -: 934:} - -: 935: - -: 936:// level 2 - -: 937:// like level 1, arrays are set to uniform when all elements are same type - -: 938: - -: 939:/** - -: 940: * serializer top function - -: 941: */ + #####: 933: r->B = B; + #####: 934: ret r; + -: 935:} + -: 936: + -: 937:// level 2 + -: 938:// like level 1, arrays are set to uniform when all elements are same type + -: 939: + -: 940:/** + -: 941: * serializer top function + -: 942: */ function netSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 942:internal sBytest* netSerialLevel2(smallt *o) { - #####: 943: sBytest *r = NULL; - #####: 944: sBytest *B = NULL; - #####: 945: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; - -: 946: - #####: 947: switch(o->type) { + #####: 943:internal sBytest* netSerialLevel2(smallt *o) { + #####: 944: sBytest *r = NULL; + #####: 945: sBytest *B = NULL; + #####: 946: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; + -: 947: + #####: 948: switch(o->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -1366,314 +1367,314 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 948: case UNDEFINED: - -: 949: case CONTAINER: - #####: 950: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 951: break; - -: 952: case BOOL: { - #####: 953: u8 c = NET_SERIAL_TYPES[(u8)o->type]; - -: 954: // set bit 4 when true - #####: 955: if (((sBoolt *)&(o->type))->value) -branch 0 never executed -branch 1 never executed - #####: 956: c |= (1<<4); - #####: 957: sBytesPush(&r, c); -call 0 never executed - -: 958: } - #####: 959: break; - -: 960: case DICT: - #####: 961: dictNetSerialLevel2(&r, (sDictt *)&(o->type), &ctx, /*packed=*/false); -call 0 never executed - #####: 962: break; - -: 963: case DOUBLE: - #####: 964: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 965: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); -call 0 never executed - #####: 966: break; - -: 967: case INT: { - -: 968: // encode int to varint - -: 969: // v is int64_t to convert to varint - #####: 970: i64 v = ((sIntt *)&(o->type))->value; - -: 971: // encode v with arithmetic shifts - #####: 972: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 973: } - #####: 974: break; - -: 975: case STRING: - #####: 976: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 977: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); -call 0 never executed - #####: 978: break; - -: 979: case ARRAY: - #####: 980: arrayNetSerialLevel2(&r, (sArrayt *)&(o->type), &ctx, /*packed=*/false); -call 0 never executed - #####: 981: break; - -: 982: case BYTES: - #####: 983: B = (sBytest *)&(o->type); - #####: 984: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); -call 0 never executed - #####: 985: sBytesPushBuffer(&r, &(B->data), B->count); -call 0 never executed - #####: 986: break; - -: 987: } - #####: 988: ret r; - -: 989:} - -: 990: + -: 949: case UNDEFINED: + -: 950: case CONTAINER: + #####: 951: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 952: break; + -: 953: case BOOL: { + #####: 954: u8 c = NET_SERIAL_TYPES[(u8)o->type]; + -: 955: // set bit 4 when true + #####: 956: if (((sBoolt *)&(o->type))->value) +branch 0 never executed +branch 1 never executed + #####: 957: c |= (1<<4); + #####: 958: sBytesPush(&r, c); +call 0 never executed + -: 959: } + #####: 960: break; + -: 961: case DICT: + #####: 962: dictNetSerialLevel2(&r, (sDictt *)&(o->type), &ctx, /*packed=*/false); +call 0 never executed + #####: 963: break; + -: 964: case DOUBLE: + #####: 965: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 966: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); +call 0 never executed + #####: 967: break; + -: 968: case INT: { + -: 969: // encode int to varint + -: 970: // v is int64_t to convert to varint + #####: 971: i64 v = ((sIntt *)&(o->type))->value; + -: 972: // encode v with arithmetic shifts + #####: 973: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); +call 0 never executed + -: 974: } + #####: 975: break; + -: 976: case STRING: + #####: 977: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 never executed + #####: 978: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); +call 0 never executed + #####: 979: break; + -: 980: case ARRAY: + #####: 981: arrayNetSerialLevel2(&r, (sArrayt *)&(o->type), &ctx, /*packed=*/false); +call 0 never executed + #####: 982: break; + -: 983: case BYTES: + #####: 984: B = (sBytest *)&(o->type); + #####: 985: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); +call 0 never executed + #####: 986: sBytesPushBuffer(&r, &(B->data), B->count); +call 0 never executed + #####: 987: break; + -: 988: } + #####: 989: ret r; + -: 990:} + -: 991: function isDictUniform called 33 returned 100% blocks executed 69% - 33: 991:internal u8 isDictUniform(sDictt *dict) { - 33: 992: bool allElementsHaveSameType = true; - 33: 993: bool foundFirstType = false; - 33: 994: u8 type = 0; - 66: 995: forEachSDict(dict, e) { + 33: 992:internal u8 isDictUniform(sDictt *dict) { + 33: 993: bool allElementsHaveSameType = true; + 33: 994: bool foundFirstType = false; + 33: 995: u8 type = 0; + 66: 996: forEachSDict(dict, e) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 44: 996: if (e->key) { + 44: 997: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 44: 997: if (foundFirstType) { + 44: 998: if (foundFirstType) { branch 0 taken 39% (fallthrough) branch 1 taken 61% - -: 998: u8 nextType; - 17: 999: switch(e->data->type) { + -: 999: u8 nextType; + 17: 1000: switch(e->data->type) { branch 0 taken 0% branch 1 taken 0% branch 2 taken 100% - -: 1000: case DICT: - #####: 1001: nextType = isDictUniform((sDictt*)e->data); -call 0 never executed - #####: 1002: break; - -: 1003: case ARRAY: - #####: 1004: nextType = isArrayUniform((sArrayt*)e->data); -call 0 never executed - #####: 1005: break; - -: 1006: default: - 17: 1007: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1008: } - 17: 1009: if (nextType != type) { + -: 1001: case DICT: + #####: 1002: nextType = isDictUniform((sDictt*)e->data); +call 0 never executed + #####: 1003: break; + -: 1004: case ARRAY: + #####: 1005: nextType = isArrayUniform((sArrayt*)e->data); +call 0 never executed + #####: 1006: break; + -: 1007: default: + 17: 1008: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1009: } + 17: 1010: if (nextType != type) { branch 0 taken 65% (fallthrough) branch 1 taken 35% - 11: 1010: allElementsHaveSameType = false; - 11: 1011: break; - -: 1012: } - -: 1013: } - -: 1014: else { - 27: 1015: switch(e->data->type) { + 11: 1011: allElementsHaveSameType = false; + 11: 1012: break; + -: 1013: } + -: 1014: } + -: 1015: else { + 27: 1016: switch(e->data->type) { branch 0 taken 0% branch 1 taken 0% branch 2 taken 100% - -: 1016: case DICT: - #####: 1017: type = isDictUniform((sDictt*)e->data); -call 0 never executed - #####: 1018: break; - -: 1019: case ARRAY: - #####: 1020: type = isArrayUniform((sArrayt*)e->data); -call 0 never executed - #####: 1021: break; - -: 1022: default: - 27: 1023: type = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1024: } - 27: 1025: foundFirstType = true; - -: 1026: } - -: 1027: } - -: 1028: } - 33: 1029: if (allElementsHaveSameType) + -: 1017: case DICT: + #####: 1018: type = isDictUniform((sDictt*)e->data); +call 0 never executed + #####: 1019: break; + -: 1020: case ARRAY: + #####: 1021: type = isArrayUniform((sArrayt*)e->data); +call 0 never executed + #####: 1022: break; + -: 1023: default: + 27: 1024: type = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1025: } + 27: 1026: foundFirstType = true; + -: 1027: } + -: 1028: } + -: 1029: } + 33: 1030: if (allElementsHaveSameType) branch 0 taken 67% (fallthrough) branch 1 taken 33% - 22: 1030: type = UNIFORM_DICT; - -: 1031: else - 11: 1032: type = S_DICT; - 33: 1033: ret type; - -: 1034:} - -: 1035: + 22: 1031: type = UNIFORM_DICT; + -: 1032: else + 11: 1033: type = S_DICT; + 33: 1034: ret type; + -: 1035:} + -: 1036: function isArrayUniform called 28 returned 100% blocks executed 65% - 28: 1036:internal u8 isArrayUniform(sArrayt *array) { - 28: 1037: bool allElementsHaveSameType = true; - 28: 1038: bool foundFirstType = false; - 28: 1039: char type = 0; - 79: 1040: forEachSArray(array, e) { + 28: 1037:internal u8 isArrayUniform(sArrayt *array) { + 28: 1038: bool allElementsHaveSameType = true; + 28: 1039: bool foundFirstType = false; + 28: 1040: char type = 0; + 79: 1041: forEachSArray(array, e) { branch 0 taken 73% branch 1 taken 27% (fallthrough) - 58: 1041: if (!e) { + 58: 1042: if (!e) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 1042: if (foundFirstType) { + #####: 1043: if (foundFirstType) { branch 0 never executed branch 1 never executed - #####: 1043: if (type != S_UNDEFINED) { + #####: 1044: if (type != S_UNDEFINED) { branch 0 never executed branch 1 never executed - #####: 1044: allElementsHaveSameType = false; - #####: 1045: break; - -: 1046: } - -: 1047: } - -: 1048: else { - #####: 1049: type = S_UNDEFINED; - #####: 1050: foundFirstType = true; - -: 1051: } - -: 1052: } - -: 1053: else { - 58: 1054: if (foundFirstType) { + #####: 1045: allElementsHaveSameType = false; + #####: 1046: break; + -: 1047: } + -: 1048: } + -: 1049: else { + #####: 1050: type = S_UNDEFINED; + #####: 1051: foundFirstType = true; + -: 1052: } + -: 1053: } + -: 1054: else { + 58: 1055: if (foundFirstType) { branch 0 taken 57% (fallthrough) branch 1 taken 43% - -: 1055: u8 nextType; - 33: 1056: switch(e->type) { + -: 1056: u8 nextType; + 33: 1057: switch(e->type) { branch 0 taken 0% branch 1 taken 0% branch 2 taken 100% - -: 1057: case DICT: - #####: 1058: nextType = isDictUniform((sDictt*)e); -call 0 never executed - #####: 1059: break; - -: 1060: case ARRAY: - #####: 1061: nextType = isArrayUniform((sArrayt*)e); -call 0 never executed - #####: 1062: break; - -: 1063: default: - 33: 1064: nextType = NET_SERIAL_TYPES[(u8)e->type]; - -: 1065: } - 33: 1066: if (nextType != type) { + -: 1058: case DICT: + #####: 1059: nextType = isDictUniform((sDictt*)e); +call 0 never executed + #####: 1060: break; + -: 1061: case ARRAY: + #####: 1062: nextType = isArrayUniform((sArrayt*)e); +call 0 never executed + #####: 1063: break; + -: 1064: default: + 33: 1065: nextType = NET_SERIAL_TYPES[(u8)e->type]; + -: 1066: } + 33: 1067: if (nextType != type) { branch 0 taken 21% (fallthrough) branch 1 taken 79% - 7: 1067: allElementsHaveSameType = false; - 7: 1068: break; - -: 1069: } - -: 1070: } - -: 1071: else { - 25: 1072: switch(e->type) { + 7: 1068: allElementsHaveSameType = false; + 7: 1069: break; + -: 1070: } + -: 1071: } + -: 1072: else { + 25: 1073: switch(e->type) { branch 0 taken 4% branch 1 taken 0% branch 2 taken 96% - -: 1073: case DICT: - 1: 1074: type = isDictUniform((sDictt*)e); -call 0 returned 100% - 1: 1075: break; - -: 1076: case ARRAY: - #####: 1077: type = isArrayUniform((sArrayt*)e); -call 0 never executed - #####: 1078: break; - -: 1079: default: - 24: 1080: type = NET_SERIAL_TYPES[(u8)e->type]; - -: 1081: } - 25: 1082: foundFirstType = true; - -: 1083: } - -: 1084: } - -: 1085: } - 28: 1086: if (allElementsHaveSameType) + -: 1074: case DICT: + 1: 1075: type = isDictUniform((sDictt*)e); +call 0 returned 100% + 1: 1076: break; + -: 1077: case ARRAY: + #####: 1078: type = isArrayUniform((sArrayt*)e); +call 0 never executed + #####: 1079: break; + -: 1080: default: + 24: 1081: type = NET_SERIAL_TYPES[(u8)e->type]; + -: 1082: } + 25: 1083: foundFirstType = true; + -: 1084: } + -: 1085: } + -: 1086: } + 28: 1087: if (allElementsHaveSameType) branch 0 taken 75% (fallthrough) branch 1 taken 25% - 21: 1087: type = UNIFORM_ARRAY; - -: 1088: else - 7: 1089: type = S_ARRAY; - 28: 1090: ret type; - -: 1091:} - -: 1092: - -: 1093:/** - -: 1094: * serialize dictionary - -: 1095: * - -: 1096: * the serialized dict is pushed to r. - -: 1097: * All elements are serialized recursively - -: 1098: * - -: 1099: * the data in containers is not serialized - -: 1100: * - -: 1101: * \param - -: 1102: * r small bytes object - -: 1103: * dict dictionary to serialize - -: 1104: */ + 21: 1088: type = UNIFORM_ARRAY; + -: 1089: else + 7: 1090: type = S_ARRAY; + 28: 1091: ret type; + -: 1092:} + -: 1093: + -: 1094:/** + -: 1095: * serialize dictionary + -: 1096: * + -: 1097: * the serialized dict is pushed to r. + -: 1098: * All elements are serialized recursively + -: 1099: * + -: 1100: * the data in containers is not serialized + -: 1101: * + -: 1102: * \param + -: 1103: * r small bytes object + -: 1104: * dict dictionary to serialize + -: 1105: */ function dictNetSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 1105:internal void dictNetSerialLevel2(sBytest **r, sDictt *dict, contextt *ctx, bool packed) { - #####: 1106: sBytest *B = NULL; - #####: 1107: char *data = NULL; - -: 1108: - -: 1109: // check if all elements have same type - #####: 1110: bool allElementsHaveSameType = true; - #####: 1111: bool foundFirstType = false; - #####: 1112: char type = 0; - #####: 1113: {forEachSDict(dict, e) { + #####: 1106:internal void dictNetSerialLevel2(sBytest **r, sDictt *dict, contextt *ctx, bool packed) { + #####: 1107: sBytest *B = NULL; + #####: 1108: char *data = NULL; + -: 1109: + -: 1110: // check if all elements have same type + #####: 1111: bool allElementsHaveSameType = true; + #####: 1112: bool foundFirstType = false; + #####: 1113: char type = 0; + #####: 1114: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1114: if (e->key) { + #####: 1115: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1115: if (foundFirstType) { + #####: 1116: if (foundFirstType) { branch 0 never executed branch 1 never executed - -: 1116: u8 nextType; - #####: 1117: switch(e->data->type) { + -: 1117: u8 nextType; + #####: 1118: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed - -: 1118: case DICT: - #####: 1119: nextType = isDictUniform((sDictt*)e->data); + -: 1119: case DICT: + #####: 1120: nextType = isDictUniform((sDictt*)e->data); call 0 never executed - #####: 1120: break; - -: 1121: case ARRAY: - #####: 1122: nextType = isArrayUniform((sArrayt*)e->data); + #####: 1121: break; + -: 1122: case ARRAY: + #####: 1123: nextType = isArrayUniform((sArrayt*)e->data); call 0 never executed - #####: 1123: break; - -: 1124: default: - #####: 1125: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1126: } - #####: 1127: if (nextType != type) { + #####: 1124: break; + -: 1125: default: + #####: 1126: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1127: } + #####: 1128: if (nextType != type) { branch 0 never executed branch 1 never executed - #####: 1128: allElementsHaveSameType = false; - #####: 1129: break; - -: 1130: } - -: 1131: } - -: 1132: else { - #####: 1133: switch(e->data->type) { + #####: 1129: allElementsHaveSameType = false; + #####: 1130: break; + -: 1131: } + -: 1132: } + -: 1133: else { + #####: 1134: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed - -: 1134: case DICT: - #####: 1135: type = isDictUniform((sDictt*)e->data); + -: 1135: case DICT: + #####: 1136: type = isDictUniform((sDictt*)e->data); call 0 never executed - #####: 1136: break; - -: 1137: case ARRAY: - #####: 1138: type = isArrayUniform((sArrayt*)e->data); + #####: 1137: break; + -: 1138: case ARRAY: + #####: 1139: type = isArrayUniform((sArrayt*)e->data); call 0 never executed - #####: 1139: break; - -: 1140: default: - #####: 1141: type = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1142: } - #####: 1143: foundFirstType = true; - -: 1144: } - -: 1145: } - -: 1146: }} - -: 1147: - #####: 1148: if (allElementsHaveSameType) { + #####: 1140: break; + -: 1141: default: + #####: 1142: type = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1143: } + #####: 1144: foundFirstType = true; + -: 1145: } + -: 1146: } + -: 1147: }} + -: 1148: + #####: 1149: if (allElementsHaveSameType) { branch 0 never executed branch 1 never executed - -: 1149: // pack dictionary - #####: 1150: if (packed) { + -: 1150: // pack dictionary + #####: 1151: if (packed) { branch 0 never executed branch 1 never executed - #####: 1151: uintToNetTypeVarint(r, type, dict->count); + #####: 1152: uintToNetTypeVarint(r, type, dict->count); call 0 never executed - -: 1152: } - -: 1153: else { - #####: 1154: if (ctx->nibble == lowNbl) { + -: 1153: } + -: 1154: else { + #####: 1155: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1155: sBytesPush(r, (type << 4) + UNIFORM_DICT); + #####: 1156: sBytesPush(r, (type << 4) + UNIFORM_DICT); call 0 never executed - #####: 1156: uintToVarint(r, dict->count); + #####: 1157: uintToVarint(r, dict->count); call 0 never executed - -: 1157: } - -: 1158: else { - -: 1159: // high nibble - #####: 1160: ctx->nibble = lowNbl; - #####: 1161: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 1162: *data |= UNIFORM_DICT << 4; - #####: 1163: uintToNetTypeVarint(r, type, dict->count); + -: 1158: } + -: 1159: else { + -: 1160: // high nibble + #####: 1161: ctx->nibble = lowNbl; + #####: 1162: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 1163: *data |= UNIFORM_DICT << 4; + #####: 1164: uintToNetTypeVarint(r, type, dict->count); call 0 never executed - -: 1164: } - -: 1165: } - -: 1166: - #####: 1167: switch(type) { + -: 1165: } + -: 1166: } + -: 1167: + #####: 1168: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -1683,188 +1684,188 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 1168: case S_UNDEFINED: - #####: 1169: {forEachSDict(dict, e) { + -: 1169: case S_UNDEFINED: + #####: 1170: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1170: if (e->key) { + #####: 1171: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1171: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1172: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 1172: } - -: 1173: }} - -: 1174: - #####: 1175: break; - -: 1176: case S_BOOL: - #####: 1177: {forEachSDict(dict, e) { + -: 1173: } + -: 1174: }} + -: 1175: + #####: 1176: break; + -: 1177: case S_BOOL: + #####: 1178: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1178: if (e->key) { + #####: 1179: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1179: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1180: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 1180: - #####: 1181: if (!ctx->boolOffset) { + -: 1181: + #####: 1182: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 1182: // new packed bools - #####: 1183: storeNew8bPackedBool(e->data); + -: 1183: // new packed bools + #####: 1184: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1184: } - -: 1185: else { - -: 1186: // there was a bool before this one, fill bits in nibbles - #####: 1187: if (ctx->boolShift == 8) { + -: 1185: } + -: 1186: else { + -: 1187: // there was a bool before this one, fill bits in nibbles + #####: 1188: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1188: // previous packed bool is full - -: 1189: // next byte is the new packed bools - #####: 1190: storeNew8bPackedBool(e->data); + -: 1189: // previous packed bool is full + -: 1190: // next byte is the new packed bools + #####: 1191: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1191: } - -: 1192: else { - #####: 1193: storeBool(e->data); + -: 1192: } + -: 1193: else { + #####: 1194: storeBool(e->data); branch 0 never executed branch 1 never executed - -: 1194: } - -: 1195: } - -: 1196: } - -: 1197: }} - #####: 1198: break; - -: 1199: case S_DICT: - -: 1200: case UNIFORM_DICT: - #####: 1201: {forEachSDict(dict, e) { + -: 1195: } + -: 1196: } + -: 1197: } + -: 1198: }} + #####: 1199: break; + -: 1200: case S_DICT: + -: 1201: case UNIFORM_DICT: + #####: 1202: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1202: if (e->key) { + #####: 1203: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1203: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1204: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1204: dictNetSerialLevel2(r, (sDictt *)(e->data), ctx, /*packed=*/true); + #####: 1205: dictNetSerialLevel2(r, (sDictt *)(e->data), ctx, /*packed=*/true); call 0 never executed - -: 1205: } - -: 1206: }} - #####: 1207: break; - -: 1208: case S_DOUBLE: - #####: 1209: {forEachSDict(dict, e) { + -: 1206: } + -: 1207: }} + #####: 1208: break; + -: 1209: case S_DOUBLE: + #####: 1210: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1210: if (e->key) { + #####: 1211: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1211: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1212: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1212: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); + #####: 1213: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); call 0 never executed - -: 1213: } - -: 1214: }} - #####: 1215: break; - -: 1216: case S_INT: - #####: 1217: {forEachSDict(dict, e) { + -: 1214: } + -: 1215: }} + #####: 1216: break; + -: 1217: case S_INT: + #####: 1218: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1218: if (e->key) { + #####: 1219: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1219: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1220: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1220: i64 v = ((sIntt *)(e->data))->value; - #####: 1221: uintToVarint(r, (v << 1) ^ (v >> 63)); + #####: 1221: i64 v = ((sIntt *)(e->data))->value; + #####: 1222: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 never executed - -: 1222: } - -: 1223: }} - #####: 1224: break; - -: 1225: case S_STRING: - #####: 1226: {forEachSDict(dict, e) { + -: 1223: } + -: 1224: }} + #####: 1225: break; + -: 1226: case S_STRING: + #####: 1227: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1227: if (e->key) { + #####: 1228: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1228: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1229: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1229: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); + #####: 1230: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); call 0 never executed - -: 1230: } - -: 1231: }} - #####: 1232: break; - -: 1233: case S_ARRAY: - -: 1234: case UNIFORM_ARRAY: - #####: 1235: {forEachSDict(dict, e) { + -: 1231: } + -: 1232: }} + #####: 1233: break; + -: 1234: case S_ARRAY: + -: 1235: case UNIFORM_ARRAY: + #####: 1236: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1236: if (e->key) { + #####: 1237: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1237: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1238: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1238: arrayNetSerialLevel2(r, (sArrayt *)(e->data), ctx, /*packed=*/true); + #####: 1239: arrayNetSerialLevel2(r, (sArrayt *)(e->data), ctx, /*packed=*/true); call 0 never executed - -: 1239: } - -: 1240: }} - #####: 1241: break; - -: 1242: case S_BYTES: - #####: 1243: {forEachSDict(dict, e) { + -: 1240: } + -: 1241: }} + #####: 1242: break; + -: 1243: case S_BYTES: + #####: 1244: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1244: if (e->key) { + #####: 1245: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1245: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1246: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1246: B = (sBytest *)(e->data); - #####: 1247: uintToVarint(r, B->count); + #####: 1247: B = (sBytest *)(e->data); + #####: 1248: uintToVarint(r, B->count); call 0 never executed - #####: 1248: sBytesPushBuffer(r, &(B->data), B->count); + #####: 1249: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 1249: } - -: 1250: }} - #####: 1251: break; - -: 1252: } - #####: 1253: ret; - -: 1254: } - -: 1255: - #####: 1256: if (packed) { + -: 1250: } + -: 1251: }} + #####: 1252: break; + -: 1253: } + #####: 1254: ret; + -: 1255: } + -: 1256: + #####: 1257: if (packed) { branch 0 never executed branch 1 never executed - #####: 1257: uintToVarint(r, dict->count); + #####: 1258: uintToVarint(r, dict->count); call 0 never executed - -: 1258: } - -: 1259: else { - #####: 1260: if (ctx->nibble == lowNbl) { + -: 1259: } + -: 1260: else { + #####: 1261: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1261: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); + #####: 1262: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); call 0 never executed - -: 1262: } - -: 1263: else { - -: 1264: // high nibble - -: 1265:#define storeTypeInHighNbl(o)\ - -: 1266: ctx->nibble = lowNbl;\ - -: 1267: data = (char *)&((*r)->data) + ctx->nblOffset;\ - -: 1268: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 - #####: 1269: storeTypeInHighNbl(dict); - #####: 1270: uintToVarint(r, dict->count); + -: 1263: } + -: 1264: else { + -: 1265: // high nibble + -: 1266:#define storeTypeInHighNbl(o)\ + -: 1267: ctx->nibble = lowNbl;\ + -: 1268: data = (char *)&((*r)->data) + ctx->nblOffset;\ + -: 1269: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 + #####: 1270: storeTypeInHighNbl(dict); + #####: 1271: uintToVarint(r, dict->count); call 0 never executed - -: 1271: } - -: 1272: } - -: 1273: - #####: 1274: forEachSDict(dict, e) { + -: 1272: } + -: 1273: } + -: 1274: + #####: 1275: forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1275: if (e->key) { + #####: 1276: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1276: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1277: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 1277: - #####: 1278: switch(e->data->type) { + -: 1278: + #####: 1279: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -1874,307 +1875,307 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 1279: case UNDEFINED: - -: 1280: case CONTAINER: - #####: 1281: if (ctx->nibble == lowNbl) { + -: 1280: case UNDEFINED: + -: 1281: case CONTAINER: + #####: 1282: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 1282: #define storeTypeOnly(o)\ - -: 1283: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ - -: 1284: ctx->nibble = highNbl;\ - -: 1285: ctx->nblOffset = (*r)->count -1 - #####: 1286: storeTypeOnly(e->data); + -: 1283: #define storeTypeOnly(o)\ + -: 1284: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ + -: 1285: ctx->nibble = highNbl;\ + -: 1286: ctx->nblOffset = (*r)->count -1 + #####: 1287: storeTypeOnly(e->data); call 0 never executed - -: 1287: } - -: 1288: else { - #####: 1289: storeTypeInHighNbl(e->data); - -: 1290: } - #####: 1291: break; - -: 1292: case BOOL: - #####: 1293: if (!ctx->boolOffset) { + -: 1288: } + -: 1289: else { + #####: 1290: storeTypeInHighNbl(e->data); + -: 1291: } + #####: 1292: break; + -: 1293: case BOOL: + #####: 1294: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 1294: // new packed bools - #####: 1295: if (ctx->nibble == lowNbl) { + -: 1295: // new packed bools + #####: 1296: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 1296: #define storeNew4bPackedBool(o)\ - -: 1297: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ - -: 1298: /* set bit 4 when true */\ - -: 1299: if (((sBoolt *)(o))->value)\ - -: 1300: c |= (1<<4);\ - -: 1301: sBytesPush(r, c);\ - -: 1302: ctx->boolShift = 5;\ - -: 1303: ctx->boolOffset = (*r)->count -1 - #####: 1304: storeNew4bPackedBool(e->data); + -: 1297: #define storeNew4bPackedBool(o)\ + -: 1298: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ + -: 1299: /* set bit 4 when true */\ + -: 1300: if (((sBoolt *)(o))->value)\ + -: 1301: c |= (1<<4);\ + -: 1302: sBytesPush(r, c);\ + -: 1303: ctx->boolShift = 5;\ + -: 1304: ctx->boolOffset = (*r)->count -1 + #####: 1305: storeNew4bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1305: } - -: 1306: else { - -: 1307: // high nibble, next byte is packed bools - #####: 1308: storeTypeInHighNbl(e->data); - -: 1309: #define storeNew8bPackedBool(o)\ - -: 1310: u8 c = 0;\ - -: 1311: if (((sBoolt *)(o))->value)\ - -: 1312: c = 1;\ - -: 1313: sBytesPush(r, c);\ - -: 1314: ctx->boolShift = 1;\ - -: 1315: ctx->boolOffset = (*r)->count -1 - #####: 1316: storeNew8bPackedBool(e->data); + -: 1306: } + -: 1307: else { + -: 1308: // high nibble, next byte is packed bools + #####: 1309: storeTypeInHighNbl(e->data); + -: 1310: #define storeNew8bPackedBool(o)\ + -: 1311: u8 c = 0;\ + -: 1312: if (((sBoolt *)(o))->value)\ + -: 1313: c = 1;\ + -: 1314: sBytesPush(r, c);\ + -: 1315: ctx->boolShift = 1;\ + -: 1316: ctx->boolOffset = (*r)->count -1 + #####: 1317: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1317: } - -: 1318: } - -: 1319: else { - -: 1320: // there was a bool before this one, fill bits in nibbles - #####: 1321: if (ctx->nibble == lowNbl) { + -: 1318: } + -: 1319: } + -: 1320: else { + -: 1321: // there was a bool before this one, fill bits in nibbles + #####: 1322: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1322: if (ctx->boolShift == 8) { + #####: 1323: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1323: // previous packed bool is full - -: 1324: // this byte is the new packed bools - #####: 1325: storeNew4bPackedBool(e->data); + -: 1324: // previous packed bool is full + -: 1325: // this byte is the new packed bools + #####: 1326: storeNew4bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1326: } - -: 1327: else { - #####: 1328: storeTypeOnly(e->data); + -: 1327: } + -: 1328: else { + #####: 1329: storeTypeOnly(e->data); call 0 never executed - -: 1329: #define storeBool(o)\ - -: 1330: data = (char *)&((*r)->data) + ctx->boolOffset;\ - -: 1331: if (((sBoolt *)(o))->value)\ - -: 1332: *data |= 1 << ctx->boolShift;\ - -: 1333: ctx->boolShift++ - #####: 1334: storeBool(e->data); + -: 1330: #define storeBool(o)\ + -: 1331: data = (char *)&((*r)->data) + ctx->boolOffset;\ + -: 1332: if (((sBoolt *)(o))->value)\ + -: 1333: *data |= 1 << ctx->boolShift;\ + -: 1334: ctx->boolShift++ + #####: 1335: storeBool(e->data); branch 0 never executed branch 1 never executed - -: 1335: } - -: 1336: } - -: 1337: else { - -: 1338: // high nibble - #####: 1339: storeTypeInHighNbl(e->data); - #####: 1340: if (ctx->boolShift == 8) { + -: 1336: } + -: 1337: } + -: 1338: else { + -: 1339: // high nibble + #####: 1340: storeTypeInHighNbl(e->data); + #####: 1341: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1341: // previous packed bool is full - -: 1342: // next byte is the new packed bools - #####: 1343: storeNew8bPackedBool(e->data); + -: 1342: // previous packed bool is full + -: 1343: // next byte is the new packed bools + #####: 1344: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1344: } - -: 1345: else { - #####: 1346: storeBool(e->data); -branch 0 never executed -branch 1 never executed - -: 1347: } - -: 1348: } - -: 1349: } - #####: 1350: break; - -: 1351: case DICT: - #####: 1352: dictNetSerialLevel2(r, (sDictt *)(e->data), ctx, /*packed=*/false); -call 0 never executed - #####: 1353: break; - -: 1354: case DOUBLE: - #####: 1355: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 1356: storeTypeOnly(e->data); -call 0 never executed - -: 1357: } - -: 1358: else { - -: 1359: // high nibble - #####: 1360: storeTypeInHighNbl(e->data); - -: 1361: } - #####: 1362: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 never executed - #####: 1363: break; - -: 1364: case INT: { - -: 1365: // encode int to varint - -: 1366: // v is int64_t to convert to varint - #####: 1367: i64 v = ((sIntt *)(e->data))->value; - #####: 1368: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - -: 1369: // encode v with arithmetic shifts - #####: 1370: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 1371: } - -: 1372: else { - -: 1373: // high nibble - #####: 1374: storeTypeInHighNbl(e->data); - #####: 1375: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 never executed - -: 1376: } - -: 1377: } - #####: 1378: break; - -: 1379: case STRING: - #####: 1380: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 1381: storeTypeOnly(e->data); -call 0 never executed - -: 1382: } - -: 1383: else { - -: 1384: // high nibble - #####: 1385: storeTypeInHighNbl(e->data); - -: 1386: } - #####: 1387: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 never executed - #####: 1388: break; - -: 1389: case ARRAY: - #####: 1390: arrayNetSerialLevel2(r, (sArrayt *)(e->data), ctx, /*packed=*/false); -call 0 never executed - #####: 1391: break; - -: 1392: case BYTES: - #####: 1393: B = (sBytest *)(e->data); - #####: 1394: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 1395: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); -call 0 never executed - -: 1396: } - -: 1397: else { - -: 1398: // high nibble - #####: 1399: storeTypeInHighNbl(e->data); - #####: 1400: uintToVarint(r, B->count); -call 0 never executed - -: 1401: } - #####: 1402: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - #####: 1403: break; - -: 1404: } - -: 1405: } - -: 1406: } - #####: 1407: ret; - -: 1408:} - -: 1409: - -: 1410:/** - -: 1411: * serialize array - -: 1412: * - -: 1413: * the serialized array is pushed to r. - -: 1414: * All elements are serialized recursively - -: 1415: * - -: 1416: * the data in containers is not serialized - -: 1417: * - -: 1418: * \param - -: 1419: * r small bytes object - -: 1420: * array to serialize - -: 1421: */ + -: 1345: } + -: 1346: else { + #####: 1347: storeBool(e->data); +branch 0 never executed +branch 1 never executed + -: 1348: } + -: 1349: } + -: 1350: } + #####: 1351: break; + -: 1352: case DICT: + #####: 1353: dictNetSerialLevel2(r, (sDictt *)(e->data), ctx, /*packed=*/false); +call 0 never executed + #####: 1354: break; + -: 1355: case DOUBLE: + #####: 1356: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 1357: storeTypeOnly(e->data); +call 0 never executed + -: 1358: } + -: 1359: else { + -: 1360: // high nibble + #####: 1361: storeTypeInHighNbl(e->data); + -: 1362: } + #####: 1363: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); +call 0 never executed + #####: 1364: break; + -: 1365: case INT: { + -: 1366: // encode int to varint + -: 1367: // v is int64_t to convert to varint + #####: 1368: i64 v = ((sIntt *)(e->data))->value; + #####: 1369: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + -: 1370: // encode v with arithmetic shifts + #####: 1371: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); +call 0 never executed + -: 1372: } + -: 1373: else { + -: 1374: // high nibble + #####: 1375: storeTypeInHighNbl(e->data); + #####: 1376: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 never executed + -: 1377: } + -: 1378: } + #####: 1379: break; + -: 1380: case STRING: + #####: 1381: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 1382: storeTypeOnly(e->data); +call 0 never executed + -: 1383: } + -: 1384: else { + -: 1385: // high nibble + #####: 1386: storeTypeInHighNbl(e->data); + -: 1387: } + #####: 1388: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); +call 0 never executed + #####: 1389: break; + -: 1390: case ARRAY: + #####: 1391: arrayNetSerialLevel2(r, (sArrayt *)(e->data), ctx, /*packed=*/false); +call 0 never executed + #####: 1392: break; + -: 1393: case BYTES: + #####: 1394: B = (sBytest *)(e->data); + #####: 1395: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 1396: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); +call 0 never executed + -: 1397: } + -: 1398: else { + -: 1399: // high nibble + #####: 1400: storeTypeInHighNbl(e->data); + #####: 1401: uintToVarint(r, B->count); +call 0 never executed + -: 1402: } + #####: 1403: sBytesPushBuffer(r, &(B->data), B->count); +call 0 never executed + #####: 1404: break; + -: 1405: } + -: 1406: } + -: 1407: } + #####: 1408: ret; + -: 1409:} + -: 1410: + -: 1411:/** + -: 1412: * serialize array + -: 1413: * + -: 1414: * the serialized array is pushed to r. + -: 1415: * All elements are serialized recursively + -: 1416: * + -: 1417: * the data in containers is not serialized + -: 1418: * + -: 1419: * \param + -: 1420: * r small bytes object + -: 1421: * array to serialize + -: 1422: */ function arrayNetSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 1422:internal void arrayNetSerialLevel2(sBytest **r, sArrayt *array, contextt *ctx, bool packed) { - #####: 1423: sBytest *B = NULL; - #####: 1424: char *data = NULL; - -: 1425: - -: 1426: // check if all elements have same type - #####: 1427: bool allElementsHaveSameType = true; - #####: 1428: bool foundFirstType = false; - #####: 1429: char type = 0; - -: 1430: - #####: 1431: {forEachSArray(array, e) { + #####: 1423:internal void arrayNetSerialLevel2(sBytest **r, sArrayt *array, contextt *ctx, bool packed) { + #####: 1424: sBytest *B = NULL; + #####: 1425: char *data = NULL; + -: 1426: + -: 1427: // check if all elements have same type + #####: 1428: bool allElementsHaveSameType = true; + #####: 1429: bool foundFirstType = false; + #####: 1430: char type = 0; + -: 1431: + #####: 1432: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1432: if (!e) { + #####: 1433: if (!e) { branch 0 never executed branch 1 never executed - #####: 1433: if (foundFirstType) { + #####: 1434: if (foundFirstType) { branch 0 never executed branch 1 never executed - #####: 1434: if (type != S_UNDEFINED) { + #####: 1435: if (type != S_UNDEFINED) { branch 0 never executed branch 1 never executed - #####: 1435: allElementsHaveSameType = false; - #####: 1436: break; - -: 1437: } - -: 1438: } - -: 1439: else { - #####: 1440: type = S_UNDEFINED; - #####: 1441: foundFirstType = true; - -: 1442: } - -: 1443: } - -: 1444: else { - #####: 1445: if (foundFirstType) { + #####: 1436: allElementsHaveSameType = false; + #####: 1437: break; + -: 1438: } + -: 1439: } + -: 1440: else { + #####: 1441: type = S_UNDEFINED; + #####: 1442: foundFirstType = true; + -: 1443: } + -: 1444: } + -: 1445: else { + #####: 1446: if (foundFirstType) { branch 0 never executed branch 1 never executed - -: 1446: u8 nextType; - #####: 1447: switch(e->type) { + -: 1447: u8 nextType; + #####: 1448: switch(e->type) { branch 0 never executed branch 1 never executed branch 2 never executed - -: 1448: case DICT: - #####: 1449: nextType = isDictUniform((sDictt*)e); + -: 1449: case DICT: + #####: 1450: nextType = isDictUniform((sDictt*)e); call 0 never executed - #####: 1450: break; - -: 1451: case ARRAY: - #####: 1452: nextType = isArrayUniform((sArrayt*)e); + #####: 1451: break; + -: 1452: case ARRAY: + #####: 1453: nextType = isArrayUniform((sArrayt*)e); call 0 never executed - #####: 1453: break; - -: 1454: default: - #####: 1455: nextType = NET_SERIAL_TYPES[(u8)e->type]; - -: 1456: } - #####: 1457: if (nextType != type) { + #####: 1454: break; + -: 1455: default: + #####: 1456: nextType = NET_SERIAL_TYPES[(u8)e->type]; + -: 1457: } + #####: 1458: if (nextType != type) { branch 0 never executed branch 1 never executed - #####: 1458: allElementsHaveSameType = false; - #####: 1459: break; - -: 1460: } - -: 1461: } - -: 1462: else { - #####: 1463: switch(e->type) { + #####: 1459: allElementsHaveSameType = false; + #####: 1460: break; + -: 1461: } + -: 1462: } + -: 1463: else { + #####: 1464: switch(e->type) { branch 0 never executed branch 1 never executed branch 2 never executed - -: 1464: case DICT: - #####: 1465: type = isDictUniform((sDictt*)e); + -: 1465: case DICT: + #####: 1466: type = isDictUniform((sDictt*)e); call 0 never executed - #####: 1466: break; - -: 1467: case ARRAY: - #####: 1468: type = isArrayUniform((sArrayt*)e); + #####: 1467: break; + -: 1468: case ARRAY: + #####: 1469: type = isArrayUniform((sArrayt*)e); call 0 never executed - #####: 1469: break; - -: 1470: default: - #####: 1471: type = NET_SERIAL_TYPES[(u8)e->type]; - -: 1472: } - #####: 1473: foundFirstType = true; - -: 1474: } - -: 1475: } - -: 1476: }} - -: 1477: - #####: 1478: if (allElementsHaveSameType) { + #####: 1470: break; + -: 1471: default: + #####: 1472: type = NET_SERIAL_TYPES[(u8)e->type]; + -: 1473: } + #####: 1474: foundFirstType = true; + -: 1475: } + -: 1476: } + -: 1477: }} + -: 1478: + #####: 1479: if (allElementsHaveSameType) { branch 0 never executed branch 1 never executed - -: 1479: // pack array - #####: 1480: if (packed) { + -: 1480: // pack array + #####: 1481: if (packed) { branch 0 never executed branch 1 never executed - #####: 1481: uintToNetTypeVarint(r, type, array->count); + #####: 1482: uintToNetTypeVarint(r, type, array->count); call 0 never executed - -: 1482: } - -: 1483: else { - #####: 1484: if (ctx->nibble == lowNbl) { + -: 1483: } + -: 1484: else { + #####: 1485: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1485: sBytesPush(r, (type << 4) + UNIFORM_ARRAY); + #####: 1486: sBytesPush(r, (type << 4) + UNIFORM_ARRAY); call 0 never executed - #####: 1486: uintToVarint(r, array->count); + #####: 1487: uintToVarint(r, array->count); call 0 never executed - -: 1487: } - -: 1488: else { - -: 1489: // high nibble - #####: 1490: ctx->nibble = lowNbl; - #####: 1491: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 1492: *data |= UNIFORM_ARRAY << 4; - #####: 1493: uintToNetTypeVarint(r, type, array->count); + -: 1488: } + -: 1489: else { + -: 1490: // high nibble + #####: 1491: ctx->nibble = lowNbl; + #####: 1492: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 1493: *data |= UNIFORM_ARRAY << 4; + #####: 1494: uintToNetTypeVarint(r, type, array->count); call 0 never executed - -: 1494: } - -: 1495: } - -: 1496: - #####: 1497: switch(type) { + -: 1495: } + -: 1496: } + -: 1497: + #####: 1498: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -2183,142 +2184,142 @@ branch 4 never executed branch 5 never executed branch 6 never executed branch 7 never executed - -: 1498: case S_BOOL: - #####: 1499: {forEachSArray(array, e) { + -: 1499: case S_BOOL: + #####: 1500: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1500: if (!ctx->boolOffset) { + #####: 1501: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 1501: // new packed bools - #####: 1502: storeNew8bPackedBool(e); + -: 1502: // new packed bools + #####: 1503: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1503: } - -: 1504: else { - -: 1505: // there was a bool before this one, fill bits in nibbles - #####: 1506: if (ctx->boolShift == 8) { + -: 1504: } + -: 1505: else { + -: 1506: // there was a bool before this one, fill bits in nibbles + #####: 1507: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1507: // previous packed bool is full - -: 1508: // next byte is the new packed bools - #####: 1509: storeNew8bPackedBool(e); + -: 1508: // previous packed bool is full + -: 1509: // next byte is the new packed bools + #####: 1510: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1510: } - -: 1511: else { - #####: 1512: storeBool(e); + -: 1511: } + -: 1512: else { + #####: 1513: storeBool(e); branch 0 never executed branch 1 never executed - -: 1513: } - -: 1514: } - -: 1515: }} - #####: 1516: break; - -: 1517: case S_DICT: - -: 1518: case UNIFORM_DICT: - #####: 1519: {forEachSArray(array, e) { + -: 1514: } + -: 1515: } + -: 1516: }} + #####: 1517: break; + -: 1518: case S_DICT: + -: 1519: case UNIFORM_DICT: + #####: 1520: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1520: dictNetSerialLevel2(r, (sDictt *)e, ctx, /*packed=*/true); + #####: 1521: dictNetSerialLevel2(r, (sDictt *)e, ctx, /*packed=*/true); call 0 never executed - -: 1521: }} - #####: 1522: break; - -: 1523: case S_DOUBLE: - #####: 1524: {forEachSArray(array, e) { + -: 1522: }} + #####: 1523: break; + -: 1524: case S_DOUBLE: + #####: 1525: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1525: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); + #####: 1526: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); call 0 never executed - -: 1526: }} - #####: 1527: break; - -: 1528: case S_INT: - #####: 1529: {forEachSArray(array, e) { + -: 1527: }} + #####: 1528: break; + -: 1529: case S_INT: + #####: 1530: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1530: i64 v = ((sIntt *)e)->value; - #####: 1531: uintToVarint(r, (v << 1) ^ (v >> 63)); + #####: 1531: i64 v = ((sIntt *)e)->value; + #####: 1532: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 never executed - -: 1532: }} - #####: 1533: break; - -: 1534: case S_STRING: - #####: 1535: {forEachSArray(array, e) { + -: 1533: }} + #####: 1534: break; + -: 1535: case S_STRING: + #####: 1536: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1536: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); + #####: 1537: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); call 0 never executed - -: 1537: }} - #####: 1538: break; - -: 1539: case S_ARRAY: - -: 1540: case UNIFORM_ARRAY: - #####: 1541: {forEachSArray(array, e) { + -: 1538: }} + #####: 1539: break; + -: 1540: case S_ARRAY: + -: 1541: case UNIFORM_ARRAY: + #####: 1542: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1542: arrayNetSerialLevel2(r, (sArrayt *)e, ctx, /*packed=*/true); + #####: 1543: arrayNetSerialLevel2(r, (sArrayt *)e, ctx, /*packed=*/true); call 0 never executed - -: 1543: }} - #####: 1544: break; - -: 1545: case S_BYTES: - #####: 1546: {forEachSArray(array, e) { + -: 1544: }} + #####: 1545: break; + -: 1546: case S_BYTES: + #####: 1547: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1547: B = (sBytest *)e; - #####: 1548: uintToVarint(r, B->count); + #####: 1548: B = (sBytest *)e; + #####: 1549: uintToVarint(r, B->count); call 0 never executed - #####: 1549: sBytesPushBuffer(r, &(B->data), B->count); + #####: 1550: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 1550: }} - #####: 1551: break; - -: 1552: } - #####: 1553: ret; - -: 1554: } - -: 1555: - #####: 1556: if (packed) { + -: 1551: }} + #####: 1552: break; + -: 1553: } + #####: 1554: ret; + -: 1555: } + -: 1556: + #####: 1557: if (packed) { branch 0 never executed branch 1 never executed - #####: 1557: uintToVarint(r, array->count); + #####: 1558: uintToVarint(r, array->count); call 0 never executed - -: 1558: } - -: 1559: else { - #####: 1560: if (ctx->nibble == lowNbl) { + -: 1559: } + -: 1560: else { + #####: 1561: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1561: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); + #####: 1562: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); call 0 never executed - -: 1562: } - -: 1563: else { - -: 1564: // high nibble - #####: 1565: storeTypeInHighNbl(array); - #####: 1566: uintToVarint(r, array->count); + -: 1563: } + -: 1564: else { + -: 1565: // high nibble + #####: 1566: storeTypeInHighNbl(array); + #####: 1567: uintToVarint(r, array->count); call 0 never executed - -: 1567: } - -: 1568: } - -: 1569: - #####: 1570: forEachSArray(array, e) { + -: 1568: } + -: 1569: } + -: 1570: + #####: 1571: forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1571: if (!e) { + #####: 1572: if (!e) { branch 0 never executed branch 1 never executed - -: 1572: // empty slots are represented as undefined elements - #####: 1573: if (ctx->nibble == lowNbl) { + -: 1573: // empty slots are represented as undefined elements + #####: 1574: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1574: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); + #####: 1575: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); call 0 never executed - #####: 1575: ctx->nibble = highNbl; - #####: 1576: ctx->nblOffset = (*r)->count -1; - -: 1577: } - -: 1578: else { - -: 1579: // high nibble - #####: 1580: ctx->nibble = lowNbl; - #####: 1581: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 1582: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; - -: 1583: } - -: 1584: } - -: 1585: else { - #####: 1586: switch(e->type) { + #####: 1576: ctx->nibble = highNbl; + #####: 1577: ctx->nblOffset = (*r)->count -1; + -: 1578: } + -: 1579: else { + -: 1580: // high nibble + #####: 1581: ctx->nibble = lowNbl; + #####: 1582: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 1583: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; + -: 1584: } + -: 1585: } + -: 1586: else { + #####: 1587: switch(e->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -2328,387 +2329,387 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 1587: case UNDEFINED: - -: 1588: case CONTAINER: - #####: 1589: if (ctx->nibble == lowNbl) { + -: 1588: case UNDEFINED: + -: 1589: case CONTAINER: + #####: 1590: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1590: storeTypeOnly(e); + #####: 1591: storeTypeOnly(e); call 0 never executed - -: 1591: } - -: 1592: else { - -: 1593: // high nibble - #####: 1594: storeTypeInHighNbl(e); - -: 1595: } - #####: 1596: break; - -: 1597: case BOOL: - #####: 1598: if (!ctx->boolOffset) { + -: 1592: } + -: 1593: else { + -: 1594: // high nibble + #####: 1595: storeTypeInHighNbl(e); + -: 1596: } + #####: 1597: break; + -: 1598: case BOOL: + #####: 1599: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 1599: // new packed bools - #####: 1600: if (ctx->nibble == lowNbl) { + -: 1600: // new packed bools + #####: 1601: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1601: storeNew4bPackedBool(e); + #####: 1602: storeNew4bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1602: } - -: 1603: else { - -: 1604: // high nibble, next byte is packed bools - #####: 1605: storeTypeInHighNbl(e); - #####: 1606: storeNew8bPackedBool(e); + -: 1603: } + -: 1604: else { + -: 1605: // high nibble, next byte is packed bools + #####: 1606: storeTypeInHighNbl(e); + #####: 1607: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1607: } - -: 1608: } - -: 1609: else { - -: 1610: // there was a bool before this one, fill bits in nibbles - #####: 1611: if (ctx->nibble == lowNbl) { + -: 1608: } + -: 1609: } + -: 1610: else { + -: 1611: // there was a bool before this one, fill bits in nibbles + #####: 1612: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1612: if (ctx->boolShift == 8) { + #####: 1613: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1613: // previous packed bool is full - -: 1614: // this byte is the new packed bools - #####: 1615: storeNew4bPackedBool(e); + -: 1614: // previous packed bool is full + -: 1615: // this byte is the new packed bools + #####: 1616: storeNew4bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1616: } - -: 1617: else { - #####: 1618: storeTypeOnly(e); + -: 1617: } + -: 1618: else { + #####: 1619: storeTypeOnly(e); call 0 never executed - #####: 1619: storeBool(e); + #####: 1620: storeBool(e); branch 0 never executed branch 1 never executed - -: 1620: } - -: 1621: } - -: 1622: else { - -: 1623: // high nibble - #####: 1624: storeTypeInHighNbl(e); - #####: 1625: if (ctx->boolShift == 8) { + -: 1621: } + -: 1622: } + -: 1623: else { + -: 1624: // high nibble + #####: 1625: storeTypeInHighNbl(e); + #####: 1626: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1626: // previous packed bool is full - -: 1627: // next byte is the new packed bools - #####: 1628: storeNew8bPackedBool(e); + -: 1627: // previous packed bool is full + -: 1628: // next byte is the new packed bools + #####: 1629: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1629: } - -: 1630: else { - #####: 1631: storeBool(e); + -: 1630: } + -: 1631: else { + #####: 1632: storeBool(e); branch 0 never executed branch 1 never executed - -: 1632: } - -: 1633: } - -: 1634: } - #####: 1635: break; - -: 1636: case DICT: - #####: 1637: dictNetSerialLevel2(r, (sDictt *)e, ctx, /*packed=*/false); + -: 1633: } + -: 1634: } + -: 1635: } + #####: 1636: break; + -: 1637: case DICT: + #####: 1638: dictNetSerialLevel2(r, (sDictt *)e, ctx, /*packed=*/false); call 0 never executed - #####: 1638: break; - -: 1639: case DOUBLE: - #####: 1640: if (ctx->nibble == lowNbl) { + #####: 1639: break; + -: 1640: case DOUBLE: + #####: 1641: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1641: storeTypeOnly(e); + #####: 1642: storeTypeOnly(e); call 0 never executed - -: 1642: } - -: 1643: else { - -: 1644: // high nibble - #####: 1645: storeTypeInHighNbl(e); - -: 1646: } - #####: 1647: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); + -: 1643: } + -: 1644: else { + -: 1645: // high nibble + #####: 1646: storeTypeInHighNbl(e); + -: 1647: } + #####: 1648: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); call 0 never executed - #####: 1648: break; - -: 1649: case INT: { - -: 1650: // encode int to varint - -: 1651: // v is int64_t to convert to varint - #####: 1652: i64 v = ((sIntt *)&(e->type))->value; - #####: 1653: if (ctx->nibble == lowNbl) { + #####: 1649: break; + -: 1650: case INT: { + -: 1651: // encode int to varint + -: 1652: // v is int64_t to convert to varint + #####: 1653: i64 v = ((sIntt *)&(e->type))->value; + #####: 1654: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 1654: // encode v with arithmetic shifts - #####: 1655: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); + -: 1655: // encode v with arithmetic shifts + #####: 1656: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); call 0 never executed - -: 1656: } - -: 1657: else { - -: 1658: // high nibble - #####: 1659: storeTypeInHighNbl(e); - #####: 1660: uintToVarint(r, (v << 1) ^ (v >> 63)); + -: 1657: } + -: 1658: else { + -: 1659: // high nibble + #####: 1660: storeTypeInHighNbl(e); + #####: 1661: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 never executed - -: 1661: } - -: 1662: } - #####: 1663: break; - -: 1664: case STRING: - #####: 1665: if (ctx->nibble == lowNbl) { + -: 1662: } + -: 1663: } + #####: 1664: break; + -: 1665: case STRING: + #####: 1666: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1666: storeTypeOnly(e); + #####: 1667: storeTypeOnly(e); call 0 never executed - -: 1667: } - -: 1668: else { - -: 1669: // high nibble - #####: 1670: storeTypeInHighNbl(e); - -: 1671: } - #####: 1672: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); + -: 1668: } + -: 1669: else { + -: 1670: // high nibble + #####: 1671: storeTypeInHighNbl(e); + -: 1672: } + #####: 1673: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); call 0 never executed - #####: 1673: break; - -: 1674: case ARRAY: - #####: 1675: arrayNetSerialLevel2(r, (sArrayt *)e, ctx, /*packed=*/false); + #####: 1674: break; + -: 1675: case ARRAY: + #####: 1676: arrayNetSerialLevel2(r, (sArrayt *)e, ctx, /*packed=*/false); call 0 never executed - #####: 1676: break; - -: 1677: case BYTES: - #####: 1678: B = (sBytest *)e; - #####: 1679: if (ctx->nibble == lowNbl) { + #####: 1677: break; + -: 1678: case BYTES: + #####: 1679: B = (sBytest *)e; + #####: 1680: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1680: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); + #####: 1681: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); call 0 never executed - -: 1681: } - -: 1682: else { - -: 1683: // high nibble - #####: 1684: storeTypeInHighNbl(e); - #####: 1685: uintToVarint(r, B->count); + -: 1682: } + -: 1683: else { + -: 1684: // high nibble + #####: 1685: storeTypeInHighNbl(e); + #####: 1686: uintToVarint(r, B->count); call 0 never executed - -: 1686: } - #####: 1687: sBytesPushBuffer(r, &(B->data), B->count); + -: 1687: } + #####: 1688: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - #####: 1688: break; - -: 1689: } - -: 1690: } - -: 1691: } - #####: 1692: ret; - -: 1693:} - -: 1694: + #####: 1689: break; + -: 1690: } + -: 1691: } + -: 1692: } + #####: 1693: ret; + -: 1694:} + -: 1695: function serialNetSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 1695:internal smallBytest* serialNetSerialLevel2(smallJsont *self) { - -: 1696: - #####: 1697: smallt *o = getsoG(self); -call 0 never executed - -: 1698: - #####: 1699: if (o == NULL) -branch 0 never executed -branch 1 never executed - #####: 1700: ret NULL; - -: 1701: - #####: 1702: sBytest *B = netSerialLevel2(o); -call 0 never executed - -: 1703: - #####: 1704: if (!B) { -branch 0 never executed -branch 1 never executed - #####: 1705: ret NULL; - -: 1706: } - -: 1707: - #####: 1708: createAllocateSmallBytes(r); -call 0 never executed - #####: 1709: r->B = B; - #####: 1710: ret r; - -: 1711:} - -: 1712: - -: 1713:// level 3 - -: 1714:// like level 2, elements of identical type in a row are packed - -: 1715: - -: 1716:/** - -: 1717: * serializer top function - -: 1718: */ -function netSerial called 78 returned 100% blocks executed 88% - 78: 1719:internal sBytest* netSerial(smallt *o) { - 78: 1720: sBytest *r = NULL; - 78: 1721: sBytest *B = NULL; - 78: 1722: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; - -: 1723: - 78: 1724: switch(o->type) { + #####: 1696:internal smallBytest* serialNetSerialLevel2(smallJsont *self) { + -: 1697: + #####: 1698: smallt *o = getsoG(self); +call 0 never executed + -: 1699: + #####: 1700: if (o == NULL) +branch 0 never executed +branch 1 never executed + #####: 1701: ret NULL; + -: 1702: + #####: 1703: sBytest *B = netSerialLevel2(o); +call 0 never executed + -: 1704: + #####: 1705: if (!B) { +branch 0 never executed +branch 1 never executed + #####: 1706: ret NULL; + -: 1707: } + -: 1708: + #####: 1709: createAllocateSmallBytes(r); +call 0 never executed + #####: 1710: r->B = B; + #####: 1711: ret r; + -: 1712:} + -: 1713: + -: 1714:// level 3 + -: 1715:// like level 2, elements of identical type in a row are packed + -: 1716: + -: 1717:/** + -: 1718: * serializer top function + -: 1719: */ +function netSerial called 79 returned 100% blocks executed 88% + 79: 1720:internal sBytest* netSerial(smallt *o) { + 79: 1721: sBytest *r = NULL; + 79: 1722: sBytest *B = NULL; + 79: 1723: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; + -: 1724: + 79: 1725: switch(o->type) { branch 0 taken 1% branch 1 taken 1% branch 2 taken 46% branch 3 taken 1% -branch 4 taken 3% +branch 4 taken 4% branch 5 taken 1% branch 6 taken 46% branch 7 taken 0% branch 8 taken 0% - -: 1725: case UNDEFINED: - -: 1726: case CONTAINER: - 1: 1727: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 returned 100% - 1: 1728: break; - -: 1729: case BOOL: { - 1: 1730: u8 c = NET_SERIAL_TYPES[(u8)o->type]; - -: 1731: // set bit 4 when true - 1: 1732: if (((sBoolt *)&(o->type))->value) + -: 1726: case UNDEFINED: + -: 1727: case CONTAINER: + 1: 1728: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 returned 100% + 1: 1729: break; + -: 1730: case BOOL: { + 1: 1731: u8 c = NET_SERIAL_TYPES[(u8)o->type]; + -: 1732: // set bit 4 when true + 1: 1733: if (((sBoolt *)&(o->type))->value) branch 0 taken 100% (fallthrough) branch 1 taken 0% - 1: 1733: c |= (1<<4); - 1: 1734: sBytesPush(&r, c); -call 0 returned 100% - -: 1735: } - 1: 1736: break; - -: 1737: case DICT: - 36: 1738: dictNetSerial(&r, (sDictt *)&(o->type), &ctx, /*packing=*/NOPACKING); -call 0 returned 100% - 36: 1739: break; - -: 1740: case DOUBLE: - 1: 1741: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 returned 100% - 1: 1742: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); -call 0 returned 100% - 1: 1743: break; - -: 1744: case INT: { - -: 1745: // encode int to varint - -: 1746: // v is int64_t to convert to varint - 2: 1747: i64 v = ((sIntt *)&(o->type))->value; - -: 1748: // encode v with arithmetic shifts - 2: 1749: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 1750: } - 2: 1751: break; - -: 1752: case STRING: - 1: 1753: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 returned 100% - 1: 1754: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); -call 0 returned 100% - 1: 1755: break; - -: 1756: case ARRAY: - 36: 1757: arrayNetSerial(&r, (sArrayt *)&(o->type), &ctx, /*packing=*/NOPACKING); -call 0 returned 100% - 36: 1758: break; - -: 1759: case BYTES: - #####: 1760: B = (sBytest *)&(o->type); - #####: 1761: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); -call 0 never executed - #####: 1762: sBytesPushBuffer(&r, &(B->data), B->count); -call 0 never executed - #####: 1763: break; - -: 1764: } - 78: 1765: ret r; - -: 1766:} - -: 1767: - -: 1768:/** - -: 1769: * serialize dictionary - -: 1770: * - -: 1771: * the serialized dict is pushed to r. - -: 1772: * All elements are serialized recursively - -: 1773: * - -: 1774: * the data in containers is not serialized - -: 1775: * - -: 1776: * \param - -: 1777: * r small bytes object - -: 1778: * dict dictionary to serialize - -: 1779: */ + 1: 1734: c |= (1<<4); + 1: 1735: sBytesPush(&r, c); +call 0 returned 100% + -: 1736: } + 1: 1737: break; + -: 1738: case DICT: + 36: 1739: dictNetSerial(&r, (sDictt *)&(o->type), &ctx, /*packing=*/NOPACKING); +call 0 returned 100% + 36: 1740: break; + -: 1741: case DOUBLE: + 1: 1742: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 returned 100% + 1: 1743: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); +call 0 returned 100% + 1: 1744: break; + -: 1745: case INT: { + -: 1746: // encode int to varint + -: 1747: // v is int64_t to convert to varint + 3: 1748: i64 v = ((sIntt *)&(o->type))->value; + -: 1749: // encode v with arithmetic shifts + 3: 1750: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 1751: } + 3: 1752: break; + -: 1753: case STRING: + 1: 1754: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); +call 0 returned 100% + 1: 1755: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); +call 0 returned 100% + 1: 1756: break; + -: 1757: case ARRAY: + 36: 1758: arrayNetSerial(&r, (sArrayt *)&(o->type), &ctx, /*packing=*/NOPACKING); +call 0 returned 100% + 36: 1759: break; + -: 1760: case BYTES: + #####: 1761: B = (sBytest *)&(o->type); + #####: 1762: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); +call 0 never executed + #####: 1763: sBytesPushBuffer(&r, &(B->data), B->count); +call 0 never executed + #####: 1764: break; + -: 1765: } + 79: 1766: ret r; + -: 1767:} + -: 1768: + -: 1769:/** + -: 1770: * serialize dictionary + -: 1771: * + -: 1772: * the serialized dict is pushed to r. + -: 1773: * All elements are serialized recursively + -: 1774: * + -: 1775: * the data in containers is not serialized + -: 1776: * + -: 1777: * \param + -: 1778: * r small bytes object + -: 1779: * dict dictionary to serialize + -: 1780: */ function dictNetSerial called 79 returned 100% blocks executed 91% - 79: 1780:internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT packing) { - 79: 1781: sBytest *B = NULL; - 79: 1782: char *data = NULL; - -: 1783: - -: 1784: // check if all elements have same type - -: 1785: // then set dict type normal or uniform - -: 1786: // array and dict have to be checked recursively to know if they are normal or uniform - 79: 1787: bool allElementsHaveSameType = true; - 79: 1788: bool foundFirstType = false; - 79: 1789: char type = 0; - -: 1790: // get first element type - -: 1791: // compare to other element type - 200: 1792: {forEachSDict(dict, e) { + 79: 1781:internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT packing) { + 79: 1782: sBytest *B = NULL; + 79: 1783: char *data = NULL; + -: 1784: + -: 1785: // check if all elements have same type + -: 1786: // then set dict type normal or uniform + -: 1787: // array and dict have to be checked recursively to know if they are normal or uniform + 79: 1788: bool allElementsHaveSameType = true; + 79: 1789: bool foundFirstType = false; + 79: 1790: char type = 0; + -: 1791: // get first element type + -: 1792: // compare to other element type + 200: 1793: {forEachSDict(dict, e) { branch 0 taken 79% branch 1 taken 22% (fallthrough) - 157: 1793: if (e->key) { + 157: 1794: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 157: 1794: if (foundFirstType) { + 157: 1795: if (foundFirstType) { branch 0 taken 57% (fallthrough) branch 1 taken 43% - -: 1795: u8 nextType; - 89: 1796: switch(e->data->type) { + -: 1796: u8 nextType; + 89: 1797: switch(e->data->type) { branch 0 taken 17% branch 1 taken 9% branch 2 taken 74% - -: 1797: case DICT: - 15: 1798: nextType = isDictUniform((sDictt*)e->data); -call 0 returned 100% - 15: 1799: break; - -: 1800: case ARRAY: - 8: 1801: nextType = isArrayUniform((sArrayt*)e->data); -call 0 returned 100% - 8: 1802: break; - -: 1803: default: - 66: 1804: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1805: } - 89: 1806: if (nextType != type) { + -: 1798: case DICT: + 15: 1799: nextType = isDictUniform((sDictt*)e->data); +call 0 returned 100% + 15: 1800: break; + -: 1801: case ARRAY: + 8: 1802: nextType = isArrayUniform((sArrayt*)e->data); +call 0 returned 100% + 8: 1803: break; + -: 1804: default: + 66: 1805: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1806: } + 89: 1807: if (nextType != type) { branch 0 taken 40% (fallthrough) branch 1 taken 60% - 36: 1807: allElementsHaveSameType = false; - 36: 1808: break; - -: 1809: } - -: 1810: } - -: 1811: else { - 68: 1812: switch(e->data->type) { + 36: 1808: allElementsHaveSameType = false; + 36: 1809: break; + -: 1810: } + -: 1811: } + -: 1812: else { + 68: 1813: switch(e->data->type) { branch 0 taken 7% branch 1 taken 4% branch 2 taken 88% - -: 1813: case DICT: - 5: 1814: type = isDictUniform((sDictt*)e->data); -call 0 returned 100% - 5: 1815: break; - -: 1816: case ARRAY: - 3: 1817: type = isArrayUniform((sArrayt*)e->data); -call 0 returned 100% - 3: 1818: break; - -: 1819: default: - 60: 1820: type = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1821: } - 68: 1822: foundFirstType = true; - -: 1823: } - -: 1824: } - -: 1825: }} - -: 1826: - 79: 1827: if (allElementsHaveSameType) { + -: 1814: case DICT: + 5: 1815: type = isDictUniform((sDictt*)e->data); +call 0 returned 100% + 5: 1816: break; + -: 1817: case ARRAY: + 3: 1818: type = isArrayUniform((sArrayt*)e->data); +call 0 returned 100% + 3: 1819: break; + -: 1820: default: + 60: 1821: type = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1822: } + 68: 1823: foundFirstType = true; + -: 1824: } + -: 1825: } + -: 1826: }} + -: 1827: + 79: 1828: if (allElementsHaveSameType) { branch 0 taken 54% (fallthrough) branch 1 taken 46% - -: 1828: // uniform dict - -: 1829: // encode type and element count - -: 1830: - -: 1831: // in pack dictionary - 43: 1832: if (packing == PACKED) { + -: 1829: // uniform dict + -: 1830: // encode type and element count + -: 1831: + -: 1832: // in pack dictionary + 43: 1833: if (packing == PACKED) { branch 0 taken 42% (fallthrough) branch 1 taken 58% - -: 1833: // uniform dict can't be packed - -: 1834: // because there is only one type of packed arrays - 18: 1835: goto normalDict; - -: 1836: } - 25: 1837: elif (packing == UNIFORM) { + -: 1834: // uniform dict can't be packed + -: 1835: // because there is only one type of packed arrays + 18: 1836: goto normalDict; + -: 1837: } + 25: 1838: elif (packing == UNIFORM) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - -: 1838: // when the packing is uniform, there is no need to encode UNIFORM_DICT since all elements have this type - 4: 1839: uintToNetTypeVarint(r, type, dict->count); + -: 1839: // when the packing is uniform, there is no need to encode UNIFORM_DICT since all elements have this type + 4: 1840: uintToNetTypeVarint(r, type, dict->count); call 0 returned 100% - -: 1840: } - -: 1841: else { - 21: 1842: if (ctx->nibble == lowNbl) { + -: 1841: } + -: 1842: else { + 21: 1843: if (ctx->nibble == lowNbl) { branch 0 taken 90% (fallthrough) branch 1 taken 10% - 19: 1843: sBytesPush(r, (type << 4) + UNIFORM_DICT); -call 0 returned 100% - 19: 1844: uintToVarint(r, dict->count); -call 0 returned 100% - -: 1845: } - -: 1846: else { - -: 1847: // high nibble - 2: 1848: ctx->nibble = lowNbl; - 2: 1849: data = (char *)&((*r)->data) + ctx->nblOffset; - 2: 1850: *data |= UNIFORM_DICT << 4; - 2: 1851: uintToNetTypeVarint(r, type, dict->count); -call 0 returned 100% - -: 1852: } - -: 1853: } - -: 1854: - -: 1855: // encode all element keys and values - 25: 1856: switch(type) { + 19: 1844: sBytesPush(r, (type << 4) + UNIFORM_DICT); +call 0 returned 100% + 19: 1845: uintToVarint(r, dict->count); +call 0 returned 100% + -: 1846: } + -: 1847: else { + -: 1848: // high nibble + 2: 1849: ctx->nibble = lowNbl; + 2: 1850: data = (char *)&((*r)->data) + ctx->nblOffset; + 2: 1851: *data |= UNIFORM_DICT << 4; + 2: 1852: uintToNetTypeVarint(r, type, dict->count); +call 0 returned 100% + -: 1853: } + -: 1854: } + -: 1855: + -: 1856: // encode all element keys and values + 25: 1857: switch(type) { branch 0 taken 8% branch 1 taken 16% branch 2 taken 8% @@ -2718,250 +2719,250 @@ branch 5 taken 20% branch 6 taken 8% branch 7 taken 0% branch 8 taken 0% - -: 1857: case S_UNDEFINED: - 8: 1858: {forEachSDict(dict, e) { + -: 1858: case S_UNDEFINED: + 8: 1859: {forEachSDict(dict, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 6: 1859: if (e->key) { + 6: 1860: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 6: 1860: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); -call 0 returned 100% - -: 1861: } - -: 1862: }} - -: 1863: - 2: 1864: break; - -: 1865: case S_BOOL: - 19: 1866: {forEachSDict(dict, e) { + 6: 1861: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); +call 0 returned 100% + -: 1862: } + -: 1863: }} + -: 1864: + 2: 1865: break; + -: 1866: case S_BOOL: + 19: 1867: {forEachSDict(dict, e) { branch 0 taken 79% branch 1 taken 21% (fallthrough) - 15: 1867: if (e->key) { + 15: 1868: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 15: 1868: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 15: 1869: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - -: 1869: - 15: 1870: if (!ctx->boolOffset) { + -: 1870: + 15: 1871: if (!ctx->boolOffset) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 1871: // new packed bools - 3: 1872: storeNew8bPackedBool(e->data); + -: 1872: // new packed bools + 3: 1873: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 1873: } - -: 1874: else { - -: 1875: // there was a bool before this one, fill bits in nibbles - 12: 1876: if (ctx->boolShift == 8) { + -: 1874: } + -: 1875: else { + -: 1876: // there was a bool before this one, fill bits in nibbles + 12: 1877: if (ctx->boolShift == 8) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - -: 1877: // previous packed bool is full - -: 1878: // next byte is the new packed bools - 1: 1879: storeNew8bPackedBool(e->data); + -: 1878: // previous packed bool is full + -: 1879: // next byte is the new packed bools + 1: 1880: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 1880: } - -: 1881: else { - 11: 1882: storeBool(e->data); + -: 1881: } + -: 1882: else { + 11: 1883: storeBool(e->data); branch 0 taken 91% (fallthrough) branch 1 taken 9% - -: 1883: } - -: 1884: } - -: 1885: } - -: 1886: }} - 4: 1887: break; - -: 1888: case S_DICT: - -: 1889: case UNIFORM_DICT: - 6: 1890: {forEachSDict(dict, e) { + -: 1884: } + -: 1885: } + -: 1886: } + -: 1887: }} + 4: 1888: break; + -: 1889: case S_DICT: + -: 1890: case UNIFORM_DICT: + 6: 1891: {forEachSDict(dict, e) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 4: 1891: if (e->key) { + 4: 1892: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 4: 1892: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 4: 1893: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 4: 1893: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/UNIFORM); + 4: 1894: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 1894: } - -: 1895: }} - 2: 1896: break; - -: 1897: case S_DOUBLE: - 4: 1898: {forEachSDict(dict, e) { + -: 1895: } + -: 1896: }} + 2: 1897: break; + -: 1898: case S_DOUBLE: + 4: 1899: {forEachSDict(dict, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 1899: if (e->key) { + 3: 1900: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 3: 1900: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 3: 1901: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 3: 1901: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); + 3: 1902: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); call 0 returned 100% - -: 1902: } - -: 1903: }} - 1: 1904: break; - -: 1905: case S_INT: - 21: 1906: {forEachSDict(dict, e) { + -: 1903: } + -: 1904: }} + 1: 1905: break; + -: 1906: case S_INT: + 21: 1907: {forEachSDict(dict, e) { branch 0 taken 57% branch 1 taken 43% (fallthrough) - 12: 1907: if (e->key) { + 12: 1908: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 12: 1908: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 12: 1909: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 12: 1909: i64 v = ((sIntt *)(e->data))->value; - 12: 1910: uintToVarint(r, (v << 1) ^ (v >> 63)); + 12: 1910: i64 v = ((sIntt *)(e->data))->value; + 12: 1911: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 returned 100% - -: 1911: } - -: 1912: }} - 9: 1913: break; - -: 1914: case S_STRING: - 16: 1915: {forEachSDict(dict, e) { + -: 1912: } + -: 1913: }} + 9: 1914: break; + -: 1915: case S_STRING: + 16: 1916: {forEachSDict(dict, e) { branch 0 taken 69% branch 1 taken 31% (fallthrough) - 11: 1916: if (e->key) { + 11: 1917: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 11: 1917: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 11: 1918: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 11: 1918: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); + 11: 1919: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); call 0 returned 100% - -: 1919: } - -: 1920: }} - 5: 1921: break; - -: 1922: case S_ARRAY: - -: 1923: case UNIFORM_ARRAY: - 4: 1924: {forEachSDict(dict, e) { + -: 1920: } + -: 1921: }} + 5: 1922: break; + -: 1923: case S_ARRAY: + -: 1924: case UNIFORM_ARRAY: + 4: 1925: {forEachSDict(dict, e) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 2: 1925: if (e->key) { + 2: 1926: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 2: 1926: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 2: 1927: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 2: 1927: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/UNIFORM); + 2: 1928: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 1928: } - -: 1929: }} - 2: 1930: break; - -: 1931: case S_BYTES: - #####: 1932: {forEachSDict(dict, e) { + -: 1929: } + -: 1930: }} + 2: 1931: break; + -: 1932: case S_BYTES: + #####: 1933: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1933: if (e->key) { + #####: 1934: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1934: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1935: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1935: B = (sBytest *)(e->data); - #####: 1936: uintToVarint(r, B->count); + #####: 1936: B = (sBytest *)(e->data); + #####: 1937: uintToVarint(r, B->count); call 0 never executed - #####: 1937: sBytesPushBuffer(r, &(B->data), B->count); + #####: 1938: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 1938: } - -: 1939: }} - #####: 1940: break; - -: 1941: } - 25: 1942: ret; - -: 1943: } - -: 1944: - -: 1945: normalDict: - -: 1946: // encode type and element count - 54: 1947: if (packing == PACKED or packing == UNIFORM) { + -: 1939: } + -: 1940: }} + #####: 1941: break; + -: 1942: } + 25: 1943: ret; + -: 1944: } + -: 1945: + -: 1946: normalDict: + -: 1947: // encode type and element count + 54: 1948: if (packing == PACKED or packing == UNIFORM) { branch 0 taken 57% (fallthrough) branch 1 taken 43% branch 2 taken 13% (fallthrough) branch 3 taken 87% - -: 1948: // when the packing is packed or uniform, there is no need to encode DICT type since all elements have this type - 27: 1949: uintToVarint(r, dict->count); + -: 1949: // when the packing is packed or uniform, there is no need to encode DICT type since all elements have this type + 27: 1950: uintToVarint(r, dict->count); call 0 returned 100% - -: 1950: } - -: 1951: else { - 27: 1952: if (ctx->nibble == lowNbl) { + -: 1951: } + -: 1952: else { + 27: 1953: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 25: 1953: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); -call 0 returned 100% - -: 1954: } - -: 1955: else { - -: 1956: // high nibble - -: 1957: #define storeTypeInHighNbl(o)\ - -: 1958: ctx->nibble = lowNbl;\ - -: 1959: data = (char *)&((*r)->data) + ctx->nblOffset;\ - -: 1960: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 - 2: 1961: storeTypeInHighNbl(dict); - 2: 1962: uintToVarint(r, dict->count); -call 0 returned 100% - -: 1963: } - -: 1964: } - -: 1965: - 54: 1966: bool pack = false; - -: 1967: size_t packCount; - 210: 1968: enumerateSDict(dict, e, eIdx) { + 25: 1954: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); +call 0 returned 100% + -: 1955: } + -: 1956: else { + -: 1957: // high nibble + -: 1958: #define storeTypeInHighNbl(o)\ + -: 1959: ctx->nibble = lowNbl;\ + -: 1960: data = (char *)&((*r)->data) + ctx->nblOffset;\ + -: 1961: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 + 2: 1962: storeTypeInHighNbl(dict); + 2: 1963: uintToVarint(r, dict->count); +call 0 returned 100% + -: 1964: } + -: 1965: } + -: 1966: + 54: 1967: bool pack = false; + -: 1968: size_t packCount; + 210: 1969: enumerateSDict(dict, e, eIdx) { branch 0 taken 74% branch 1 taken 26% (fallthrough) - 156: 1969: if (e->key) { + 156: 1970: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 156: 1970: if (!pack) { + 156: 1971: if (!pack) { branch 0 taken 76% (fallthrough) branch 1 taken 24% - -: 1971: // scan dict for packing - 118: 1972: if ((dict->count - eIdx) > 3) { + -: 1972: // scan dict for packing + 118: 1973: if ((dict->count - eIdx) > 3) { branch 0 taken 35% (fallthrough) branch 1 taken 65% - -: 1973: // at least 4 elements, less than that is not worth it - 41: 1974: if ( e->data->type == DICT + -: 1974: // at least 4 elements, less than that is not worth it + 41: 1975: if ( e->data->type == DICT branch 0 taken 93% (fallthrough) branch 1 taken 7% - 38: 1975: or e->data->type == DOUBLE + 38: 1976: or e->data->type == DOUBLE branch 0 taken 95% (fallthrough) branch 1 taken 5% - 36: 1976: or e->data->type == INT + 36: 1977: or e->data->type == INT branch 0 taken 94% (fallthrough) branch 1 taken 6% - 34: 1977: or e->data->type == STRING + 34: 1978: or e->data->type == STRING branch 0 taken 94% (fallthrough) branch 1 taken 6% - 32: 1978: or e->data->type == ARRAY + 32: 1979: or e->data->type == ARRAY branch 0 taken 94% (fallthrough) branch 1 taken 6% - 30: 1979: or e->data->type == BYTES) { + 30: 1980: or e->data->type == BYTES) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - 11: 1980: type = e->data->type; - 11: 1981: packCount = 1; - 11: 1982: sDictElemt *element = &((dict)->elements) + eIdx +1; - 49: 1983: for (size_t i = eIdx+1; i < (dict)->count ; i++, element = &((dict)->elements) + i) { + 11: 1981: type = e->data->type; + 11: 1982: packCount = 1; + 11: 1983: sDictElemt *element = &((dict)->elements) + eIdx +1; + 49: 1984: for (size_t i = eIdx+1; i < (dict)->count ; i++, element = &((dict)->elements) + i) { branch 0 taken 100% branch 1 taken 0% (fallthrough) - 49: 1984: if (element->key) { + 49: 1985: if (element->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 49: 1985: if (element->data->type != type) { + 49: 1986: if (element->data->type != type) { branch 0 taken 22% (fallthrough) branch 1 taken 78% - 11: 1986: break; - -: 1987: } - 38: 1988: packCount++; - -: 1989: } // element->key - -: 1990: } // for - 11: 1991: if (packCount > 3) { + 11: 1987: break; + -: 1988: } + 38: 1989: packCount++; + -: 1990: } // element->key + -: 1991: } // for + 11: 1992: if (packCount > 3) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 11: 1992: type = PACKED_NET_SERIAL_TYPES[(u8)type]; - 11: 1993: pack = true; - -: 1994: } - -: 1995: } // test current element type - -: 1996: } // is dict big enough - -: 1997: } // not already packing - -: 1998: - -: 1999: // encode key - 156: 2000: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); -call 0 returned 100% - -: 2001: - -: 2002: // encode value - 156: 2003: switch(e->data->type) { + 11: 1993: type = PACKED_NET_SERIAL_TYPES[(u8)type]; + 11: 1994: pack = true; + -: 1995: } + -: 1996: } // test current element type + -: 1997: } // is dict big enough + -: 1998: } // not already packing + -: 1999: + -: 2000: // encode key + 156: 2001: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); +call 0 returned 100% + -: 2002: + -: 2003: // encode value + 156: 2004: switch(e->data->type) { branch 0 taken 17% branch 1 taken 20% branch 2 taken 13% @@ -2971,535 +2972,535 @@ branch 5 taken 14% branch 6 taken 8% branch 7 taken 0% branch 8 taken 0% - -: 2004: case UNDEFINED: - -: 2005: case CONTAINER: - 26: 2006: if (ctx->nibble == lowNbl) { + -: 2005: case UNDEFINED: + -: 2006: case CONTAINER: + 26: 2007: if (ctx->nibble == lowNbl) { branch 0 taken 92% (fallthrough) branch 1 taken 8% - -: 2007: #define storeTypeOnly(o)\ - -: 2008: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ - -: 2009: ctx->nibble = highNbl;\ - -: 2010: ctx->nblOffset = (*r)->count -1 - 24: 2011: storeTypeOnly(e->data); -call 0 returned 100% - -: 2012: } - -: 2013: else { - 2: 2014: storeTypeInHighNbl(e->data); - -: 2015: } - 26: 2016: break; - -: 2017: case BOOL: - 31: 2018: if (!ctx->boolOffset) { + -: 2008: #define storeTypeOnly(o)\ + -: 2009: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ + -: 2010: ctx->nibble = highNbl;\ + -: 2011: ctx->nblOffset = (*r)->count -1 + 24: 2012: storeTypeOnly(e->data); +call 0 returned 100% + -: 2013: } + -: 2014: else { + 2: 2015: storeTypeInHighNbl(e->data); + -: 2016: } + 26: 2017: break; + -: 2018: case BOOL: + 31: 2019: if (!ctx->boolOffset) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - -: 2019: // new packed bools - 5: 2020: if (ctx->nibble == lowNbl) { + -: 2020: // new packed bools + 5: 2021: if (ctx->nibble == lowNbl) { branch 0 taken 60% (fallthrough) branch 1 taken 40% - -: 2021: #define storeNew4bPackedBool(o)\ - -: 2022: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ - -: 2023: /* set bit 4 when true */\ - -: 2024: if (((sBoolt *)(o))->value)\ - -: 2025: c |= (1<<4);\ - -: 2026: sBytesPush(r, c);\ - -: 2027: ctx->boolShift = 5;\ - -: 2028: ctx->boolOffset = (*r)->count -1 - 3: 2029: storeNew4bPackedBool(e->data); + -: 2022: #define storeNew4bPackedBool(o)\ + -: 2023: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ + -: 2024: /* set bit 4 when true */\ + -: 2025: if (((sBoolt *)(o))->value)\ + -: 2026: c |= (1<<4);\ + -: 2027: sBytesPush(r, c);\ + -: 2028: ctx->boolShift = 5;\ + -: 2029: ctx->boolOffset = (*r)->count -1 + 3: 2030: storeNew4bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2030: } - -: 2031: else { - -: 2032: // high nibble, next byte is packed bools - 2: 2033: storeTypeInHighNbl(e->data); - -: 2034: #define storeNew8bPackedBool(o)\ - -: 2035: u8 c = 0;\ - -: 2036: if (((sBoolt *)(o))->value)\ - -: 2037: c = 1;\ - -: 2038: sBytesPush(r, c);\ - -: 2039: ctx->boolShift = 1;\ - -: 2040: ctx->boolOffset = (*r)->count -1 - 2: 2041: storeNew8bPackedBool(e->data); + -: 2031: } + -: 2032: else { + -: 2033: // high nibble, next byte is packed bools + 2: 2034: storeTypeInHighNbl(e->data); + -: 2035: #define storeNew8bPackedBool(o)\ + -: 2036: u8 c = 0;\ + -: 2037: if (((sBoolt *)(o))->value)\ + -: 2038: c = 1;\ + -: 2039: sBytesPush(r, c);\ + -: 2040: ctx->boolShift = 1;\ + -: 2041: ctx->boolOffset = (*r)->count -1 + 2: 2042: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2042: } - -: 2043: } - -: 2044: else { - -: 2045: // there was a bool before this one, fill bits in nibbles - 26: 2046: if (ctx->nibble == lowNbl) { + -: 2043: } + -: 2044: } + -: 2045: else { + -: 2046: // there was a bool before this one, fill bits in nibbles + 26: 2047: if (ctx->nibble == lowNbl) { branch 0 taken 58% (fallthrough) branch 1 taken 42% - 15: 2047: if (ctx->boolShift == 8) { + 15: 2048: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - -: 2048: // previous packed bool is full - -: 2049: // this byte is the new packed bools - 1: 2050: storeNew4bPackedBool(e->data); + -: 2049: // previous packed bool is full + -: 2050: // this byte is the new packed bools + 1: 2051: storeNew4bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2051: } - -: 2052: else { - 14: 2053: storeTypeOnly(e->data); -call 0 returned 100% - -: 2054: #define storeBool(o)\ - -: 2055: data = (char *)&((*r)->data) + ctx->boolOffset;\ - -: 2056: if (((sBoolt *)(o))->value)\ - -: 2057: *data |= 1 << ctx->boolShift;\ - -: 2058: ctx->boolShift++ - 14: 2059: storeBool(e->data); + -: 2052: } + -: 2053: else { + 14: 2054: storeTypeOnly(e->data); +call 0 returned 100% + -: 2055: #define storeBool(o)\ + -: 2056: data = (char *)&((*r)->data) + ctx->boolOffset;\ + -: 2057: if (((sBoolt *)(o))->value)\ + -: 2058: *data |= 1 << ctx->boolShift;\ + -: 2059: ctx->boolShift++ + 14: 2060: storeBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% - -: 2060: } - -: 2061: } - -: 2062: else { - -: 2063: // high nibble - 11: 2064: storeTypeInHighNbl(e->data); - 11: 2065: if (ctx->boolShift == 8) { + -: 2061: } + -: 2062: } + -: 2063: else { + -: 2064: // high nibble + 11: 2065: storeTypeInHighNbl(e->data); + 11: 2066: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 2066: // previous packed bool is full - -: 2067: // next byte is the new packed bools - 2: 2068: storeNew8bPackedBool(e->data); + -: 2067: // previous packed bool is full + -: 2068: // next byte is the new packed bools + 2: 2069: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2069: } - -: 2070: else { - 9: 2071: storeBool(e->data); + -: 2070: } + -: 2071: else { + 9: 2072: storeBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% - -: 2072: } - -: 2073: } - -: 2074: } - 31: 2075: break; - -: 2076: case DICT: - 20: 2077: if (pack) { + -: 2073: } + -: 2074: } + -: 2075: } + 31: 2076: break; + -: 2077: case DICT: + 20: 2078: if (pack) { branch 0 taken 75% (fallthrough) branch 1 taken 25% - 15: 2078: if (type) { + 15: 2079: if (type) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2079: // this is the first packed element - 3: 2080: if (ctx->nibble == lowNbl) { + -: 2080: // this is the first packed element + 3: 2081: if (ctx->nibble == lowNbl) { branch 0 taken 67% (fallthrough) branch 1 taken 33% - 2: 2081: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2082: } - -: 2083: else { - -: 2084: // high nibble - -: 2085: // store type in high nibble - 1: 2086: ctx->nibble = lowNbl; - 1: 2087: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2088: *data |= type << 4; - 1: 2089: uintToVarint(r, packCount); -call 0 returned 100% - -: 2090: } - 3: 2091: type = 0; - -: 2092: } // if type - -: 2093: - 15: 2094: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2095: // stop packing when packCount == 0 - 15: 2096: packCount--; - 15: 2097: if (!packCount) pack = false; + 2: 2082: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2083: } + -: 2084: else { + -: 2085: // high nibble + -: 2086: // store type in high nibble + 1: 2087: ctx->nibble = lowNbl; + 1: 2088: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2089: *data |= type << 4; + 1: 2090: uintToVarint(r, packCount); +call 0 returned 100% + -: 2091: } + 3: 2092: type = 0; + -: 2093: } // if type + -: 2094: + 15: 2095: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/PACKED); +call 0 returned 100% + -: 2096: // stop packing when packCount == 0 + 15: 2097: packCount--; + 15: 2098: if (!packCount) pack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2098: } // if pack - -: 2099: else - 5: 2100: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/NOPACKING); + -: 2099: } // if pack + -: 2100: else + 5: 2101: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/NOPACKING); call 0 returned 100% - 20: 2101: break; - -: 2102: case DOUBLE: - 12: 2103: if (pack) { + 20: 2102: break; + -: 2103: case DOUBLE: + 12: 2104: if (pack) { branch 0 taken 83% (fallthrough) branch 1 taken 17% - 10: 2104: if (type) { + 10: 2105: if (type) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2105: // this is the first packed element - 2: 2106: if (ctx->nibble == lowNbl) { + -: 2106: // this is the first packed element + 2: 2107: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2107: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2108: } - -: 2109: else { - -: 2110: // high nibble - -: 2111: // store type in high nibble - 1: 2112: ctx->nibble = lowNbl; - 1: 2113: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2114: *data |= type << 4; - 1: 2115: uintToVarint(r, packCount); -call 0 returned 100% - -: 2116: } - 2: 2117: type = 0; - -: 2118: } // if type - -: 2119: - 10: 2120: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 returned 100% - -: 2121: // stop packing when packCount == 0 - 10: 2122: packCount--; - 10: 2123: if (!packCount) pack = false; + 1: 2108: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2109: } + -: 2110: else { + -: 2111: // high nibble + -: 2112: // store type in high nibble + 1: 2113: ctx->nibble = lowNbl; + 1: 2114: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2115: *data |= type << 4; + 1: 2116: uintToVarint(r, packCount); +call 0 returned 100% + -: 2117: } + 2: 2118: type = 0; + -: 2119: } // if type + -: 2120: + 10: 2121: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); +call 0 returned 100% + -: 2122: // stop packing when packCount == 0 + 10: 2123: packCount--; + 10: 2124: if (!packCount) pack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2124: } // if pack - -: 2125: else { - 2: 2126: if (ctx->nibble == lowNbl) { + -: 2125: } // if pack + -: 2126: else { + 2: 2127: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2127: storeTypeOnly(e->data); -call 0 returned 100% - -: 2128: } - -: 2129: else { - -: 2130: // high nibble - 1: 2131: storeTypeInHighNbl(e->data); - -: 2132: } - 2: 2133: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 returned 100% - -: 2134: } - 12: 2135: break; - -: 2136: case INT: - 32: 2137: if (pack) { + 1: 2128: storeTypeOnly(e->data); +call 0 returned 100% + -: 2129: } + -: 2130: else { + -: 2131: // high nibble + 1: 2132: storeTypeInHighNbl(e->data); + -: 2133: } + 2: 2134: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); +call 0 returned 100% + -: 2135: } + 12: 2136: break; + -: 2137: case INT: + 32: 2138: if (pack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 2138: if (type) { + 8: 2139: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2139: // this is the first packed element - 2: 2140: if (ctx->nibble == lowNbl) { + -: 2140: // this is the first packed element + 2: 2141: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2141: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2142: } - -: 2143: else { - -: 2144: // high nibble - -: 2145: // store type in high nibble - 1: 2146: ctx->nibble = lowNbl; - 1: 2147: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2148: *data |= type << 4; - 1: 2149: uintToVarint(r, packCount); -call 0 returned 100% - -: 2150: } - 2: 2151: type = 0; - -: 2152: } // if type - -: 2153: - 8: 2154: i64 v = ((sIntt *)(e->data))->value; - 8: 2155: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2156: // stop packing when packCount == 0 - 8: 2157: packCount--; - 8: 2158: if (!packCount) pack = false; + 1: 2142: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2143: } + -: 2144: else { + -: 2145: // high nibble + -: 2146: // store type in high nibble + 1: 2147: ctx->nibble = lowNbl; + 1: 2148: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2149: *data |= type << 4; + 1: 2150: uintToVarint(r, packCount); +call 0 returned 100% + -: 2151: } + 2: 2152: type = 0; + -: 2153: } // if type + -: 2154: + 8: 2155: i64 v = ((sIntt *)(e->data))->value; + 8: 2156: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2157: // stop packing when packCount == 0 + 8: 2158: packCount--; + 8: 2159: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2159: } // if pack - -: 2160: else { - -: 2161: // encode int to varint - -: 2162: // v is int64_t to convert to varint - 24: 2163: i64 v = ((sIntt *)(e->data))->value; - 24: 2164: if (ctx->nibble == lowNbl) { + -: 2160: } // if pack + -: 2161: else { + -: 2162: // encode int to varint + -: 2163: // v is int64_t to convert to varint + 24: 2164: i64 v = ((sIntt *)(e->data))->value; + 24: 2165: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - -: 2165: // encode v with arithmetic shifts - 12: 2166: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2167: } - -: 2168: else { - -: 2169: // high nibble - 12: 2170: storeTypeInHighNbl(e->data); - 12: 2171: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2172: } - -: 2173: } - 32: 2174: break; - -: 2175: case STRING: - 22: 2176: if (pack) { + -: 2166: // encode v with arithmetic shifts + 12: 2167: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2168: } + -: 2169: else { + -: 2170: // high nibble + 12: 2171: storeTypeInHighNbl(e->data); + 12: 2172: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2173: } + -: 2174: } + 32: 2175: break; + -: 2176: case STRING: + 22: 2177: if (pack) { branch 0 taken 36% (fallthrough) branch 1 taken 64% - 8: 2177: if (type) { + 8: 2178: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2178: // this is the first packed element - 2: 2179: if (ctx->nibble == lowNbl) { + -: 2179: // this is the first packed element + 2: 2180: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2180: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2181: } - -: 2182: else { - -: 2183: // high nibble - -: 2184: // store type in high nibble - 1: 2185: ctx->nibble = lowNbl; - 1: 2186: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2187: *data |= type << 4; - 1: 2188: uintToVarint(r, packCount); -call 0 returned 100% - -: 2189: } - 2: 2190: type = 0; - -: 2191: } // if type - -: 2192: - 8: 2193: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 returned 100% - -: 2194: // stop packing when packCount == 0 - 8: 2195: packCount--; - 8: 2196: if (!packCount) pack = false; + 1: 2181: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2182: } + -: 2183: else { + -: 2184: // high nibble + -: 2185: // store type in high nibble + 1: 2186: ctx->nibble = lowNbl; + 1: 2187: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2188: *data |= type << 4; + 1: 2189: uintToVarint(r, packCount); +call 0 returned 100% + -: 2190: } + 2: 2191: type = 0; + -: 2192: } // if type + -: 2193: + 8: 2194: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); +call 0 returned 100% + -: 2195: // stop packing when packCount == 0 + 8: 2196: packCount--; + 8: 2197: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2197: } // if pack - -: 2198: else { - 14: 2199: if (ctx->nibble == lowNbl) { + -: 2198: } // if pack + -: 2199: else { + 14: 2200: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 13: 2200: storeTypeOnly(e->data); -call 0 returned 100% - -: 2201: } - -: 2202: else { - -: 2203: // high nibble - 1: 2204: storeTypeInHighNbl(e->data); - -: 2205: } - 14: 2206: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 returned 100% - -: 2207: } - 22: 2208: break; - -: 2209: case ARRAY: - 13: 2210: if (pack) { + 13: 2201: storeTypeOnly(e->data); +call 0 returned 100% + -: 2202: } + -: 2203: else { + -: 2204: // high nibble + 1: 2205: storeTypeInHighNbl(e->data); + -: 2206: } + 14: 2207: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); +call 0 returned 100% + -: 2208: } + 22: 2209: break; + -: 2210: case ARRAY: + 13: 2211: if (pack) { branch 0 taken 62% (fallthrough) branch 1 taken 38% - 8: 2211: if (type) { + 8: 2212: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2212: // this is the first packed element - 2: 2213: if (ctx->nibble == lowNbl) { + -: 2213: // this is the first packed element + 2: 2214: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2214: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2215: } - -: 2216: else { - -: 2217: // high nibble - -: 2218: // store type in high nibble - 1: 2219: ctx->nibble = lowNbl; - 1: 2220: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2221: *data |= type << 4; - 1: 2222: uintToVarint(r, packCount); -call 0 returned 100% - -: 2223: } - 2: 2224: type = 0; - -: 2225: } // if type - -: 2226: - 8: 2227: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2228: // stop packing when packCount == 0 - 8: 2229: packCount--; - 8: 2230: if (!packCount) pack = false; + 1: 2215: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2216: } + -: 2217: else { + -: 2218: // high nibble + -: 2219: // store type in high nibble + 1: 2220: ctx->nibble = lowNbl; + 1: 2221: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2222: *data |= type << 4; + 1: 2223: uintToVarint(r, packCount); +call 0 returned 100% + -: 2224: } + 2: 2225: type = 0; + -: 2226: } // if type + -: 2227: + 8: 2228: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/PACKED); +call 0 returned 100% + -: 2229: // stop packing when packCount == 0 + 8: 2230: packCount--; + 8: 2231: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2231: } // if pack - -: 2232: else - 5: 2233: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/NOPACKING); -call 0 returned 100% - 13: 2234: break; - -: 2235: case BYTES: - #####: 2236: if (pack) { -branch 0 never executed -branch 1 never executed - #####: 2237: if (type) { -branch 0 never executed -branch 1 never executed - -: 2238: // this is the first packed element - #####: 2239: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 2240: uintToNetTypeVarint(r, type, packCount); -call 0 never executed - -: 2241: } - -: 2242: else { - -: 2243: // high nibble - -: 2244: // store type in high nibble - #####: 2245: ctx->nibble = lowNbl; - #####: 2246: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 2247: *data |= type << 4; - #####: 2248: uintToVarint(r, packCount); -call 0 never executed - -: 2249: } - #####: 2250: type = 0; - -: 2251: } // if type - -: 2252: - #####: 2253: B = (sBytest *)(e->data); - #####: 2254: uintToVarint(r, B->count); -call 0 never executed - #####: 2255: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - -: 2256: // stop packing when packCount == 0 - #####: 2257: packCount--; - #####: 2258: if (!packCount) pack = false; -branch 0 never executed -branch 1 never executed - -: 2259: } // if pack - -: 2260: else { - #####: 2261: B = (sBytest *)(e->data); - #####: 2262: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 2263: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); -call 0 never executed - -: 2264: } - -: 2265: else { - -: 2266: // high nibble - #####: 2267: storeTypeInHighNbl(e->data); - #####: 2268: uintToVarint(r, B->count); -call 0 never executed - -: 2269: } - #####: 2270: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - -: 2271: } - #####: 2272: break; - -: 2273: } - -: 2274: } - -: 2275: } - 54: 2276: ret; - -: 2277:} - -: 2278: - -: 2279:/** - -: 2280: * serialize array - -: 2281: * - -: 2282: * the serialized array is pushed to r. - -: 2283: * All elements are serialized recursively - -: 2284: * - -: 2285: * the data in containers is not serialized - -: 2286: * - -: 2287: * \param - -: 2288: * r small bytes object - -: 2289: * array to serialize - -: 2290: */ + -: 2232: } // if pack + -: 2233: else + 5: 2234: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/NOPACKING); +call 0 returned 100% + 13: 2235: break; + -: 2236: case BYTES: + #####: 2237: if (pack) { +branch 0 never executed +branch 1 never executed + #####: 2238: if (type) { +branch 0 never executed +branch 1 never executed + -: 2239: // this is the first packed element + #####: 2240: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 2241: uintToNetTypeVarint(r, type, packCount); +call 0 never executed + -: 2242: } + -: 2243: else { + -: 2244: // high nibble + -: 2245: // store type in high nibble + #####: 2246: ctx->nibble = lowNbl; + #####: 2247: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 2248: *data |= type << 4; + #####: 2249: uintToVarint(r, packCount); +call 0 never executed + -: 2250: } + #####: 2251: type = 0; + -: 2252: } // if type + -: 2253: + #####: 2254: B = (sBytest *)(e->data); + #####: 2255: uintToVarint(r, B->count); +call 0 never executed + #####: 2256: sBytesPushBuffer(r, &(B->data), B->count); +call 0 never executed + -: 2257: // stop packing when packCount == 0 + #####: 2258: packCount--; + #####: 2259: if (!packCount) pack = false; +branch 0 never executed +branch 1 never executed + -: 2260: } // if pack + -: 2261: else { + #####: 2262: B = (sBytest *)(e->data); + #####: 2263: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 2264: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); +call 0 never executed + -: 2265: } + -: 2266: else { + -: 2267: // high nibble + #####: 2268: storeTypeInHighNbl(e->data); + #####: 2269: uintToVarint(r, B->count); +call 0 never executed + -: 2270: } + #####: 2271: sBytesPushBuffer(r, &(B->data), B->count); +call 0 never executed + -: 2272: } + #####: 2273: break; + -: 2274: } + -: 2275: } + -: 2276: } + 54: 2277: ret; + -: 2278:} + -: 2279: + -: 2280:/** + -: 2281: * serialize array + -: 2282: * + -: 2283: * the serialized array is pushed to r. + -: 2284: * All elements are serialized recursively + -: 2285: * + -: 2286: * the data in containers is not serialized + -: 2287: * + -: 2288: * \param + -: 2289: * r small bytes object + -: 2290: * array to serialize + -: 2291: */ function arrayNetSerial called 73 returned 100% blocks executed 86% - 73: 2291:internal void arrayNetSerial(sBytest **r, sArrayt *array, contextt *ctx, packingT packing) { - 73: 2292: sBytest *B = NULL; - 73: 2293: char *data = NULL; - -: 2294: - -: 2295: // check if all elements have same type - -: 2296: // then set array type normal or uniform - -: 2297: // array and dict have to be checked recursively to know if they are normal or uniform - 73: 2298: bool allElementsHaveSameType = true; - 73: 2299: bool foundFirstType = false; - 73: 2300: char type = 0; - -: 2301: - -: 2302: // get first element type - -: 2303: // compare to other element type - -: 2304: // null element are interpreted as undefined - 217: 2305: {forEachSArray(array, e) { + 73: 2292:internal void arrayNetSerial(sBytest **r, sArrayt *array, contextt *ctx, packingT packing) { + 73: 2293: sBytest *B = NULL; + 73: 2294: char *data = NULL; + -: 2295: + -: 2296: // check if all elements have same type + -: 2297: // then set array type normal or uniform + -: 2298: // array and dict have to be checked recursively to know if they are normal or uniform + 73: 2299: bool allElementsHaveSameType = true; + 73: 2300: bool foundFirstType = false; + 73: 2301: char type = 0; + -: 2302: + -: 2303: // get first element type + -: 2304: // compare to other element type + -: 2305: // null element are interpreted as undefined + 217: 2306: {forEachSArray(array, e) { branch 0 taken 82% branch 1 taken 18% (fallthrough) - 177: 2306: if (!e) { + 177: 2307: if (!e) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2307: if (foundFirstType) { + #####: 2308: if (foundFirstType) { branch 0 never executed branch 1 never executed - #####: 2308: if (type != S_UNDEFINED) { + #####: 2309: if (type != S_UNDEFINED) { branch 0 never executed branch 1 never executed - #####: 2309: allElementsHaveSameType = false; - #####: 2310: break; - -: 2311: } - -: 2312: } - -: 2313: else { - #####: 2314: type = S_UNDEFINED; - #####: 2315: foundFirstType = true; - -: 2316: } - -: 2317: } - -: 2318: else { - 177: 2319: if (foundFirstType) { + #####: 2310: allElementsHaveSameType = false; + #####: 2311: break; + -: 2312: } + -: 2313: } + -: 2314: else { + #####: 2315: type = S_UNDEFINED; + #####: 2316: foundFirstType = true; + -: 2317: } + -: 2318: } + -: 2319: else { + 177: 2320: if (foundFirstType) { branch 0 taken 61% (fallthrough) branch 1 taken 39% - -: 2320: u8 nextType; - 108: 2321: switch(e->type) { + -: 2321: u8 nextType; + 108: 2322: switch(e->type) { branch 0 taken 6% branch 1 taken 10% branch 2 taken 83% - -: 2322: case DICT: - 7: 2323: nextType = isDictUniform((sDictt*)e); -call 0 returned 100% - 7: 2324: break; - -: 2325: case ARRAY: - 11: 2326: nextType = isArrayUniform((sArrayt*)e); -call 0 returned 100% - 11: 2327: break; - -: 2328: default: - 90: 2329: nextType = NET_SERIAL_TYPES[(u8)e->type]; - -: 2330: } - 108: 2331: if (nextType != type) { + -: 2323: case DICT: + 7: 2324: nextType = isDictUniform((sDictt*)e); +call 0 returned 100% + 7: 2325: break; + -: 2326: case ARRAY: + 11: 2327: nextType = isArrayUniform((sArrayt*)e); +call 0 returned 100% + 11: 2328: break; + -: 2329: default: + 90: 2330: nextType = NET_SERIAL_TYPES[(u8)e->type]; + -: 2331: } + 108: 2332: if (nextType != type) { branch 0 taken 31% (fallthrough) branch 1 taken 69% - 33: 2332: allElementsHaveSameType = false; - 33: 2333: break; - -: 2334: } - -: 2335: } - -: 2336: else { - 69: 2337: switch(e->type) { + 33: 2333: allElementsHaveSameType = false; + 33: 2334: break; + -: 2335: } + -: 2336: } + -: 2337: else { + 69: 2338: switch(e->type) { branch 0 taken 7% branch 1 taken 9% branch 2 taken 84% - -: 2338: case DICT: - 5: 2339: type = isDictUniform((sDictt*)e); -call 0 returned 100% - 5: 2340: break; - -: 2341: case ARRAY: - 6: 2342: type = isArrayUniform((sArrayt*)e); -call 0 returned 100% - 6: 2343: break; - -: 2344: default: - 58: 2345: type = NET_SERIAL_TYPES[(u8)e->type]; - -: 2346: } - 69: 2347: foundFirstType = true; - -: 2348: } - -: 2349: } - -: 2350: }} - -: 2351: - 73: 2352: if (allElementsHaveSameType) { + -: 2339: case DICT: + 5: 2340: type = isDictUniform((sDictt*)e); +call 0 returned 100% + 5: 2341: break; + -: 2342: case ARRAY: + 6: 2343: type = isArrayUniform((sArrayt*)e); +call 0 returned 100% + 6: 2344: break; + -: 2345: default: + 58: 2346: type = NET_SERIAL_TYPES[(u8)e->type]; + -: 2347: } + 69: 2348: foundFirstType = true; + -: 2349: } + -: 2350: } + -: 2351: }} + -: 2352: + 73: 2353: if (allElementsHaveSameType) { branch 0 taken 55% (fallthrough) branch 1 taken 45% - -: 2353: // uniform array - -: 2354: // encode type and element count - -: 2355: - -: 2356: // in pack array - 40: 2357: if (packing == PACKED) { + -: 2354: // uniform array + -: 2355: // encode type and element count + -: 2356: + -: 2357: // in pack array + 40: 2358: if (packing == PACKED) { branch 0 taken 40% (fallthrough) branch 1 taken 60% - -: 2358: // uniform array can't be packed - -: 2359: // because there is only one type of packed arrays - 16: 2360: goto normalArray; - -: 2361: } - 24: 2362: elif (packing == UNIFORM) { + -: 2359: // uniform array can't be packed + -: 2360: // because there is only one type of packed arrays + 16: 2361: goto normalArray; + -: 2362: } + 24: 2363: elif (packing == UNIFORM) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - -: 2363: // when the packing is uniform, there is no need to encode UNIFORM_ARRAY since all elements have this type - 2: 2364: uintToNetTypeVarint(r, type, array->count); + -: 2364: // when the packing is uniform, there is no need to encode UNIFORM_ARRAY since all elements have this type + 2: 2365: uintToNetTypeVarint(r, type, array->count); call 0 returned 100% - -: 2365: } - -: 2366: else { - 22: 2367: if (ctx->nibble == lowNbl) { + -: 2366: } + -: 2367: else { + 22: 2368: if (ctx->nibble == lowNbl) { branch 0 taken 77% (fallthrough) branch 1 taken 23% - 17: 2368: sBytesPush(r, (type << 4) + UNIFORM_ARRAY); -call 0 returned 100% - 17: 2369: uintToVarint(r, array->count); -call 0 returned 100% - -: 2370: } - -: 2371: else { - -: 2372: // high nibble - 5: 2373: ctx->nibble = lowNbl; - 5: 2374: data = (char *)&((*r)->data) + ctx->nblOffset; - 5: 2375: *data |= UNIFORM_ARRAY << 4; - 5: 2376: uintToNetTypeVarint(r, type, array->count); -call 0 returned 100% - -: 2377: } - -: 2378: } - -: 2379: - -: 2380: // encode all element values - 24: 2381: switch(type) { + 17: 2369: sBytesPush(r, (type << 4) + UNIFORM_ARRAY); +call 0 returned 100% + 17: 2370: uintToVarint(r, array->count); +call 0 returned 100% + -: 2371: } + -: 2372: else { + -: 2373: // high nibble + 5: 2374: ctx->nibble = lowNbl; + 5: 2375: data = (char *)&((*r)->data) + ctx->nblOffset; + 5: 2376: *data |= UNIFORM_ARRAY << 4; + 5: 2377: uintToNetTypeVarint(r, type, array->count); +call 0 returned 100% + -: 2378: } + -: 2379: } + -: 2380: + -: 2381: // encode all element values + 24: 2382: switch(type) { branch 0 taken 8% branch 1 taken 8% branch 2 taken 4% @@ -3508,207 +3509,207 @@ branch 4 taken 4% branch 5 taken 17% branch 6 taken 0% branch 7 taken 13% - -: 2382: case S_BOOL: - 16: 2383: {forEachSArray(array, e) { + -: 2383: case S_BOOL: + 16: 2384: {forEachSArray(array, e) { branch 0 taken 88% branch 1 taken 13% (fallthrough) - 14: 2384: if (!ctx->boolOffset) { + 14: 2385: if (!ctx->boolOffset) { branch 0 taken 14% (fallthrough) branch 1 taken 86% - -: 2385: // new packed bools - 2: 2386: storeNew8bPackedBool(e); + -: 2386: // new packed bools + 2: 2387: storeNew8bPackedBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2387: } - -: 2388: else { - -: 2389: // there was a bool before this one, fill bits in nibbles - 12: 2390: if (ctx->boolShift == 8) { + -: 2388: } + -: 2389: else { + -: 2390: // there was a bool before this one, fill bits in nibbles + 12: 2391: if (ctx->boolShift == 8) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - -: 2391: // previous packed bool is full - -: 2392: // next byte is the new packed bools - 1: 2393: storeNew8bPackedBool(e); + -: 2392: // previous packed bool is full + -: 2393: // next byte is the new packed bools + 1: 2394: storeNew8bPackedBool(e); branch 0 taken 0% (fallthrough) branch 1 taken 100% call 2 returned 100% - -: 2394: } - -: 2395: else { - 11: 2396: storeBool(e); + -: 2395: } + -: 2396: else { + 11: 2397: storeBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% - -: 2397: } - -: 2398: } - -: 2399: }} - 2: 2400: break; - -: 2401: case S_DICT: - -: 2402: case UNIFORM_DICT: - 6: 2403: {forEachSArray(array, e) { + -: 2398: } + -: 2399: } + -: 2400: }} + 2: 2401: break; + -: 2402: case S_DICT: + -: 2403: case UNIFORM_DICT: + 6: 2404: {forEachSArray(array, e) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 4: 2404: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/UNIFORM); + 4: 2405: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 2405: }} - 2: 2406: break; - -: 2407: case S_DOUBLE: - 4: 2408: {forEachSArray(array, e) { + -: 2406: }} + 2: 2407: break; + -: 2408: case S_DOUBLE: + 4: 2409: {forEachSArray(array, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 2409: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); + 3: 2410: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); call 0 returned 100% - -: 2410: }} - 1: 2411: break; - -: 2412: case S_INT: - 49: 2413: {forEachSArray(array, e) { + -: 2411: }} + 1: 2412: break; + -: 2413: case S_INT: + 49: 2414: {forEachSArray(array, e) { branch 0 taken 78% branch 1 taken 22% (fallthrough) - 38: 2414: i64 v = ((sIntt *)e)->value; - 38: 2415: uintToVarint(r, (v << 1) ^ (v >> 63)); + 38: 2415: i64 v = ((sIntt *)e)->value; + 38: 2416: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 returned 100% - -: 2416: }} - 11: 2417: break; - -: 2418: case S_STRING: - 4: 2419: {forEachSArray(array, e) { + -: 2417: }} + 11: 2418: break; + -: 2419: case S_STRING: + 4: 2420: {forEachSArray(array, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 2420: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); + 3: 2421: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); call 0 returned 100% - -: 2421: }} - 1: 2422: break; - -: 2423: case S_ARRAY: - -: 2424: case UNIFORM_ARRAY: - 10: 2425: {forEachSArray(array, e) { + -: 2422: }} + 1: 2423: break; + -: 2424: case S_ARRAY: + -: 2425: case UNIFORM_ARRAY: + 10: 2426: {forEachSArray(array, e) { branch 0 taken 60% branch 1 taken 40% (fallthrough) - 6: 2426: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/UNIFORM); + 6: 2427: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 2427: }} - 4: 2428: break; - -: 2429: case S_BYTES: - #####: 2430: {forEachSArray(array, e) { + -: 2428: }} + 4: 2429: break; + -: 2430: case S_BYTES: + #####: 2431: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 2431: B = (sBytest *)e; - #####: 2432: uintToVarint(r, B->count); + #####: 2432: B = (sBytest *)e; + #####: 2433: uintToVarint(r, B->count); call 0 never executed - #####: 2433: sBytesPushBuffer(r, &(B->data), B->count); + #####: 2434: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 2434: }} - #####: 2435: break; - -: 2436: } - 24: 2437: ret; - -: 2438: } - -: 2439: - -: 2440: normalArray: - -: 2441: // encode type and element count - 49: 2442: if (packing == PACKED or packing == UNIFORM) { + -: 2435: }} + #####: 2436: break; + -: 2437: } + 24: 2438: ret; + -: 2439: } + -: 2440: + -: 2441: normalArray: + -: 2442: // encode type and element count + 49: 2443: if (packing == PACKED or packing == UNIFORM) { branch 0 taken 67% (fallthrough) branch 1 taken 33% branch 2 taken 18% (fallthrough) branch 3 taken 82% - -: 2443: // when the packing is packed or uniform, there is no need to encode ARRAY type since all elements have this type - 22: 2444: uintToVarint(r, array->count); + -: 2444: // when the packing is packed or uniform, there is no need to encode ARRAY type since all elements have this type + 22: 2445: uintToVarint(r, array->count); call 0 returned 100% - -: 2445: } - -: 2446: else { - 27: 2447: if (ctx->nibble == lowNbl) { + -: 2446: } + -: 2447: else { + 27: 2448: if (ctx->nibble == lowNbl) { branch 0 taken 96% (fallthrough) branch 1 taken 4% - 26: 2448: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); -call 0 returned 100% - -: 2449: } - -: 2450: else { - -: 2451: // high nibble - 1: 2452: storeTypeInHighNbl(array); - 1: 2453: uintToVarint(r, array->count); -call 0 returned 100% - -: 2454: } - -: 2455: } - -: 2456: - 49: 2457: bool pack = false; - -: 2458: size_t packCount; - 203: 2459: enumerateSArray(array, e, eIdx) { + 26: 2449: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); +call 0 returned 100% + -: 2450: } + -: 2451: else { + -: 2452: // high nibble + 1: 2453: storeTypeInHighNbl(array); + 1: 2454: uintToVarint(r, array->count); +call 0 returned 100% + -: 2455: } + -: 2456: } + -: 2457: + 49: 2458: bool pack = false; + -: 2459: size_t packCount; + 203: 2460: enumerateSArray(array, e, eIdx) { branch 0 taken 76% branch 1 taken 24% (fallthrough) - 154: 2460: if (!e) { + 154: 2461: if (!e) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 2461: // empty slots are represented as undefined elements - #####: 2462: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 2463: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); -call 0 never executed - #####: 2464: ctx->nibble = highNbl; - #####: 2465: ctx->nblOffset = (*r)->count -1; - -: 2466: } - -: 2467: else { - -: 2468: // high nibble - #####: 2469: ctx->nibble = lowNbl; - #####: 2470: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 2471: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; - -: 2472: } - -: 2473: } - -: 2474: else { - 154: 2475: if (!pack) { + -: 2462: // empty slots are represented as undefined elements + #####: 2463: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 2464: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); +call 0 never executed + #####: 2465: ctx->nibble = highNbl; + #####: 2466: ctx->nblOffset = (*r)->count -1; + -: 2467: } + -: 2468: else { + -: 2469: // high nibble + #####: 2470: ctx->nibble = lowNbl; + #####: 2471: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 2472: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; + -: 2473: } + -: 2474: } + -: 2475: else { + 154: 2476: if (!pack) { branch 0 taken 81% (fallthrough) branch 1 taken 19% - -: 2476: // scan array for packing - 124: 2477: if ((array->count - eIdx) > 3) { + -: 2477: // scan array for packing + 124: 2478: if ((array->count - eIdx) > 3) { branch 0 taken 32% (fallthrough) branch 1 taken 68% - -: 2478: // at least 4 elements, less than that is not worth it - 40: 2479: if ( e->type == DICT + -: 2479: // at least 4 elements, less than that is not worth it + 40: 2480: if ( e->type == DICT branch 0 taken 90% (fallthrough) branch 1 taken 10% - 36: 2480: or e->type == DOUBLE + 36: 2481: or e->type == DOUBLE branch 0 taken 94% (fallthrough) branch 1 taken 6% - 34: 2481: or e->type == INT + 34: 2482: or e->type == INT branch 0 taken 91% (fallthrough) branch 1 taken 9% - 31: 2482: or e->type == STRING + 31: 2483: or e->type == STRING branch 0 taken 94% (fallthrough) branch 1 taken 6% - 29: 2483: or e->type == ARRAY + 29: 2484: or e->type == ARRAY branch 0 taken 93% (fallthrough) branch 1 taken 7% - 27: 2484: or e->type == BYTES) { + 27: 2485: or e->type == BYTES) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - 13: 2485: type = e->type; - 13: 2486: packCount = 1; - 13: 2487: smallt *element = ((smallt **) &((array)->data))[eIdx+1]; - 45: 2488: for (size_t i = eIdx+1; i < (array)->count ; i++, element = ((smallt **) &((array)->data))[i]) { + 13: 2486: type = e->type; + 13: 2487: packCount = 1; + 13: 2488: smallt *element = ((smallt **) &((array)->data))[eIdx+1]; + 45: 2489: for (size_t i = eIdx+1; i < (array)->count ; i++, element = ((smallt **) &((array)->data))[i]) { branch 0 taken 100% branch 1 taken 0% (fallthrough) - 45: 2489: if (!element) { + 45: 2490: if (!element) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 2490: // null element are undefined - #####: 2491: break; - -: 2492: } - -: 2493: else { - 45: 2494: if (element->type != type) { + -: 2491: // null element are undefined + #####: 2492: break; + -: 2493: } + -: 2494: else { + 45: 2495: if (element->type != type) { branch 0 taken 29% (fallthrough) branch 1 taken 71% - 13: 2495: break; - -: 2496: } - 32: 2497: packCount++; - -: 2498: } // if element - -: 2499: } // for - 13: 2500: if (packCount > 3) { + 13: 2496: break; + -: 2497: } + 32: 2498: packCount++; + -: 2499: } // if element + -: 2500: } // for + 13: 2501: if (packCount > 3) { branch 0 taken 77% (fallthrough) branch 1 taken 23% - 10: 2501: type = PACKED_NET_SERIAL_TYPES[(u8)type]; - 10: 2502: pack = true; - -: 2503: } - -: 2504: } // test current element type - -: 2505: } // is array big enough - -: 2506: } // not already packing - -: 2507: - -: 2508: // encode element value - 154: 2509: switch(e->type) { + 10: 2502: type = PACKED_NET_SERIAL_TYPES[(u8)type]; + 10: 2503: pack = true; + -: 2504: } + -: 2505: } // test current element type + -: 2506: } // is array big enough + -: 2507: } // not already packing + -: 2508: + -: 2509: // encode element value + 154: 2510: switch(e->type) { branch 0 taken 18% branch 1 taken 22% branch 2 taken 10% @@ -3718,419 +3719,419 @@ branch 5 taken 14% branch 6 taken 10% branch 7 taken 0% branch 8 taken 0% - -: 2510: case UNDEFINED: - -: 2511: case CONTAINER: - 28: 2512: if (ctx->nibble == lowNbl) { + -: 2511: case UNDEFINED: + -: 2512: case CONTAINER: + 28: 2513: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 26: 2513: storeTypeOnly(e); -call 0 returned 100% - -: 2514: } - -: 2515: else { - -: 2516: // high nibble - 2: 2517: storeTypeInHighNbl(e); - -: 2518: } - 28: 2519: break; - -: 2520: case BOOL: - 34: 2521: if (!ctx->boolOffset) { + 26: 2514: storeTypeOnly(e); +call 0 returned 100% + -: 2515: } + -: 2516: else { + -: 2517: // high nibble + 2: 2518: storeTypeInHighNbl(e); + -: 2519: } + 28: 2520: break; + -: 2521: case BOOL: + 34: 2522: if (!ctx->boolOffset) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 2522: // new packed bools - 6: 2523: if (ctx->nibble == lowNbl) { + -: 2523: // new packed bools + 6: 2524: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 3: 2524: storeNew4bPackedBool(e); + 3: 2525: storeNew4bPackedBool(e); branch 0 taken 67% (fallthrough) branch 1 taken 33% call 2 returned 100% - -: 2525: } - -: 2526: else { - -: 2527: // high nibble, next byte is packed bools - 3: 2528: storeTypeInHighNbl(e); - 3: 2529: storeNew8bPackedBool(e); + -: 2526: } + -: 2527: else { + -: 2528: // high nibble, next byte is packed bools + 3: 2529: storeTypeInHighNbl(e); + 3: 2530: storeNew8bPackedBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2530: } - -: 2531: } - -: 2532: else { - -: 2533: // there was a bool before this one, fill bits in nibbles - 28: 2534: if (ctx->nibble == lowNbl) { + -: 2531: } + -: 2532: } + -: 2533: else { + -: 2534: // there was a bool before this one, fill bits in nibbles + 28: 2535: if (ctx->nibble == lowNbl) { branch 0 taken 61% (fallthrough) branch 1 taken 39% - 17: 2535: if (ctx->boolShift == 8) { + 17: 2536: if (ctx->boolShift == 8) { branch 0 taken 12% (fallthrough) branch 1 taken 88% - -: 2536: // previous packed bool is full - -: 2537: // this byte is the new packed bools - 2: 2538: storeNew4bPackedBool(e); + -: 2537: // previous packed bool is full + -: 2538: // this byte is the new packed bools + 2: 2539: storeNew4bPackedBool(e); branch 0 taken 50% (fallthrough) branch 1 taken 50% call 2 returned 100% - -: 2539: } - -: 2540: else { - 15: 2541: storeTypeOnly(e); + -: 2540: } + -: 2541: else { + 15: 2542: storeTypeOnly(e); call 0 returned 100% - 15: 2542: storeBool(e); + 15: 2543: storeBool(e); branch 0 taken 53% (fallthrough) branch 1 taken 47% - -: 2543: } - -: 2544: } - -: 2545: else { - -: 2546: // high nibble - 11: 2547: storeTypeInHighNbl(e); - 11: 2548: if (ctx->boolShift == 8) { + -: 2544: } + -: 2545: } + -: 2546: else { + -: 2547: // high nibble + 11: 2548: storeTypeInHighNbl(e); + 11: 2549: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 2549: // previous packed bool is full - -: 2550: // next byte is the new packed bools - 2: 2551: storeNew8bPackedBool(e); + -: 2550: // previous packed bool is full + -: 2551: // next byte is the new packed bools + 2: 2552: storeNew8bPackedBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2552: } - -: 2553: else { - 9: 2554: storeBool(e); + -: 2553: } + -: 2554: else { + 9: 2555: storeBool(e); branch 0 taken 78% (fallthrough) branch 1 taken 22% - -: 2555: } - -: 2556: } - -: 2557: } - 34: 2558: break; - -: 2559: case DICT: - 15: 2560: if (pack) { + -: 2556: } + -: 2557: } + -: 2558: } + 34: 2559: break; + -: 2560: case DICT: + 15: 2561: if (pack) { branch 0 taken 53% (fallthrough) branch 1 taken 47% - 8: 2561: if (type) { + 8: 2562: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2562: // this is the first packed element - 2: 2563: if (ctx->nibble == lowNbl) { + -: 2563: // this is the first packed element + 2: 2564: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2564: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2565: } - -: 2566: else { - -: 2567: // high nibble - -: 2568: // store type in high nibble - 1: 2569: ctx->nibble = lowNbl; - 1: 2570: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2571: *data |= type << 4; - 1: 2572: uintToVarint(r, packCount); -call 0 returned 100% - -: 2573: } - 2: 2574: type = 0; - -: 2575: } // if type - -: 2576: - 8: 2577: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2578: // stop packing when packCount == 0 - 8: 2579: packCount--; - 8: 2580: if (!packCount) pack = false; + 1: 2565: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2566: } + -: 2567: else { + -: 2568: // high nibble + -: 2569: // store type in high nibble + 1: 2570: ctx->nibble = lowNbl; + 1: 2571: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2572: *data |= type << 4; + 1: 2573: uintToVarint(r, packCount); +call 0 returned 100% + -: 2574: } + 2: 2575: type = 0; + -: 2576: } // if type + -: 2577: + 8: 2578: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/PACKED); +call 0 returned 100% + -: 2579: // stop packing when packCount == 0 + 8: 2580: packCount--; + 8: 2581: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2581: } // if pack - -: 2582: else - 7: 2583: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/NOPACKING); + -: 2582: } // if pack + -: 2583: else + 7: 2584: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/NOPACKING); call 0 returned 100% - 15: 2584: break; - -: 2585: case DOUBLE: - 10: 2586: if (pack) { + 15: 2585: break; + -: 2586: case DOUBLE: + 10: 2587: if (pack) { branch 0 taken 80% (fallthrough) branch 1 taken 20% - 8: 2587: if (type) { + 8: 2588: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2588: // this is the first packed element - 2: 2589: if (ctx->nibble == lowNbl) { + -: 2589: // this is the first packed element + 2: 2590: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2590: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2591: } - -: 2592: else { - -: 2593: // high nibble - -: 2594: // store type in high nibble - 1: 2595: ctx->nibble = lowNbl; - 1: 2596: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2597: *data |= type << 4; - 1: 2598: uintToVarint(r, packCount); -call 0 returned 100% - -: 2599: } - 2: 2600: type = 0; - -: 2601: } // if type - -: 2602: - 8: 2603: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); -call 0 returned 100% - -: 2604: // stop packing when packCount == 0 - 8: 2605: packCount--; - 8: 2606: if (!packCount) pack = false; + 1: 2591: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2592: } + -: 2593: else { + -: 2594: // high nibble + -: 2595: // store type in high nibble + 1: 2596: ctx->nibble = lowNbl; + 1: 2597: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2598: *data |= type << 4; + 1: 2599: uintToVarint(r, packCount); +call 0 returned 100% + -: 2600: } + 2: 2601: type = 0; + -: 2602: } // if type + -: 2603: + 8: 2604: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); +call 0 returned 100% + -: 2605: // stop packing when packCount == 0 + 8: 2606: packCount--; + 8: 2607: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2607: } // if pack - -: 2608: else { - 2: 2609: if (ctx->nibble == lowNbl) { + -: 2608: } // if pack + -: 2609: else { + 2: 2610: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2610: storeTypeOnly(e); -call 0 returned 100% - -: 2611: } - -: 2612: else { - -: 2613: // high nibble - 1: 2614: storeTypeInHighNbl(e); - -: 2615: } - 2: 2616: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); -call 0 returned 100% - -: 2617: } - 10: 2618: break; - -: 2619: case INT: - 30: 2620: if (pack) { + 1: 2611: storeTypeOnly(e); +call 0 returned 100% + -: 2612: } + -: 2613: else { + -: 2614: // high nibble + 1: 2615: storeTypeInHighNbl(e); + -: 2616: } + 2: 2617: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); +call 0 returned 100% + -: 2618: } + 10: 2619: break; + -: 2620: case INT: + 30: 2621: if (pack) { branch 0 taken 27% (fallthrough) branch 1 taken 73% - 8: 2621: if (type) { + 8: 2622: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2622: // this is the first packed element - 2: 2623: if (ctx->nibble == lowNbl) { + -: 2623: // this is the first packed element + 2: 2624: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2624: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2625: } - -: 2626: else { - -: 2627: // high nibble - -: 2628: // store type in high nibble - 1: 2629: ctx->nibble = lowNbl; - 1: 2630: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2631: *data |= type << 4; - 1: 2632: uintToVarint(r, packCount); -call 0 returned 100% - -: 2633: } - 2: 2634: type = 0; - -: 2635: } // if type - -: 2636: - 8: 2637: i64 v = ((sIntt *)&(e->type))->value; - 8: 2638: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2639: // stop packing when packCount == 0 - 8: 2640: packCount--; - 8: 2641: if (!packCount) pack = false; + 1: 2625: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2626: } + -: 2627: else { + -: 2628: // high nibble + -: 2629: // store type in high nibble + 1: 2630: ctx->nibble = lowNbl; + 1: 2631: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2632: *data |= type << 4; + 1: 2633: uintToVarint(r, packCount); +call 0 returned 100% + -: 2634: } + 2: 2635: type = 0; + -: 2636: } // if type + -: 2637: + 8: 2638: i64 v = ((sIntt *)&(e->type))->value; + 8: 2639: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2640: // stop packing when packCount == 0 + 8: 2641: packCount--; + 8: 2642: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2642: } // if pack - -: 2643: else { - -: 2644: // encode int to varint - -: 2645: // v is int64_t to convert to varint - 22: 2646: i64 v = ((sIntt *)&(e->type))->value; - 22: 2647: if (ctx->nibble == lowNbl) { + -: 2643: } // if pack + -: 2644: else { + -: 2645: // encode int to varint + -: 2646: // v is int64_t to convert to varint + 22: 2647: i64 v = ((sIntt *)&(e->type))->value; + 22: 2648: if (ctx->nibble == lowNbl) { branch 0 taken 82% (fallthrough) branch 1 taken 18% - -: 2648: // encode v with arithmetic shifts - 18: 2649: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2650: } - -: 2651: else { - -: 2652: // high nibble - 4: 2653: storeTypeInHighNbl(e); - 4: 2654: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2655: } - -: 2656: } - 30: 2657: break; - -: 2658: case STRING: - 21: 2659: if (pack) { + -: 2649: // encode v with arithmetic shifts + 18: 2650: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2651: } + -: 2652: else { + -: 2653: // high nibble + 4: 2654: storeTypeInHighNbl(e); + 4: 2655: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2656: } + -: 2657: } + 30: 2658: break; + -: 2659: case STRING: + 21: 2660: if (pack) { branch 0 taken 38% (fallthrough) branch 1 taken 62% - 8: 2660: if (type) { + 8: 2661: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2661: // this is the first packed element - 2: 2662: if (ctx->nibble == lowNbl) { + -: 2662: // this is the first packed element + 2: 2663: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2663: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2664: } - -: 2665: else { - -: 2666: // high nibble - -: 2667: // store type in high nibble - 1: 2668: ctx->nibble = lowNbl; - 1: 2669: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2670: *data |= type << 4; - 1: 2671: uintToVarint(r, packCount); -call 0 returned 100% - -: 2672: } - 2: 2673: type = 0; - -: 2674: } // if type - -: 2675: - 8: 2676: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); -call 0 returned 100% - -: 2677: // stop packing when packCount == 0 - 8: 2678: packCount--; - 8: 2679: if (!packCount) pack = false; + 1: 2664: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2665: } + -: 2666: else { + -: 2667: // high nibble + -: 2668: // store type in high nibble + 1: 2669: ctx->nibble = lowNbl; + 1: 2670: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2671: *data |= type << 4; + 1: 2672: uintToVarint(r, packCount); +call 0 returned 100% + -: 2673: } + 2: 2674: type = 0; + -: 2675: } // if type + -: 2676: + 8: 2677: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); +call 0 returned 100% + -: 2678: // stop packing when packCount == 0 + 8: 2679: packCount--; + 8: 2680: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2680: } // if pack - -: 2681: else { - 13: 2682: if (ctx->nibble == lowNbl) { + -: 2681: } // if pack + -: 2682: else { + 13: 2683: if (ctx->nibble == lowNbl) { branch 0 taken 69% (fallthrough) branch 1 taken 31% - 9: 2683: storeTypeOnly(e); -call 0 returned 100% - -: 2684: } - -: 2685: else { - -: 2686: // high nibble - 4: 2687: storeTypeInHighNbl(e); - -: 2688: } - 13: 2689: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); -call 0 returned 100% - -: 2690: } - 21: 2691: break; - -: 2692: case ARRAY: - 16: 2693: if (pack) { + 9: 2684: storeTypeOnly(e); +call 0 returned 100% + -: 2685: } + -: 2686: else { + -: 2687: // high nibble + 4: 2688: storeTypeInHighNbl(e); + -: 2689: } + 13: 2690: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); +call 0 returned 100% + -: 2691: } + 21: 2692: break; + -: 2693: case ARRAY: + 16: 2694: if (pack) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 8: 2694: if (type) { + 8: 2695: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2695: // this is the first packed element - 2: 2696: if (ctx->nibble == lowNbl) { + -: 2696: // this is the first packed element + 2: 2697: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2697: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2698: } - -: 2699: else { - -: 2700: // high nibble - -: 2701: // store type in high nibble - 1: 2702: ctx->nibble = lowNbl; - 1: 2703: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2704: *data |= type << 4; - 1: 2705: uintToVarint(r, packCount); -call 0 returned 100% - -: 2706: } - 2: 2707: type = 0; - -: 2708: } // if type - -: 2709: - 8: 2710: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2711: // stop packing when packCount == 0 - 8: 2712: packCount--; - 8: 2713: if (!packCount) pack = false; + 1: 2698: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2699: } + -: 2700: else { + -: 2701: // high nibble + -: 2702: // store type in high nibble + 1: 2703: ctx->nibble = lowNbl; + 1: 2704: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2705: *data |= type << 4; + 1: 2706: uintToVarint(r, packCount); +call 0 returned 100% + -: 2707: } + 2: 2708: type = 0; + -: 2709: } // if type + -: 2710: + 8: 2711: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/PACKED); +call 0 returned 100% + -: 2712: // stop packing when packCount == 0 + 8: 2713: packCount--; + 8: 2714: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2714: } // if pack - -: 2715: else - 8: 2716: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/NOPACKING); + -: 2715: } // if pack + -: 2716: else + 8: 2717: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/NOPACKING); call 0 returned 100% - 16: 2717: break; - -: 2718: case BYTES: - #####: 2719: if (pack) { + 16: 2718: break; + -: 2719: case BYTES: + #####: 2720: if (pack) { branch 0 never executed branch 1 never executed - #####: 2720: if (type) { + #####: 2721: if (type) { branch 0 never executed branch 1 never executed - -: 2721: // this is the first packed element - #####: 2722: if (ctx->nibble == lowNbl) { + -: 2722: // this is the first packed element + #####: 2723: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 2723: uintToNetTypeVarint(r, type, packCount); + #####: 2724: uintToNetTypeVarint(r, type, packCount); call 0 never executed - -: 2724: } - -: 2725: else { - -: 2726: // high nibble - -: 2727: // store type in high nibble - #####: 2728: ctx->nibble = lowNbl; - #####: 2729: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 2730: *data |= type << 4; - #####: 2731: uintToVarint(r, packCount); + -: 2725: } + -: 2726: else { + -: 2727: // high nibble + -: 2728: // store type in high nibble + #####: 2729: ctx->nibble = lowNbl; + #####: 2730: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 2731: *data |= type << 4; + #####: 2732: uintToVarint(r, packCount); call 0 never executed - -: 2732: } - #####: 2733: type = 0; - -: 2734: } // if type - -: 2735: - #####: 2736: B = (sBytest *)e; - #####: 2737: uintToVarint(r, B->count); + -: 2733: } + #####: 2734: type = 0; + -: 2735: } // if type + -: 2736: + #####: 2737: B = (sBytest *)e; + #####: 2738: uintToVarint(r, B->count); call 0 never executed - #####: 2738: sBytesPushBuffer(r, &(B->data), B->count); + #####: 2739: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 2739: // stop packing when packCount == 0 - #####: 2740: packCount--; - #####: 2741: if (!packCount) pack = false; + -: 2740: // stop packing when packCount == 0 + #####: 2741: packCount--; + #####: 2742: if (!packCount) pack = false; branch 0 never executed branch 1 never executed - -: 2742: } // if pack - -: 2743: else { - #####: 2744: B = (sBytest *)e; - #####: 2745: if (ctx->nibble == lowNbl) { + -: 2743: } // if pack + -: 2744: else { + #####: 2745: B = (sBytest *)e; + #####: 2746: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 2746: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); + #####: 2747: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); call 0 never executed - -: 2747: } - -: 2748: else { - -: 2749: // high nibble - #####: 2750: storeTypeInHighNbl(e); - #####: 2751: uintToVarint(r, B->count); + -: 2748: } + -: 2749: else { + -: 2750: // high nibble + #####: 2751: storeTypeInHighNbl(e); + #####: 2752: uintToVarint(r, B->count); call 0 never executed - -: 2752: } - #####: 2753: sBytesPushBuffer(r, &(B->data), B->count); + -: 2753: } + #####: 2754: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 2754: } - #####: 2755: break; - -: 2756: } - -: 2757: } - -: 2758: } - 49: 2759: ret; - -: 2760:} - -: 2761: -function serialNetSerial called 78 returned 100% blocks executed 80% - 78: 2762:internal smallBytest* serialNetSerial(smallJsont *self) { - -: 2763: - 78: 2764: smallt *o = getsoG(self); + -: 2755: } + #####: 2756: break; + -: 2757: } + -: 2758: } + -: 2759: } + 49: 2760: ret; + -: 2761:} + -: 2762: +function serialNetSerial called 79 returned 100% blocks executed 80% + 79: 2763:internal smallBytest* serialNetSerial(smallJsont *self) { + -: 2764: + 79: 2765: smallt *o = getsoG(self); call 0 returned 100% - -: 2765: - 78: 2766: if (o == NULL) + -: 2766: + 79: 2767: if (o == NULL) branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2767: ret NULL; - -: 2768: - 78: 2769: sBytest *B = netSerial(o); + #####: 2768: ret NULL; + -: 2769: + 79: 2770: sBytest *B = netSerial(o); call 0 returned 100% - -: 2770: - 78: 2771: if (!B) { + -: 2771: + 79: 2772: if (!B) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2772: ret NULL; - -: 2773: } - -: 2774: - 78: 2775: createAllocateSmallBytes(r); -call 0 returned 100% - 78: 2776: r->B = B; - 78: 2777: ret r; - -: 2778:} - -: 2779: - -: 2780:// ------------------------------------- - -: 2781:// Deserializers - -: 2782: - -: 2783:// level 0 - -: 2784:// like smallJson with ints and length encoded as varints - -: 2785: - -: 2786:/** - -: 2787: * deserializer top function - -: 2788: */ + #####: 2773: ret NULL; + -: 2774: } + -: 2775: + 79: 2776: createAllocateSmallBytes(r); +call 0 returned 100% + 79: 2777: r->B = B; + 79: 2778: ret r; + -: 2779:} + -: 2780: + -: 2781:// ------------------------------------- + -: 2782:// Deserializers + -: 2783: + -: 2784:// level 0 + -: 2785:// like smallJson with ints and length encoded as varints + -: 2786: + -: 2787:/** + -: 2788: * deserializer top function + -: 2789: */ function netDeserialLevel0 called 0 returned 0% blocks executed 0% - #####: 2789:internal smallt* netDeserialLevel0(sBytest *obj) { - #####: 2790: smallt *r = NULL; - #####: 2791: double *D = NULL; - #####: 2792: char *s = NULL; - #####: 2793: sBytest *B = NULL; - -: 2794: uint32_t count; - #####: 2795: char *data = NULL; - -: 2796: - #####: 2797: switch(obj->data & 0xF) { + #####: 2790:internal smallt* netDeserialLevel0(sBytest *obj) { + #####: 2791: smallt *r = NULL; + #####: 2792: double *D = NULL; + #####: 2793: char *s = NULL; + #####: 2794: sBytest *B = NULL; + -: 2795: uint32_t count; + #####: 2796: char *data = NULL; + -: 2797: + #####: 2798: switch(obj->data & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4140,103 +4141,103 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 2798: case S_UNDEFINED: - #####: 2799: r = (smallt *) allocSUndefined(); -call 0 never executed - #####: 2800: break; - -: 2801: case S_BOOL: - #####: 2802: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 never executed - #####: 2803: break; - -: 2804: case S_DICT: - #####: 2805: data = (char *)&(obj->data); - #####: 2806: dictNetDeserialLevel0((sDictt **)&r, &data); -call 0 never executed - #####: 2807: break; - -: 2808: case S_DOUBLE: - #####: 2809: data = &(obj->data)+1; - #####: 2810: D = (double *)data; - #####: 2811: r = (smallt *) allocSDouble(*D); -call 0 never executed - #####: 2812: break; - -: 2813: case S_INT: - #####: 2814: data = &(obj->data); - #####: 2815: i64 v = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 2816: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 2817: r = (smallt *) allocSInt(v); -call 0 never executed - #####: 2818: break; - -: 2819: case S_STRING: - #####: 2820: s = (char *)&(obj->data)+1; - #####: 2821: r = (smallt *) allocSStringTiny(s); -call 0 never executed - #####: 2822: break; - -: 2823: case S_ARRAY: - #####: 2824: data = (char *)&(obj->data); - #####: 2825: arrayNetDeserialLevel0((sArrayt **)&r, &data); -call 0 never executed - #####: 2826: break; - -: 2827: case S_BYTES: - #####: 2828: B = allocSBytes(); -call 0 never executed - #####: 2829: data = &(obj->data); - #####: 2830: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 2831: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 2832: r = (smallt *)B; - #####: 2833: break; - -: 2834: } - -: 2835: - #####: 2836: ret r; - -: 2837:} - -: 2838: - -: 2839:/** - -: 2840: * deserialize dictionary from data - -: 2841: * - -: 2842: * a new dictionary is allocated - -: 2843: * - -: 2844: * \param - -: 2845: * dict dictionary holding the elements - -: 2846: * data serialized dictionary - -: 2847: */ + -: 2799: case S_UNDEFINED: + #####: 2800: r = (smallt *) allocSUndefined(); +call 0 never executed + #####: 2801: break; + -: 2802: case S_BOOL: + #####: 2803: r = (smallt *) allocSBool(obj->data & 0x10); +call 0 never executed + #####: 2804: break; + -: 2805: case S_DICT: + #####: 2806: data = (char *)&(obj->data); + #####: 2807: dictNetDeserialLevel0((sDictt **)&r, &data); +call 0 never executed + #####: 2808: break; + -: 2809: case S_DOUBLE: + #####: 2810: data = &(obj->data)+1; + #####: 2811: D = (double *)data; + #####: 2812: r = (smallt *) allocSDouble(*D); +call 0 never executed + #####: 2813: break; + -: 2814: case S_INT: + #####: 2815: data = &(obj->data); + #####: 2816: u64 v = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 2817: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 2818: r = (smallt *) allocSInt(v); +call 0 never executed + #####: 2819: break; + -: 2820: case S_STRING: + #####: 2821: s = (char *)&(obj->data)+1; + #####: 2822: r = (smallt *) allocSStringTiny(s); +call 0 never executed + #####: 2823: break; + -: 2824: case S_ARRAY: + #####: 2825: data = (char *)&(obj->data); + #####: 2826: arrayNetDeserialLevel0((sArrayt **)&r, &data); +call 0 never executed + #####: 2827: break; + -: 2828: case S_BYTES: + #####: 2829: B = allocSBytes(); +call 0 never executed + #####: 2830: data = &(obj->data); + #####: 2831: count = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 2832: sBytesPushBuffer(&B, data, count); +call 0 never executed + #####: 2833: r = (smallt *)B; + #####: 2834: break; + -: 2835: } + -: 2836: + #####: 2837: ret r; + -: 2838:} + -: 2839: + -: 2840:/** + -: 2841: * deserialize dictionary from data + -: 2842: * + -: 2843: * a new dictionary is allocated + -: 2844: * + -: 2845: * \param + -: 2846: * dict dictionary holding the elements + -: 2847: * data serialized dictionary + -: 2848: */ function dictNetDeserialLevel0 called 0 returned 0% blocks executed 0% - #####: 2848:internal void dictNetDeserialLevel0(sDictt **dict, char **data) { - #####: 2849: sUndefinedt *u = NULL; - #####: 2850: sBoolt *bo = NULL; - #####: 2851: double *D = NULL; - #####: 2852: sDoublet *Do = NULL; - #####: 2853: sDictt *d = NULL; - #####: 2854: sIntt *io = NULL; - #####: 2855: char *s = NULL; - #####: 2856: sStringt *so = NULL; - #####: 2857: sArrayt *a = NULL; - #####: 2858: sBytest *B = NULL; - -: 2859: uint32_t count; - -: 2860: uint32_t dictCount; - -: 2861: - #####: 2862: dictCount = netTypeVarintToUint((u8**)data); -call 0 never executed - -: 2863: - #####: 2864: if (!dictCount) { -branch 0 never executed -branch 1 never executed - #####: 2865: *dict = allocSDict(); -call 0 never executed - #####: 2866: ret; - -: 2867: } - -: 2868: - #####: 2869: loop(dictCount) { -branch 0 never executed -branch 1 never executed - -: 2870: char type; - -: 2871: char *key; - #####: 2872: key = *data; - #####: 2873: *data += strlen(key)+1; - #####: 2874: type = **data; - -: 2875: - #####: 2876: switch(type & 0xF) { + #####: 2849:internal void dictNetDeserialLevel0(sDictt **dict, char **data) { + #####: 2850: sUndefinedt *u = NULL; + #####: 2851: sBoolt *bo = NULL; + #####: 2852: double *D = NULL; + #####: 2853: sDoublet *Do = NULL; + #####: 2854: sDictt *d = NULL; + #####: 2855: sIntt *io = NULL; + #####: 2856: char *s = NULL; + #####: 2857: sStringt *so = NULL; + #####: 2858: sArrayt *a = NULL; + #####: 2859: sBytest *B = NULL; + -: 2860: uint32_t count; + -: 2861: uint32_t dictCount; + -: 2862: + #####: 2863: dictCount = netTypeVarintToUint((u8**)data); +call 0 never executed + -: 2864: + #####: 2865: if (!dictCount) { +branch 0 never executed +branch 1 never executed + #####: 2866: *dict = allocSDict(); +call 0 never executed + #####: 2867: ret; + -: 2868: } + -: 2869: + #####: 2870: loop(dictCount) { +branch 0 never executed +branch 1 never executed + -: 2871: char type; + -: 2872: char *key; + #####: 2873: key = *data; + #####: 2874: *data += strlen(key)+1; + #####: 2875: type = **data; + -: 2876: + #####: 2877: switch(type & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4246,119 +4247,119 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 2877: case S_UNDEFINED: - #####: 2878: (*data)++; - #####: 2879: u = allocSUndefined(); -call 0 never executed - #####: 2880: sDictPushTiny(dict, key, (smallt *) u); -call 0 never executed - #####: 2881: break; - -: 2882: case S_BOOL: - #####: 2883: (*data)++; - #####: 2884: bo = allocSBool(type & 0x10); -call 0 never executed - #####: 2885: sDictPushTiny(dict, key, (smallt *) bo); -call 0 never executed - #####: 2886: break; - -: 2887: case S_DICT: - #####: 2888: d = NULL; - #####: 2889: dictNetDeserialLevel0(&d, data); -call 0 never executed - #####: 2890: sDictPushTiny(dict, key, (smallt *) d); -call 0 never executed - #####: 2891: break; - -: 2892: case S_DOUBLE: - #####: 2893: (*data)++; - #####: 2894: D = (double *)(*data); - #####: 2895: *data += sizeof(double); - #####: 2896: Do = allocSDouble(*D); -call 0 never executed - #####: 2897: sDictPushTiny(dict, key, (smallt *) Do); -call 0 never executed - #####: 2898: break; - -: 2899: case S_INT: { - #####: 2900: i64 v = netTypeVarintToUint((u8**)data); -call 0 never executed - #####: 2901: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 2902: io = allocSInt(v); -call 0 never executed - #####: 2903: sDictPushTiny(dict, key, (smallt *) io); -call 0 never executed - -: 2904: } - #####: 2905: break; - -: 2906: case S_STRING: - #####: 2907: (*data)++; - #####: 2908: s = (char *)(*data); - #####: 2909: *data += strlen(s)+1; - #####: 2910: so = allocSStringTiny(s); -call 0 never executed - #####: 2911: sDictPushTiny(dict, key, (smallt *) so); -call 0 never executed - #####: 2912: break; - -: 2913: case S_ARRAY: - #####: 2914: a = NULL; - #####: 2915: arrayNetDeserialLevel0(&a, data); -call 0 never executed - #####: 2916: sDictPushTiny(dict, key, (smallt *) a); -call 0 never executed - #####: 2917: break; - -: 2918: case S_BYTES: - #####: 2919: B = allocSBytes(); -call 0 never executed - #####: 2920: count = netTypeVarintToUint((u8**)data); -call 0 never executed - #####: 2921: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 2922: *data += count; - #####: 2923: sDictPushTiny(dict, key, (smallt *) B); -call 0 never executed - #####: 2924: break; - -: 2925: } - -: 2926: } - -: 2927:} - -: 2928: - -: 2929:/** - -: 2930: * deserialize array from data - -: 2931: * - -: 2932: * a new array is allocated - -: 2933: * - -: 2934: * \param - -: 2935: * array holding the elements - -: 2936: * data serialized dictionary - -: 2937: */ + -: 2878: case S_UNDEFINED: + #####: 2879: (*data)++; + #####: 2880: u = allocSUndefined(); +call 0 never executed + #####: 2881: sDictPushTiny(dict, key, (smallt *) u); +call 0 never executed + #####: 2882: break; + -: 2883: case S_BOOL: + #####: 2884: (*data)++; + #####: 2885: bo = allocSBool(type & 0x10); +call 0 never executed + #####: 2886: sDictPushTiny(dict, key, (smallt *) bo); +call 0 never executed + #####: 2887: break; + -: 2888: case S_DICT: + #####: 2889: d = NULL; + #####: 2890: dictNetDeserialLevel0(&d, data); +call 0 never executed + #####: 2891: sDictPushTiny(dict, key, (smallt *) d); +call 0 never executed + #####: 2892: break; + -: 2893: case S_DOUBLE: + #####: 2894: (*data)++; + #####: 2895: D = (double *)(*data); + #####: 2896: *data += sizeof(double); + #####: 2897: Do = allocSDouble(*D); +call 0 never executed + #####: 2898: sDictPushTiny(dict, key, (smallt *) Do); +call 0 never executed + #####: 2899: break; + -: 2900: case S_INT: { + #####: 2901: u64 v = netTypeVarintToUint((u8**)data); +call 0 never executed + #####: 2902: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 2903: io = allocSInt(v); +call 0 never executed + #####: 2904: sDictPushTiny(dict, key, (smallt *) io); +call 0 never executed + -: 2905: } + #####: 2906: break; + -: 2907: case S_STRING: + #####: 2908: (*data)++; + #####: 2909: s = (char *)(*data); + #####: 2910: *data += strlen(s)+1; + #####: 2911: so = allocSStringTiny(s); +call 0 never executed + #####: 2912: sDictPushTiny(dict, key, (smallt *) so); +call 0 never executed + #####: 2913: break; + -: 2914: case S_ARRAY: + #####: 2915: a = NULL; + #####: 2916: arrayNetDeserialLevel0(&a, data); +call 0 never executed + #####: 2917: sDictPushTiny(dict, key, (smallt *) a); +call 0 never executed + #####: 2918: break; + -: 2919: case S_BYTES: + #####: 2920: B = allocSBytes(); +call 0 never executed + #####: 2921: count = netTypeVarintToUint((u8**)data); +call 0 never executed + #####: 2922: sBytesPushBuffer(&B, data, count); +call 0 never executed + #####: 2923: *data += count; + #####: 2924: sDictPushTiny(dict, key, (smallt *) B); +call 0 never executed + #####: 2925: break; + -: 2926: } + -: 2927: } + -: 2928:} + -: 2929: + -: 2930:/** + -: 2931: * deserialize array from data + -: 2932: * + -: 2933: * a new array is allocated + -: 2934: * + -: 2935: * \param + -: 2936: * array holding the elements + -: 2937: * data serialized dictionary + -: 2938: */ function arrayNetDeserialLevel0 called 0 returned 0% blocks executed 0% - #####: 2938:internal void arrayNetDeserialLevel0(sArrayt **array, char **data) { - #####: 2939: sUndefinedt *u = NULL; - #####: 2940: sBoolt *bo = NULL; - #####: 2941: double *D = NULL; - #####: 2942: sDoublet *Do = NULL; - #####: 2943: sDictt *d = NULL; - #####: 2944: sIntt *io = NULL; - #####: 2945: char *s = NULL; - #####: 2946: sStringt *so = NULL; - #####: 2947: sArrayt *a = NULL; - #####: 2948: sBytest *B = NULL; - -: 2949: uint32_t count; - -: 2950: uint32_t arrayCount; - -: 2951: - #####: 2952: arrayCount = netTypeVarintToUint((u8**)data); + #####: 2939:internal void arrayNetDeserialLevel0(sArrayt **array, char **data) { + #####: 2940: sUndefinedt *u = NULL; + #####: 2941: sBoolt *bo = NULL; + #####: 2942: double *D = NULL; + #####: 2943: sDoublet *Do = NULL; + #####: 2944: sDictt *d = NULL; + #####: 2945: sIntt *io = NULL; + #####: 2946: char *s = NULL; + #####: 2947: sStringt *so = NULL; + #####: 2948: sArrayt *a = NULL; + #####: 2949: sBytest *B = NULL; + -: 2950: uint32_t count; + -: 2951: uint32_t arrayCount; + -: 2952: + #####: 2953: arrayCount = netTypeVarintToUint((u8**)data); call 0 never executed - -: 2953: - #####: 2954: if (!arrayCount) { + -: 2954: + #####: 2955: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 2955: *array = allocSArray();; + #####: 2956: *array = allocSArray();; call 0 never executed - #####: 2956: ret; - -: 2957: } - -: 2958: - #####: 2959: loop(arrayCount) { + #####: 2957: ret; + -: 2958: } + -: 2959: + #####: 2960: loop(arrayCount) { branch 0 never executed branch 1 never executed - -: 2960: char type; - #####: 2961: type = **data; - -: 2962: - #####: 2963: switch(type & 0xF) { + -: 2961: char type; + #####: 2962: type = **data; + -: 2963: + #####: 2964: switch(type & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4368,125 +4369,125 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 2964: case S_UNDEFINED: - #####: 2965: (*data)++; - #####: 2966: u = allocSUndefined(); + -: 2965: case S_UNDEFINED: + #####: 2966: (*data)++; + #####: 2967: u = allocSUndefined(); call 0 never executed - #####: 2967: sArrayPushTiny(array, (smallt *) u); + #####: 2968: sArrayPushTiny(array, (smallt *) u); call 0 never executed - #####: 2968: break; - -: 2969: case S_BOOL: - #####: 2970: (*data)++; - #####: 2971: bo = allocSBool(type & 0x10); + #####: 2969: break; + -: 2970: case S_BOOL: + #####: 2971: (*data)++; + #####: 2972: bo = allocSBool(type & 0x10); call 0 never executed - #####: 2972: sArrayPushTiny(array, (smallt *) bo); + #####: 2973: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - #####: 2973: break; - -: 2974: case S_DICT: - #####: 2975: d = NULL; - #####: 2976: dictNetDeserialLevel0(&d, data); + #####: 2974: break; + -: 2975: case S_DICT: + #####: 2976: d = NULL; + #####: 2977: dictNetDeserialLevel0(&d, data); call 0 never executed - #####: 2977: sArrayPushTiny(array, (smallt *) d); + #####: 2978: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 2978: break; - -: 2979: case S_DOUBLE: - #####: 2980: (*data)++; - #####: 2981: D = (double *)(*data); - #####: 2982: *data += sizeof(double); - #####: 2983: Do = allocSDouble(*D); + #####: 2979: break; + -: 2980: case S_DOUBLE: + #####: 2981: (*data)++; + #####: 2982: D = (double *)(*data); + #####: 2983: *data += sizeof(double); + #####: 2984: Do = allocSDouble(*D); call 0 never executed - #####: 2984: sArrayPushTiny(array, (smallt *) Do); + #####: 2985: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - #####: 2985: break; - -: 2986: case S_INT: { - #####: 2987: i64 v = netTypeVarintToUint((u8**)data); + #####: 2986: break; + -: 2987: case S_INT: { + #####: 2988: u64 v = netTypeVarintToUint((u8**)data); call 0 never executed - #####: 2988: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 2989: io = allocSInt(v); + #####: 2989: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 2990: io = allocSInt(v); call 0 never executed - #####: 2990: sArrayPushTiny(array, (smallt *) io); + #####: 2991: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 2991: } - #####: 2992: break; - -: 2993: case S_STRING: - #####: 2994: (*data)++; - #####: 2995: s = (char *)(*data); - #####: 2996: *data += strlen(s)+1; - #####: 2997: so = allocSStringTiny(s); + -: 2992: } + #####: 2993: break; + -: 2994: case S_STRING: + #####: 2995: (*data)++; + #####: 2996: s = (char *)(*data); + #####: 2997: *data += strlen(s)+1; + #####: 2998: so = allocSStringTiny(s); call 0 never executed - #####: 2998: sArrayPushTiny(array, (smallt *) so); + #####: 2999: sArrayPushTiny(array, (smallt *) so); call 0 never executed - #####: 2999: break; - -: 3000: case S_ARRAY: - #####: 3001: a = NULL; - #####: 3002: arrayNetDeserialLevel0(&a, data); + #####: 3000: break; + -: 3001: case S_ARRAY: + #####: 3002: a = NULL; + #####: 3003: arrayNetDeserialLevel0(&a, data); call 0 never executed - #####: 3003: sArrayPushTiny(array, (smallt *) a); + #####: 3004: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 3004: break; - -: 3005: case S_BYTES: - #####: 3006: B = allocSBytes(); + #####: 3005: break; + -: 3006: case S_BYTES: + #####: 3007: B = allocSBytes(); call 0 never executed - #####: 3007: count = netTypeVarintToUint((u8**)data); + #####: 3008: count = netTypeVarintToUint((u8**)data); call 0 never executed - #####: 3008: sBytesPushBuffer(&B, data, count); + #####: 3009: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3009: *data += count; - #####: 3010: sArrayPushTiny(array, (smallt *) B); + #####: 3010: *data += count; + #####: 3011: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 3011: break; - -: 3012: } - -: 3013: } - -: 3014:} - -: 3015: + #####: 3012: break; + -: 3013: } + -: 3014: } + -: 3015:} + -: 3016: function deserialNetSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 3016:internal smallJsont* deserialNetSerialLevel0(smallJsont *self, smallBytest *data) { - -: 3017: - #####: 3018: if (!data or !data->B or !data->B->count) { + #####: 3017:internal smallJsont* deserialNetSerialLevel0(smallJsont *self, smallBytest *data) { + -: 3018: + #####: 3019: if (!data or !data->B or !data->B->count) { branch 0 never executed branch 1 never executed branch 2 never executed branch 3 never executed branch 4 never executed branch 5 never executed - #####: 3019: ret self; - -: 3020: } - -: 3021: - #####: 3022: smallt *o = netDeserialLevel0(data->B); -call 0 never executed - -: 3023: - #####: 3024: if (!o) { -branch 0 never executed -branch 1 never executed - #####: 3025: ret self; - -: 3026: } - -: 3027: - #####: 3028: freeG(self); -call 0 never executed - -: 3029: - #####: 3030: setsoG(self, o); -call 0 never executed - -: 3031: - #####: 3032: ret self; - -: 3033:} - -: 3034: - -: 3035:// level 1 - -: 3036:// like level 0 with type encoded in nibbles and bools are packed - -: 3037: - -: 3038:/** - -: 3039: * deserializer top function - -: 3040: */ + #####: 3020: ret self; + -: 3021: } + -: 3022: + #####: 3023: smallt *o = netDeserialLevel0(data->B); +call 0 never executed + -: 3024: + #####: 3025: if (!o) { +branch 0 never executed +branch 1 never executed + #####: 3026: ret self; + -: 3027: } + -: 3028: + #####: 3029: freeG(self); +call 0 never executed + -: 3030: + #####: 3031: setsoG(self, o); +call 0 never executed + -: 3032: + #####: 3033: ret self; + -: 3034:} + -: 3035: + -: 3036:// level 1 + -: 3037:// like level 0 with type encoded in nibbles and bools are packed + -: 3038: + -: 3039:/** + -: 3040: * deserializer top function + -: 3041: */ function netDeserialLevel1 called 0 returned 0% blocks executed 0% - #####: 3041:internal smallt* netDeserialLevel1(sBytest *obj) { - #####: 3042: smallt *r = NULL; - #####: 3043: double *D = NULL; - #####: 3044: char *s = NULL; - #####: 3045: sBytest *B = NULL; - -: 3046: uint32_t count; - #####: 3047: char *data = NULL; - #####: 3048: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; - -: 3049: - #####: 3050: switch(obj->data & 0xF) { + #####: 3042:internal smallt* netDeserialLevel1(sBytest *obj) { + #####: 3043: smallt *r = NULL; + #####: 3044: double *D = NULL; + #####: 3045: char *s = NULL; + #####: 3046: sBytest *B = NULL; + -: 3047: uint32_t count; + #####: 3048: char *data = NULL; + #####: 3049: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; + -: 3050: + #####: 3051: switch(obj->data & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4496,130 +4497,130 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 3051: case S_UNDEFINED: - #####: 3052: r = (smallt *) allocSUndefined(); -call 0 never executed - #####: 3053: break; - -: 3054: case S_BOOL: - #####: 3055: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 never executed - #####: 3056: break; - -: 3057: case S_DICT: - #####: 3058: data = (char *)&(obj->data); - -: 3059: //debug - ctx.dbuf = (u8*) data; - #####: 3060: dictNetDeserialLevel1((sDictt **)&r, (u8**)&data, &ctx); -call 0 never executed - #####: 3061: break; - -: 3062: case S_DOUBLE: - #####: 3063: data = &(obj->data)+1; - #####: 3064: D = (double *)data; - #####: 3065: r = (smallt *) allocSDouble(*D); -call 0 never executed - #####: 3066: break; - -: 3067: case S_INT: - #####: 3068: data = &(obj->data); - #####: 3069: i64 v = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 3070: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3071: r = (smallt *) allocSInt(v); -call 0 never executed - #####: 3072: break; - -: 3073: case S_STRING: - #####: 3074: s = (char *)&(obj->data)+1; - #####: 3075: r = (smallt *) allocSStringTiny(s); -call 0 never executed - #####: 3076: break; - -: 3077: case S_ARRAY: - #####: 3078: data = (char *)&(obj->data); - -: 3079: //debug - ctx.dbuf = (u8*) data; - #####: 3080: arrayNetDeserialLevel1((sArrayt **)&r, (u8**)&data, &ctx); -call 0 never executed - #####: 3081: break; - -: 3082: case S_BYTES: - #####: 3083: B = allocSBytes(); -call 0 never executed - #####: 3084: data = &(obj->data); - #####: 3085: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 3086: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 3087: r = (smallt *)B; - #####: 3088: break; - -: 3089: } - -: 3090: - #####: 3091: ret r; - -: 3092:} - -: 3093: - -: 3094:/** - -: 3095: * deserialize dictionary from data - -: 3096: * - -: 3097: * a new dictionary is allocated - -: 3098: * - -: 3099: * \param - -: 3100: * dict dictionary holding the elements - -: 3101: * data serialized dictionary - -: 3102: */ + -: 3052: case S_UNDEFINED: + #####: 3053: r = (smallt *) allocSUndefined(); +call 0 never executed + #####: 3054: break; + -: 3055: case S_BOOL: + #####: 3056: r = (smallt *) allocSBool(obj->data & 0x10); +call 0 never executed + #####: 3057: break; + -: 3058: case S_DICT: + #####: 3059: data = (char *)&(obj->data); + -: 3060: //debug - ctx.dbuf = (u8*) data; + #####: 3061: dictNetDeserialLevel1((sDictt **)&r, (u8**)&data, &ctx); +call 0 never executed + #####: 3062: break; + -: 3063: case S_DOUBLE: + #####: 3064: data = &(obj->data)+1; + #####: 3065: D = (double *)data; + #####: 3066: r = (smallt *) allocSDouble(*D); +call 0 never executed + #####: 3067: break; + -: 3068: case S_INT: + #####: 3069: data = &(obj->data); + #####: 3070: u64 v = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 3071: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3072: r = (smallt *) allocSInt(v); +call 0 never executed + #####: 3073: break; + -: 3074: case S_STRING: + #####: 3075: s = (char *)&(obj->data)+1; + #####: 3076: r = (smallt *) allocSStringTiny(s); +call 0 never executed + #####: 3077: break; + -: 3078: case S_ARRAY: + #####: 3079: data = (char *)&(obj->data); + -: 3080: //debug - ctx.dbuf = (u8*) data; + #####: 3081: arrayNetDeserialLevel1((sArrayt **)&r, (u8**)&data, &ctx); +call 0 never executed + #####: 3082: break; + -: 3083: case S_BYTES: + #####: 3084: B = allocSBytes(); +call 0 never executed + #####: 3085: data = &(obj->data); + #####: 3086: count = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 3087: sBytesPushBuffer(&B, data, count); +call 0 never executed + #####: 3088: r = (smallt *)B; + #####: 3089: break; + -: 3090: } + -: 3091: + #####: 3092: ret r; + -: 3093:} + -: 3094: + -: 3095:/** + -: 3096: * deserialize dictionary from data + -: 3097: * + -: 3098: * a new dictionary is allocated + -: 3099: * + -: 3100: * \param + -: 3101: * dict dictionary holding the elements + -: 3102: * data serialized dictionary + -: 3103: */ function dictNetDeserialLevel1 called 0 returned 0% blocks executed 0% - #####: 3103:internal void dictNetDeserialLevel1(sDictt **dict, u8 **data, contextt *ctx) { - #####: 3104: sUndefinedt *u = NULL; - #####: 3105: sBoolt *bo = NULL; - #####: 3106: double *D = NULL; - #####: 3107: sDoublet *Do = NULL; - #####: 3108: sDictt *d = NULL; - #####: 3109: sIntt *io = NULL; - #####: 3110: char *s = NULL; - #####: 3111: sStringt *so = NULL; - #####: 3112: sArrayt *a = NULL; - #####: 3113: sBytest *B = NULL; - -: 3114: uint32_t count; - -: 3115: uint32_t dictCount; - -: 3116: - #####: 3117: if (ctx->nibble == lowNbl) { + #####: 3104:internal void dictNetDeserialLevel1(sDictt **dict, u8 **data, contextt *ctx) { + #####: 3105: sUndefinedt *u = NULL; + #####: 3106: sBoolt *bo = NULL; + #####: 3107: double *D = NULL; + #####: 3108: sDoublet *Do = NULL; + #####: 3109: sDictt *d = NULL; + #####: 3110: sIntt *io = NULL; + #####: 3111: char *s = NULL; + #####: 3112: sStringt *so = NULL; + #####: 3113: sArrayt *a = NULL; + #####: 3114: sBytest *B = NULL; + -: 3115: uint32_t count; + -: 3116: uint32_t dictCount; + -: 3117: + #####: 3118: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3118: dictCount = netTypeVarintToUint(data); + #####: 3119: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3119: } - -: 3120: else { - -: 3121: // high nibble - -: 3122: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; - -: 3123: #define readTypeInHighNbl\ - -: 3124: ctx->nibble = lowNbl;\ - -: 3125: if (ctx->nblAddr == *data)\ - -: 3126: /* data points to the type, next byte is count */\ - -: 3127: (*data)++ - #####: 3128: readTypeInHighNbl; + -: 3120: } + -: 3121: else { + -: 3122: // high nibble + -: 3123: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; + -: 3124: #define readTypeInHighNbl\ + -: 3125: ctx->nibble = lowNbl;\ + -: 3126: if (ctx->nblAddr == *data)\ + -: 3127: /* data points to the type, next byte is count */\ + -: 3128: (*data)++ + #####: 3129: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3129: dictCount = varintToUint(data); + #####: 3130: dictCount = varintToUint(data); call 0 never executed - -: 3130: } - -: 3131: - #####: 3132: if (!dictCount) { + -: 3131: } + -: 3132: + #####: 3133: if (!dictCount) { branch 0 never executed branch 1 never executed - #####: 3133: *dict = allocSDict(); + #####: 3134: *dict = allocSDict(); call 0 never executed - #####: 3134: ret; - -: 3135: } - -: 3136: - #####: 3137: loop(dictCount) { + #####: 3135: ret; + -: 3136: } + -: 3137: + #####: 3138: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3138: char *key = (char*)*data; - #####: 3139: *data += strlen(key)+1; - -: 3140: char type; - #####: 3141: if (ctx->nibble == lowNbl) { + #####: 3139: char *key = (char*)*data; + #####: 3140: *data += strlen(key)+1; + -: 3141: char type; + #####: 3142: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3142: type = (**data) & 0xF; - -: 3143: } - -: 3144: else { - -: 3145: // high nibble - #####: 3146: type = (*ctx->nblAddr) >> 4; - -: 3147: } - -: 3148: - #####: 3149: switch(type) { + #####: 3143: type = (**data) & 0xF; + -: 3144: } + -: 3145: else { + -: 3146: // high nibble + #####: 3147: type = (*ctx->nblAddr) >> 4; + -: 3148: } + -: 3149: + #####: 3150: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4629,261 +4630,261 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 3150: case S_UNDEFINED: - #####: 3151: if (ctx->nibble == lowNbl) { + -: 3151: case S_UNDEFINED: + #####: 3152: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3152: #define readTypeOnly\ - -: 3153: ctx->nibble = highNbl;\ - -: 3154: ctx->nblAddr = *data;\ - -: 3155: (*data)++ - #####: 3156: readTypeOnly; - -: 3157: } - -: 3158: else { - -: 3159: // high nibble - #####: 3160: readTypeInHighNbl; + -: 3153: #define readTypeOnly\ + -: 3154: ctx->nibble = highNbl;\ + -: 3155: ctx->nblAddr = *data;\ + -: 3156: (*data)++ + #####: 3157: readTypeOnly; + -: 3158: } + -: 3159: else { + -: 3160: // high nibble + #####: 3161: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3161: } - #####: 3162: u = allocSUndefined(); + -: 3162: } + #####: 3163: u = allocSUndefined(); call 0 never executed - #####: 3163: sDictPushTiny(dict, key, (smallt *) u); + #####: 3164: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - #####: 3164: break; - -: 3165: case S_BOOL: - #####: 3166: if (!ctx->boolAddr) { + #####: 3165: break; + -: 3166: case S_BOOL: + #####: 3167: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3167: // new packed bools - #####: 3168: if (ctx->nibble == lowNbl) { + -: 3168: // new packed bools + #####: 3169: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3169: #define read4bPackedBool\ - -: 3170: ctx->boolShift = 5;\ - -: 3171: ctx->boolAddr = *data;\ - -: 3172: (*data)++ - #####: 3173: read4bPackedBool; - #####: 3174: bo = allocSBool((*ctx->boolAddr) & 0x10); + -: 3170: #define read4bPackedBool\ + -: 3171: ctx->boolShift = 5;\ + -: 3172: ctx->boolAddr = *data;\ + -: 3173: (*data)++ + #####: 3174: read4bPackedBool; + #####: 3175: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3175: } - -: 3176: else { - -: 3177: // high nibble - #####: 3178: readTypeInHighNbl; + -: 3176: } + -: 3177: else { + -: 3178: // high nibble + #####: 3179: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3179: #define read8bPackedBool\ - -: 3180: ctx->boolShift = 1;\ - -: 3181: ctx->boolAddr = *data;\ - -: 3182: (*data)++ - #####: 3183: read8bPackedBool; - #####: 3184: bo = allocSBool((*ctx->boolAddr) & 0x1); + -: 3180: #define read8bPackedBool\ + -: 3181: ctx->boolShift = 1;\ + -: 3182: ctx->boolAddr = *data;\ + -: 3183: (*data)++ + #####: 3184: read8bPackedBool; + #####: 3185: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3185: } - -: 3186: } - -: 3187: else { - -: 3188: // there was a bool before this one, read bits in nibbles - #####: 3189: if (ctx->nibble == lowNbl) { + -: 3186: } + -: 3187: } + -: 3188: else { + -: 3189: // there was a bool before this one, read bits in nibbles + #####: 3190: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3190: if (ctx->boolShift == 8) { + #####: 3191: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3191: read4bPackedBool; - #####: 3192: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3192: read4bPackedBool; + #####: 3193: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3193: } - -: 3194: else { - #####: 3195: readTypeOnly; - #####: 3196: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3194: } + -: 3195: else { + #####: 3196: readTypeOnly; + #####: 3197: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3197: } - -: 3198: } - -: 3199: else { - -: 3200: // high nibble - #####: 3201: readTypeInHighNbl; + -: 3198: } + -: 3199: } + -: 3200: else { + -: 3201: // high nibble + #####: 3202: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3202: if (ctx->boolShift == 8) { + #####: 3203: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3203: read8bPackedBool; - #####: 3204: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3204: read8bPackedBool; + #####: 3205: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3205: } - -: 3206: else { - -: 3207: // high nibble - #####: 3208: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3206: } + -: 3207: else { + -: 3208: // high nibble + #####: 3209: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3209: } - -: 3210: } - -: 3211: } - #####: 3212: sDictPushTiny(dict, key, (smallt *) bo); + -: 3210: } + -: 3211: } + -: 3212: } + #####: 3213: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - #####: 3213: break; - -: 3214: case S_DICT: - #####: 3215: d = NULL; - #####: 3216: dictNetDeserialLevel1(&d, data, ctx); + #####: 3214: break; + -: 3215: case S_DICT: + #####: 3216: d = NULL; + #####: 3217: dictNetDeserialLevel1(&d, data, ctx); call 0 never executed - #####: 3217: sDictPushTiny(dict, key, (smallt *) d); + #####: 3218: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - #####: 3218: break; - -: 3219: case S_DOUBLE: - #####: 3220: if (ctx->nibble == lowNbl) { + #####: 3219: break; + -: 3220: case S_DOUBLE: + #####: 3221: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3221: readTypeOnly; - -: 3222: } - -: 3223: else { - -: 3224: // high nibble - #####: 3225: readTypeInHighNbl; + #####: 3222: readTypeOnly; + -: 3223: } + -: 3224: else { + -: 3225: // high nibble + #####: 3226: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3226: } - #####: 3227: D = (double *)(*data); - #####: 3228: *data += sizeof(double); - #####: 3229: Do = allocSDouble(*D); + -: 3227: } + #####: 3228: D = (double *)(*data); + #####: 3229: *data += sizeof(double); + #####: 3230: Do = allocSDouble(*D); call 0 never executed - #####: 3230: sDictPushTiny(dict, key, (smallt *) Do); + #####: 3231: sDictPushTiny(dict, key, (smallt *) Do); call 0 never executed - #####: 3231: break; - -: 3232: case S_INT: { - -: 3233: i64 v; - #####: 3234: if (ctx->nibble == lowNbl) { + #####: 3232: break; + -: 3233: case S_INT: { + -: 3234: u64 v; + #####: 3235: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3235: v = netTypeVarintToUint((u8**)data); + #####: 3236: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3236: } - -: 3237: else { - -: 3238: // high nibble - #####: 3239: readTypeInHighNbl; + -: 3237: } + -: 3238: else { + -: 3239: // high nibble + #####: 3240: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3240: v = varintToUint(data); + #####: 3241: v = varintToUint(data); call 0 never executed - -: 3241: } - #####: 3242: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3243: io = allocSInt(v); + -: 3242: } + #####: 3243: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3244: io = allocSInt(v); call 0 never executed - #####: 3244: sDictPushTiny(dict, key, (smallt *) io); + #####: 3245: sDictPushTiny(dict, key, (smallt *) io); call 0 never executed - -: 3245: } - #####: 3246: break; - -: 3247: case S_STRING: - #####: 3248: if (ctx->nibble == lowNbl) { + -: 3246: } + #####: 3247: break; + -: 3248: case S_STRING: + #####: 3249: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3249: readTypeOnly; - -: 3250: } - -: 3251: else { - -: 3252: // high nibble - #####: 3253: readTypeInHighNbl; + #####: 3250: readTypeOnly; + -: 3251: } + -: 3252: else { + -: 3253: // high nibble + #####: 3254: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3254: } - #####: 3255: s = (char *)(*data); - #####: 3256: *data += strlen(s)+1; - #####: 3257: so = allocSStringTiny(s); + -: 3255: } + #####: 3256: s = (char *)(*data); + #####: 3257: *data += strlen(s)+1; + #####: 3258: so = allocSStringTiny(s); call 0 never executed - #####: 3258: sDictPushTiny(dict, key, (smallt *) so); + #####: 3259: sDictPushTiny(dict, key, (smallt *) so); call 0 never executed - #####: 3259: break; - -: 3260: case S_ARRAY: - #####: 3261: a = NULL; - #####: 3262: arrayNetDeserialLevel1(&a, data, ctx); + #####: 3260: break; + -: 3261: case S_ARRAY: + #####: 3262: a = NULL; + #####: 3263: arrayNetDeserialLevel1(&a, data, ctx); call 0 never executed - #####: 3263: sDictPushTiny(dict, key, (smallt *) a); + #####: 3264: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - #####: 3264: break; - -: 3265: case S_BYTES: - #####: 3266: B = allocSBytes(); + #####: 3265: break; + -: 3266: case S_BYTES: + #####: 3267: B = allocSBytes(); call 0 never executed - #####: 3267: if (ctx->nibble == lowNbl) { + #####: 3268: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3268: count = netTypeVarintToUint((u8**)data); + #####: 3269: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3269: } - -: 3270: else { - -: 3271: // high nibble - #####: 3272: readTypeInHighNbl; + -: 3270: } + -: 3271: else { + -: 3272: // high nibble + #####: 3273: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3273: count = varintToUint((u8**)data); + #####: 3274: count = varintToUint((u8**)data); call 0 never executed - -: 3274: } - #####: 3275: sBytesPushBuffer(&B, data, count); + -: 3275: } + #####: 3276: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3276: *data += count; - #####: 3277: sDictPushTiny(dict, key, (smallt *) B); + #####: 3277: *data += count; + #####: 3278: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - #####: 3278: break; - -: 3279: } - -: 3280: } - -: 3281:} - -: 3282: - -: 3283:/** - -: 3284: * deserialize array from data - -: 3285: * - -: 3286: * a new array is allocated - -: 3287: * - -: 3288: * \param - -: 3289: * array holding the elements - -: 3290: * data serialized dictionary - -: 3291: */ + #####: 3279: break; + -: 3280: } + -: 3281: } + -: 3282:} + -: 3283: + -: 3284:/** + -: 3285: * deserialize array from data + -: 3286: * + -: 3287: * a new array is allocated + -: 3288: * + -: 3289: * \param + -: 3290: * array holding the elements + -: 3291: * data serialized dictionary + -: 3292: */ function arrayNetDeserialLevel1 called 0 returned 0% blocks executed 0% - #####: 3292:internal void arrayNetDeserialLevel1(sArrayt **array, u8 **data, contextt *ctx) { - #####: 3293: sUndefinedt *u = NULL; - #####: 3294: sBoolt *bo = NULL; - #####: 3295: double *D = NULL; - #####: 3296: sDoublet *Do = NULL; - #####: 3297: sDictt *d = NULL; - #####: 3298: sIntt *io = NULL; - #####: 3299: char *s = NULL; - #####: 3300: sStringt *so = NULL; - #####: 3301: sArrayt *a = NULL; - #####: 3302: sBytest *B = NULL; - -: 3303: uint32_t count; - -: 3304: uint32_t arrayCount; - -: 3305: - #####: 3306: if (ctx->nibble == lowNbl) { + #####: 3293:internal void arrayNetDeserialLevel1(sArrayt **array, u8 **data, contextt *ctx) { + #####: 3294: sUndefinedt *u = NULL; + #####: 3295: sBoolt *bo = NULL; + #####: 3296: double *D = NULL; + #####: 3297: sDoublet *Do = NULL; + #####: 3298: sDictt *d = NULL; + #####: 3299: sIntt *io = NULL; + #####: 3300: char *s = NULL; + #####: 3301: sStringt *so = NULL; + #####: 3302: sArrayt *a = NULL; + #####: 3303: sBytest *B = NULL; + -: 3304: uint32_t count; + -: 3305: uint32_t arrayCount; + -: 3306: + #####: 3307: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3307: arrayCount = netTypeVarintToUint(data); + #####: 3308: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 3308: } - -: 3309: else { - -: 3310: // high nibble - #####: 3311: readTypeInHighNbl; + -: 3309: } + -: 3310: else { + -: 3311: // high nibble + #####: 3312: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3312: arrayCount = varintToUint(data); + #####: 3313: arrayCount = varintToUint(data); call 0 never executed - -: 3313: } - -: 3314: - #####: 3315: if (!arrayCount) { + -: 3314: } + -: 3315: + #####: 3316: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 3316: *array = allocSArray();; + #####: 3317: *array = allocSArray();; call 0 never executed - #####: 3317: ret; - -: 3318: } - -: 3319: - #####: 3320: loop(arrayCount) { + #####: 3318: ret; + -: 3319: } + -: 3320: + #####: 3321: loop(arrayCount) { branch 0 never executed branch 1 never executed - -: 3321: char type; - #####: 3322: if (ctx->nibble == lowNbl) { + -: 3322: char type; + #####: 3323: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3323: type = (**data) & 0xF; - -: 3324: } - -: 3325: else { - -: 3326: // high nibble - #####: 3327: type = (*ctx->nblAddr) >> 4; - -: 3328: } - -: 3329: - #####: 3330: switch(type) { + #####: 3324: type = (**data) & 0xF; + -: 3325: } + -: 3326: else { + -: 3327: // high nibble + #####: 3328: type = (*ctx->nblAddr) >> 4; + -: 3329: } + -: 3330: + #####: 3331: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4893,234 +4894,234 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 3331: case S_UNDEFINED: - #####: 3332: if (ctx->nibble == lowNbl) { + -: 3332: case S_UNDEFINED: + #####: 3333: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3333: readTypeOnly; - -: 3334: } - -: 3335: else { - -: 3336: // high nibble - #####: 3337: readTypeInHighNbl; + #####: 3334: readTypeOnly; + -: 3335: } + -: 3336: else { + -: 3337: // high nibble + #####: 3338: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3338: } - #####: 3339: u = allocSUndefined(); + -: 3339: } + #####: 3340: u = allocSUndefined(); call 0 never executed - #####: 3340: sArrayPushTiny(array, (smallt *) u); + #####: 3341: sArrayPushTiny(array, (smallt *) u); call 0 never executed - #####: 3341: break; - -: 3342: case S_BOOL: - #####: 3343: if (!ctx->boolAddr) { + #####: 3342: break; + -: 3343: case S_BOOL: + #####: 3344: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3344: // new packed bools - #####: 3345: if (ctx->nibble == lowNbl) { + -: 3345: // new packed bools + #####: 3346: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3346: read4bPackedBool; - #####: 3347: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3347: read4bPackedBool; + #####: 3348: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3348: } - -: 3349: else { - -: 3350: // high nibble - #####: 3351: readTypeInHighNbl; + -: 3349: } + -: 3350: else { + -: 3351: // high nibble + #####: 3352: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3352: read8bPackedBool; - #####: 3353: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3353: read8bPackedBool; + #####: 3354: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3354: } - -: 3355: } - -: 3356: else { - -: 3357: // there was a bool before this one, read bits in nibbles - #####: 3358: if (ctx->nibble == lowNbl) { + -: 3355: } + -: 3356: } + -: 3357: else { + -: 3358: // there was a bool before this one, read bits in nibbles + #####: 3359: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3359: if (ctx->boolShift == 8) { + #####: 3360: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3360: read4bPackedBool; - #####: 3361: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3361: read4bPackedBool; + #####: 3362: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3362: } - -: 3363: else { - #####: 3364: readTypeOnly; - #####: 3365: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3363: } + -: 3364: else { + #####: 3365: readTypeOnly; + #####: 3366: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3366: } - -: 3367: } - -: 3368: else { - -: 3369: // high nibble - #####: 3370: readTypeInHighNbl; + -: 3367: } + -: 3368: } + -: 3369: else { + -: 3370: // high nibble + #####: 3371: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3371: if (ctx->boolShift == 8) { + #####: 3372: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3372: read8bPackedBool; - #####: 3373: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3373: read8bPackedBool; + #####: 3374: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3374: } - -: 3375: else { - #####: 3376: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3375: } + -: 3376: else { + #####: 3377: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3377: } - -: 3378: } - -: 3379: } - #####: 3380: sArrayPushTiny(array, (smallt *) bo); + -: 3378: } + -: 3379: } + -: 3380: } + #####: 3381: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - #####: 3381: break; - -: 3382: case S_DICT: - #####: 3383: d = NULL; - #####: 3384: dictNetDeserialLevel1(&d, data, ctx); + #####: 3382: break; + -: 3383: case S_DICT: + #####: 3384: d = NULL; + #####: 3385: dictNetDeserialLevel1(&d, data, ctx); call 0 never executed - #####: 3385: sArrayPushTiny(array, (smallt *) d); + #####: 3386: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 3386: break; - -: 3387: case S_DOUBLE: - #####: 3388: if (ctx->nibble == lowNbl) { + #####: 3387: break; + -: 3388: case S_DOUBLE: + #####: 3389: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3389: readTypeOnly; - -: 3390: } - -: 3391: else { - -: 3392: // high nibble - #####: 3393: readTypeInHighNbl; + #####: 3390: readTypeOnly; + -: 3391: } + -: 3392: else { + -: 3393: // high nibble + #####: 3394: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3394: } - #####: 3395: D = (double *)(*data); - #####: 3396: *data += sizeof(double); - #####: 3397: Do = allocSDouble(*D); + -: 3395: } + #####: 3396: D = (double *)(*data); + #####: 3397: *data += sizeof(double); + #####: 3398: Do = allocSDouble(*D); call 0 never executed - #####: 3398: sArrayPushTiny(array, (smallt *) Do); + #####: 3399: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - #####: 3399: break; - -: 3400: case S_INT: { - -: 3401: i64 v; - #####: 3402: if (ctx->nibble == lowNbl) { + #####: 3400: break; + -: 3401: case S_INT: { + -: 3402: u64 v; + #####: 3403: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3403: v = netTypeVarintToUint((u8**)data); + #####: 3404: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3404: } - -: 3405: else { - -: 3406: // high nibble - #####: 3407: readTypeInHighNbl; + -: 3405: } + -: 3406: else { + -: 3407: // high nibble + #####: 3408: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3408: v = varintToUint(data); + #####: 3409: v = varintToUint(data); call 0 never executed - -: 3409: } - #####: 3410: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3411: io = allocSInt(v); + -: 3410: } + #####: 3411: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3412: io = allocSInt(v); call 0 never executed - #####: 3412: sArrayPushTiny(array, (smallt *) io); + #####: 3413: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 3413: } - #####: 3414: break; - -: 3415: case S_STRING: - #####: 3416: if (ctx->nibble == lowNbl) { + -: 3414: } + #####: 3415: break; + -: 3416: case S_STRING: + #####: 3417: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3417: readTypeOnly; - -: 3418: } - -: 3419: else { - -: 3420: // high nibble - #####: 3421: readTypeInHighNbl; + #####: 3418: readTypeOnly; + -: 3419: } + -: 3420: else { + -: 3421: // high nibble + #####: 3422: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3422: } - #####: 3423: s = (char *)(*data); - #####: 3424: *data += strlen(s)+1; - #####: 3425: so = allocSStringTiny(s); + -: 3423: } + #####: 3424: s = (char *)(*data); + #####: 3425: *data += strlen(s)+1; + #####: 3426: so = allocSStringTiny(s); call 0 never executed - #####: 3426: sArrayPushTiny(array, (smallt *) so); + #####: 3427: sArrayPushTiny(array, (smallt *) so); call 0 never executed - #####: 3427: break; - -: 3428: case S_ARRAY: - #####: 3429: a = NULL; - #####: 3430: arrayNetDeserialLevel1(&a, data, ctx); + #####: 3428: break; + -: 3429: case S_ARRAY: + #####: 3430: a = NULL; + #####: 3431: arrayNetDeserialLevel1(&a, data, ctx); call 0 never executed - #####: 3431: sArrayPushTiny(array, (smallt *) a); + #####: 3432: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 3432: break; - -: 3433: case S_BYTES: - #####: 3434: B = allocSBytes(); + #####: 3433: break; + -: 3434: case S_BYTES: + #####: 3435: B = allocSBytes(); call 0 never executed - #####: 3435: if (ctx->nibble == lowNbl) { + #####: 3436: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3436: count = netTypeVarintToUint((u8**)data); + #####: 3437: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3437: } - -: 3438: else { - -: 3439: // high nibble - #####: 3440: readTypeInHighNbl; + -: 3438: } + -: 3439: else { + -: 3440: // high nibble + #####: 3441: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3441: count = varintToUint((u8**)data); + #####: 3442: count = varintToUint((u8**)data); call 0 never executed - -: 3442: } - #####: 3443: sBytesPushBuffer(&B, data, count); + -: 3443: } + #####: 3444: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3444: *data += count; - #####: 3445: sArrayPushTiny(array, (smallt *) B); + #####: 3445: *data += count; + #####: 3446: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 3446: break; - -: 3447: } - -: 3448: } - -: 3449:} - -: 3450: + #####: 3447: break; + -: 3448: } + -: 3449: } + -: 3450:} + -: 3451: function deserialNetSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 3451:internal smallJsont* deserialNetSerialLevel1(smallJsont *self, smallBytest *data) { - -: 3452: - #####: 3453: if (!data or !data->B or !data->B->count) { + #####: 3452:internal smallJsont* deserialNetSerialLevel1(smallJsont *self, smallBytest *data) { + -: 3453: + #####: 3454: if (!data or !data->B or !data->B->count) { branch 0 never executed branch 1 never executed branch 2 never executed branch 3 never executed branch 4 never executed branch 5 never executed - #####: 3454: ret self; - -: 3455: } - -: 3456: - #####: 3457: smallt *o = netDeserialLevel1(data->B); -call 0 never executed - -: 3458: - #####: 3459: if (!o) { -branch 0 never executed -branch 1 never executed - #####: 3460: ret self; - -: 3461: } - -: 3462: - #####: 3463: freeG(self); -call 0 never executed - -: 3464: - #####: 3465: setsoG(self, o); -call 0 never executed - -: 3466: - #####: 3467: ret self; - -: 3468:} - -: 3469: - -: 3470:// level 2 - -: 3471:// like level 1, arrays are set to uniform when all elements are same type - -: 3472: - -: 3473:/** - -: 3474: * deserializer top function - -: 3475: */ + #####: 3455: ret self; + -: 3456: } + -: 3457: + #####: 3458: smallt *o = netDeserialLevel1(data->B); +call 0 never executed + -: 3459: + #####: 3460: if (!o) { +branch 0 never executed +branch 1 never executed + #####: 3461: ret self; + -: 3462: } + -: 3463: + #####: 3464: freeG(self); +call 0 never executed + -: 3465: + #####: 3466: setsoG(self, o); +call 0 never executed + -: 3467: + #####: 3468: ret self; + -: 3469:} + -: 3470: + -: 3471:// level 2 + -: 3472:// like level 1, arrays are set to uniform when all elements are same type + -: 3473: + -: 3474:/** + -: 3475: * deserializer top function + -: 3476: */ function netDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3476:internal smallt* netDeserialLevel2(sBytest *obj) { - #####: 3477: smallt *r = NULL; - #####: 3478: double *D = NULL; - #####: 3479: char *s = NULL; - #####: 3480: sBytest *B = NULL; - -: 3481: uint32_t count; - #####: 3482: char *data = NULL; - #####: 3483: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; - -: 3484: - #####: 3485: switch(obj->data & 0xF) { + #####: 3477:internal smallt* netDeserialLevel2(sBytest *obj) { + #####: 3478: smallt *r = NULL; + #####: 3479: double *D = NULL; + #####: 3480: char *s = NULL; + #####: 3481: sBytest *B = NULL; + -: 3482: uint32_t count; + #####: 3483: char *data = NULL; + #####: 3484: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; + -: 3485: + #####: 3486: switch(obj->data & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5132,150 +5133,150 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3486: case S_UNDEFINED: - #####: 3487: r = (smallt *) allocSUndefined(); -call 0 never executed - #####: 3488: break; - -: 3489: case S_BOOL: - #####: 3490: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 never executed - #####: 3491: break; - -: 3492: case S_DICT: - #####: 3493: data = (char *)&(obj->data); - -: 3494: //debug - ctx.dbuf = (u8*) data; - #####: 3495: dictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 never executed - #####: 3496: break; - -: 3497: case S_DOUBLE: - #####: 3498: data = &(obj->data)+1; - #####: 3499: D = (double *)data; - #####: 3500: r = (smallt *) allocSDouble(*D); -call 0 never executed - #####: 3501: break; - -: 3502: case S_INT: - #####: 3503: data = &(obj->data); - #####: 3504: i64 v = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 3505: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3506: r = (smallt *) allocSInt(v); -call 0 never executed - #####: 3507: break; - -: 3508: case S_STRING: - #####: 3509: s = (char *)&(obj->data)+1; - #####: 3510: r = (smallt *) allocSStringTiny(s); -call 0 never executed - #####: 3511: break; - -: 3512: case S_ARRAY: - #####: 3513: data = (char *)&(obj->data); - -: 3514: //debug - ctx.dbuf = (u8*) data; - #####: 3515: arrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 never executed - #####: 3516: break; - -: 3517: case S_BYTES: - #####: 3518: B = allocSBytes(); -call 0 never executed - #####: 3519: data = &(obj->data); - #####: 3520: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 3521: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 3522: r = (smallt *)B; - #####: 3523: break; - -: 3524: case UNIFORM_DICT: - #####: 3525: data = (char *)&(obj->data); - -: 3526: //debug - ctx.dbuf = (u8*) data; - #####: 3527: uniformDictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 never executed - #####: 3528: break; - -: 3529: case UNIFORM_ARRAY: - #####: 3530: data = (char *)&(obj->data); - -: 3531: //debug - ctx.dbuf = (u8*) data; - #####: 3532: uniformArrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 never executed - #####: 3533: break; - -: 3534: } - -: 3535: - #####: 3536: ret r; - -: 3537:} - -: 3538: - -: 3539:/** - -: 3540: * deserialize dictionary from data - -: 3541: * - -: 3542: * a new dictionary is allocated - -: 3543: * - -: 3544: * \param - -: 3545: * dict dictionary holding the elements - -: 3546: * data serialized dictionary - -: 3547: */ + -: 3487: case S_UNDEFINED: + #####: 3488: r = (smallt *) allocSUndefined(); +call 0 never executed + #####: 3489: break; + -: 3490: case S_BOOL: + #####: 3491: r = (smallt *) allocSBool(obj->data & 0x10); +call 0 never executed + #####: 3492: break; + -: 3493: case S_DICT: + #####: 3494: data = (char *)&(obj->data); + -: 3495: //debug - ctx.dbuf = (u8*) data; + #####: 3496: dictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 never executed + #####: 3497: break; + -: 3498: case S_DOUBLE: + #####: 3499: data = &(obj->data)+1; + #####: 3500: D = (double *)data; + #####: 3501: r = (smallt *) allocSDouble(*D); +call 0 never executed + #####: 3502: break; + -: 3503: case S_INT: + #####: 3504: data = &(obj->data); + #####: 3505: u64 v = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 3506: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3507: r = (smallt *) allocSInt(v); +call 0 never executed + #####: 3508: break; + -: 3509: case S_STRING: + #####: 3510: s = (char *)&(obj->data)+1; + #####: 3511: r = (smallt *) allocSStringTiny(s); +call 0 never executed + #####: 3512: break; + -: 3513: case S_ARRAY: + #####: 3514: data = (char *)&(obj->data); + -: 3515: //debug - ctx.dbuf = (u8*) data; + #####: 3516: arrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 never executed + #####: 3517: break; + -: 3518: case S_BYTES: + #####: 3519: B = allocSBytes(); +call 0 never executed + #####: 3520: data = &(obj->data); + #####: 3521: count = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 3522: sBytesPushBuffer(&B, data, count); +call 0 never executed + #####: 3523: r = (smallt *)B; + #####: 3524: break; + -: 3525: case UNIFORM_DICT: + #####: 3526: data = (char *)&(obj->data); + -: 3527: //debug - ctx.dbuf = (u8*) data; + #####: 3528: uniformDictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 never executed + #####: 3529: break; + -: 3530: case UNIFORM_ARRAY: + #####: 3531: data = (char *)&(obj->data); + -: 3532: //debug - ctx.dbuf = (u8*) data; + #####: 3533: uniformArrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 never executed + #####: 3534: break; + -: 3535: } + -: 3536: + #####: 3537: ret r; + -: 3538:} + -: 3539: + -: 3540:/** + -: 3541: * deserialize dictionary from data + -: 3542: * + -: 3543: * a new dictionary is allocated + -: 3544: * + -: 3545: * \param + -: 3546: * dict dictionary holding the elements + -: 3547: * data serialized dictionary + -: 3548: */ function dictNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3548:internal void dictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - #####: 3549: sUndefinedt *u = NULL; - #####: 3550: sBoolt *bo = NULL; - #####: 3551: double *D = NULL; - #####: 3552: sDoublet *Do = NULL; - #####: 3553: sDictt *d = NULL; - #####: 3554: sIntt *io = NULL; - #####: 3555: char *s = NULL; - #####: 3556: sStringt *so = NULL; - #####: 3557: sArrayt *a = NULL; - #####: 3558: sBytest *B = NULL; - -: 3559: uint32_t count; - -: 3560: uint32_t dictCount; - -: 3561: - #####: 3562: if (packed) { + #####: 3549:internal void dictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { + #####: 3550: sUndefinedt *u = NULL; + #####: 3551: sBoolt *bo = NULL; + #####: 3552: double *D = NULL; + #####: 3553: sDoublet *Do = NULL; + #####: 3554: sDictt *d = NULL; + #####: 3555: sIntt *io = NULL; + #####: 3556: char *s = NULL; + #####: 3557: sStringt *so = NULL; + #####: 3558: sArrayt *a = NULL; + #####: 3559: sBytest *B = NULL; + -: 3560: uint32_t count; + -: 3561: uint32_t dictCount; + -: 3562: + #####: 3563: if (packed) { branch 0 never executed branch 1 never executed - #####: 3563: dictCount = varintToUint(data); + #####: 3564: dictCount = varintToUint(data); call 0 never executed - -: 3564: } - -: 3565: else { - #####: 3566: if (ctx->nibble == lowNbl) { + -: 3565: } + -: 3566: else { + #####: 3567: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3567: dictCount = netTypeVarintToUint(data); + #####: 3568: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3568: } - -: 3569: else { - -: 3570: // high nibble - -: 3571: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; - -: 3572: #define readTypeInHighNbl\ - -: 3573: ctx->nibble = lowNbl;\ - -: 3574: if (ctx->nblAddr == *data)\ - -: 3575: /* data points to the type, next byte is count */\ - -: 3576: (*data)++ - #####: 3577: readTypeInHighNbl; + -: 3569: } + -: 3570: else { + -: 3571: // high nibble + -: 3572: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; + -: 3573: #define readTypeInHighNbl\ + -: 3574: ctx->nibble = lowNbl;\ + -: 3575: if (ctx->nblAddr == *data)\ + -: 3576: /* data points to the type, next byte is count */\ + -: 3577: (*data)++ + #####: 3578: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3578: dictCount = varintToUint(data); + #####: 3579: dictCount = varintToUint(data); call 0 never executed - -: 3579: } - -: 3580: } - -: 3581: - #####: 3582: if (!dictCount) { + -: 3580: } + -: 3581: } + -: 3582: + #####: 3583: if (!dictCount) { branch 0 never executed branch 1 never executed - #####: 3583: *dict = allocSDict(); + #####: 3584: *dict = allocSDict(); call 0 never executed - #####: 3584: ret; - -: 3585: } - -: 3586: - #####: 3587: loop(dictCount) { + #####: 3585: ret; + -: 3586: } + -: 3587: + #####: 3588: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3588: char *key = (char*)*data; - #####: 3589: *data += strlen(key)+1; - -: 3590: char type; - #####: 3591: if (ctx->nibble == lowNbl) { + #####: 3589: char *key = (char*)*data; + #####: 3590: *data += strlen(key)+1; + -: 3591: char type; + #####: 3592: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3592: type = (**data) & 0xF; - -: 3593: } - -: 3594: else { - -: 3595: // high nibble - #####: 3596: type = (*ctx->nblAddr) >> 4; - -: 3597: } - -: 3598: - #####: 3599: switch(type) { + #####: 3593: type = (**data) & 0xF; + -: 3594: } + -: 3595: else { + -: 3596: // high nibble + #####: 3597: type = (*ctx->nblAddr) >> 4; + -: 3598: } + -: 3599: + #####: 3600: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5287,274 +5288,274 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3600: case S_UNDEFINED: - #####: 3601: if (ctx->nibble == lowNbl) { + -: 3601: case S_UNDEFINED: + #####: 3602: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3602: #define readTypeOnly\ - -: 3603: ctx->nibble = highNbl;\ - -: 3604: ctx->nblAddr = *data;\ - -: 3605: (*data)++ - #####: 3606: readTypeOnly; - -: 3607: } - -: 3608: else { - -: 3609: // high nibble - #####: 3610: readTypeInHighNbl; + -: 3603: #define readTypeOnly\ + -: 3604: ctx->nibble = highNbl;\ + -: 3605: ctx->nblAddr = *data;\ + -: 3606: (*data)++ + #####: 3607: readTypeOnly; + -: 3608: } + -: 3609: else { + -: 3610: // high nibble + #####: 3611: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3611: } - #####: 3612: u = allocSUndefined(); + -: 3612: } + #####: 3613: u = allocSUndefined(); call 0 never executed - #####: 3613: sDictPushTiny(dict, key, (smallt *) u); + #####: 3614: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - #####: 3614: break; - -: 3615: case S_BOOL: - #####: 3616: if (!ctx->boolAddr) { + #####: 3615: break; + -: 3616: case S_BOOL: + #####: 3617: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3617: // new packed bools - #####: 3618: if (ctx->nibble == lowNbl) { + -: 3618: // new packed bools + #####: 3619: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3619: #define read4bPackedBool\ - -: 3620: ctx->boolShift = 5;\ - -: 3621: ctx->boolAddr = *data;\ - -: 3622: (*data)++ - #####: 3623: read4bPackedBool; - #####: 3624: bo = allocSBool((*ctx->boolAddr) & 0x10); + -: 3620: #define read4bPackedBool\ + -: 3621: ctx->boolShift = 5;\ + -: 3622: ctx->boolAddr = *data;\ + -: 3623: (*data)++ + #####: 3624: read4bPackedBool; + #####: 3625: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3625: } - -: 3626: else { - -: 3627: // high nibble - #####: 3628: readTypeInHighNbl; + -: 3626: } + -: 3627: else { + -: 3628: // high nibble + #####: 3629: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3629: #define read8bPackedBool\ - -: 3630: ctx->boolShift = 1;\ - -: 3631: ctx->boolAddr = *data;\ - -: 3632: (*data)++ - #####: 3633: read8bPackedBool; - #####: 3634: bo = allocSBool((*ctx->boolAddr) & 0x1); + -: 3630: #define read8bPackedBool\ + -: 3631: ctx->boolShift = 1;\ + -: 3632: ctx->boolAddr = *data;\ + -: 3633: (*data)++ + #####: 3634: read8bPackedBool; + #####: 3635: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3635: } - -: 3636: } - -: 3637: else { - -: 3638: // there was a bool before this one, read bits in nibbles - #####: 3639: if (ctx->nibble == lowNbl) { + -: 3636: } + -: 3637: } + -: 3638: else { + -: 3639: // there was a bool before this one, read bits in nibbles + #####: 3640: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3640: if (ctx->boolShift == 8) { + #####: 3641: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3641: read4bPackedBool; - #####: 3642: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3642: read4bPackedBool; + #####: 3643: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3643: } - -: 3644: else { - #####: 3645: readTypeOnly; - #####: 3646: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3644: } + -: 3645: else { + #####: 3646: readTypeOnly; + #####: 3647: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3647: } - -: 3648: } - -: 3649: else { - -: 3650: // high nibble - #####: 3651: readTypeInHighNbl; + -: 3648: } + -: 3649: } + -: 3650: else { + -: 3651: // high nibble + #####: 3652: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3652: if (ctx->boolShift == 8) { + #####: 3653: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3653: read8bPackedBool; - #####: 3654: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3654: read8bPackedBool; + #####: 3655: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3655: } - -: 3656: else { - -: 3657: // high nibble - #####: 3658: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3656: } + -: 3657: else { + -: 3658: // high nibble + #####: 3659: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3659: } - -: 3660: } - -: 3661: } - #####: 3662: sDictPushTiny(dict, key, (smallt *) bo); + -: 3660: } + -: 3661: } + -: 3662: } + #####: 3663: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - #####: 3663: break; - -: 3664: case S_DICT: - #####: 3665: d = NULL; - #####: 3666: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 3664: break; + -: 3665: case S_DICT: + #####: 3666: d = NULL; + #####: 3667: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 3667: sDictPushTiny(dict, key, (smallt *) d); + #####: 3668: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - #####: 3668: break; - -: 3669: case S_DOUBLE: - #####: 3670: if (ctx->nibble == lowNbl) { + #####: 3669: break; + -: 3670: case S_DOUBLE: + #####: 3671: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3671: readTypeOnly; - -: 3672: } - -: 3673: else { - -: 3674: // high nibble - #####: 3675: readTypeInHighNbl; + #####: 3672: readTypeOnly; + -: 3673: } + -: 3674: else { + -: 3675: // high nibble + #####: 3676: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3676: } - #####: 3677: D = (double *)(*data); - #####: 3678: *data += sizeof(double); - #####: 3679: Do = allocSDouble(*D); + -: 3677: } + #####: 3678: D = (double *)(*data); + #####: 3679: *data += sizeof(double); + #####: 3680: Do = allocSDouble(*D); call 0 never executed - #####: 3680: sDictPushTiny(dict, key, (smallt *) Do); + #####: 3681: sDictPushTiny(dict, key, (smallt *) Do); call 0 never executed - #####: 3681: break; - -: 3682: case S_INT: { - -: 3683: i64 v; - #####: 3684: if (ctx->nibble == lowNbl) { + #####: 3682: break; + -: 3683: case S_INT: { + -: 3684: u64 v; + #####: 3685: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3685: v = netTypeVarintToUint((u8**)data); + #####: 3686: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3686: } - -: 3687: else { - -: 3688: // high nibble - #####: 3689: readTypeInHighNbl; + -: 3687: } + -: 3688: else { + -: 3689: // high nibble + #####: 3690: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3690: v = varintToUint(data); + #####: 3691: v = varintToUint(data); call 0 never executed - -: 3691: } - #####: 3692: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3693: io = allocSInt(v); + -: 3692: } + #####: 3693: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3694: io = allocSInt(v); call 0 never executed - #####: 3694: sDictPushTiny(dict, key, (smallt *) io); + #####: 3695: sDictPushTiny(dict, key, (smallt *) io); call 0 never executed - -: 3695: } - #####: 3696: break; - -: 3697: case S_STRING: - #####: 3698: if (ctx->nibble == lowNbl) { + -: 3696: } + #####: 3697: break; + -: 3698: case S_STRING: + #####: 3699: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3699: readTypeOnly; - -: 3700: } - -: 3701: else { - -: 3702: // high nibble - #####: 3703: readTypeInHighNbl; + #####: 3700: readTypeOnly; + -: 3701: } + -: 3702: else { + -: 3703: // high nibble + #####: 3704: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3704: } - #####: 3705: s = (char *)(*data); - #####: 3706: *data += strlen(s)+1; - #####: 3707: so = allocSStringTiny(s); + -: 3705: } + #####: 3706: s = (char *)(*data); + #####: 3707: *data += strlen(s)+1; + #####: 3708: so = allocSStringTiny(s); call 0 never executed - #####: 3708: sDictPushTiny(dict, key, (smallt *) so); + #####: 3709: sDictPushTiny(dict, key, (smallt *) so); call 0 never executed - #####: 3709: break; - -: 3710: case S_ARRAY: - #####: 3711: a = NULL; - #####: 3712: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 3710: break; + -: 3711: case S_ARRAY: + #####: 3712: a = NULL; + #####: 3713: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 3713: sDictPushTiny(dict, key, (smallt *) a); + #####: 3714: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - #####: 3714: break; - -: 3715: case S_BYTES: - #####: 3716: B = allocSBytes(); + #####: 3715: break; + -: 3716: case S_BYTES: + #####: 3717: B = allocSBytes(); call 0 never executed - #####: 3717: if (ctx->nibble == lowNbl) { + #####: 3718: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3718: count = netTypeVarintToUint((u8**)data); + #####: 3719: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3719: } - -: 3720: else { - -: 3721: // high nibble - #####: 3722: readTypeInHighNbl; + -: 3720: } + -: 3721: else { + -: 3722: // high nibble + #####: 3723: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3723: count = varintToUint((u8**)data); + #####: 3724: count = varintToUint((u8**)data); call 0 never executed - -: 3724: } - #####: 3725: sBytesPushBuffer(&B, data, count); + -: 3725: } + #####: 3726: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3726: *data += count; - #####: 3727: sDictPushTiny(dict, key, (smallt *) B); + #####: 3727: *data += count; + #####: 3728: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - #####: 3728: break; - -: 3729: case UNIFORM_DICT: - #####: 3730: d = NULL; - #####: 3731: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 3729: break; + -: 3730: case UNIFORM_DICT: + #####: 3731: d = NULL; + #####: 3732: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 3732: sDictPushTiny(dict, key, (smallt *) d); + #####: 3733: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - #####: 3733: break; - -: 3734: case UNIFORM_ARRAY: - #####: 3735: a = NULL; - #####: 3736: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 3734: break; + -: 3735: case UNIFORM_ARRAY: + #####: 3736: a = NULL; + #####: 3737: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 3737: sDictPushTiny(dict, key, (smallt *) a); + #####: 3738: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - #####: 3738: break; - -: 3739: } - -: 3740: } - -: 3741:} - -: 3742: - -: 3743:/** - -: 3744: * deserialize dictionary from data - -: 3745: * - -: 3746: * a new dictionary is allocated - -: 3747: * - -: 3748: * \param - -: 3749: * dict dictionary holding the elements - -: 3750: * data serialized dictionary - -: 3751: */ + #####: 3739: break; + -: 3740: } + -: 3741: } + -: 3742:} + -: 3743: + -: 3744:/** + -: 3745: * deserialize dictionary from data + -: 3746: * + -: 3747: * a new dictionary is allocated + -: 3748: * + -: 3749: * \param + -: 3750: * dict dictionary holding the elements + -: 3751: * data serialized dictionary + -: 3752: */ function uniformDictNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3752:internal void uniformDictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - #####: 3753: sUndefinedt *u = NULL; - #####: 3754: sBoolt *bo = NULL; - #####: 3755: double *D = NULL; - #####: 3756: sDoublet *Do = NULL; - #####: 3757: sDictt *d = NULL; - #####: 3758: sIntt *io = NULL; - #####: 3759: char *s = NULL; - #####: 3760: sStringt *so = NULL; - #####: 3761: sArrayt *a = NULL; - #####: 3762: sBytest *B = NULL; - -: 3763: uint32_t count; - -: 3764: uint32_t dictCount; - -: 3765: u8 type; - -: 3766: - #####: 3767: if (packed) { + #####: 3753:internal void uniformDictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { + #####: 3754: sUndefinedt *u = NULL; + #####: 3755: sBoolt *bo = NULL; + #####: 3756: double *D = NULL; + #####: 3757: sDoublet *Do = NULL; + #####: 3758: sDictt *d = NULL; + #####: 3759: sIntt *io = NULL; + #####: 3760: char *s = NULL; + #####: 3761: sStringt *so = NULL; + #####: 3762: sArrayt *a = NULL; + #####: 3763: sBytest *B = NULL; + -: 3764: uint32_t count; + -: 3765: uint32_t dictCount; + -: 3766: u8 type; + -: 3767: + #####: 3768: if (packed) { branch 0 never executed branch 1 never executed - #####: 3768: type = (**data) & 0xF; - #####: 3769: dictCount = netTypeVarintToUint(data); + #####: 3769: type = (**data) & 0xF; + #####: 3770: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3770: } - -: 3771: else { - #####: 3772: if (ctx->nibble == lowNbl) { + -: 3771: } + -: 3772: else { + #####: 3773: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3773: type = (**data) >> 4; - #####: 3774: (*data)++; - #####: 3775: dictCount = varintToUint(data); + #####: 3774: type = (**data) >> 4; + #####: 3775: (*data)++; + #####: 3776: dictCount = varintToUint(data); call 0 never executed - -: 3776: } - -: 3777: else { - #####: 3778: readTypeInHighNbl; + -: 3777: } + -: 3778: else { + #####: 3779: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3779: type = (**data) & 0xF; - #####: 3780: dictCount = netTypeVarintToUint(data); + #####: 3780: type = (**data) & 0xF; + #####: 3781: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3781: } - -: 3782: } - -: 3783: - #####: 3784: if (!dictCount) { + -: 3782: } + -: 3783: } + -: 3784: + #####: 3785: if (!dictCount) { branch 0 never executed branch 1 never executed - #####: 3785: *dict = allocSDict(); + #####: 3786: *dict = allocSDict(); call 0 never executed - #####: 3786: ret; - -: 3787: } - -: 3788: + #####: 3787: ret; + -: 3788: } -: 3789: - #####: 3790: switch(type) { + -: 3790: + #####: 3791: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5566,237 +5567,237 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3791: case S_UNDEFINED: - #####: 3792: loop(dictCount) { + -: 3792: case S_UNDEFINED: + #####: 3793: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3793: char *key = (char*)*data; - #####: 3794: *data += strlen(key)+1; - #####: 3795: u = allocSUndefined(); + #####: 3794: char *key = (char*)*data; + #####: 3795: *data += strlen(key)+1; + #####: 3796: u = allocSUndefined(); call 0 never executed - #####: 3796: sDictPushTiny(dict, key, (smallt *) u); + #####: 3797: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - -: 3797: } - #####: 3798: break; - -: 3799: case S_BOOL: - #####: 3800: loop(dictCount) { + -: 3798: } + #####: 3799: break; + -: 3800: case S_BOOL: + #####: 3801: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3801: char *key = (char*)*data; - #####: 3802: *data += strlen(key)+1; - #####: 3803: if (!ctx->boolAddr) { + #####: 3802: char *key = (char*)*data; + #####: 3803: *data += strlen(key)+1; + #####: 3804: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - #####: 3804: read8bPackedBool; - #####: 3805: ctx->boolShift = 0; - -: 3806: } - #####: 3807: if (ctx->boolShift == 8) { + #####: 3805: read8bPackedBool; + #####: 3806: ctx->boolShift = 0; + -: 3807: } + #####: 3808: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3808: readTypeInHighNbl; + #####: 3809: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3809: read8bPackedBool; - #####: 3810: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3810: read8bPackedBool; + #####: 3811: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3811: } - -: 3812: else { - -: 3813: // high nibble - #####: 3814: readTypeInHighNbl; + -: 3812: } + -: 3813: else { + -: 3814: // high nibble + #####: 3815: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3815: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + #####: 3816: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3816: } - #####: 3817: sDictPushTiny(dict, key, (smallt *) bo); + -: 3817: } + #####: 3818: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - -: 3818: } - #####: 3819: break; - -: 3820: case S_DICT: - #####: 3821: loop(dictCount) { + -: 3819: } + #####: 3820: break; + -: 3821: case S_DICT: + #####: 3822: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3822: char *key = (char*)*data; - #####: 3823: *data += strlen(key)+1; - #####: 3824: d = NULL; - #####: 3825: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 3823: char *key = (char*)*data; + #####: 3824: *data += strlen(key)+1; + #####: 3825: d = NULL; + #####: 3826: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 3826: sDictPushTiny(dict, key, (smallt *) d); + #####: 3827: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - -: 3827: } - #####: 3828: break; - -: 3829: case S_DOUBLE: - #####: 3830: loop(dictCount) { + -: 3828: } + #####: 3829: break; + -: 3830: case S_DOUBLE: + #####: 3831: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3831: char *key = (char*)*data; - #####: 3832: *data += strlen(key)+1; - #####: 3833: D = (double *)(*data); - #####: 3834: *data += sizeof(double); - #####: 3835: Do = allocSDouble(*D); + #####: 3832: char *key = (char*)*data; + #####: 3833: *data += strlen(key)+1; + #####: 3834: D = (double *)(*data); + #####: 3835: *data += sizeof(double); + #####: 3836: Do = allocSDouble(*D); call 0 never executed - #####: 3836: sDictPushTiny(dict, key, (smallt *) Do); + #####: 3837: sDictPushTiny(dict, key, (smallt *) Do); call 0 never executed - -: 3837: } - #####: 3838: break; - -: 3839: case S_INT: - #####: 3840: loop(dictCount) { + -: 3838: } + #####: 3839: break; + -: 3840: case S_INT: + #####: 3841: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3841: char *key = (char*)*data; - #####: 3842: *data += strlen(key)+1; - #####: 3843: i64 v = varintToUint(data); + #####: 3842: char *key = (char*)*data; + #####: 3843: *data += strlen(key)+1; + #####: 3844: u64 v = varintToUint(data); call 0 never executed - #####: 3844: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3845: io = allocSInt(v); + #####: 3845: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3846: io = allocSInt(v); call 0 never executed - #####: 3846: sDictPushTiny(dict, key, (smallt *) io); + #####: 3847: sDictPushTiny(dict, key, (smallt *) io); call 0 never executed - -: 3847: } - #####: 3848: break; - -: 3849: case S_STRING: - #####: 3850: loop(dictCount) { + -: 3848: } + #####: 3849: break; + -: 3850: case S_STRING: + #####: 3851: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3851: char *key = (char*)*data; - #####: 3852: *data += strlen(key)+1; - #####: 3853: s = (char *)(*data); - #####: 3854: *data += strlen(s)+1; - #####: 3855: so = allocSStringTiny(s); + #####: 3852: char *key = (char*)*data; + #####: 3853: *data += strlen(key)+1; + #####: 3854: s = (char *)(*data); + #####: 3855: *data += strlen(s)+1; + #####: 3856: so = allocSStringTiny(s); call 0 never executed - #####: 3856: sDictPushTiny(dict, key, (smallt *) so); + #####: 3857: sDictPushTiny(dict, key, (smallt *) so); call 0 never executed - -: 3857: } - #####: 3858: break; - -: 3859: case S_ARRAY: - #####: 3860: loop(dictCount) { + -: 3858: } + #####: 3859: break; + -: 3860: case S_ARRAY: + #####: 3861: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3861: char *key = (char*)*data; - #####: 3862: *data += strlen(key)+1; - #####: 3863: a = NULL; - #####: 3864: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 3862: char *key = (char*)*data; + #####: 3863: *data += strlen(key)+1; + #####: 3864: a = NULL; + #####: 3865: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 3865: sDictPushTiny(dict, key, (smallt *) a); + #####: 3866: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - -: 3866: } - #####: 3867: break; - -: 3868: case S_BYTES: - #####: 3869: loop(dictCount) { + -: 3867: } + #####: 3868: break; + -: 3869: case S_BYTES: + #####: 3870: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3870: char *key = (char*)*data; - #####: 3871: *data += strlen(key)+1; - #####: 3872: B = allocSBytes(); + #####: 3871: char *key = (char*)*data; + #####: 3872: *data += strlen(key)+1; + #####: 3873: B = allocSBytes(); call 0 never executed - #####: 3873: count = varintToUint((u8**)data); + #####: 3874: count = varintToUint((u8**)data); call 0 never executed - #####: 3874: sBytesPushBuffer(&B, data, count); + #####: 3875: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3875: *data += count; - #####: 3876: sDictPushTiny(dict, key, (smallt *) B); + #####: 3876: *data += count; + #####: 3877: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - -: 3877: } - #####: 3878: break; - -: 3879: case UNIFORM_DICT: - #####: 3880: loop(dictCount) { + -: 3878: } + #####: 3879: break; + -: 3880: case UNIFORM_DICT: + #####: 3881: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3881: char *key = (char*)*data; - #####: 3882: *data += strlen(key)+1; - #####: 3883: d = NULL; - #####: 3884: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 3882: char *key = (char*)*data; + #####: 3883: *data += strlen(key)+1; + #####: 3884: d = NULL; + #####: 3885: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 3885: sDictPushTiny(dict, key, (smallt *) d); + #####: 3886: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - -: 3886: } - #####: 3887: break; - -: 3888: case UNIFORM_ARRAY: - #####: 3889: loop(dictCount) { + -: 3887: } + #####: 3888: break; + -: 3889: case UNIFORM_ARRAY: + #####: 3890: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3890: char *key = (char*)*data; - #####: 3891: *data += strlen(key)+1; - #####: 3892: a = NULL; - #####: 3893: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 3891: char *key = (char*)*data; + #####: 3892: *data += strlen(key)+1; + #####: 3893: a = NULL; + #####: 3894: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 3894: sDictPushTiny(dict, key, (smallt *) a); + #####: 3895: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - -: 3895: } - #####: 3896: break; - -: 3897: } - -: 3898:} - -: 3899: - -: 3900:/** - -: 3901: * deserialize array from data - -: 3902: * - -: 3903: * a new array is allocated - -: 3904: * - -: 3905: * \param - -: 3906: * array holding the elements - -: 3907: * data serialized dictionary - -: 3908: */ + -: 3896: } + #####: 3897: break; + -: 3898: } + -: 3899:} + -: 3900: + -: 3901:/** + -: 3902: * deserialize array from data + -: 3903: * + -: 3904: * a new array is allocated + -: 3905: * + -: 3906: * \param + -: 3907: * array holding the elements + -: 3908: * data serialized dictionary + -: 3909: */ function arrayNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3909:internal void arrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - #####: 3910: sUndefinedt *u = NULL; - #####: 3911: sBoolt *bo = NULL; - #####: 3912: double *D = NULL; - #####: 3913: sDoublet *Do = NULL; - #####: 3914: sDictt *d = NULL; - #####: 3915: sIntt *io = NULL; - #####: 3916: char *s = NULL; - #####: 3917: sStringt *so = NULL; - #####: 3918: sArrayt *a = NULL; - #####: 3919: sBytest *B = NULL; - -: 3920: uint32_t count; - -: 3921: uint32_t arrayCount; - -: 3922: - #####: 3923: if (packed) { + #####: 3910:internal void arrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { + #####: 3911: sUndefinedt *u = NULL; + #####: 3912: sBoolt *bo = NULL; + #####: 3913: double *D = NULL; + #####: 3914: sDoublet *Do = NULL; + #####: 3915: sDictt *d = NULL; + #####: 3916: sIntt *io = NULL; + #####: 3917: char *s = NULL; + #####: 3918: sStringt *so = NULL; + #####: 3919: sArrayt *a = NULL; + #####: 3920: sBytest *B = NULL; + -: 3921: uint32_t count; + -: 3922: uint32_t arrayCount; + -: 3923: + #####: 3924: if (packed) { branch 0 never executed branch 1 never executed - #####: 3924: arrayCount = varintToUint(data); + #####: 3925: arrayCount = varintToUint(data); call 0 never executed - -: 3925: } - -: 3926: else { - #####: 3927: if (ctx->nibble == lowNbl) { + -: 3926: } + -: 3927: else { + #####: 3928: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3928: arrayCount = netTypeVarintToUint(data); + #####: 3929: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 3929: } - -: 3930: else { - -: 3931: // high nibble - #####: 3932: readTypeInHighNbl; + -: 3930: } + -: 3931: else { + -: 3932: // high nibble + #####: 3933: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3933: arrayCount = varintToUint(data); + #####: 3934: arrayCount = varintToUint(data); call 0 never executed - -: 3934: } - -: 3935: } - -: 3936: - #####: 3937: if (!arrayCount) { + -: 3935: } + -: 3936: } + -: 3937: + #####: 3938: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 3938: *array = allocSArray();; + #####: 3939: *array = allocSArray();; call 0 never executed - #####: 3939: ret; - -: 3940: } - -: 3941: - #####: 3942: loop(arrayCount) { + #####: 3940: ret; + -: 3941: } + -: 3942: + #####: 3943: loop(arrayCount) { branch 0 never executed branch 1 never executed - -: 3943: char type; - #####: 3944: if (ctx->nibble == lowNbl) { + -: 3944: char type; + #####: 3945: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3945: type = (**data) & 0xF; - -: 3946: } - -: 3947: else { - -: 3948: // high nibble - #####: 3949: type = (*ctx->nblAddr) >> 4; - -: 3950: } - -: 3951: - #####: 3952: switch(type) { + #####: 3946: type = (**data) & 0xF; + -: 3947: } + -: 3948: else { + -: 3949: // high nibble + #####: 3950: type = (*ctx->nblAddr) >> 4; + -: 3951: } + -: 3952: + #####: 3953: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5808,251 +5809,251 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3953: case S_UNDEFINED: - #####: 3954: if (ctx->nibble == lowNbl) { + -: 3954: case S_UNDEFINED: + #####: 3955: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3955: readTypeOnly; - -: 3956: } - -: 3957: else { - -: 3958: // high nibble - #####: 3959: readTypeInHighNbl; + #####: 3956: readTypeOnly; + -: 3957: } + -: 3958: else { + -: 3959: // high nibble + #####: 3960: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3960: } - #####: 3961: u = allocSUndefined(); + -: 3961: } + #####: 3962: u = allocSUndefined(); call 0 never executed - #####: 3962: sArrayPushTiny(array, (smallt *) u); + #####: 3963: sArrayPushTiny(array, (smallt *) u); call 0 never executed - #####: 3963: break; - -: 3964: case S_BOOL: - #####: 3965: if (!ctx->boolAddr) { + #####: 3964: break; + -: 3965: case S_BOOL: + #####: 3966: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3966: // new packed bools - #####: 3967: if (ctx->nibble == lowNbl) { + -: 3967: // new packed bools + #####: 3968: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3968: read4bPackedBool; - #####: 3969: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3969: read4bPackedBool; + #####: 3970: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3970: } - -: 3971: else { - -: 3972: // high nibble - #####: 3973: readTypeInHighNbl; + -: 3971: } + -: 3972: else { + -: 3973: // high nibble + #####: 3974: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3974: read8bPackedBool; - #####: 3975: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3975: read8bPackedBool; + #####: 3976: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3976: } - -: 3977: } - -: 3978: else { - -: 3979: // there was a bool before this one, read bits in nibbles - #####: 3980: if (ctx->nibble == lowNbl) { + -: 3977: } + -: 3978: } + -: 3979: else { + -: 3980: // there was a bool before this one, read bits in nibbles + #####: 3981: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3981: if (ctx->boolShift == 8) { + #####: 3982: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3982: read4bPackedBool; - #####: 3983: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3983: read4bPackedBool; + #####: 3984: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3984: } - -: 3985: else { - #####: 3986: readTypeOnly; - #####: 3987: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3985: } + -: 3986: else { + #####: 3987: readTypeOnly; + #####: 3988: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3988: } - -: 3989: } - -: 3990: else { - -: 3991: // high nibble - #####: 3992: readTypeInHighNbl; + -: 3989: } + -: 3990: } + -: 3991: else { + -: 3992: // high nibble + #####: 3993: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3993: if (ctx->boolShift == 8) { + #####: 3994: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3994: read8bPackedBool; - #####: 3995: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3995: read8bPackedBool; + #####: 3996: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3996: } - -: 3997: else { - #####: 3998: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3997: } + -: 3998: else { + #####: 3999: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3999: } - -: 4000: } - -: 4001: } - #####: 4002: sArrayPushTiny(array, (smallt *) bo); + -: 4000: } + -: 4001: } + -: 4002: } + #####: 4003: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - #####: 4003: break; - -: 4004: case S_DICT: - #####: 4005: d = NULL; - #####: 4006: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 4004: break; + -: 4005: case S_DICT: + #####: 4006: d = NULL; + #####: 4007: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 4007: sArrayPushTiny(array, (smallt *) d); + #####: 4008: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 4008: break; - -: 4009: case S_DOUBLE: - #####: 4010: if (ctx->nibble == lowNbl) { + #####: 4009: break; + -: 4010: case S_DOUBLE: + #####: 4011: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4011: readTypeOnly; - -: 4012: } - -: 4013: else { - -: 4014: // high nibble - #####: 4015: readTypeInHighNbl; + #####: 4012: readTypeOnly; + -: 4013: } + -: 4014: else { + -: 4015: // high nibble + #####: 4016: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 4016: } - #####: 4017: D = (double *)(*data); - #####: 4018: *data += sizeof(double); - #####: 4019: Do = allocSDouble(*D); + -: 4017: } + #####: 4018: D = (double *)(*data); + #####: 4019: *data += sizeof(double); + #####: 4020: Do = allocSDouble(*D); call 0 never executed - #####: 4020: sArrayPushTiny(array, (smallt *) Do); + #####: 4021: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - #####: 4021: break; - -: 4022: case S_INT: { - -: 4023: i64 v; - #####: 4024: if (ctx->nibble == lowNbl) { + #####: 4022: break; + -: 4023: case S_INT: { + -: 4024: u64 v; + #####: 4025: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4025: v = netTypeVarintToUint((u8**)data); + #####: 4026: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4026: } - -: 4027: else { - -: 4028: // high nibble - #####: 4029: readTypeInHighNbl; + -: 4027: } + -: 4028: else { + -: 4029: // high nibble + #####: 4030: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4030: v = varintToUint(data); + #####: 4031: v = varintToUint(data); call 0 never executed - -: 4031: } - #####: 4032: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 4033: io = allocSInt(v); + -: 4032: } + #####: 4033: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 4034: io = allocSInt(v); call 0 never executed - #####: 4034: sArrayPushTiny(array, (smallt *) io); + #####: 4035: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 4035: } - #####: 4036: break; - -: 4037: case S_STRING: - #####: 4038: if (ctx->nibble == lowNbl) { + -: 4036: } + #####: 4037: break; + -: 4038: case S_STRING: + #####: 4039: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4039: readTypeOnly; - -: 4040: } - -: 4041: else { - -: 4042: // high nibble - #####: 4043: readTypeInHighNbl; + #####: 4040: readTypeOnly; + -: 4041: } + -: 4042: else { + -: 4043: // high nibble + #####: 4044: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 4044: } - #####: 4045: s = (char *)(*data); - #####: 4046: *data += strlen(s)+1; - #####: 4047: so = allocSStringTiny(s); + -: 4045: } + #####: 4046: s = (char *)(*data); + #####: 4047: *data += strlen(s)+1; + #####: 4048: so = allocSStringTiny(s); call 0 never executed - #####: 4048: sArrayPushTiny(array, (smallt *) so); + #####: 4049: sArrayPushTiny(array, (smallt *) so); call 0 never executed - #####: 4049: break; - -: 4050: case S_ARRAY: - #####: 4051: a = NULL; - #####: 4052: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 4050: break; + -: 4051: case S_ARRAY: + #####: 4052: a = NULL; + #####: 4053: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 4053: sArrayPushTiny(array, (smallt *) a); + #####: 4054: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 4054: break; - -: 4055: case S_BYTES: - #####: 4056: B = allocSBytes(); + #####: 4055: break; + -: 4056: case S_BYTES: + #####: 4057: B = allocSBytes(); call 0 never executed - #####: 4057: if (ctx->nibble == lowNbl) { + #####: 4058: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4058: count = netTypeVarintToUint((u8**)data); + #####: 4059: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4059: } - -: 4060: else { - -: 4061: // high nibble - #####: 4062: readTypeInHighNbl; + -: 4060: } + -: 4061: else { + -: 4062: // high nibble + #####: 4063: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4063: count = varintToUint((u8**)data); + #####: 4064: count = varintToUint((u8**)data); call 0 never executed - -: 4064: } - #####: 4065: sBytesPushBuffer(&B, data, count); + -: 4065: } + #####: 4066: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4066: *data += count; - #####: 4067: sArrayPushTiny(array, (smallt *) B); + #####: 4067: *data += count; + #####: 4068: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 4068: break; - -: 4069: case UNIFORM_DICT: - #####: 4070: d = NULL; - #####: 4071: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 4069: break; + -: 4070: case UNIFORM_DICT: + #####: 4071: d = NULL; + #####: 4072: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 4072: sArrayPushTiny(array, (smallt *) d); + #####: 4073: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 4073: break; - -: 4074: case UNIFORM_ARRAY: - #####: 4075: a = NULL; - #####: 4076: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 4074: break; + -: 4075: case UNIFORM_ARRAY: + #####: 4076: a = NULL; + #####: 4077: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 4077: sArrayPushTiny(array, (smallt *) a); + #####: 4078: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 4078: break; - -: 4079: } - -: 4080: } - -: 4081:} - -: 4082: + #####: 4079: break; + -: 4080: } + -: 4081: } + -: 4082:} + -: 4083: function uniformArrayNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 4083:internal void uniformArrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - #####: 4084: sUndefinedt *u = NULL; - #####: 4085: sBoolt *bo = NULL; - #####: 4086: double *D = NULL; - #####: 4087: sDoublet *Do = NULL; - #####: 4088: sDictt *d = NULL; - #####: 4089: sIntt *io = NULL; - #####: 4090: char *s = NULL; - #####: 4091: sStringt *so = NULL; - #####: 4092: sArrayt *a = NULL; - #####: 4093: sBytest *B = NULL; - -: 4094: uint32_t count; - -: 4095: uint32_t arrayCount; - -: 4096: u8 type; - -: 4097: - #####: 4098: if (packed) { + #####: 4084:internal void uniformArrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { + #####: 4085: sUndefinedt *u = NULL; + #####: 4086: sBoolt *bo = NULL; + #####: 4087: double *D = NULL; + #####: 4088: sDoublet *Do = NULL; + #####: 4089: sDictt *d = NULL; + #####: 4090: sIntt *io = NULL; + #####: 4091: char *s = NULL; + #####: 4092: sStringt *so = NULL; + #####: 4093: sArrayt *a = NULL; + #####: 4094: sBytest *B = NULL; + -: 4095: uint32_t count; + -: 4096: uint32_t arrayCount; + -: 4097: u8 type; + -: 4098: + #####: 4099: if (packed) { branch 0 never executed branch 1 never executed - #####: 4099: type = (**data) & 0xF; - #####: 4100: arrayCount = netTypeVarintToUint(data); + #####: 4100: type = (**data) & 0xF; + #####: 4101: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 4101: } - -: 4102: else { - #####: 4103: if (ctx->nibble == lowNbl) { + -: 4102: } + -: 4103: else { + #####: 4104: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4104: type = (**data) >> 4; - #####: 4105: (*data)++; - #####: 4106: arrayCount = varintToUint(data); + #####: 4105: type = (**data) >> 4; + #####: 4106: (*data)++; + #####: 4107: arrayCount = varintToUint(data); call 0 never executed - -: 4107: } - -: 4108: else { - #####: 4109: readTypeInHighNbl; + -: 4108: } + -: 4109: else { + #####: 4110: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4110: type = (**data) & 0xF; - #####: 4111: arrayCount = netTypeVarintToUint(data); + #####: 4111: type = (**data) & 0xF; + #####: 4112: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 4112: } - -: 4113: } - -: 4114: - #####: 4115: if (!arrayCount) { + -: 4113: } + -: 4114: } + -: 4115: + #####: 4116: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 4116: *array = allocSArray();; + #####: 4117: *array = allocSArray();; call 0 never executed - #####: 4117: ret; - -: 4118: } - -: 4119: - #####: 4120: switch(type) { + #####: 4118: ret; + -: 4119: } + -: 4120: + #####: 4121: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -6064,353 +6065,353 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 4121: case S_UNDEFINED: - #####: 4122: loop(arrayCount) { + -: 4122: case S_UNDEFINED: + #####: 4123: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4123: u = allocSUndefined(); + #####: 4124: u = allocSUndefined(); call 0 never executed - #####: 4124: sArrayPushTiny(array, (smallt *) u); + #####: 4125: sArrayPushTiny(array, (smallt *) u); call 0 never executed - -: 4125: } - #####: 4126: break; - -: 4127: case S_BOOL: - #####: 4128: loop(arrayCount) { + -: 4126: } + #####: 4127: break; + -: 4128: case S_BOOL: + #####: 4129: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4129: if (!ctx->boolAddr) { + #####: 4130: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - #####: 4130: read8bPackedBool; - #####: 4131: ctx->boolShift = 0; - -: 4132: } - #####: 4133: if (ctx->boolShift == 8) { + #####: 4131: read8bPackedBool; + #####: 4132: ctx->boolShift = 0; + -: 4133: } + #####: 4134: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 4134: read8bPackedBool; - #####: 4135: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 4135: read8bPackedBool; + #####: 4136: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 4136: } - -: 4137: else { - #####: 4138: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 4137: } + -: 4138: else { + #####: 4139: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 4139: } - #####: 4140: sArrayPushTiny(array, (smallt *) bo); + -: 4140: } + #####: 4141: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - -: 4141: } - #####: 4142: break; - -: 4143: case S_DICT: - #####: 4144: loop(arrayCount) { + -: 4142: } + #####: 4143: break; + -: 4144: case S_DICT: + #####: 4145: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4145: d = NULL; - #####: 4146: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 4146: d = NULL; + #####: 4147: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 4147: sArrayPushTiny(array, (smallt *) d); + #####: 4148: sArrayPushTiny(array, (smallt *) d); call 0 never executed - -: 4148: } - #####: 4149: break; - -: 4150: case S_DOUBLE: - #####: 4151: loop(arrayCount) { + -: 4149: } + #####: 4150: break; + -: 4151: case S_DOUBLE: + #####: 4152: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4152: D = (double *)(*data); - #####: 4153: *data += sizeof(double); - #####: 4154: Do = allocSDouble(*D); + #####: 4153: D = (double *)(*data); + #####: 4154: *data += sizeof(double); + #####: 4155: Do = allocSDouble(*D); call 0 never executed - #####: 4155: sArrayPushTiny(array, (smallt *) Do); + #####: 4156: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - -: 4156: } - #####: 4157: break; - -: 4158: case S_INT: - #####: 4159: loop(arrayCount) { + -: 4157: } + #####: 4158: break; + -: 4159: case S_INT: + #####: 4160: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4160: i64 v = varintToUint(data); + #####: 4161: u64 v = varintToUint(data); call 0 never executed - #####: 4161: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 4162: io = allocSInt(v); + #####: 4162: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 4163: io = allocSInt(v); call 0 never executed - #####: 4163: sArrayPushTiny(array, (smallt *) io); + #####: 4164: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 4164: } - #####: 4165: break; - -: 4166: case S_STRING: - #####: 4167: loop(arrayCount) { + -: 4165: } + #####: 4166: break; + -: 4167: case S_STRING: + #####: 4168: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4168: s = (char *)(*data); - #####: 4169: *data += strlen(s)+1; - #####: 4170: so = allocSStringTiny(s); + #####: 4169: s = (char *)(*data); + #####: 4170: *data += strlen(s)+1; + #####: 4171: so = allocSStringTiny(s); call 0 never executed - #####: 4171: sArrayPushTiny(array, (smallt *) so); + #####: 4172: sArrayPushTiny(array, (smallt *) so); call 0 never executed - -: 4172: } - #####: 4173: break; - -: 4174: case S_ARRAY: - #####: 4175: loop(arrayCount) { + -: 4173: } + #####: 4174: break; + -: 4175: case S_ARRAY: + #####: 4176: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4176: a = NULL; - #####: 4177: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 4177: a = NULL; + #####: 4178: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 4178: sArrayPushTiny(array, (smallt *) a); + #####: 4179: sArrayPushTiny(array, (smallt *) a); call 0 never executed - -: 4179: } - #####: 4180: break; - -: 4181: case S_BYTES: - #####: 4182: loop(arrayCount) { + -: 4180: } + #####: 4181: break; + -: 4182: case S_BYTES: + #####: 4183: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4183: B = allocSBytes(); + #####: 4184: B = allocSBytes(); call 0 never executed - #####: 4184: count = varintToUint((u8**)data); + #####: 4185: count = varintToUint((u8**)data); call 0 never executed - #####: 4185: sBytesPushBuffer(&B, data, count); + #####: 4186: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4186: *data += count; - #####: 4187: sArrayPushTiny(array, (smallt *) B); + #####: 4187: *data += count; + #####: 4188: sArrayPushTiny(array, (smallt *) B); call 0 never executed - -: 4188: } - #####: 4189: break; - -: 4190: case UNIFORM_DICT: - #####: 4191: loop(arrayCount) { + -: 4189: } + #####: 4190: break; + -: 4191: case UNIFORM_DICT: + #####: 4192: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4192: d = NULL; - #####: 4193: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 4193: d = NULL; + #####: 4194: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 4194: sArrayPushTiny(array, (smallt *) d); + #####: 4195: sArrayPushTiny(array, (smallt *) d); call 0 never executed - -: 4195: } - #####: 4196: break; - -: 4197: case UNIFORM_ARRAY: - #####: 4198: loop(arrayCount) { + -: 4196: } + #####: 4197: break; + -: 4198: case UNIFORM_ARRAY: + #####: 4199: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4199: a = NULL; - #####: 4200: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 4200: a = NULL; + #####: 4201: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 4201: sArrayPushTiny(array, (smallt *) a); + #####: 4202: sArrayPushTiny(array, (smallt *) a); call 0 never executed - -: 4202: } - #####: 4203: break; - -: 4204: } - -: 4205:} - -: 4206: + -: 4203: } + #####: 4204: break; + -: 4205: } + -: 4206:} + -: 4207: function deserialNetSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 4207:internal smallJsont* deserialNetSerialLevel2(smallJsont *self, smallBytest *data) { - -: 4208: - #####: 4209: if (!data or !data->B or !data->B->count) { + #####: 4208:internal smallJsont* deserialNetSerialLevel2(smallJsont *self, smallBytest *data) { + -: 4209: + #####: 4210: if (!data or !data->B or !data->B->count) { branch 0 never executed branch 1 never executed branch 2 never executed branch 3 never executed branch 4 never executed branch 5 never executed - #####: 4210: ret self; - -: 4211: } - -: 4212: - #####: 4213: smallt *o = netDeserialLevel2(data->B); -call 0 never executed - -: 4214: - #####: 4215: if (!o) { -branch 0 never executed -branch 1 never executed - #####: 4216: ret self; - -: 4217: } - -: 4218: - #####: 4219: freeG(self); -call 0 never executed - -: 4220: - #####: 4221: setsoG(self, o); -call 0 never executed - -: 4222: - #####: 4223: ret self; - -: 4224:} - -: 4225: - -: 4226:// level 3 - -: 4227:// like level 2, elements of identical type in a row are packed - -: 4228: - -: 4229:/** - -: 4230: * deserializer top function - -: 4231: */ -function netDeserial called 78 returned 100% blocks executed 85% - 78: 4232:internal smallt* netDeserial(sBytest *obj) { - 78: 4233: smallt *r = NULL; - 78: 4234: double *D = NULL; - 78: 4235: char *s = NULL; - 78: 4236: sBytest *B = NULL; - -: 4237: uint32_t count; - 78: 4238: char *data = NULL; - 78: 4239: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; - -: 4240: - 78: 4241: switch(obj->data & 0xF) { + #####: 4211: ret self; + -: 4212: } + -: 4213: + #####: 4214: smallt *o = netDeserialLevel2(data->B); +call 0 never executed + -: 4215: + #####: 4216: if (!o) { +branch 0 never executed +branch 1 never executed + #####: 4217: ret self; + -: 4218: } + -: 4219: + #####: 4220: freeG(self); +call 0 never executed + -: 4221: + #####: 4222: setsoG(self, o); +call 0 never executed + -: 4223: + #####: 4224: ret self; + -: 4225:} + -: 4226: + -: 4227:// level 3 + -: 4228:// like level 2, elements of identical type in a row are packed + -: 4229: + -: 4230:/** + -: 4231: * deserializer top function + -: 4232: */ +function netDeserial called 79 returned 100% blocks executed 85% + 79: 4233:internal smallt* netDeserial(sBytest *obj) { + 79: 4234: smallt *r = NULL; + 79: 4235: double *D = NULL; + 79: 4236: char *s = NULL; + 79: 4237: sBytest *B = NULL; + -: 4238: uint32_t count; + 79: 4239: char *data = NULL; + 79: 4240: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; + -: 4241: + 79: 4242: switch(obj->data & 0xF) { branch 0 taken 1% branch 1 taken 1% -branch 2 taken 31% +branch 2 taken 30% branch 3 taken 1% -branch 4 taken 3% +branch 4 taken 4% branch 5 taken 1% -branch 6 taken 31% +branch 6 taken 30% branch 7 taken 0% branch 8 taken 15% branch 9 taken 15% branch 10 taken 0% - -: 4242: case S_UNDEFINED: - 1: 4243: r = (smallt *) allocSUndefined(); -call 0 returned 100% - 1: 4244: break; - -: 4245: case S_BOOL: - 1: 4246: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 returned 100% - 1: 4247: break; - -: 4248: case S_DICT: - 24: 4249: data = (char *)&(obj->data); - -: 4250: //debug - ctx.dbuf = (u8*) data; - 24: 4251: dictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 24: 4252: break; - -: 4253: case S_DOUBLE: - 1: 4254: data = &(obj->data)+1; - 1: 4255: D = (double *)data; - 1: 4256: r = (smallt *) allocSDouble(*D); -call 0 returned 100% - 1: 4257: break; - -: 4258: case S_INT: - 2: 4259: data = &(obj->data); - 2: 4260: i64 v = netTypeVarintToUint((u8**)&data); -call 0 returned 100% - 2: 4261: v = (v >> 1) ^ ((v << 63) >> 63); - 2: 4262: r = (smallt *) allocSInt(v); -call 0 returned 100% - 2: 4263: break; - -: 4264: case S_STRING: - 1: 4265: s = (char *)&(obj->data)+1; - 1: 4266: r = (smallt *) allocSStringTiny(s); -call 0 returned 100% - 1: 4267: break; - -: 4268: case S_ARRAY: - 24: 4269: data = (char *)&(obj->data); - -: 4270: //debug - ctx.dbuf = (u8*) data; - 24: 4271: arrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 24: 4272: break; - -: 4273: case S_BYTES: - #####: 4274: B = allocSBytes(); -call 0 never executed - #####: 4275: data = &(obj->data); - #####: 4276: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 4277: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 4278: r = (smallt *)B; - #####: 4279: break; - -: 4280: case UNIFORM_DICT: - 12: 4281: data = (char *)&(obj->data); - -: 4282: //debug - ctx.dbuf = (u8*) data; - 12: 4283: uniformDictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 12: 4284: break; - -: 4285: case UNIFORM_ARRAY: - 12: 4286: data = (char *)&(obj->data); - -: 4287: //debug - ctx.dbuf = (u8*) data; - 12: 4288: uniformArrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 12: 4289: break; - -: 4290: } - -: 4291: - 78: 4292: ret r; - -: 4293:} - -: 4294: - -: 4295:/** - -: 4296: * deserialize dictionary from data - -: 4297: * - -: 4298: * a new dictionary is allocated - -: 4299: * - -: 4300: * \param - -: 4301: * dict dictionary holding the elements - -: 4302: * data serialized dictionary - -: 4303: */ + -: 4243: case S_UNDEFINED: + 1: 4244: r = (smallt *) allocSUndefined(); +call 0 returned 100% + 1: 4245: break; + -: 4246: case S_BOOL: + 1: 4247: r = (smallt *) allocSBool(obj->data & 0x10); +call 0 returned 100% + 1: 4248: break; + -: 4249: case S_DICT: + 24: 4250: data = (char *)&(obj->data); + -: 4251: //debug - ctx.dbuf = (u8*) data; + 24: 4252: dictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 returned 100% + 24: 4253: break; + -: 4254: case S_DOUBLE: + 1: 4255: data = &(obj->data)+1; + 1: 4256: D = (double *)data; + 1: 4257: r = (smallt *) allocSDouble(*D); +call 0 returned 100% + 1: 4258: break; + -: 4259: case S_INT: + 3: 4260: data = &(obj->data); + 3: 4261: u64 v = netTypeVarintToUint((u8**)&data); +call 0 returned 100% + 3: 4262: v = (v >> 1) ^ (~(v & 1) + 1); + 3: 4263: r = (smallt *) allocSInt(v); +call 0 returned 100% + 3: 4264: break; + -: 4265: case S_STRING: + 1: 4266: s = (char *)&(obj->data)+1; + 1: 4267: r = (smallt *) allocSStringTiny(s); +call 0 returned 100% + 1: 4268: break; + -: 4269: case S_ARRAY: + 24: 4270: data = (char *)&(obj->data); + -: 4271: //debug - ctx.dbuf = (u8*) data; + 24: 4272: arrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 returned 100% + 24: 4273: break; + -: 4274: case S_BYTES: + #####: 4275: B = allocSBytes(); +call 0 never executed + #####: 4276: data = &(obj->data); + #####: 4277: count = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 4278: sBytesPushBuffer(&B, data, count); +call 0 never executed + #####: 4279: r = (smallt *)B; + #####: 4280: break; + -: 4281: case UNIFORM_DICT: + 12: 4282: data = (char *)&(obj->data); + -: 4283: //debug - ctx.dbuf = (u8*) data; + 12: 4284: uniformDictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 returned 100% + 12: 4285: break; + -: 4286: case UNIFORM_ARRAY: + 12: 4287: data = (char *)&(obj->data); + -: 4288: //debug - ctx.dbuf = (u8*) data; + 12: 4289: uniformArrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 returned 100% + 12: 4290: break; + -: 4291: } + -: 4292: + 79: 4293: ret r; + -: 4294:} + -: 4295: + -: 4296:/** + -: 4297: * deserialize dictionary from data + -: 4298: * + -: 4299: * a new dictionary is allocated + -: 4300: * + -: 4301: * \param + -: 4302: * dict dictionary holding the elements + -: 4303: * data serialized dictionary + -: 4304: */ function dictNetDeserial called 54 returned 100% blocks executed 78% - 54: 4304:internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - 54: 4305: sUndefinedt *u = NULL; - 54: 4306: sBoolt *bo = NULL; - 54: 4307: double *D = NULL; - 54: 4308: sDoublet *Do = NULL; - 54: 4309: sDictt *d = NULL; - 54: 4310: sIntt *io = NULL; - 54: 4311: char *s = NULL; - 54: 4312: sStringt *so = NULL; - 54: 4313: sArrayt *a = NULL; - 54: 4314: sBytest *B = NULL; - -: 4315: uint32_t count; - -: 4316: uint32_t dictCount; - -: 4317: - 54: 4318: if (packed) { + 54: 4305:internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { + 54: 4306: sUndefinedt *u = NULL; + 54: 4307: sBoolt *bo = NULL; + 54: 4308: double *D = NULL; + 54: 4309: sDoublet *Do = NULL; + 54: 4310: sDictt *d = NULL; + 54: 4311: sIntt *io = NULL; + 54: 4312: char *s = NULL; + 54: 4313: sStringt *so = NULL; + 54: 4314: sArrayt *a = NULL; + 54: 4315: sBytest *B = NULL; + -: 4316: uint32_t count; + -: 4317: uint32_t dictCount; + -: 4318: + 54: 4319: if (packed) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 27: 4319: dictCount = varintToUint(data); + 27: 4320: dictCount = varintToUint(data); call 0 returned 100% - -: 4320: } - -: 4321: else { - 27: 4322: if (ctx->nibble == lowNbl) { + -: 4321: } + -: 4322: else { + 27: 4323: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 25: 4323: dictCount = netTypeVarintToUint(data); -call 0 returned 100% - -: 4324: } - -: 4325: else { - -: 4326: // high nibble - -: 4327: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; - -: 4328: #define readTypeInHighNbl\ - -: 4329: ctx->nibble = lowNbl;\ - -: 4330: if (ctx->nblAddr == *data)\ - -: 4331: /* data points to the type, next byte is count */\ - -: 4332: (*data)++ - 2: 4333: readTypeInHighNbl; + 25: 4324: dictCount = netTypeVarintToUint(data); +call 0 returned 100% + -: 4325: } + -: 4326: else { + -: 4327: // high nibble + -: 4328: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; + -: 4329: #define readTypeInHighNbl\ + -: 4330: ctx->nibble = lowNbl;\ + -: 4331: if (ctx->nblAddr == *data)\ + -: 4332: /* data points to the type, next byte is count */\ + -: 4333: (*data)++ + 2: 4334: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 2: 4334: dictCount = varintToUint(data); + 2: 4335: dictCount = varintToUint(data); call 0 returned 100% - -: 4335: } - -: 4336: } - -: 4337: - 54: 4338: if (!dictCount) { + -: 4336: } + -: 4337: } + -: 4338: + 54: 4339: if (!dictCount) { branch 0 taken 19% (fallthrough) branch 1 taken 81% - 10: 4339: *dict = allocSDict(); -call 0 returned 100% - 10: 4340: ret; - -: 4341: } - -: 4342: - 44: 4343: bool inPack = false; - -: 4344: u8 packedType; - -: 4345: size_t packCount; - 200: 4346: loop(dictCount) { + 10: 4340: *dict = allocSDict(); +call 0 returned 100% + 10: 4341: ret; + -: 4342: } + -: 4343: + 44: 4344: bool inPack = false; + -: 4345: u8 packedType; + -: 4346: size_t packCount; + 200: 4347: loop(dictCount) { branch 0 taken 78% branch 1 taken 22% (fallthrough) - 156: 4347: char *key = (char*)*data; - 156: 4348: *data += strlen(key)+1; - -: 4349: char type; - 156: 4350: if (inPack) { + 156: 4348: char *key = (char*)*data; + 156: 4349: *data += strlen(key)+1; + -: 4350: char type; + 156: 4351: if (inPack) { branch 0 taken 24% (fallthrough) branch 1 taken 76% - 38: 4351: type = packedType; - -: 4352: } - -: 4353: else { - 118: 4354: if (ctx->nibble == lowNbl) { + 38: 4352: type = packedType; + -: 4353: } + -: 4354: else { + 118: 4355: if (ctx->nibble == lowNbl) { branch 0 taken 67% (fallthrough) branch 1 taken 33% - 79: 4355: type = (**data) & 0xF; - -: 4356: } - -: 4357: else { - -: 4358: // high nibble - 39: 4359: type = (*ctx->nblAddr) >> 4; - -: 4360: } - -: 4361: } - -: 4362: - 156: 4363: switch(type) { + 79: 4356: type = (**data) & 0xF; + -: 4357: } + -: 4358: else { + -: 4359: // high nibble + 39: 4360: type = (*ctx->nblAddr) >> 4; + -: 4361: } + -: 4362: } + -: 4363: + 156: 4364: switch(type) { branch 0 taken 17% branch 1 taken 20% branch 2 taken 1% @@ -6428,483 +6429,483 @@ branch 13 taken 0% branch 14 taken 3% branch 15 taken 3% branch 16 taken 0% - -: 4364: case S_UNDEFINED: - 26: 4365: if (ctx->nibble == lowNbl) { + -: 4365: case S_UNDEFINED: + 26: 4366: if (ctx->nibble == lowNbl) { branch 0 taken 92% (fallthrough) branch 1 taken 8% - -: 4366: #define readTypeOnly\ - -: 4367: ctx->nibble = highNbl;\ - -: 4368: ctx->nblAddr = *data;\ - -: 4369: (*data)++ - 24: 4370: readTypeOnly; - -: 4371: } - -: 4372: else { - -: 4373: // high nibble - 2: 4374: readTypeInHighNbl; + -: 4367: #define readTypeOnly\ + -: 4368: ctx->nibble = highNbl;\ + -: 4369: ctx->nblAddr = *data;\ + -: 4370: (*data)++ + 24: 4371: readTypeOnly; + -: 4372: } + -: 4373: else { + -: 4374: // high nibble + 2: 4375: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4375: } - 26: 4376: u = allocSUndefined(); + -: 4376: } + 26: 4377: u = allocSUndefined(); call 0 returned 100% - 26: 4377: sDictPushTiny(dict, key, (smallt *) u); + 26: 4378: sDictPushTiny(dict, key, (smallt *) u); call 0 returned 100% - 26: 4378: break; - -: 4379: case S_BOOL: - 31: 4380: if (!ctx->boolAddr) { + 26: 4379: break; + -: 4380: case S_BOOL: + 31: 4381: if (!ctx->boolAddr) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - -: 4381: // new packed bools - 5: 4382: if (ctx->nibble == lowNbl) { + -: 4382: // new packed bools + 5: 4383: if (ctx->nibble == lowNbl) { branch 0 taken 60% (fallthrough) branch 1 taken 40% - -: 4383: #define read4bPackedBool\ - -: 4384: ctx->boolShift = 5;\ - -: 4385: ctx->boolAddr = *data;\ - -: 4386: (*data)++ - 3: 4387: read4bPackedBool; - 3: 4388: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 returned 100% - -: 4389: } - -: 4390: else { - -: 4391: // high nibble - 2: 4392: readTypeInHighNbl; + -: 4384: #define read4bPackedBool\ + -: 4385: ctx->boolShift = 5;\ + -: 4386: ctx->boolAddr = *data;\ + -: 4387: (*data)++ + 3: 4388: read4bPackedBool; + 3: 4389: bo = allocSBool((*ctx->boolAddr) & 0x10); +call 0 returned 100% + -: 4390: } + -: 4391: else { + -: 4392: // high nibble + 2: 4393: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4393: #define read8bPackedBool\ - -: 4394: ctx->boolShift = 1;\ - -: 4395: ctx->boolAddr = *data;\ - -: 4396: (*data)++ - 2: 4397: read8bPackedBool; - 2: 4398: bo = allocSBool((*ctx->boolAddr) & 0x1); -call 0 returned 100% - -: 4399: } - -: 4400: } - -: 4401: else { - -: 4402: // there was a bool before this one, read bits in nibbles - 26: 4403: if (ctx->nibble == lowNbl) { + -: 4394: #define read8bPackedBool\ + -: 4395: ctx->boolShift = 1;\ + -: 4396: ctx->boolAddr = *data;\ + -: 4397: (*data)++ + 2: 4398: read8bPackedBool; + 2: 4399: bo = allocSBool((*ctx->boolAddr) & 0x1); +call 0 returned 100% + -: 4400: } + -: 4401: } + -: 4402: else { + -: 4403: // there was a bool before this one, read bits in nibbles + 26: 4404: if (ctx->nibble == lowNbl) { branch 0 taken 58% (fallthrough) branch 1 taken 42% - 15: 4404: if (ctx->boolShift == 8) { + 15: 4405: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - 1: 4405: read4bPackedBool; - 1: 4406: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 returned 100% - -: 4407: } - -: 4408: else { - 14: 4409: readTypeOnly; - 14: 4410: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); -call 0 returned 100% - -: 4411: } - -: 4412: } - -: 4413: else { - -: 4414: // high nibble - 11: 4415: readTypeInHighNbl; + 1: 4406: read4bPackedBool; + 1: 4407: bo = allocSBool((*ctx->boolAddr) & 0x10); +call 0 returned 100% + -: 4408: } + -: 4409: else { + 14: 4410: readTypeOnly; + 14: 4411: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); +call 0 returned 100% + -: 4412: } + -: 4413: } + -: 4414: else { + -: 4415: // high nibble + 11: 4416: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 11: 4416: if (ctx->boolShift == 8) { + 11: 4417: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - 2: 4417: read8bPackedBool; - 2: 4418: bo = allocSBool((*ctx->boolAddr) & 0x1); + 2: 4418: read8bPackedBool; + 2: 4419: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 4419: } - -: 4420: else { - -: 4421: // high nibble - 9: 4422: readTypeInHighNbl; + -: 4420: } + -: 4421: else { + -: 4422: // high nibble + 9: 4423: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 9: 4423: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + 9: 4424: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 4424: } - -: 4425: } - -: 4426: } - 31: 4427: sDictPushTiny(dict, key, (smallt *) bo); + -: 4425: } + -: 4426: } + -: 4427: } + 31: 4428: sDictPushTiny(dict, key, (smallt *) bo); call 0 returned 100% - 31: 4428: break; - -: 4429: case S_DICT: - 1: 4430: d = NULL; - 1: 4431: dictNetDeserial(&d, data, ctx, /*packed=*/false); + 31: 4429: break; + -: 4430: case S_DICT: + 1: 4431: d = NULL; + 1: 4432: dictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 1: 4432: sDictPushTiny(dict, key, (smallt *) d); + 1: 4433: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - 1: 4433: break; - -: 4434: case S_DOUBLE: - 2: 4435: if (ctx->nibble == lowNbl) { + 1: 4434: break; + -: 4435: case S_DOUBLE: + 2: 4436: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4436: readTypeOnly; - -: 4437: } - -: 4438: else { - -: 4439: // high nibble - 1: 4440: readTypeInHighNbl; + 1: 4437: readTypeOnly; + -: 4438: } + -: 4439: else { + -: 4440: // high nibble + 1: 4441: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4441: } - 2: 4442: D = (double *)(*data); - 2: 4443: *data += sizeof(double); - 2: 4444: Do = allocSDouble(*D); + -: 4442: } + 2: 4443: D = (double *)(*data); + 2: 4444: *data += sizeof(double); + 2: 4445: Do = allocSDouble(*D); call 0 returned 100% - 2: 4445: sDictPushTiny(dict, key, (smallt *) Do); + 2: 4446: sDictPushTiny(dict, key, (smallt *) Do); call 0 returned 100% - 2: 4446: break; - -: 4447: case S_INT: { - -: 4448: i64 v; - 24: 4449: if (ctx->nibble == lowNbl) { + 2: 4447: break; + -: 4448: case S_INT: { + -: 4449: u64 v; + 24: 4450: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 12: 4450: v = netTypeVarintToUint((u8**)data); + 12: 4451: v = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4451: } - -: 4452: else { - -: 4453: // high nibble - 12: 4454: readTypeInHighNbl; + -: 4452: } + -: 4453: else { + -: 4454: // high nibble + 12: 4455: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 12: 4455: v = varintToUint(data); + 12: 4456: v = varintToUint(data); call 0 returned 100% - -: 4456: } - 24: 4457: v = (v >> 1) ^ ((v << 63) >> 63); - 24: 4458: io = allocSInt(v); + -: 4457: } + 24: 4458: v = (v >> 1) ^ (~(v & 1) + 1); + 24: 4459: io = allocSInt(v); call 0 returned 100% - 24: 4459: sDictPushTiny(dict, key, (smallt *) io); + 24: 4460: sDictPushTiny(dict, key, (smallt *) io); call 0 returned 100% - -: 4460: } - 24: 4461: break; - -: 4462: case S_STRING: - 14: 4463: if (ctx->nibble == lowNbl) { + -: 4461: } + 24: 4462: break; + -: 4463: case S_STRING: + 14: 4464: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 13: 4464: readTypeOnly; - -: 4465: } - -: 4466: else { - -: 4467: // high nibble - 1: 4468: readTypeInHighNbl; + 13: 4465: readTypeOnly; + -: 4466: } + -: 4467: else { + -: 4468: // high nibble + 1: 4469: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4469: } - 14: 4470: s = (char *)(*data); - 14: 4471: *data += strlen(s)+1; - 14: 4472: so = allocSStringTiny(s); + -: 4470: } + 14: 4471: s = (char *)(*data); + 14: 4472: *data += strlen(s)+1; + 14: 4473: so = allocSStringTiny(s); call 0 returned 100% - 14: 4473: sDictPushTiny(dict, key, (smallt *) so); + 14: 4474: sDictPushTiny(dict, key, (smallt *) so); call 0 returned 100% - 14: 4474: break; - -: 4475: case S_ARRAY: - 1: 4476: a = NULL; - 1: 4477: arrayNetDeserial(&a, data, ctx, /*packed=*/false); + 14: 4475: break; + -: 4476: case S_ARRAY: + 1: 4477: a = NULL; + 1: 4478: arrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 1: 4478: sDictPushTiny(dict, key, (smallt *) a); + 1: 4479: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - 1: 4479: break; - -: 4480: case S_BYTES: - #####: 4481: B = allocSBytes(); + 1: 4480: break; + -: 4481: case S_BYTES: + #####: 4482: B = allocSBytes(); call 0 never executed - #####: 4482: if (ctx->nibble == lowNbl) { + #####: 4483: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4483: count = netTypeVarintToUint((u8**)data); + #####: 4484: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4484: } - -: 4485: else { - -: 4486: // high nibble - #####: 4487: readTypeInHighNbl; + -: 4485: } + -: 4486: else { + -: 4487: // high nibble + #####: 4488: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4488: count = varintToUint((u8**)data); + #####: 4489: count = varintToUint((u8**)data); call 0 never executed - -: 4489: } - #####: 4490: sBytesPushBuffer(&B, data, count); + -: 4490: } + #####: 4491: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4491: *data += count; - #####: 4492: sDictPushTiny(dict, key, (smallt *) B); + #####: 4492: *data += count; + #####: 4493: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - #####: 4493: break; - -: 4494: case PK_DICT: - 15: 4495: if (!inPack) { + #####: 4494: break; + -: 4495: case PK_DICT: + 15: 4496: if (!inPack) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - 3: 4496: inPack = true; - 3: 4497: if (ctx->nibble == lowNbl) { + 3: 4497: inPack = true; + 3: 4498: if (ctx->nibble == lowNbl) { branch 0 taken 67% (fallthrough) branch 1 taken 33% - 2: 4498: packCount = netTypeVarintToUint((u8**)data); + 2: 4499: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4499: } - -: 4500: else { - -: 4501: // high nibble - 1: 4502: readTypeInHighNbl; + -: 4500: } + -: 4501: else { + -: 4502: // high nibble + 1: 4503: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4503: packCount = varintToUint((u8**)data); + 1: 4504: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4504: } - 3: 4505: packedType = PK_DICT; - -: 4506: } - -: 4507: - 15: 4508: d = NULL; - 15: 4509: dictNetDeserial(&d, data, ctx, /*packed=*/true); + -: 4505: } + 3: 4506: packedType = PK_DICT; + -: 4507: } + -: 4508: + 15: 4509: d = NULL; + 15: 4510: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 15: 4510: sDictPushTiny(dict, key, (smallt *) d); + 15: 4511: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - -: 4511: // stop unpacking when packCount == 0 - 15: 4512: packCount--; - 15: 4513: if (!packCount) inPack = false; + -: 4512: // stop unpacking when packCount == 0 + 15: 4513: packCount--; + 15: 4514: if (!packCount) inPack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - 15: 4514: break; - -: 4515: case PK_DOUBLE: - 10: 4516: if (!inPack) { + 15: 4515: break; + -: 4516: case PK_DOUBLE: + 10: 4517: if (!inPack) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - 2: 4517: inPack = true; - 2: 4518: if (ctx->nibble == lowNbl) { + 2: 4518: inPack = true; + 2: 4519: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4519: packCount = netTypeVarintToUint((u8**)data); + 1: 4520: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4520: } - -: 4521: else { - -: 4522: // high nibble - 1: 4523: readTypeInHighNbl; + -: 4521: } + -: 4522: else { + -: 4523: // high nibble + 1: 4524: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4524: packCount = varintToUint((u8**)data); + 1: 4525: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4525: } - 2: 4526: packedType = PK_DOUBLE; - -: 4527: } - -: 4528: - 10: 4529: D = (double *)(*data); - 10: 4530: *data += sizeof(double); - 10: 4531: Do = allocSDouble(*D); + -: 4526: } + 2: 4527: packedType = PK_DOUBLE; + -: 4528: } + -: 4529: + 10: 4530: D = (double *)(*data); + 10: 4531: *data += sizeof(double); + 10: 4532: Do = allocSDouble(*D); call 0 returned 100% - 10: 4532: sDictPushTiny(dict, key, (smallt *) Do); + 10: 4533: sDictPushTiny(dict, key, (smallt *) Do); call 0 returned 100% - -: 4533: // stop unpacking when packCount == 0 - 10: 4534: packCount--; - 10: 4535: if (!packCount) inPack = false; + -: 4534: // stop unpacking when packCount == 0 + 10: 4535: packCount--; + 10: 4536: if (!packCount) inPack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - 10: 4536: break; - -: 4537: case PK_INT: - 8: 4538: if (!inPack) { + 10: 4537: break; + -: 4538: case PK_INT: + 8: 4539: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4539: inPack = true; - 2: 4540: if (ctx->nibble == lowNbl) { + 2: 4540: inPack = true; + 2: 4541: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4541: packCount = netTypeVarintToUint((u8**)data); + 1: 4542: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4542: } - -: 4543: else { - -: 4544: // high nibble - 1: 4545: readTypeInHighNbl; + -: 4543: } + -: 4544: else { + -: 4545: // high nibble + 1: 4546: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4546: packCount = varintToUint((u8**)data); + 1: 4547: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4547: } - 2: 4548: packedType = PK_INT; - -: 4549: } - -: 4550: - 8: 4551: i64 v = varintToUint(data); + -: 4548: } + 2: 4549: packedType = PK_INT; + -: 4550: } + -: 4551: + 8: 4552: u64 v = varintToUint(data); call 0 returned 100% - 8: 4552: v = (v >> 1) ^ ((v << 63) >> 63); - 8: 4553: io = allocSInt(v); + 8: 4553: v = (v >> 1) ^ (~(v & 1) + 1); + 8: 4554: io = allocSInt(v); call 0 returned 100% - 8: 4554: sDictPushTiny(dict, key, (smallt *) io); + 8: 4555: sDictPushTiny(dict, key, (smallt *) io); call 0 returned 100% - -: 4555: // stop unpacking when packCount == 0 - 8: 4556: packCount--; - 8: 4557: if (!packCount) inPack = false; + -: 4556: // stop unpacking when packCount == 0 + 8: 4557: packCount--; + 8: 4558: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4558: break; - -: 4559: case PK_STRING: - 8: 4560: if (!inPack) { + 8: 4559: break; + -: 4560: case PK_STRING: + 8: 4561: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4561: inPack = true; - 2: 4562: if (ctx->nibble == lowNbl) { + 2: 4562: inPack = true; + 2: 4563: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4563: packCount = netTypeVarintToUint((u8**)data); + 1: 4564: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4564: } - -: 4565: else { - -: 4566: // high nibble - 1: 4567: readTypeInHighNbl; + -: 4565: } + -: 4566: else { + -: 4567: // high nibble + 1: 4568: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4568: packCount = varintToUint((u8**)data); + 1: 4569: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4569: } - 2: 4570: packedType = PK_STRING; - -: 4571: } - -: 4572: - 8: 4573: s = (char *)(*data); - 8: 4574: *data += strlen(s)+1; - 8: 4575: so = allocSStringTiny(s); + -: 4570: } + 2: 4571: packedType = PK_STRING; + -: 4572: } + -: 4573: + 8: 4574: s = (char *)(*data); + 8: 4575: *data += strlen(s)+1; + 8: 4576: so = allocSStringTiny(s); call 0 returned 100% - 8: 4576: sDictPushTiny(dict, key, (smallt *) so); + 8: 4577: sDictPushTiny(dict, key, (smallt *) so); call 0 returned 100% - -: 4577: // stop unpacking when packCount == 0 - 8: 4578: packCount--; - 8: 4579: if (!packCount) inPack = false; + -: 4578: // stop unpacking when packCount == 0 + 8: 4579: packCount--; + 8: 4580: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4580: break; - -: 4581: case PK_ARRAY: - 8: 4582: if (!inPack) { + 8: 4581: break; + -: 4582: case PK_ARRAY: + 8: 4583: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4583: inPack = true; - 2: 4584: if (ctx->nibble == lowNbl) { + 2: 4584: inPack = true; + 2: 4585: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4585: packCount = netTypeVarintToUint((u8**)data); + 1: 4586: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4586: } - -: 4587: else { - -: 4588: // high nibble - 1: 4589: readTypeInHighNbl; + -: 4587: } + -: 4588: else { + -: 4589: // high nibble + 1: 4590: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4590: packCount = varintToUint((u8**)data); + 1: 4591: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4591: } - 2: 4592: packedType = PK_ARRAY; - -: 4593: } - -: 4594: - 8: 4595: a = NULL; - 8: 4596: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + -: 4592: } + 2: 4593: packedType = PK_ARRAY; + -: 4594: } + -: 4595: + 8: 4596: a = NULL; + 8: 4597: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 8: 4597: sDictPushTiny(dict, key, (smallt *) a); + 8: 4598: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - -: 4598: // stop unpacking when packCount == 0 - 8: 4599: packCount--; - 8: 4600: if (!packCount) inPack = false; + -: 4599: // stop unpacking when packCount == 0 + 8: 4600: packCount--; + 8: 4601: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4601: break; - -: 4602: case PK_BYTES: - #####: 4603: if (!inPack) { + 8: 4602: break; + -: 4603: case PK_BYTES: + #####: 4604: if (!inPack) { branch 0 never executed branch 1 never executed - #####: 4604: inPack = true; - #####: 4605: if (ctx->nibble == lowNbl) { + #####: 4605: inPack = true; + #####: 4606: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4606: packCount = netTypeVarintToUint((u8**)data); + #####: 4607: packCount = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4607: } - -: 4608: else { - -: 4609: // high nibble - #####: 4610: readTypeInHighNbl; + -: 4608: } + -: 4609: else { + -: 4610: // high nibble + #####: 4611: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4611: packCount = varintToUint((u8**)data); + #####: 4612: packCount = varintToUint((u8**)data); call 0 never executed - -: 4612: } - #####: 4613: packedType = PK_BYTES; - -: 4614: } - -: 4615: - #####: 4616: B = allocSBytes(); + -: 4613: } + #####: 4614: packedType = PK_BYTES; + -: 4615: } + -: 4616: + #####: 4617: B = allocSBytes(); call 0 never executed - #####: 4617: count = varintToUint((u8**)data); + #####: 4618: count = varintToUint((u8**)data); call 0 never executed - #####: 4618: sBytesPushBuffer(&B, data, count); + #####: 4619: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4619: *data += count; - #####: 4620: sDictPushTiny(dict, key, (smallt *) B); + #####: 4620: *data += count; + #####: 4621: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - -: 4621: // stop unpacking when packCount == 0 - #####: 4622: packCount--; - #####: 4623: if (!packCount) inPack = false; + -: 4622: // stop unpacking when packCount == 0 + #####: 4623: packCount--; + #####: 4624: if (!packCount) inPack = false; branch 0 never executed branch 1 never executed - #####: 4624: break; - -: 4625: case UNIFORM_DICT: - 4: 4626: d = NULL; - 4: 4627: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); + #####: 4625: break; + -: 4626: case UNIFORM_DICT: + 4: 4627: d = NULL; + 4: 4628: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 4: 4628: sDictPushTiny(dict, key, (smallt *) d); + 4: 4629: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - 4: 4629: break; - -: 4630: case UNIFORM_ARRAY: - 4: 4631: a = NULL; - 4: 4632: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); + 4: 4630: break; + -: 4631: case UNIFORM_ARRAY: + 4: 4632: a = NULL; + 4: 4633: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 4: 4633: sDictPushTiny(dict, key, (smallt *) a); + 4: 4634: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - 4: 4634: break; - -: 4635: } - -: 4636: } - -: 4637:} - -: 4638: - -: 4639:/** - -: 4640: * deserialize dictionary from data - -: 4641: * - -: 4642: * a new dictionary is allocated - -: 4643: * - -: 4644: * \param - -: 4645: * dict dictionary holding the elements - -: 4646: * data serialized dictionary - -: 4647: */ + 4: 4635: break; + -: 4636: } + -: 4637: } + -: 4638:} + -: 4639: + -: 4640:/** + -: 4641: * deserialize dictionary from data + -: 4642: * + -: 4643: * a new dictionary is allocated + -: 4644: * + -: 4645: * \param + -: 4646: * dict dictionary holding the elements + -: 4647: * data serialized dictionary + -: 4648: */ function uniformDictNetDeserial called 25 returned 100% blocks executed 87% - 25: 4648:internal void uniformDictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - 25: 4649: sUndefinedt *u = NULL; - 25: 4650: sBoolt *bo = NULL; - 25: 4651: double *D = NULL; - 25: 4652: sDoublet *Do = NULL; - 25: 4653: sDictt *d = NULL; - 25: 4654: sIntt *io = NULL; - 25: 4655: char *s = NULL; - 25: 4656: sStringt *so = NULL; - 25: 4657: sArrayt *a = NULL; - 25: 4658: sBytest *B = NULL; - -: 4659: uint32_t count; - -: 4660: uint32_t dictCount; - -: 4661: u8 type; - -: 4662: - 25: 4663: if (packed) { + 25: 4649:internal void uniformDictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { + 25: 4650: sUndefinedt *u = NULL; + 25: 4651: sBoolt *bo = NULL; + 25: 4652: double *D = NULL; + 25: 4653: sDoublet *Do = NULL; + 25: 4654: sDictt *d = NULL; + 25: 4655: sIntt *io = NULL; + 25: 4656: char *s = NULL; + 25: 4657: sStringt *so = NULL; + 25: 4658: sArrayt *a = NULL; + 25: 4659: sBytest *B = NULL; + -: 4660: uint32_t count; + -: 4661: uint32_t dictCount; + -: 4662: u8 type; + -: 4663: + 25: 4664: if (packed) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - 4: 4664: type = (**data) & 0xF; - 4: 4665: dictCount = netTypeVarintToUint(data); + 4: 4665: type = (**data) & 0xF; + 4: 4666: dictCount = netTypeVarintToUint(data); call 0 returned 100% - -: 4666: } - -: 4667: else { - 21: 4668: if (ctx->nibble == lowNbl) { + -: 4667: } + -: 4668: else { + 21: 4669: if (ctx->nibble == lowNbl) { branch 0 taken 90% (fallthrough) branch 1 taken 10% - 19: 4669: type = (**data) >> 4; - 19: 4670: (*data)++; - 19: 4671: dictCount = varintToUint(data); + 19: 4670: type = (**data) >> 4; + 19: 4671: (*data)++; + 19: 4672: dictCount = varintToUint(data); call 0 returned 100% - -: 4672: } - -: 4673: else { - 2: 4674: readTypeInHighNbl; + -: 4673: } + -: 4674: else { + 2: 4675: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 2: 4675: type = (**data) & 0xF; - 2: 4676: dictCount = netTypeVarintToUint(data); + 2: 4676: type = (**data) & 0xF; + 2: 4677: dictCount = netTypeVarintToUint(data); call 0 returned 100% - -: 4677: } - -: 4678: } - -: 4679: - 25: 4680: if (!dictCount) { + -: 4678: } + -: 4679: } + -: 4680: + 25: 4681: if (!dictCount) { branch 0 taken 4% (fallthrough) branch 1 taken 96% - 1: 4681: *dict = allocSDict(); + 1: 4682: *dict = allocSDict(); call 0 returned 100% - 1: 4682: ret; - -: 4683: } - -: 4684: + 1: 4683: ret; + -: 4684: } -: 4685: - 24: 4686: switch(type) { + -: 4686: + 24: 4687: switch(type) { branch 0 taken 4% branch 1 taken 17% branch 2 taken 4% @@ -6916,247 +6917,247 @@ branch 7 taken 0% branch 8 taken 4% branch 9 taken 4% branch 10 taken 0% - -: 4687: case S_UNDEFINED: - 7: 4688: loop(dictCount) { + -: 4688: case S_UNDEFINED: + 7: 4689: loop(dictCount) { branch 0 taken 86% branch 1 taken 14% (fallthrough) - 6: 4689: char *key = (char*)*data; - 6: 4690: *data += strlen(key)+1; - 6: 4691: u = allocSUndefined(); + 6: 4690: char *key = (char*)*data; + 6: 4691: *data += strlen(key)+1; + 6: 4692: u = allocSUndefined(); call 0 returned 100% - 6: 4692: sDictPushTiny(dict, key, (smallt *) u); + 6: 4693: sDictPushTiny(dict, key, (smallt *) u); call 0 returned 100% - -: 4693: } - 1: 4694: break; - -: 4695: case S_BOOL: - 19: 4696: loop(dictCount) { + -: 4694: } + 1: 4695: break; + -: 4696: case S_BOOL: + 19: 4697: loop(dictCount) { branch 0 taken 79% branch 1 taken 21% (fallthrough) - 15: 4697: char *key = (char*)*data; - 15: 4698: *data += strlen(key)+1; - 15: 4699: if (!ctx->boolAddr) { + 15: 4698: char *key = (char*)*data; + 15: 4699: *data += strlen(key)+1; + 15: 4700: if (!ctx->boolAddr) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - 3: 4700: read8bPackedBool; - 3: 4701: ctx->boolShift = 0; - -: 4702: } - 15: 4703: if (ctx->boolShift == 8) { + 3: 4701: read8bPackedBool; + 3: 4702: ctx->boolShift = 0; + -: 4703: } + 15: 4704: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - 1: 4704: readTypeInHighNbl; + 1: 4705: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4705: read8bPackedBool; - 1: 4706: bo = allocSBool((*ctx->boolAddr) & 0x1); + 1: 4706: read8bPackedBool; + 1: 4707: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 4707: } - -: 4708: else { - -: 4709: // high nibble - 14: 4710: readTypeInHighNbl; + -: 4708: } + -: 4709: else { + -: 4710: // high nibble + 14: 4711: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 14: 4711: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + 14: 4712: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 4712: } - 15: 4713: sDictPushTiny(dict, key, (smallt *) bo); + -: 4713: } + 15: 4714: sDictPushTiny(dict, key, (smallt *) bo); call 0 returned 100% - -: 4714: } - 4: 4715: break; - -: 4716: case S_DICT: - 3: 4717: loop(dictCount) { + -: 4715: } + 4: 4716: break; + -: 4717: case S_DICT: + 3: 4718: loop(dictCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 4718: char *key = (char*)*data; - 2: 4719: *data += strlen(key)+1; - 2: 4720: d = NULL; - 2: 4721: dictNetDeserial(&d, data, ctx, /*packed=*/true); + 2: 4719: char *key = (char*)*data; + 2: 4720: *data += strlen(key)+1; + 2: 4721: d = NULL; + 2: 4722: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 2: 4722: sDictPushTiny(dict, key, (smallt *) d); + 2: 4723: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - -: 4723: } - 1: 4724: break; - -: 4725: case S_DOUBLE: - 4: 4726: loop(dictCount) { + -: 4724: } + 1: 4725: break; + -: 4726: case S_DOUBLE: + 4: 4727: loop(dictCount) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 4727: char *key = (char*)*data; - 3: 4728: *data += strlen(key)+1; - 3: 4729: D = (double *)(*data); - 3: 4730: *data += sizeof(double); - 3: 4731: Do = allocSDouble(*D); -call 0 returned 100% - 3: 4732: sDictPushTiny(dict, key, (smallt *) Do); -call 0 returned 100% - -: 4733: } - 1: 4734: break; - -: 4735: case S_INT: - 21: 4736: loop(dictCount) { + 3: 4728: char *key = (char*)*data; + 3: 4729: *data += strlen(key)+1; + 3: 4730: D = (double *)(*data); + 3: 4731: *data += sizeof(double); + 3: 4732: Do = allocSDouble(*D); +call 0 returned 100% + 3: 4733: sDictPushTiny(dict, key, (smallt *) Do); +call 0 returned 100% + -: 4734: } + 1: 4735: break; + -: 4736: case S_INT: + 21: 4737: loop(dictCount) { branch 0 taken 57% branch 1 taken 43% (fallthrough) - 12: 4737: char *key = (char*)*data; - 12: 4738: *data += strlen(key)+1; - 12: 4739: i64 v = varintToUint(data); + 12: 4738: char *key = (char*)*data; + 12: 4739: *data += strlen(key)+1; + 12: 4740: u64 v = varintToUint(data); call 0 returned 100% - 12: 4740: v = (v >> 1) ^ ((v << 63) >> 63); - 12: 4741: io = allocSInt(v); + 12: 4741: v = (v >> 1) ^ (~(v & 1) + 1); + 12: 4742: io = allocSInt(v); call 0 returned 100% - 12: 4742: sDictPushTiny(dict, key, (smallt *) io); + 12: 4743: sDictPushTiny(dict, key, (smallt *) io); call 0 returned 100% - -: 4743: } - 9: 4744: break; - -: 4745: case S_STRING: - 16: 4746: loop(dictCount) { + -: 4744: } + 9: 4745: break; + -: 4746: case S_STRING: + 16: 4747: loop(dictCount) { branch 0 taken 69% branch 1 taken 31% (fallthrough) - 11: 4747: char *key = (char*)*data; - 11: 4748: *data += strlen(key)+1; - 11: 4749: s = (char *)(*data); - 11: 4750: *data += strlen(s)+1; - 11: 4751: so = allocSStringTiny(s); -call 0 returned 100% - 11: 4752: sDictPushTiny(dict, key, (smallt *) so); -call 0 returned 100% - -: 4753: } - 5: 4754: break; - -: 4755: case S_ARRAY: - 2: 4756: loop(dictCount) { + 11: 4748: char *key = (char*)*data; + 11: 4749: *data += strlen(key)+1; + 11: 4750: s = (char *)(*data); + 11: 4751: *data += strlen(s)+1; + 11: 4752: so = allocSStringTiny(s); +call 0 returned 100% + 11: 4753: sDictPushTiny(dict, key, (smallt *) so); +call 0 returned 100% + -: 4754: } + 5: 4755: break; + -: 4756: case S_ARRAY: + 2: 4757: loop(dictCount) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 1: 4757: char *key = (char*)*data; - 1: 4758: *data += strlen(key)+1; - 1: 4759: a = NULL; - 1: 4760: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + 1: 4758: char *key = (char*)*data; + 1: 4759: *data += strlen(key)+1; + 1: 4760: a = NULL; + 1: 4761: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 1: 4761: sDictPushTiny(dict, key, (smallt *) a); + 1: 4762: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - -: 4762: } - 1: 4763: break; - -: 4764: case S_BYTES: - #####: 4765: loop(dictCount) { + -: 4763: } + 1: 4764: break; + -: 4765: case S_BYTES: + #####: 4766: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 4766: char *key = (char*)*data; - #####: 4767: *data += strlen(key)+1; - #####: 4768: B = allocSBytes(); + #####: 4767: char *key = (char*)*data; + #####: 4768: *data += strlen(key)+1; + #####: 4769: B = allocSBytes(); call 0 never executed - #####: 4769: count = varintToUint((u8**)data); + #####: 4770: count = varintToUint((u8**)data); call 0 never executed - #####: 4770: sBytesPushBuffer(&B, data, count); + #####: 4771: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4771: *data += count; - #####: 4772: sDictPushTiny(dict, key, (smallt *) B); + #####: 4772: *data += count; + #####: 4773: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - -: 4773: } - #####: 4774: break; - -: 4775: case UNIFORM_DICT: - 3: 4776: loop(dictCount) { + -: 4774: } + #####: 4775: break; + -: 4776: case UNIFORM_DICT: + 3: 4777: loop(dictCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 4777: char *key = (char*)*data; - 2: 4778: *data += strlen(key)+1; - 2: 4779: d = NULL; - 2: 4780: uniformDictNetDeserial(&d, data, ctx, /*packed=*/true); + 2: 4778: char *key = (char*)*data; + 2: 4779: *data += strlen(key)+1; + 2: 4780: d = NULL; + 2: 4781: uniformDictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 2: 4781: sDictPushTiny(dict, key, (smallt *) d); + 2: 4782: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - -: 4782: } - 1: 4783: break; - -: 4784: case UNIFORM_ARRAY: - 2: 4785: loop(dictCount) { + -: 4783: } + 1: 4784: break; + -: 4785: case UNIFORM_ARRAY: + 2: 4786: loop(dictCount) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 1: 4786: char *key = (char*)*data; - 1: 4787: *data += strlen(key)+1; - 1: 4788: a = NULL; - 1: 4789: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/true); -call 0 returned 100% - 1: 4790: sDictPushTiny(dict, key, (smallt *) a); -call 0 returned 100% - -: 4791: } - 1: 4792: break; - -: 4793: } - -: 4794:} - -: 4795: - -: 4796:/** - -: 4797: * deserialize array from data - -: 4798: * - -: 4799: * a new array is allocated - -: 4800: * - -: 4801: * \param - -: 4802: * array holding the elements - -: 4803: * data serialized dictionary - -: 4804: */ + 1: 4787: char *key = (char*)*data; + 1: 4788: *data += strlen(key)+1; + 1: 4789: a = NULL; + 1: 4790: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/true); +call 0 returned 100% + 1: 4791: sDictPushTiny(dict, key, (smallt *) a); +call 0 returned 100% + -: 4792: } + 1: 4793: break; + -: 4794: } + -: 4795:} + -: 4796: + -: 4797:/** + -: 4798: * deserialize array from data + -: 4799: * + -: 4800: * a new array is allocated + -: 4801: * + -: 4802: * \param + -: 4803: * array holding the elements + -: 4804: * data serialized dictionary + -: 4805: */ function arrayNetDeserial called 49 returned 100% blocks executed 78% - 49: 4805:internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - 49: 4806: sUndefinedt *u = NULL; - 49: 4807: sBoolt *bo = NULL; - 49: 4808: double *D = NULL; - 49: 4809: sDoublet *Do = NULL; - 49: 4810: sDictt *d = NULL; - 49: 4811: sIntt *io = NULL; - 49: 4812: char *s = NULL; - 49: 4813: sStringt *so = NULL; - 49: 4814: sArrayt *a = NULL; - 49: 4815: sBytest *B = NULL; - -: 4816: uint32_t count; - -: 4817: uint32_t arrayCount; - -: 4818: - 49: 4819: if (packed) { + 49: 4806:internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { + 49: 4807: sUndefinedt *u = NULL; + 49: 4808: sBoolt *bo = NULL; + 49: 4809: double *D = NULL; + 49: 4810: sDoublet *Do = NULL; + 49: 4811: sDictt *d = NULL; + 49: 4812: sIntt *io = NULL; + 49: 4813: char *s = NULL; + 49: 4814: sStringt *so = NULL; + 49: 4815: sArrayt *a = NULL; + 49: 4816: sBytest *B = NULL; + -: 4817: uint32_t count; + -: 4818: uint32_t arrayCount; + -: 4819: + 49: 4820: if (packed) { branch 0 taken 45% (fallthrough) branch 1 taken 55% - 22: 4820: arrayCount = varintToUint(data); + 22: 4821: arrayCount = varintToUint(data); call 0 returned 100% - -: 4821: } - -: 4822: else { - 27: 4823: if (ctx->nibble == lowNbl) { + -: 4822: } + -: 4823: else { + 27: 4824: if (ctx->nibble == lowNbl) { branch 0 taken 96% (fallthrough) branch 1 taken 4% - 26: 4824: arrayCount = netTypeVarintToUint(data); + 26: 4825: arrayCount = netTypeVarintToUint(data); call 0 returned 100% - -: 4825: } - -: 4826: else { - -: 4827: // high nibble - 1: 4828: readTypeInHighNbl; + -: 4826: } + -: 4827: else { + -: 4828: // high nibble + 1: 4829: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4829: arrayCount = varintToUint(data); + 1: 4830: arrayCount = varintToUint(data); call 0 returned 100% - -: 4830: } - -: 4831: } - -: 4832: - 49: 4833: if (!arrayCount) { + -: 4831: } + -: 4832: } + -: 4833: + 49: 4834: if (!arrayCount) { branch 0 taken 4% (fallthrough) branch 1 taken 96% - 2: 4834: *array = allocSArray();; -call 0 returned 100% - 2: 4835: ret; - -: 4836: } - -: 4837: - 47: 4838: bool inPack = false; - -: 4839: u8 packedType; - -: 4840: size_t packCount; - 201: 4841: loop(arrayCount) { + 2: 4835: *array = allocSArray();; +call 0 returned 100% + 2: 4836: ret; + -: 4837: } + -: 4838: + 47: 4839: bool inPack = false; + -: 4840: u8 packedType; + -: 4841: size_t packCount; + 201: 4842: loop(arrayCount) { branch 0 taken 77% branch 1 taken 23% (fallthrough) - -: 4842: char type; - 154: 4843: if (inPack) { + -: 4843: char type; + 154: 4844: if (inPack) { branch 0 taken 19% (fallthrough) branch 1 taken 81% - 30: 4844: type = packedType; - -: 4845: } - -: 4846: else { - 124: 4847: if (ctx->nibble == lowNbl) { + 30: 4845: type = packedType; + -: 4846: } + -: 4847: else { + 124: 4848: if (ctx->nibble == lowNbl) { branch 0 taken 72% (fallthrough) branch 1 taken 28% - 89: 4848: type = (**data) & 0xF; - -: 4849: } - -: 4850: else { - -: 4851: // high nibble - 35: 4852: type = (*ctx->nblAddr) >> 4; - -: 4853: } - -: 4854: } - -: 4855: - 154: 4856: switch(type) { + 89: 4849: type = (**data) & 0xF; + -: 4850: } + -: 4851: else { + -: 4852: // high nibble + 35: 4853: type = (*ctx->nblAddr) >> 4; + -: 4854: } + -: 4855: } + -: 4856: + 154: 4857: switch(type) { branch 0 taken 18% branch 1 taken 22% branch 2 taken 1% @@ -7174,457 +7175,457 @@ branch 13 taken 0% branch 14 taken 3% branch 15 taken 4% branch 16 taken 0% - -: 4857: case S_UNDEFINED: - 28: 4858: if (ctx->nibble == lowNbl) { + -: 4858: case S_UNDEFINED: + 28: 4859: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 26: 4859: readTypeOnly; - -: 4860: } - -: 4861: else { - -: 4862: // high nibble - 2: 4863: readTypeInHighNbl; + 26: 4860: readTypeOnly; + -: 4861: } + -: 4862: else { + -: 4863: // high nibble + 2: 4864: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4864: } - 28: 4865: u = allocSUndefined(); + -: 4865: } + 28: 4866: u = allocSUndefined(); call 0 returned 100% - 28: 4866: sArrayPushTiny(array, (smallt *) u); + 28: 4867: sArrayPushTiny(array, (smallt *) u); call 0 returned 100% - 28: 4867: break; - -: 4868: case S_BOOL: - 34: 4869: if (!ctx->boolAddr) { + 28: 4868: break; + -: 4869: case S_BOOL: + 34: 4870: if (!ctx->boolAddr) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 4870: // new packed bools - 6: 4871: if (ctx->nibble == lowNbl) { + -: 4871: // new packed bools + 6: 4872: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 3: 4872: read4bPackedBool; - 3: 4873: bo = allocSBool((*ctx->boolAddr) & 0x10); + 3: 4873: read4bPackedBool; + 3: 4874: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 returned 100% - -: 4874: } - -: 4875: else { - -: 4876: // high nibble - 3: 4877: readTypeInHighNbl; + -: 4875: } + -: 4876: else { + -: 4877: // high nibble + 3: 4878: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 3: 4878: read8bPackedBool; - 3: 4879: bo = allocSBool((*ctx->boolAddr) & 0x1); -call 0 returned 100% - -: 4880: } - -: 4881: } - -: 4882: else { - -: 4883: // there was a bool before this one, read bits in nibbles - 28: 4884: if (ctx->nibble == lowNbl) { + 3: 4879: read8bPackedBool; + 3: 4880: bo = allocSBool((*ctx->boolAddr) & 0x1); +call 0 returned 100% + -: 4881: } + -: 4882: } + -: 4883: else { + -: 4884: // there was a bool before this one, read bits in nibbles + 28: 4885: if (ctx->nibble == lowNbl) { branch 0 taken 61% (fallthrough) branch 1 taken 39% - 17: 4885: if (ctx->boolShift == 8) { + 17: 4886: if (ctx->boolShift == 8) { branch 0 taken 12% (fallthrough) branch 1 taken 88% - 2: 4886: read4bPackedBool; - 2: 4887: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 returned 100% - -: 4888: } - -: 4889: else { - 15: 4890: readTypeOnly; - 15: 4891: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); -call 0 returned 100% - -: 4892: } - -: 4893: } - -: 4894: else { - -: 4895: // high nibble - 11: 4896: readTypeInHighNbl; + 2: 4887: read4bPackedBool; + 2: 4888: bo = allocSBool((*ctx->boolAddr) & 0x10); +call 0 returned 100% + -: 4889: } + -: 4890: else { + 15: 4891: readTypeOnly; + 15: 4892: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); +call 0 returned 100% + -: 4893: } + -: 4894: } + -: 4895: else { + -: 4896: // high nibble + 11: 4897: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 11: 4897: if (ctx->boolShift == 8) { + 11: 4898: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - 2: 4898: read8bPackedBool; - 2: 4899: bo = allocSBool((*ctx->boolAddr) & 0x1); + 2: 4899: read8bPackedBool; + 2: 4900: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 4900: } - -: 4901: else { - 9: 4902: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 4901: } + -: 4902: else { + 9: 4903: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 4903: } - -: 4904: } - -: 4905: } - 34: 4906: sArrayPushTiny(array, (smallt *) bo); + -: 4904: } + -: 4905: } + -: 4906: } + 34: 4907: sArrayPushTiny(array, (smallt *) bo); call 0 returned 100% - 34: 4907: break; - -: 4908: case S_DICT: - 2: 4909: d = NULL; - 2: 4910: dictNetDeserial(&d, data, ctx, /*packed=*/false); + 34: 4908: break; + -: 4909: case S_DICT: + 2: 4910: d = NULL; + 2: 4911: dictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 2: 4911: sArrayPushTiny(array, (smallt *) d); + 2: 4912: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - 2: 4912: break; - -: 4913: case S_DOUBLE: - 2: 4914: if (ctx->nibble == lowNbl) { + 2: 4913: break; + -: 4914: case S_DOUBLE: + 2: 4915: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4915: readTypeOnly; - -: 4916: } - -: 4917: else { - -: 4918: // high nibble - 1: 4919: readTypeInHighNbl; + 1: 4916: readTypeOnly; + -: 4917: } + -: 4918: else { + -: 4919: // high nibble + 1: 4920: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4920: } - 2: 4921: D = (double *)(*data); - 2: 4922: *data += sizeof(double); - 2: 4923: Do = allocSDouble(*D); + -: 4921: } + 2: 4922: D = (double *)(*data); + 2: 4923: *data += sizeof(double); + 2: 4924: Do = allocSDouble(*D); call 0 returned 100% - 2: 4924: sArrayPushTiny(array, (smallt *) Do); + 2: 4925: sArrayPushTiny(array, (smallt *) Do); call 0 returned 100% - 2: 4925: break; - -: 4926: case S_INT: { - -: 4927: i64 v; - 22: 4928: if (ctx->nibble == lowNbl) { + 2: 4926: break; + -: 4927: case S_INT: { + -: 4928: u64 v; + 22: 4929: if (ctx->nibble == lowNbl) { branch 0 taken 82% (fallthrough) branch 1 taken 18% - 18: 4929: v = netTypeVarintToUint((u8**)data); + 18: 4930: v = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4930: } - -: 4931: else { - -: 4932: // high nibble - 4: 4933: readTypeInHighNbl; + -: 4931: } + -: 4932: else { + -: 4933: // high nibble + 4: 4934: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 4: 4934: v = varintToUint(data); + 4: 4935: v = varintToUint(data); call 0 returned 100% - -: 4935: } - 22: 4936: v = (v >> 1) ^ ((v << 63) >> 63); - 22: 4937: io = allocSInt(v); + -: 4936: } + 22: 4937: v = (v >> 1) ^ (~(v & 1) + 1); + 22: 4938: io = allocSInt(v); call 0 returned 100% - 22: 4938: sArrayPushTiny(array, (smallt *) io); + 22: 4939: sArrayPushTiny(array, (smallt *) io); call 0 returned 100% - -: 4939: } - 22: 4940: break; - -: 4941: case S_STRING: - 13: 4942: if (ctx->nibble == lowNbl) { + -: 4940: } + 22: 4941: break; + -: 4942: case S_STRING: + 13: 4943: if (ctx->nibble == lowNbl) { branch 0 taken 69% (fallthrough) branch 1 taken 31% - 9: 4943: readTypeOnly; - -: 4944: } - -: 4945: else { - -: 4946: // high nibble - 4: 4947: readTypeInHighNbl; + 9: 4944: readTypeOnly; + -: 4945: } + -: 4946: else { + -: 4947: // high nibble + 4: 4948: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4948: } - 13: 4949: s = (char *)(*data); - 13: 4950: *data += strlen(s)+1; - 13: 4951: so = allocSStringTiny(s); + -: 4949: } + 13: 4950: s = (char *)(*data); + 13: 4951: *data += strlen(s)+1; + 13: 4952: so = allocSStringTiny(s); call 0 returned 100% - 13: 4952: sArrayPushTiny(array, (smallt *) so); + 13: 4953: sArrayPushTiny(array, (smallt *) so); call 0 returned 100% - 13: 4953: break; - -: 4954: case S_ARRAY: - 2: 4955: a = NULL; - 2: 4956: arrayNetDeserial(&a, data, ctx, /*packed=*/false); + 13: 4954: break; + -: 4955: case S_ARRAY: + 2: 4956: a = NULL; + 2: 4957: arrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 2: 4957: sArrayPushTiny(array, (smallt *) a); + 2: 4958: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - 2: 4958: break; - -: 4959: case S_BYTES: - #####: 4960: B = allocSBytes(); + 2: 4959: break; + -: 4960: case S_BYTES: + #####: 4961: B = allocSBytes(); call 0 never executed - #####: 4961: if (ctx->nibble == lowNbl) { + #####: 4962: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4962: count = netTypeVarintToUint((u8**)data); + #####: 4963: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4963: } - -: 4964: else { - -: 4965: // high nibble - #####: 4966: readTypeInHighNbl; + -: 4964: } + -: 4965: else { + -: 4966: // high nibble + #####: 4967: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4967: count = varintToUint((u8**)data); + #####: 4968: count = varintToUint((u8**)data); call 0 never executed - -: 4968: } - #####: 4969: sBytesPushBuffer(&B, data, count); + -: 4969: } + #####: 4970: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4970: *data += count; - #####: 4971: sArrayPushTiny(array, (smallt *) B); + #####: 4971: *data += count; + #####: 4972: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 4972: break; - -: 4973: case PK_DICT: - 8: 4974: if (!inPack) { + #####: 4973: break; + -: 4974: case PK_DICT: + 8: 4975: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4975: inPack = true; - 2: 4976: if (ctx->nibble == lowNbl) { + 2: 4976: inPack = true; + 2: 4977: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4977: packCount = netTypeVarintToUint((u8**)data); + 1: 4978: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4978: } - -: 4979: else { - -: 4980: // high nibble - 1: 4981: readTypeInHighNbl; + -: 4979: } + -: 4980: else { + -: 4981: // high nibble + 1: 4982: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4982: packCount = varintToUint((u8**)data); + 1: 4983: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4983: } - 2: 4984: packedType = PK_DICT; - -: 4985: } - -: 4986: - 8: 4987: d = NULL; - 8: 4988: dictNetDeserial(&d, data, ctx, /*packed=*/true); + -: 4984: } + 2: 4985: packedType = PK_DICT; + -: 4986: } + -: 4987: + 8: 4988: d = NULL; + 8: 4989: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 8: 4989: sArrayPushTiny(array, (smallt *) d); + 8: 4990: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - -: 4990: // stop unpacking when packCount == 0 - 8: 4991: packCount--; - 8: 4992: if (!packCount) inPack = false; + -: 4991: // stop unpacking when packCount == 0 + 8: 4992: packCount--; + 8: 4993: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4993: break; - -: 4994: case PK_DOUBLE: - 8: 4995: if (!inPack) { + 8: 4994: break; + -: 4995: case PK_DOUBLE: + 8: 4996: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4996: inPack = true; - 2: 4997: if (ctx->nibble == lowNbl) { + 2: 4997: inPack = true; + 2: 4998: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4998: packCount = netTypeVarintToUint((u8**)data); + 1: 4999: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4999: } - -: 5000: else { - -: 5001: // high nibble - 1: 5002: readTypeInHighNbl; + -: 5000: } + -: 5001: else { + -: 5002: // high nibble + 1: 5003: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5003: packCount = varintToUint((u8**)data); + 1: 5004: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5004: } - 2: 5005: packedType = PK_DOUBLE; - -: 5006: } - -: 5007: - 8: 5008: D = (double *)(*data); - 8: 5009: *data += sizeof(double); - 8: 5010: Do = allocSDouble(*D); + -: 5005: } + 2: 5006: packedType = PK_DOUBLE; + -: 5007: } + -: 5008: + 8: 5009: D = (double *)(*data); + 8: 5010: *data += sizeof(double); + 8: 5011: Do = allocSDouble(*D); call 0 returned 100% - 8: 5011: sArrayPushTiny(array, (smallt *) Do); + 8: 5012: sArrayPushTiny(array, (smallt *) Do); call 0 returned 100% - -: 5012: // stop unpacking when packCount == 0 - 8: 5013: packCount--; - 8: 5014: if (!packCount) inPack = false; + -: 5013: // stop unpacking when packCount == 0 + 8: 5014: packCount--; + 8: 5015: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5015: break; - -: 5016: case PK_INT: - 8: 5017: if (!inPack) { + 8: 5016: break; + -: 5017: case PK_INT: + 8: 5018: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 5018: inPack = true; - 2: 5019: if (ctx->nibble == lowNbl) { + 2: 5019: inPack = true; + 2: 5020: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 5020: packCount = netTypeVarintToUint((u8**)data); + 1: 5021: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5021: } - -: 5022: else { - -: 5023: // high nibble - 1: 5024: readTypeInHighNbl; + -: 5022: } + -: 5023: else { + -: 5024: // high nibble + 1: 5025: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5025: packCount = varintToUint((u8**)data); + 1: 5026: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5026: } - 2: 5027: packedType = PK_INT; - -: 5028: } - -: 5029: - 8: 5030: i64 v = varintToUint(data); + -: 5027: } + 2: 5028: packedType = PK_INT; + -: 5029: } + -: 5030: + 8: 5031: u64 v = varintToUint(data); call 0 returned 100% - 8: 5031: v = (v >> 1) ^ ((v << 63) >> 63); - 8: 5032: io = allocSInt(v); + 8: 5032: v = (v >> 1) ^ (~(v & 1) + 1); + 8: 5033: io = allocSInt(v); call 0 returned 100% - 8: 5033: sArrayPushTiny(array, (smallt *) io); + 8: 5034: sArrayPushTiny(array, (smallt *) io); call 0 returned 100% - -: 5034: // stop unpacking when packCount == 0 - 8: 5035: packCount--; - 8: 5036: if (!packCount) inPack = false; + -: 5035: // stop unpacking when packCount == 0 + 8: 5036: packCount--; + 8: 5037: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5037: break; - -: 5038: case PK_STRING: - 8: 5039: if (!inPack) { + 8: 5038: break; + -: 5039: case PK_STRING: + 8: 5040: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 5040: inPack = true; - 2: 5041: if (ctx->nibble == lowNbl) { + 2: 5041: inPack = true; + 2: 5042: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 5042: packCount = netTypeVarintToUint((u8**)data); + 1: 5043: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5043: } - -: 5044: else { - -: 5045: // high nibble - 1: 5046: readTypeInHighNbl; + -: 5044: } + -: 5045: else { + -: 5046: // high nibble + 1: 5047: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5047: packCount = varintToUint((u8**)data); + 1: 5048: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5048: } - 2: 5049: packedType = PK_STRING; - -: 5050: } - -: 5051: - 8: 5052: s = (char *)(*data); - 8: 5053: *data += strlen(s)+1; - 8: 5054: so = allocSStringTiny(s); + -: 5049: } + 2: 5050: packedType = PK_STRING; + -: 5051: } + -: 5052: + 8: 5053: s = (char *)(*data); + 8: 5054: *data += strlen(s)+1; + 8: 5055: so = allocSStringTiny(s); call 0 returned 100% - 8: 5055: sArrayPushTiny(array, (smallt *) so); + 8: 5056: sArrayPushTiny(array, (smallt *) so); call 0 returned 100% - -: 5056: // stop unpacking when packCount == 0 - 8: 5057: packCount--; - 8: 5058: if (!packCount) inPack = false; + -: 5057: // stop unpacking when packCount == 0 + 8: 5058: packCount--; + 8: 5059: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5059: break; - -: 5060: case PK_ARRAY: - 8: 5061: if (!inPack) { + 8: 5060: break; + -: 5061: case PK_ARRAY: + 8: 5062: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 5062: inPack = true; - 2: 5063: if (ctx->nibble == lowNbl) { + 2: 5063: inPack = true; + 2: 5064: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 5064: packCount = netTypeVarintToUint((u8**)data); + 1: 5065: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5065: } - -: 5066: else { - -: 5067: // high nibble - 1: 5068: readTypeInHighNbl; + -: 5066: } + -: 5067: else { + -: 5068: // high nibble + 1: 5069: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5069: packCount = varintToUint((u8**)data); + 1: 5070: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5070: } - 2: 5071: packedType = PK_ARRAY; - -: 5072: } - -: 5073: - 8: 5074: a = NULL; - 8: 5075: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + -: 5071: } + 2: 5072: packedType = PK_ARRAY; + -: 5073: } + -: 5074: + 8: 5075: a = NULL; + 8: 5076: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 8: 5076: sArrayPushTiny(array, (smallt *) a); + 8: 5077: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - -: 5077: // stop unpacking when packCount == 0 - 8: 5078: packCount--; - 8: 5079: if (!packCount) inPack = false; + -: 5078: // stop unpacking when packCount == 0 + 8: 5079: packCount--; + 8: 5080: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5080: break; - -: 5081: case PK_BYTES: - #####: 5082: if (!inPack) { + 8: 5081: break; + -: 5082: case PK_BYTES: + #####: 5083: if (!inPack) { branch 0 never executed branch 1 never executed - #####: 5083: inPack = true; - #####: 5084: if (ctx->nibble == lowNbl) { + #####: 5084: inPack = true; + #####: 5085: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 5085: packCount = netTypeVarintToUint((u8**)data); + #####: 5086: packCount = netTypeVarintToUint((u8**)data); call 0 never executed - -: 5086: } - -: 5087: else { - -: 5088: // high nibble - #####: 5089: readTypeInHighNbl; + -: 5087: } + -: 5088: else { + -: 5089: // high nibble + #####: 5090: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 5090: packCount = varintToUint((u8**)data); + #####: 5091: packCount = varintToUint((u8**)data); call 0 never executed - -: 5091: } - #####: 5092: packedType = PK_BYTES; - -: 5093: } - -: 5094: - #####: 5095: B = allocSBytes(); + -: 5092: } + #####: 5093: packedType = PK_BYTES; + -: 5094: } + -: 5095: + #####: 5096: B = allocSBytes(); call 0 never executed - #####: 5096: count = varintToUint((u8**)data); + #####: 5097: count = varintToUint((u8**)data); call 0 never executed - #####: 5097: sBytesPushBuffer(&B, data, count); + #####: 5098: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 5098: *data += count; - #####: 5099: sArrayPushTiny(array, (smallt *) B); + #####: 5099: *data += count; + #####: 5100: sArrayPushTiny(array, (smallt *) B); call 0 never executed - -: 5100: // stop unpacking when packCount == 0 - #####: 5101: packCount--; - #####: 5102: if (!packCount) inPack = false; + -: 5101: // stop unpacking when packCount == 0 + #####: 5102: packCount--; + #####: 5103: if (!packCount) inPack = false; branch 0 never executed branch 1 never executed - #####: 5103: break; - -: 5104: case UNIFORM_DICT: - 5: 5105: d = NULL; - 5: 5106: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); + #####: 5104: break; + -: 5105: case UNIFORM_DICT: + 5: 5106: d = NULL; + 5: 5107: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 5: 5107: sArrayPushTiny(array, (smallt *) d); + 5: 5108: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - 5: 5108: break; - -: 5109: case UNIFORM_ARRAY: - 6: 5110: a = NULL; - 6: 5111: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); + 5: 5109: break; + -: 5110: case UNIFORM_ARRAY: + 6: 5111: a = NULL; + 6: 5112: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 6: 5112: sArrayPushTiny(array, (smallt *) a); + 6: 5113: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - 6: 5113: break; - -: 5114: } - -: 5115: } - -: 5116:} - -: 5117: + 6: 5114: break; + -: 5115: } + -: 5116: } + -: 5117:} + -: 5118: function uniformArrayNetDeserial called 24 returned 100% blocks executed 89% - 24: 5118:internal void uniformArrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - 24: 5119: sUndefinedt *u = NULL; - 24: 5120: sBoolt *bo = NULL; - 24: 5121: double *D = NULL; - 24: 5122: sDoublet *Do = NULL; - 24: 5123: sDictt *d = NULL; - 24: 5124: sIntt *io = NULL; - 24: 5125: char *s = NULL; - 24: 5126: sStringt *so = NULL; - 24: 5127: sArrayt *a = NULL; - 24: 5128: sBytest *B = NULL; - -: 5129: uint32_t count; - -: 5130: uint32_t arrayCount; - -: 5131: u8 type; - -: 5132: - 24: 5133: if (packed) { + 24: 5119:internal void uniformArrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { + 24: 5120: sUndefinedt *u = NULL; + 24: 5121: sBoolt *bo = NULL; + 24: 5122: double *D = NULL; + 24: 5123: sDoublet *Do = NULL; + 24: 5124: sDictt *d = NULL; + 24: 5125: sIntt *io = NULL; + 24: 5126: char *s = NULL; + 24: 5127: sStringt *so = NULL; + 24: 5128: sArrayt *a = NULL; + 24: 5129: sBytest *B = NULL; + -: 5130: uint32_t count; + -: 5131: uint32_t arrayCount; + -: 5132: u8 type; + -: 5133: + 24: 5134: if (packed) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - 2: 5134: type = (**data) & 0xF; - 2: 5135: arrayCount = netTypeVarintToUint(data); + 2: 5135: type = (**data) & 0xF; + 2: 5136: arrayCount = netTypeVarintToUint(data); call 0 returned 100% - -: 5136: } - -: 5137: else { - 22: 5138: if (ctx->nibble == lowNbl) { + -: 5137: } + -: 5138: else { + 22: 5139: if (ctx->nibble == lowNbl) { branch 0 taken 77% (fallthrough) branch 1 taken 23% - 17: 5139: type = (**data) >> 4; - 17: 5140: (*data)++; - 17: 5141: arrayCount = varintToUint(data); + 17: 5140: type = (**data) >> 4; + 17: 5141: (*data)++; + 17: 5142: arrayCount = varintToUint(data); call 0 returned 100% - -: 5142: } - -: 5143: else { - 5: 5144: readTypeInHighNbl; + -: 5143: } + -: 5144: else { + 5: 5145: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 5: 5145: type = (**data) & 0xF; - 5: 5146: arrayCount = netTypeVarintToUint(data); + 5: 5146: type = (**data) & 0xF; + 5: 5147: arrayCount = netTypeVarintToUint(data); call 0 returned 100% - -: 5147: } - -: 5148: } - -: 5149: - 24: 5150: if (!arrayCount) { + -: 5148: } + -: 5149: } + -: 5150: + 24: 5151: if (!arrayCount) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - 2: 5151: *array = allocSArray();; + 2: 5152: *array = allocSArray();; c