netSerial

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

commit cba128ef0ebcc5db8aef466767db9f6eef8d82ef
parent 15c51a5850396a01b5c958b24be9d699234b428e
Author: Remy Noulin <loader2x@gmail.com>
Date:   Fri,  1 Mar 2019 11:40:17 -0500

fix bug in netTypeVarintToUint when deserializing 64 bit ints

Force the compiler to use 64 bit shift operation instead of the default
32 bit operation and then cast to 64 bit

memcheckNetSerial.c |    17 +
netSerial.c         |     3 +-
netSerial.c.gcov    | 10659 +++++++++++++++++++++++++-------------------------
package.yml         |     2 +-
testNetSerial.c     |    17 +
5 files changed, 5367 insertions(+), 5331 deletions(-)

Diffstat:
MmemcheckNetSerial.c | 17+++++++++++++++++
MnetSerial.c | 3++-
MnetSerial.c.gcov | 10659++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mpackage.yml | 2+-
MtestNetSerial.c | 17+++++++++++++++++
5 files changed, 5367 insertions(+), 5331 deletions(-)

diff --git a/memcheckNetSerial.c b/memcheckNetSerial.c @@ -93,6 +93,23 @@ void topT(void) { terminateG(B); freeManyG(&n, &ds); + // 64 bit int test + u64 val = 12000000000UL; + logVarG(val); + setTopG(&n, 12000000000UL); + B = serialG(&n); + logSI("%s",toHexSepS(getValG(B), lenG(B), " ")); + s = sToString((smallt *) B->B); + ck_assert_str_eq(s, "[-12,-12,-68,-63,-10,11]"); + free(s); + deserialG(&ds, B); + s = toStringG(&ds); + logVarG(s); + ck_assert_str_eq(s, "12000000000"); + free(s); + terminateG(B); + freeManyG(&n, &ds); + // int setTopG(&n, 120); B = serialG(&n); diff --git a/netSerial.c b/netSerial.c @@ -300,7 +300,8 @@ internal u64 netTypeVarintToUint(u8 **buf) { u8 c = 0; while (**buf & 0x80) { (*buf)++; - r |= (**buf & 0x7F) << (7*c+3); + // 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+3); c++; } (*buf)++; 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 106 returned 100% blocks executed 100% - 106: 248:internal void uintToNetTypeVarint(sBytest **buf, u8 type, u64 value) { - 106: 249: u64 c = value; +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; -: 250: /* encode b0..2 */ - 106: 251: u8 b = type + ((c & 0x7) << 4); - 106: 252: if (c & 0xFFFFFFFFFFFFFFF8) { -branch 0 taken 9% (fallthrough) -branch 1 taken 91% - 10: 253: b |= 0x80; - 10: 254: sBytesPush(buf, b); -call 0 returned 100% - 10: 255: c >>=3; + 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; -: 256: /* encode b3..9 ...*/ - 31: 257: while(c) { -branch 0 taken 52% -branch 1 taken 48% - 11: 258: b = c & 0x7F; - 11: 259: if (c & 0xFFFFFFFFFFFFFF80) -branch 0 taken 9% (fallthrough) -branch 1 taken 91% - 1: 260: b |= 0x80; - 11: 261: sBytesPush(buf, b); -call 0 returned 100% - 11: 262: c >>=7; + 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; -: 263: } -: 264: } -: 265: else 96: 266: sBytesPush(buf, b); call 0 returned 100% - 106: 267:} + 107: 267:} -: 268: -: 269:/** -: 270: * encode uint as varuint @@ -433,59 +433,60 @@ call 0 returned 100% -: 292:/** -: 293: * decode type and varuint to uint -: 294: */ -function netTypeVarintToUint called 106 returned 100% blocks executed 100% - 106: 295:internal u64 netTypeVarintToUint(u8 **buf) { - 106: 296: u64 r = 0; +function netTypeVarintToUint called 107 returned 100% blocks executed 100% + 107: 295:internal u64 netTypeVarintToUint(u8 **buf) { + 107: 296: u64 r = 0; -: 297: - 106: 298: r = (**buf >> 4) & 0x7; + 107: 298: r = (**buf >> 4) & 0x7; -: 299: - 106: 300: u8 c = 0; - 223: 301: while (**buf & 0x80) { -branch 0 taken 9% -branch 1 taken 91% (fallthrough) - 11: 302: (*buf)++; - 11: 303: r |= (**buf & 0x7F) << (7*c+3); - 11: 304: c++; - -: 305: } - 106: 306: (*buf)++; - 106: 307: ret r; - -: 308:} - -: 309: - -: 310:/** - -: 311: * decode varuint to uint - -: 312: */ + 107: 300: u8 c = 0; + 230: 301: while (**buf & 0x80) { +branch 0 taken 13% +branch 1 taken 87% (fallthrough) + 16: 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++; + -: 306: } + 107: 307: (*buf)++; + 107: 308: ret r; + -: 309:} + -: 310: + -: 311:/** + -: 312: * decode varuint to uint + -: 313: */ function varintToUint called 180 returned 100% blocks executed 100% - 180: 313:internal u64 varintToUint(u8 **buf) { - 180: 314: u64 r = 0; - -: 315: - 180: 316: r = (**buf) & 0x7F; - 180: 317: u8 c = 1; - 363: 318: while (**buf & 0x80) { + 180: 314:internal u64 varintToUint(u8 **buf) { + 180: 315: u64 r = 0; + -: 316: + 180: 317: r = (**buf) & 0x7F; + 180: 318: u8 c = 1; + 363: 319: while (**buf & 0x80) { branch 0 taken 2% branch 1 taken 98% (fallthrough) - 3: 319: (*buf)++; - 3: 320: r |= (**buf & 0x7F) << (7*c); - 3: 321: c++; - -: 322: } - 180: 323: (*buf)++; - 180: 324: ret r; - -: 325:} - -: 326: - -: 327:// ------------------------------------- - -: 328:// Serializers - -: 329: - -: 330:// level 0 - -: 331:// like smallJson with ints and length encoded as varints - -: 332: - -: 333:/** - -: 334: * serializer top function - -: 335: */ + 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: */ function netSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 336:internal sBytest* netSerialLevel0(smallt *o) { - #####: 337: sBytest *r = NULL; - #####: 338: sBytest *B = NULL; - -: 339: - #####: 340: switch(o->type) { + #####: 337:internal sBytest* netSerialLevel0(smallt *o) { + #####: 338: sBytest *r = NULL; + #####: 339: sBytest *B = NULL; + -: 340: + #####: 341: switch(o->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -496,95 +497,95 @@ branch 6 never executed branch 7 never executed branch 8 never executed branch 9 never executed - -: 341: case UNDEFINED: - #####: 342: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 343: break; - -: 344: case BOOL: { - #####: 345: u8 c = NET_SERIAL_TYPES[(u8)o->type]; - -: 346: // set bit 4 when true - #####: 347: if (((sBoolt *)&(o->type))->value) -branch 0 never executed -branch 1 never executed - #####: 348: c |= (1<<4); - #####: 349: sBytesPush(&r, c); -call 0 never executed - -: 350: } - #####: 351: break; - -: 352: case CONTAINER: - -: 353: // undefined - #####: 354: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 355: break; - -: 356: case DICT: - #####: 357: dictNetSerialLevel0(&r, (sDictt *)&(o->type)); -call 0 never executed - #####: 358: break; - -: 359: case DOUBLE: - #####: 360: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 361: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); -call 0 never executed - #####: 362: break; - -: 363: case INT: { - -: 364: // encode int to varint - -: 365: // v is int64_t to convert to varint - #####: 366: i64 v = ((sIntt *)&(o->type))->value; - -: 367: // encode v with arithmetic shifts - #####: 368: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 369: } - #####: 370: break; - -: 371: case STRING: - #####: 372: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 373: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); -call 0 never executed - #####: 374: break; - -: 375: case ARRAY: - #####: 376: arrayNetSerialLevel0(&r, (sArrayt *)&(o->type)); -call 0 never executed - #####: 377: break; - -: 378: case BYTES: - #####: 379: B = (sBytest *)&(o->type); - #####: 380: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); -call 0 never executed - #####: 381: sBytesPushBuffer(&r, &(B->data), B->count); -call 0 never executed - #####: 382: break; - -: 383: } - #####: 384: ret r; - -: 385:} - -: 386: - -: 387:/** - -: 388: * serialize dictionary - -: 389: * - -: 390: * the serialized dict is pushed to r. - -: 391: * All elements are serialized recursively - -: 392: * - -: 393: * the data in containers is not serialized - -: 394: * - -: 395: * \param - -: 396: * r small bytes object - -: 397: * dict dictionary to serialize - -: 398: */ + -: 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: */ function dictNetSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 399:internal void dictNetSerialLevel0(sBytest **r, sDictt *dict) { - #####: 400: sBytest *B = NULL; - -: 401: - #####: 402: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); + #####: 400:internal void dictNetSerialLevel0(sBytest **r, sDictt *dict) { + #####: 401: sBytest *B = NULL; + -: 402: + #####: 403: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); call 0 never executed - -: 403: - #####: 404: forEachSDict(dict, e) { + -: 404: + #####: 405: forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 405: if (e->key) { + #####: 406: if (e->key) { branch 0 never executed branch 1 never executed - #####: 406: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 407: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 407: - #####: 408: switch(e->data->type) { + -: 408: + #####: 409: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -595,99 +596,99 @@ branch 6 never executed branch 7 never executed branch 8 never executed branch 9 never executed - -: 409: case UNDEFINED: - #####: 410: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); -call 0 never executed - #####: 411: break; - -: 412: case BOOL: { - #####: 413: u8 c = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 414: // set bit 4 when true - #####: 415: if (((sBoolt *)(e->data))->value) -branch 0 never executed -branch 1 never executed - #####: 416: c |= (1<<4); - #####: 417: sBytesPush(r, c); -call 0 never executed - -: 418: } - #####: 419: break; - -: 420: case CONTAINER: - -: 421: // undefined - #####: 422: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); -call 0 never executed - #####: 423: break; - -: 424: case DICT: - #####: 425: dictNetSerialLevel0(r, (sDictt *)(e->data)); -call 0 never executed - #####: 426: break; - -: 427: case DOUBLE: - #####: 428: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); -call 0 never executed - #####: 429: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 never executed - #####: 430: break; - -: 431: case INT: { - -: 432: // encode int to varint - -: 433: // v is int64_t to convert to varint - #####: 434: i64 v = ((sIntt *)(e->data))->value; - -: 435: // encode v with arithmetic shifts - #####: 436: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 437: } - #####: 438: break; - -: 439: case STRING: - #####: 440: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->data->type]); -call 0 never executed - #####: 441: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 never executed - #####: 442: break; - -: 443: case ARRAY: - #####: 444: arrayNetSerialLevel0(r, (sArrayt *)(e->data)); -call 0 never executed - #####: 445: break; - -: 446: case BYTES: - #####: 447: B = (sBytest *)(e->data); - #####: 448: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); -call 0 never executed - #####: 449: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - #####: 450: break; - -: 451: } - -: 452: } - -: 453: } - #####: 454: ret; - -: 455:} - -: 456: - -: 457:/** - -: 458: * serialize array - -: 459: * - -: 460: * the serialized array is pushed to r. - -: 461: * All elements are serialized recursively - -: 462: * - -: 463: * the data in containers is not serialized - -: 464: * - -: 465: * \param - -: 466: * r small bytes object - -: 467: * array to serialize - -: 468: */ + -: 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: */ function arrayNetSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 469:internal void arrayNetSerialLevel0(sBytest **r, sArrayt *array) { - #####: 470: sBytest *B = NULL; - -: 471: - #####: 472: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); + #####: 470:internal void arrayNetSerialLevel0(sBytest **r, sArrayt *array) { + #####: 471: sBytest *B = NULL; + -: 472: + #####: 473: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); call 0 never executed - -: 473: - #####: 474: forEachSArray(array, e) { + -: 474: + #####: 475: forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 475: if (!e) { + #####: 476: if (!e) { branch 0 never executed branch 1 never executed - -: 476: // empty slots are represented as undefined elements - #####: 477: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); + -: 477: // empty slots are represented as undefined elements + #####: 478: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); call 0 never executed - -: 478: } - -: 479: else { - #####: 480: switch(e->type) { + -: 479: } + -: 480: else { + #####: 481: switch(e->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -698,107 +699,107 @@ branch 6 never executed branch 7 never executed branch 8 never executed branch 9 never executed - -: 481: case UNDEFINED: - #####: 482: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); -call 0 never executed - #####: 483: break; - -: 484: case BOOL: { - #####: 485: u8 c = NET_SERIAL_TYPES[(u8)e->type]; - -: 486: // set bit 4 when true - #####: 487: if (((sBoolt *)&(e->type))->value) -branch 0 never executed -branch 1 never executed - #####: 488: c |= (1<<4); - #####: 489: sBytesPush(r, c); -call 0 never executed - -: 490: } - #####: 491: break; - -: 492: case CONTAINER: - -: 493: // undefined - #####: 494: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); -call 0 never executed - #####: 495: break; - -: 496: case DICT: - #####: 497: dictNetSerialLevel0(r, (sDictt *)e); -call 0 never executed - #####: 498: break; - -: 499: case DOUBLE: - #####: 500: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); -call 0 never executed - #####: 501: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); -call 0 never executed - #####: 502: break; - -: 503: case INT: { - -: 504: // encode int to varint - -: 505: // v is int64_t to convert to varint - #####: 506: i64 v = ((sIntt *)&(e->type))->value; - -: 507: // encode v with arithmetic shifts - #####: 508: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 509: } - #####: 510: break; - -: 511: case STRING: - #####: 512: sBytesPush(r, NET_SERIAL_TYPES[(u8)e->type]); -call 0 never executed - #####: 513: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); -call 0 never executed - #####: 514: break; - -: 515: case ARRAY: - #####: 516: arrayNetSerialLevel0(r, (sArrayt *)e); -call 0 never executed - #####: 517: break; - -: 518: case BYTES: - #####: 519: B = (sBytest *)e; - #####: 520: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); -call 0 never executed - #####: 521: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - #####: 522: break; - -: 523: } - -: 524: } - -: 525: } - #####: 526: ret; - -: 527:} - -: 528: + -: 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: function serialNetSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 529:internal smallBytest* serialNetSerialLevel0(smallJsont *self) { - -: 530: - #####: 531: smallt *o = getsoG(self); + #####: 530:internal smallBytest* serialNetSerialLevel0(smallJsont *self) { + -: 531: + #####: 532: smallt *o = getsoG(self); call 0 never executed - -: 532: - #####: 533: if (o == NULL) + -: 533: + #####: 534: if (o == NULL) branch 0 never executed branch 1 never executed - #####: 534: ret NULL; - -: 535: - #####: 536: sBytest *B = netSerialLevel0(o); + #####: 535: ret NULL; + -: 536: + #####: 537: sBytest *B = netSerialLevel0(o); call 0 never executed - -: 537: - #####: 538: if (!B) { + -: 538: + #####: 539: if (!B) { branch 0 never executed branch 1 never executed - #####: 539: ret NULL; - -: 540: } - -: 541: - #####: 542: createAllocateSmallBytes(r); + #####: 540: ret NULL; + -: 541: } + -: 542: + #####: 543: createAllocateSmallBytes(r); call 0 never executed - #####: 543: r->B = B; - #####: 544: ret r; - -: 545:} - -: 546: - -: 547:// level 1 - -: 548:// like level 0 with type encoded in nibbles and bools are packed - -: 549: - -: 550:/** - -: 551: * serializer top function - -: 552: */ + #####: 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: */ function netSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 553:internal sBytest* netSerialLevel1(smallt *o) { - #####: 554: sBytest *r = NULL; - #####: 555: sBytest *B = NULL; - #####: 556: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; - -: 557: - #####: 558: switch(o->type) { + #####: 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) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -808,106 +809,106 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 559: case UNDEFINED: - -: 560: case CONTAINER: - #####: 561: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 562: break; - -: 563: case BOOL: { - #####: 564: u8 c = NET_SERIAL_TYPES[(u8)o->type]; - -: 565: // set bit 4 when true - #####: 566: if (((sBoolt *)&(o->type))->value) -branch 0 never executed -branch 1 never executed - #####: 567: c |= (1<<4); - #####: 568: sBytesPush(&r, c); -call 0 never executed - -: 569: } - #####: 570: break; - -: 571: case DICT: - #####: 572: dictNetSerialLevel1(&r, (sDictt *)&(o->type), &ctx); -call 0 never executed - #####: 573: break; - -: 574: case DOUBLE: - #####: 575: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 576: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); -call 0 never executed - #####: 577: break; - -: 578: case INT: { - -: 579: // encode int to varint - -: 580: // v is int64_t to convert to varint - #####: 581: i64 v = ((sIntt *)&(o->type))->value; - -: 582: // encode v with arithmetic shifts - #####: 583: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 584: } - #####: 585: break; - -: 586: case STRING: - #####: 587: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 588: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); -call 0 never executed - #####: 589: break; - -: 590: case ARRAY: - #####: 591: arrayNetSerialLevel1(&r, (sArrayt *)&(o->type), &ctx); -call 0 never executed - #####: 592: break; - -: 593: case BYTES: - #####: 594: B = (sBytest *)&(o->type); - #####: 595: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); -call 0 never executed - #####: 596: sBytesPushBuffer(&r, &(B->data), B->count); -call 0 never executed - #####: 597: break; - -: 598: } - #####: 599: ret r; - -: 600:} - -: 601: - -: 602:/** - -: 603: * serialize dictionary - -: 604: * - -: 605: * the serialized dict is pushed to r. - -: 606: * All elements are serialized recursively - -: 607: * - -: 608: * the data in containers is not serialized - -: 609: * - -: 610: * \param - -: 611: * r small bytes object - -: 612: * dict dictionary to serialize - -: 613: */ + -: 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: */ function dictNetSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 614:internal void dictNetSerialLevel1(sBytest **r, sDictt *dict, contextt *ctx) { - #####: 615: sBytest *B = NULL; - #####: 616: char *data = NULL; - -: 617: - #####: 618: if (ctx->nibble == lowNbl) { + #####: 615:internal void dictNetSerialLevel1(sBytest **r, sDictt *dict, contextt *ctx) { + #####: 616: sBytest *B = NULL; + #####: 617: char *data = NULL; + -: 618: + #####: 619: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 619: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); + #####: 620: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); call 0 never executed - -: 620: } - -: 621: else { - -: 622: // high nibble - -: 623: #define storeTypeInHighNbl(o)\ - -: 624: ctx->nibble = lowNbl;\ - -: 625: data = (char *)&((*r)->data) + ctx->nblOffset;\ - -: 626: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 - #####: 627: storeTypeInHighNbl(dict); - #####: 628: uintToVarint(r, dict->count); + -: 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); call 0 never executed - -: 629: } - -: 630: - #####: 631: forEachSDict(dict, e) { + -: 630: } + -: 631: + #####: 632: forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 632: if (e->key) { + #####: 633: if (e->key) { branch 0 never executed branch 1 never executed - #####: 633: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 634: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 634: - #####: 635: switch(e->data->type) { + -: 635: + #####: 636: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -917,240 +918,240 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 636: case UNDEFINED: - -: 637: case CONTAINER: - #####: 638: if (ctx->nibble == lowNbl) { + -: 637: case UNDEFINED: + -: 638: case CONTAINER: + #####: 639: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 639: #define storeTypeOnly(o)\ - -: 640: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ - -: 641: ctx->nibble = highNbl;\ - -: 642: ctx->nblOffset = (*r)->count -1 - #####: 643: storeTypeOnly(e->data); + -: 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); call 0 never executed - -: 644: } - -: 645: else { - #####: 646: storeTypeInHighNbl(e->data); - -: 647: } - #####: 648: break; - -: 649: case BOOL: - #####: 650: if (!ctx->boolOffset) { + -: 645: } + -: 646: else { + #####: 647: storeTypeInHighNbl(e->data); + -: 648: } + #####: 649: break; + -: 650: case BOOL: + #####: 651: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 651: // new packed bools - #####: 652: if (ctx->nibble == lowNbl) { + -: 652: // new packed bools + #####: 653: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 653: #define storeNew4bPackedBool(o)\ - -: 654: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ - -: 655: /* set bit 4 when true */\ - -: 656: if (((sBoolt *)(o))->value)\ - -: 657: c |= (1<<4);\ - -: 658: sBytesPush(r, c);\ - -: 659: ctx->boolShift = 5;\ - -: 660: ctx->boolOffset = (*r)->count -1 - #####: 661: storeNew4bPackedBool(e->data); + -: 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); branch 0 never executed branch 1 never executed call 2 never executed - -: 662: } - -: 663: else { - -: 664: // high nibble, next byte is packed bools - #####: 665: storeTypeInHighNbl(e->data); - -: 666: #define storeNew8bPackedBool(o)\ - -: 667: u8 c = 0;\ - -: 668: if (((sBoolt *)(o))->value)\ - -: 669: c = 1;\ - -: 670: sBytesPush(r, c);\ - -: 671: ctx->boolShift = 1;\ - -: 672: ctx->boolOffset = (*r)->count -1 - #####: 673: storeNew8bPackedBool(e->data); + -: 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); branch 0 never executed branch 1 never executed call 2 never executed - -: 674: } - -: 675: } - -: 676: else { - -: 677: // there was a bool before this one, fill bits in nibbles - #####: 678: if (ctx->nibble == lowNbl) { + -: 675: } + -: 676: } + -: 677: else { + -: 678: // there was a bool before this one, fill bits in nibbles + #####: 679: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 679: if (ctx->boolShift == 8) { + #####: 680: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 680: // previous packed bool is full - -: 681: // this byte is the new packed bools - #####: 682: storeNew4bPackedBool(e->data); + -: 681: // previous packed bool is full + -: 682: // this byte is the new packed bools + #####: 683: storeNew4bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 683: } - -: 684: else { - #####: 685: storeTypeOnly(e->data); + -: 684: } + -: 685: else { + #####: 686: storeTypeOnly(e->data); call 0 never executed - -: 686: #define storeBool(o)\ - -: 687: data = (char *)&((*r)->data) + ctx->boolOffset;\ - -: 688: if (((sBoolt *)(o))->value)\ - -: 689: *data |= 1 << ctx->boolShift;\ - -: 690: ctx->boolShift++ - #####: 691: storeBool(e->data); + -: 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); branch 0 never executed branch 1 never executed - -: 692: } - -: 693: } - -: 694: else { - -: 695: // high nibble - #####: 696: storeTypeInHighNbl(e->data); - #####: 697: if (ctx->boolShift == 8) { + -: 693: } + -: 694: } + -: 695: else { + -: 696: // high nibble + #####: 697: storeTypeInHighNbl(e->data); + #####: 698: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 698: // previous packed bool is full - -: 699: // next byte is the new packed bools - #####: 700: storeNew8bPackedBool(e->data); + -: 699: // previous packed bool is full + -: 700: // next byte is the new packed bools + #####: 701: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 701: } - -: 702: else { - #####: 703: storeBool(e->data); -branch 0 never executed -branch 1 never executed - -: 704: } - -: 705: } - -: 706: } - #####: 707: break; - -: 708: case DICT: - #####: 709: dictNetSerialLevel1(r, (sDictt *)(e->data), ctx); -call 0 never executed - #####: 710: break; - -: 711: case DOUBLE: - #####: 712: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 713: storeTypeOnly(e->data); -call 0 never executed - -: 714: } - -: 715: else { - -: 716: // high nibble - #####: 717: storeTypeInHighNbl(e->data); - -: 718: } - #####: 719: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 never executed - #####: 720: break; - -: 721: case INT: { - -: 722: // encode int to varint - -: 723: // v is int64_t to convert to varint - #####: 724: i64 v = ((sIntt *)(e->data))->value; - #####: 725: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - -: 726: // encode v with arithmetic shifts - #####: 727: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 728: } - -: 729: else { - -: 730: // high nibble - #####: 731: storeTypeInHighNbl(e->data); - #####: 732: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 never executed - -: 733: } - -: 734: } - #####: 735: break; - -: 736: case STRING: - #####: 737: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 738: storeTypeOnly(e->data); -call 0 never executed - -: 739: } - -: 740: else { - -: 741: // high nibble - #####: 742: storeTypeInHighNbl(e->data); - -: 743: } - #####: 744: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 never executed - #####: 745: break; - -: 746: case ARRAY: - #####: 747: arrayNetSerialLevel1(r, (sArrayt *)(e->data), ctx); -call 0 never executed - #####: 748: break; - -: 749: case BYTES: - #####: 750: B = (sBytest *)(e->data); - #####: 751: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 752: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); -call 0 never executed - -: 753: } - -: 754: else { - -: 755: // high nibble - #####: 756: storeTypeInHighNbl(e->data); - #####: 757: uintToVarint(r, B->count); -call 0 never executed - -: 758: } - #####: 759: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - #####: 760: break; - -: 761: } - -: 762: } - -: 763: } - #####: 764: ret; - -: 765:} - -: 766: - -: 767:/** - -: 768: * serialize array - -: 769: * - -: 770: * the serialized array is pushed to r. - -: 771: * All elements are serialized recursively - -: 772: * - -: 773: * the data in containers is not serialized - -: 774: * - -: 775: * \param - -: 776: * r small bytes object - -: 777: * array to serialize - -: 778: */ + -: 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: */ function arrayNetSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 779:internal void arrayNetSerialLevel1(sBytest **r, sArrayt *array, contextt *ctx) { - #####: 780: sBytest *B = NULL; - #####: 781: char *data = NULL; - -: 782: - #####: 783: if (ctx->nibble == lowNbl) { + #####: 780:internal void arrayNetSerialLevel1(sBytest **r, sArrayt *array, contextt *ctx) { + #####: 781: sBytest *B = NULL; + #####: 782: char *data = NULL; + -: 783: + #####: 784: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 784: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); + #####: 785: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); call 0 never executed - -: 785: } - -: 786: else { - -: 787: // high nibble - #####: 788: storeTypeInHighNbl(array); - #####: 789: uintToVarint(r, array->count); + -: 786: } + -: 787: else { + -: 788: // high nibble + #####: 789: storeTypeInHighNbl(array); + #####: 790: uintToVarint(r, array->count); call 0 never executed - -: 790: } - -: 791: - #####: 792: forEachSArray(array, e) { + -: 791: } + -: 792: + #####: 793: forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 793: if (!e) { + #####: 794: if (!e) { branch 0 never executed branch 1 never executed - -: 794: // empty slots are represented as undefined elements - #####: 795: if (ctx->nibble == lowNbl) { + -: 795: // empty slots are represented as undefined elements + #####: 796: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 796: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); + #####: 797: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); call 0 never executed - #####: 797: ctx->nibble = highNbl; - #####: 798: ctx->nblOffset = (*r)->count -1; - -: 799: } - -: 800: else { - -: 801: // high nibble - #####: 802: ctx->nibble = lowNbl; - #####: 803: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 804: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; - -: 805: } - -: 806: } - -: 807: else { - #####: 808: switch(e->type) { + #####: 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) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -1160,202 +1161,202 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 809: case UNDEFINED: - -: 810: case CONTAINER: - #####: 811: if (ctx->nibble == lowNbl) { + -: 810: case UNDEFINED: + -: 811: case CONTAINER: + #####: 812: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 812: storeTypeOnly(e); + #####: 813: storeTypeOnly(e); call 0 never executed - -: 813: } - -: 814: else { - -: 815: // high nibble - #####: 816: storeTypeInHighNbl(e); - -: 817: } - #####: 818: break; - -: 819: case BOOL: - #####: 820: if (!ctx->boolOffset) { + -: 814: } + -: 815: else { + -: 816: // high nibble + #####: 817: storeTypeInHighNbl(e); + -: 818: } + #####: 819: break; + -: 820: case BOOL: + #####: 821: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 821: // new packed bools - #####: 822: if (ctx->nibble == lowNbl) { + -: 822: // new packed bools + #####: 823: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 823: storeNew4bPackedBool(e); + #####: 824: storeNew4bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 824: } - -: 825: else { - -: 826: // high nibble, next byte is packed bools - #####: 827: storeTypeInHighNbl(e); - #####: 828: storeNew8bPackedBool(e); + -: 825: } + -: 826: else { + -: 827: // high nibble, next byte is packed bools + #####: 828: storeTypeInHighNbl(e); + #####: 829: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 829: } - -: 830: } - -: 831: else { - -: 832: // there was a bool before this one, fill bits in nibbles - #####: 833: if (ctx->nibble == lowNbl) { + -: 830: } + -: 831: } + -: 832: else { + -: 833: // there was a bool before this one, fill bits in nibbles + #####: 834: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 834: if (ctx->boolShift == 8) { + #####: 835: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 835: // previous packed bool is full - -: 836: // this byte is the new packed bools - #####: 837: storeNew4bPackedBool(e); + -: 836: // previous packed bool is full + -: 837: // this byte is the new packed bools + #####: 838: storeNew4bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 838: } - -: 839: else { - #####: 840: storeTypeOnly(e); + -: 839: } + -: 840: else { + #####: 841: storeTypeOnly(e); call 0 never executed - #####: 841: storeBool(e); + #####: 842: storeBool(e); branch 0 never executed branch 1 never executed - -: 842: } - -: 843: } - -: 844: else { - -: 845: // high nibble - #####: 846: storeTypeInHighNbl(e); - #####: 847: if (ctx->boolShift == 8) { + -: 843: } + -: 844: } + -: 845: else { + -: 846: // high nibble + #####: 847: storeTypeInHighNbl(e); + #####: 848: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 848: // previous packed bool is full - -: 849: // next byte is the new packed bools - #####: 850: storeNew8bPackedBool(e); + -: 849: // previous packed bool is full + -: 850: // next byte is the new packed bools + #####: 851: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 851: } - -: 852: else { - #####: 853: storeBool(e); + -: 852: } + -: 853: else { + #####: 854: storeBool(e); branch 0 never executed branch 1 never executed - -: 854: } - -: 855: } - -: 856: } - #####: 857: break; - -: 858: case DICT: - #####: 859: dictNetSerialLevel1(r, (sDictt *)e, ctx); + -: 855: } + -: 856: } + -: 857: } + #####: 858: break; + -: 859: case DICT: + #####: 860: dictNetSerialLevel1(r, (sDictt *)e, ctx); call 0 never executed - #####: 860: break; - -: 861: case DOUBLE: - #####: 862: if (ctx->nibble == lowNbl) { + #####: 861: break; + -: 862: case DOUBLE: + #####: 863: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 863: storeTypeOnly(e); + #####: 864: storeTypeOnly(e); call 0 never executed - -: 864: } - -: 865: else { - -: 866: // high nibble - #####: 867: storeTypeInHighNbl(e); - -: 868: } - #####: 869: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); + -: 865: } + -: 866: else { + -: 867: // high nibble + #####: 868: storeTypeInHighNbl(e); + -: 869: } + #####: 870: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); call 0 never executed - #####: 870: break; - -: 871: case INT: { - -: 872: // encode int to varint - -: 873: // v is int64_t to convert to varint - #####: 874: i64 v = ((sIntt *)&(e->type))->value; - #####: 875: if (ctx->nibble == lowNbl) { + #####: 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) { branch 0 never executed branch 1 never executed - -: 876: // encode v with arithmetic shifts - #####: 877: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); + -: 877: // encode v with arithmetic shifts + #####: 878: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); call 0 never executed - -: 878: } - -: 879: else { - -: 880: // high nibble - #####: 881: storeTypeInHighNbl(e); - #####: 882: uintToVarint(r, (v << 1) ^ (v >> 63)); + -: 879: } + -: 880: else { + -: 881: // high nibble + #####: 882: storeTypeInHighNbl(e); + #####: 883: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 never executed - -: 883: } - -: 884: } - #####: 885: break; - -: 886: case STRING: - #####: 887: if (ctx->nibble == lowNbl) { + -: 884: } + -: 885: } + #####: 886: break; + -: 887: case STRING: + #####: 888: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 888: storeTypeOnly(e); + #####: 889: storeTypeOnly(e); call 0 never executed - -: 889: } - -: 890: else { - -: 891: // high nibble - #####: 892: storeTypeInHighNbl(e); - -: 893: } - #####: 894: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); + -: 890: } + -: 891: else { + -: 892: // high nibble + #####: 893: storeTypeInHighNbl(e); + -: 894: } + #####: 895: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); call 0 never executed - #####: 895: break; - -: 896: case ARRAY: - #####: 897: arrayNetSerialLevel1(r, (sArrayt *)e, ctx); + #####: 896: break; + -: 897: case ARRAY: + #####: 898: arrayNetSerialLevel1(r, (sArrayt *)e, ctx); call 0 never executed - #####: 898: break; - -: 899: case BYTES: - #####: 900: B = (sBytest *)e; - #####: 901: if (ctx->nibble == lowNbl) { + #####: 899: break; + -: 900: case BYTES: + #####: 901: B = (sBytest *)e; + #####: 902: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 902: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); + #####: 903: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); call 0 never executed - -: 903: } - -: 904: else { - -: 905: // high nibble - #####: 906: storeTypeInHighNbl(e); - #####: 907: uintToVarint(r, B->count); + -: 904: } + -: 905: else { + -: 906: // high nibble + #####: 907: storeTypeInHighNbl(e); + #####: 908: uintToVarint(r, B->count); call 0 never executed - -: 908: } - #####: 909: sBytesPushBuffer(r, &(B->data), B->count); + -: 909: } + #####: 910: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - #####: 910: break; - -: 911: } - -: 912: } - -: 913: } - #####: 914: ret; - -: 915:} - -: 916: + #####: 911: break; + -: 912: } + -: 913: } + -: 914: } + #####: 915: ret; + -: 916:} + -: 917: function serialNetSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 917:internal smallBytest* serialNetSerialLevel1(smallJsont *self) { - -: 918: - #####: 919: smallt *o = getsoG(self); + #####: 918:internal smallBytest* serialNetSerialLevel1(smallJsont *self) { + -: 919: + #####: 920: smallt *o = getsoG(self); call 0 never executed - -: 920: - #####: 921: if (o == NULL) + -: 921: + #####: 922: if (o == NULL) branch 0 never executed branch 1 never executed - #####: 922: ret NULL; - -: 923: - #####: 924: sBytest *B = netSerialLevel1(o); + #####: 923: ret NULL; + -: 924: + #####: 925: sBytest *B = netSerialLevel1(o); call 0 never executed - -: 925: - #####: 926: if (!B) { + -: 926: + #####: 927: if (!B) { branch 0 never executed branch 1 never executed - #####: 927: ret NULL; - -: 928: } - -: 929: - #####: 930: createAllocateSmallBytes(r); + #####: 928: ret NULL; + -: 929: } + -: 930: + #####: 931: createAllocateSmallBytes(r); call 0 never executed - #####: 931: r->B = B; - #####: 932: ret r; - -: 933:} - -: 934: - -: 935:// level 2 - -: 936:// like level 1, arrays are set to uniform when all elements are same type - -: 937: - -: 938:/** - -: 939: * serializer top function - -: 940: */ + #####: 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: */ function netSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 941:internal sBytest* netSerialLevel2(smallt *o) { - #####: 942: sBytest *r = NULL; - #####: 943: sBytest *B = NULL; - #####: 944: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; - -: 945: - #####: 946: switch(o->type) { + #####: 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) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -1365,314 +1366,314 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 947: case UNDEFINED: - -: 948: case CONTAINER: - #####: 949: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 950: break; - -: 951: case BOOL: { - #####: 952: u8 c = NET_SERIAL_TYPES[(u8)o->type]; - -: 953: // set bit 4 when true - #####: 954: if (((sBoolt *)&(o->type))->value) -branch 0 never executed -branch 1 never executed - #####: 955: c |= (1<<4); - #####: 956: sBytesPush(&r, c); -call 0 never executed - -: 957: } - #####: 958: break; - -: 959: case DICT: - #####: 960: dictNetSerialLevel2(&r, (sDictt *)&(o->type), &ctx, /*packed=*/false); -call 0 never executed - #####: 961: break; - -: 962: case DOUBLE: - #####: 963: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 964: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); -call 0 never executed - #####: 965: break; - -: 966: case INT: { - -: 967: // encode int to varint - -: 968: // v is int64_t to convert to varint - #####: 969: i64 v = ((sIntt *)&(o->type))->value; - -: 970: // encode v with arithmetic shifts - #####: 971: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 972: } - #####: 973: break; - -: 974: case STRING: - #####: 975: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 never executed - #####: 976: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); -call 0 never executed - #####: 977: break; - -: 978: case ARRAY: - #####: 979: arrayNetSerialLevel2(&r, (sArrayt *)&(o->type), &ctx, /*packed=*/false); -call 0 never executed - #####: 980: break; - -: 981: case BYTES: - #####: 982: B = (sBytest *)&(o->type); - #####: 983: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); -call 0 never executed - #####: 984: sBytesPushBuffer(&r, &(B->data), B->count); -call 0 never executed - #####: 985: break; - -: 986: } - #####: 987: ret r; - -: 988:} - -: 989: + -: 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: function isDictUniform called 33 returned 100% blocks executed 69% - 33: 990:internal u8 isDictUniform(sDictt *dict) { - 33: 991: bool allElementsHaveSameType = true; - 33: 992: bool foundFirstType = false; - 33: 993: u8 type = 0; - 66: 994: forEachSDict(dict, e) { + 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) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 44: 995: if (e->key) { + 44: 996: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 44: 996: if (foundFirstType) { + 44: 997: if (foundFirstType) { branch 0 taken 39% (fallthrough) branch 1 taken 61% - -: 997: u8 nextType; - 17: 998: switch(e->data->type) { + -: 998: u8 nextType; + 17: 999: switch(e->data->type) { branch 0 taken 0% branch 1 taken 0% branch 2 taken 100% - -: 999: case DICT: - #####: 1000: nextType = isDictUniform((sDictt*)e->data); -call 0 never executed - #####: 1001: break; - -: 1002: case ARRAY: - #####: 1003: nextType = isArrayUniform((sArrayt*)e->data); -call 0 never executed - #####: 1004: break; - -: 1005: default: - 17: 1006: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1007: } - 17: 1008: if (nextType != type) { + -: 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) { branch 0 taken 65% (fallthrough) branch 1 taken 35% - 11: 1009: allElementsHaveSameType = false; - 11: 1010: break; - -: 1011: } - -: 1012: } - -: 1013: else { - 27: 1014: switch(e->data->type) { + 11: 1010: allElementsHaveSameType = false; + 11: 1011: break; + -: 1012: } + -: 1013: } + -: 1014: else { + 27: 1015: switch(e->data->type) { branch 0 taken 0% branch 1 taken 0% branch 2 taken 100% - -: 1015: case DICT: - #####: 1016: type = isDictUniform((sDictt*)e->data); -call 0 never executed - #####: 1017: break; - -: 1018: case ARRAY: - #####: 1019: type = isArrayUniform((sArrayt*)e->data); -call 0 never executed - #####: 1020: break; - -: 1021: default: - 27: 1022: type = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1023: } - 27: 1024: foundFirstType = true; - -: 1025: } - -: 1026: } - -: 1027: } - 33: 1028: if (allElementsHaveSameType) + -: 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) branch 0 taken 67% (fallthrough) branch 1 taken 33% - 22: 1029: type = UNIFORM_DICT; - -: 1030: else - 11: 1031: type = S_DICT; - 33: 1032: ret type; - -: 1033:} - -: 1034: + 22: 1030: type = UNIFORM_DICT; + -: 1031: else + 11: 1032: type = S_DICT; + 33: 1033: ret type; + -: 1034:} + -: 1035: function isArrayUniform called 28 returned 100% blocks executed 65% - 28: 1035:internal u8 isArrayUniform(sArrayt *array) { - 28: 1036: bool allElementsHaveSameType = true; - 28: 1037: bool foundFirstType = false; - 28: 1038: char type = 0; - 79: 1039: forEachSArray(array, e) { + 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) { branch 0 taken 73% branch 1 taken 27% (fallthrough) - 58: 1040: if (!e) { + 58: 1041: if (!e) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 1041: if (foundFirstType) { + #####: 1042: if (foundFirstType) { branch 0 never executed branch 1 never executed - #####: 1042: if (type != S_UNDEFINED) { + #####: 1043: if (type != S_UNDEFINED) { branch 0 never executed branch 1 never executed - #####: 1043: allElementsHaveSameType = false; - #####: 1044: break; - -: 1045: } - -: 1046: } - -: 1047: else { - #####: 1048: type = S_UNDEFINED; - #####: 1049: foundFirstType = true; - -: 1050: } - -: 1051: } - -: 1052: else { - 58: 1053: if (foundFirstType) { + #####: 1044: allElementsHaveSameType = false; + #####: 1045: break; + -: 1046: } + -: 1047: } + -: 1048: else { + #####: 1049: type = S_UNDEFINED; + #####: 1050: foundFirstType = true; + -: 1051: } + -: 1052: } + -: 1053: else { + 58: 1054: if (foundFirstType) { branch 0 taken 57% (fallthrough) branch 1 taken 43% - -: 1054: u8 nextType; - 33: 1055: switch(e->type) { + -: 1055: u8 nextType; + 33: 1056: switch(e->type) { branch 0 taken 0% branch 1 taken 0% branch 2 taken 100% - -: 1056: case DICT: - #####: 1057: nextType = isDictUniform((sDictt*)e); -call 0 never executed - #####: 1058: break; - -: 1059: case ARRAY: - #####: 1060: nextType = isArrayUniform((sArrayt*)e); -call 0 never executed - #####: 1061: break; - -: 1062: default: - 33: 1063: nextType = NET_SERIAL_TYPES[(u8)e->type]; - -: 1064: } - 33: 1065: if (nextType != type) { + -: 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) { branch 0 taken 21% (fallthrough) branch 1 taken 79% - 7: 1066: allElementsHaveSameType = false; - 7: 1067: break; - -: 1068: } - -: 1069: } - -: 1070: else { - 25: 1071: switch(e->type) { + 7: 1067: allElementsHaveSameType = false; + 7: 1068: break; + -: 1069: } + -: 1070: } + -: 1071: else { + 25: 1072: switch(e->type) { branch 0 taken 4% branch 1 taken 0% branch 2 taken 96% - -: 1072: case DICT: - 1: 1073: type = isDictUniform((sDictt*)e); -call 0 returned 100% - 1: 1074: break; - -: 1075: case ARRAY: - #####: 1076: type = isArrayUniform((sArrayt*)e); -call 0 never executed - #####: 1077: break; - -: 1078: default: - 24: 1079: type = NET_SERIAL_TYPES[(u8)e->type]; - -: 1080: } - 25: 1081: foundFirstType = true; - -: 1082: } - -: 1083: } - -: 1084: } - 28: 1085: if (allElementsHaveSameType) + -: 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) branch 0 taken 75% (fallthrough) branch 1 taken 25% - 21: 1086: type = UNIFORM_ARRAY; - -: 1087: else - 7: 1088: type = S_ARRAY; - 28: 1089: ret type; - -: 1090:} - -: 1091: - -: 1092:/** - -: 1093: * serialize dictionary - -: 1094: * - -: 1095: * the serialized dict is pushed to r. - -: 1096: * All elements are serialized recursively - -: 1097: * - -: 1098: * the data in containers is not serialized - -: 1099: * - -: 1100: * \param - -: 1101: * r small bytes object - -: 1102: * dict dictionary to serialize - -: 1103: */ + 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: */ function dictNetSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 1104:internal void dictNetSerialLevel2(sBytest **r, sDictt *dict, contextt *ctx, bool packed) { - #####: 1105: sBytest *B = NULL; - #####: 1106: char *data = NULL; - -: 1107: - -: 1108: // check if all elements have same type - #####: 1109: bool allElementsHaveSameType = true; - #####: 1110: bool foundFirstType = false; - #####: 1111: char type = 0; - #####: 1112: {forEachSDict(dict, e) { + #####: 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) { branch 0 never executed branch 1 never executed - #####: 1113: if (e->key) { + #####: 1114: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1114: if (foundFirstType) { + #####: 1115: if (foundFirstType) { branch 0 never executed branch 1 never executed - -: 1115: u8 nextType; - #####: 1116: switch(e->data->type) { + -: 1116: u8 nextType; + #####: 1117: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed - -: 1117: case DICT: - #####: 1118: nextType = isDictUniform((sDictt*)e->data); + -: 1118: case DICT: + #####: 1119: nextType = isDictUniform((sDictt*)e->data); call 0 never executed - #####: 1119: break; - -: 1120: case ARRAY: - #####: 1121: nextType = isArrayUniform((sArrayt*)e->data); + #####: 1120: break; + -: 1121: case ARRAY: + #####: 1122: nextType = isArrayUniform((sArrayt*)e->data); call 0 never executed - #####: 1122: break; - -: 1123: default: - #####: 1124: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1125: } - #####: 1126: if (nextType != type) { + #####: 1123: break; + -: 1124: default: + #####: 1125: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1126: } + #####: 1127: if (nextType != type) { branch 0 never executed branch 1 never executed - #####: 1127: allElementsHaveSameType = false; - #####: 1128: break; - -: 1129: } - -: 1130: } - -: 1131: else { - #####: 1132: switch(e->data->type) { + #####: 1128: allElementsHaveSameType = false; + #####: 1129: break; + -: 1130: } + -: 1131: } + -: 1132: else { + #####: 1133: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed - -: 1133: case DICT: - #####: 1134: type = isDictUniform((sDictt*)e->data); + -: 1134: case DICT: + #####: 1135: type = isDictUniform((sDictt*)e->data); call 0 never executed - #####: 1135: break; - -: 1136: case ARRAY: - #####: 1137: type = isArrayUniform((sArrayt*)e->data); + #####: 1136: break; + -: 1137: case ARRAY: + #####: 1138: type = isArrayUniform((sArrayt*)e->data); call 0 never executed - #####: 1138: break; - -: 1139: default: - #####: 1140: type = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1141: } - #####: 1142: foundFirstType = true; - -: 1143: } - -: 1144: } - -: 1145: }} - -: 1146: - #####: 1147: if (allElementsHaveSameType) { + #####: 1139: break; + -: 1140: default: + #####: 1141: type = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1142: } + #####: 1143: foundFirstType = true; + -: 1144: } + -: 1145: } + -: 1146: }} + -: 1147: + #####: 1148: if (allElementsHaveSameType) { branch 0 never executed branch 1 never executed - -: 1148: // pack dictionary - #####: 1149: if (packed) { + -: 1149: // pack dictionary + #####: 1150: if (packed) { branch 0 never executed branch 1 never executed - #####: 1150: uintToNetTypeVarint(r, type, dict->count); + #####: 1151: uintToNetTypeVarint(r, type, dict->count); call 0 never executed - -: 1151: } - -: 1152: else { - #####: 1153: if (ctx->nibble == lowNbl) { + -: 1152: } + -: 1153: else { + #####: 1154: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1154: sBytesPush(r, (type << 4) + UNIFORM_DICT); + #####: 1155: sBytesPush(r, (type << 4) + UNIFORM_DICT); call 0 never executed - #####: 1155: uintToVarint(r, dict->count); + #####: 1156: uintToVarint(r, dict->count); call 0 never executed - -: 1156: } - -: 1157: else { - -: 1158: // high nibble - #####: 1159: ctx->nibble = lowNbl; - #####: 1160: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 1161: *data |= UNIFORM_DICT << 4; - #####: 1162: uintToNetTypeVarint(r, type, dict->count); + -: 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); call 0 never executed - -: 1163: } - -: 1164: } - -: 1165: - #####: 1166: switch(type) { + -: 1164: } + -: 1165: } + -: 1166: + #####: 1167: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -1682,188 +1683,188 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 1167: case S_UNDEFINED: - #####: 1168: {forEachSDict(dict, e) { + -: 1168: case S_UNDEFINED: + #####: 1169: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1169: if (e->key) { + #####: 1170: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1170: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1171: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 1171: } - -: 1172: }} - -: 1173: - #####: 1174: break; - -: 1175: case S_BOOL: - #####: 1176: {forEachSDict(dict, e) { + -: 1172: } + -: 1173: }} + -: 1174: + #####: 1175: break; + -: 1176: case S_BOOL: + #####: 1177: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1177: if (e->key) { + #####: 1178: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1178: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1179: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 1179: - #####: 1180: if (!ctx->boolOffset) { + -: 1180: + #####: 1181: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 1181: // new packed bools - #####: 1182: storeNew8bPackedBool(e->data); + -: 1182: // new packed bools + #####: 1183: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1183: } - -: 1184: else { - -: 1185: // there was a bool before this one, fill bits in nibbles - #####: 1186: if (ctx->boolShift == 8) { + -: 1184: } + -: 1185: else { + -: 1186: // there was a bool before this one, fill bits in nibbles + #####: 1187: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1187: // previous packed bool is full - -: 1188: // next byte is the new packed bools - #####: 1189: storeNew8bPackedBool(e->data); + -: 1188: // previous packed bool is full + -: 1189: // next byte is the new packed bools + #####: 1190: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1190: } - -: 1191: else { - #####: 1192: storeBool(e->data); + -: 1191: } + -: 1192: else { + #####: 1193: storeBool(e->data); branch 0 never executed branch 1 never executed - -: 1193: } - -: 1194: } - -: 1195: } - -: 1196: }} - #####: 1197: break; - -: 1198: case S_DICT: - -: 1199: case UNIFORM_DICT: - #####: 1200: {forEachSDict(dict, e) { + -: 1194: } + -: 1195: } + -: 1196: } + -: 1197: }} + #####: 1198: break; + -: 1199: case S_DICT: + -: 1200: case UNIFORM_DICT: + #####: 1201: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1201: if (e->key) { + #####: 1202: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1202: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1203: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1203: dictNetSerialLevel2(r, (sDictt *)(e->data), ctx, /*packed=*/true); + #####: 1204: dictNetSerialLevel2(r, (sDictt *)(e->data), ctx, /*packed=*/true); call 0 never executed - -: 1204: } - -: 1205: }} - #####: 1206: break; - -: 1207: case S_DOUBLE: - #####: 1208: {forEachSDict(dict, e) { + -: 1205: } + -: 1206: }} + #####: 1207: break; + -: 1208: case S_DOUBLE: + #####: 1209: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1209: if (e->key) { + #####: 1210: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1210: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1211: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1211: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); + #####: 1212: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); call 0 never executed - -: 1212: } - -: 1213: }} - #####: 1214: break; - -: 1215: case S_INT: - #####: 1216: {forEachSDict(dict, e) { + -: 1213: } + -: 1214: }} + #####: 1215: break; + -: 1216: case S_INT: + #####: 1217: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1217: if (e->key) { + #####: 1218: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1218: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1219: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1219: i64 v = ((sIntt *)(e->data))->value; - #####: 1220: uintToVarint(r, (v << 1) ^ (v >> 63)); + #####: 1220: i64 v = ((sIntt *)(e->data))->value; + #####: 1221: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 never executed - -: 1221: } - -: 1222: }} - #####: 1223: break; - -: 1224: case S_STRING: - #####: 1225: {forEachSDict(dict, e) { + -: 1222: } + -: 1223: }} + #####: 1224: break; + -: 1225: case S_STRING: + #####: 1226: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1226: if (e->key) { + #####: 1227: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1227: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1228: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1228: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); + #####: 1229: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); call 0 never executed - -: 1229: } - -: 1230: }} - #####: 1231: break; - -: 1232: case S_ARRAY: - -: 1233: case UNIFORM_ARRAY: - #####: 1234: {forEachSDict(dict, e) { + -: 1230: } + -: 1231: }} + #####: 1232: break; + -: 1233: case S_ARRAY: + -: 1234: case UNIFORM_ARRAY: + #####: 1235: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1235: if (e->key) { + #####: 1236: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1236: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1237: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1237: arrayNetSerialLevel2(r, (sArrayt *)(e->data), ctx, /*packed=*/true); + #####: 1238: arrayNetSerialLevel2(r, (sArrayt *)(e->data), ctx, /*packed=*/true); call 0 never executed - -: 1238: } - -: 1239: }} - #####: 1240: break; - -: 1241: case S_BYTES: - #####: 1242: {forEachSDict(dict, e) { + -: 1239: } + -: 1240: }} + #####: 1241: break; + -: 1242: case S_BYTES: + #####: 1243: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1243: if (e->key) { + #####: 1244: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1244: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1245: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1245: B = (sBytest *)(e->data); - #####: 1246: uintToVarint(r, B->count); + #####: 1246: B = (sBytest *)(e->data); + #####: 1247: uintToVarint(r, B->count); call 0 never executed - #####: 1247: sBytesPushBuffer(r, &(B->data), B->count); + #####: 1248: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 1248: } - -: 1249: }} - #####: 1250: break; - -: 1251: } - #####: 1252: ret; - -: 1253: } - -: 1254: - #####: 1255: if (packed) { + -: 1249: } + -: 1250: }} + #####: 1251: break; + -: 1252: } + #####: 1253: ret; + -: 1254: } + -: 1255: + #####: 1256: if (packed) { branch 0 never executed branch 1 never executed - #####: 1256: uintToVarint(r, dict->count); + #####: 1257: uintToVarint(r, dict->count); call 0 never executed - -: 1257: } - -: 1258: else { - #####: 1259: if (ctx->nibble == lowNbl) { + -: 1258: } + -: 1259: else { + #####: 1260: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1260: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); + #####: 1261: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); call 0 never executed - -: 1261: } - -: 1262: else { - -: 1263: // high nibble - -: 1264:#define storeTypeInHighNbl(o)\ - -: 1265: ctx->nibble = lowNbl;\ - -: 1266: data = (char *)&((*r)->data) + ctx->nblOffset;\ - -: 1267: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 - #####: 1268: storeTypeInHighNbl(dict); - #####: 1269: uintToVarint(r, dict->count); + -: 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); call 0 never executed - -: 1270: } - -: 1271: } - -: 1272: - #####: 1273: forEachSDict(dict, e) { + -: 1271: } + -: 1272: } + -: 1273: + #####: 1274: forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1274: if (e->key) { + #####: 1275: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1275: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1276: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - -: 1276: - #####: 1277: switch(e->data->type) { + -: 1277: + #####: 1278: switch(e->data->type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -1873,307 +1874,307 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 1278: case UNDEFINED: - -: 1279: case CONTAINER: - #####: 1280: if (ctx->nibble == lowNbl) { + -: 1279: case UNDEFINED: + -: 1280: case CONTAINER: + #####: 1281: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 1281: #define storeTypeOnly(o)\ - -: 1282: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ - -: 1283: ctx->nibble = highNbl;\ - -: 1284: ctx->nblOffset = (*r)->count -1 - #####: 1285: storeTypeOnly(e->data); + -: 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); call 0 never executed - -: 1286: } - -: 1287: else { - #####: 1288: storeTypeInHighNbl(e->data); - -: 1289: } - #####: 1290: break; - -: 1291: case BOOL: - #####: 1292: if (!ctx->boolOffset) { + -: 1287: } + -: 1288: else { + #####: 1289: storeTypeInHighNbl(e->data); + -: 1290: } + #####: 1291: break; + -: 1292: case BOOL: + #####: 1293: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 1293: // new packed bools - #####: 1294: if (ctx->nibble == lowNbl) { + -: 1294: // new packed bools + #####: 1295: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 1295: #define storeNew4bPackedBool(o)\ - -: 1296: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ - -: 1297: /* set bit 4 when true */\ - -: 1298: if (((sBoolt *)(o))->value)\ - -: 1299: c |= (1<<4);\ - -: 1300: sBytesPush(r, c);\ - -: 1301: ctx->boolShift = 5;\ - -: 1302: ctx->boolOffset = (*r)->count -1 - #####: 1303: storeNew4bPackedBool(e->data); + -: 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); branch 0 never executed branch 1 never executed call 2 never executed - -: 1304: } - -: 1305: else { - -: 1306: // high nibble, next byte is packed bools - #####: 1307: storeTypeInHighNbl(e->data); - -: 1308: #define storeNew8bPackedBool(o)\ - -: 1309: u8 c = 0;\ - -: 1310: if (((sBoolt *)(o))->value)\ - -: 1311: c = 1;\ - -: 1312: sBytesPush(r, c);\ - -: 1313: ctx->boolShift = 1;\ - -: 1314: ctx->boolOffset = (*r)->count -1 - #####: 1315: storeNew8bPackedBool(e->data); + -: 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); branch 0 never executed branch 1 never executed call 2 never executed - -: 1316: } - -: 1317: } - -: 1318: else { - -: 1319: // there was a bool before this one, fill bits in nibbles - #####: 1320: if (ctx->nibble == lowNbl) { + -: 1317: } + -: 1318: } + -: 1319: else { + -: 1320: // there was a bool before this one, fill bits in nibbles + #####: 1321: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1321: if (ctx->boolShift == 8) { + #####: 1322: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1322: // previous packed bool is full - -: 1323: // this byte is the new packed bools - #####: 1324: storeNew4bPackedBool(e->data); + -: 1323: // previous packed bool is full + -: 1324: // this byte is the new packed bools + #####: 1325: storeNew4bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1325: } - -: 1326: else { - #####: 1327: storeTypeOnly(e->data); + -: 1326: } + -: 1327: else { + #####: 1328: storeTypeOnly(e->data); call 0 never executed - -: 1328: #define storeBool(o)\ - -: 1329: data = (char *)&((*r)->data) + ctx->boolOffset;\ - -: 1330: if (((sBoolt *)(o))->value)\ - -: 1331: *data |= 1 << ctx->boolShift;\ - -: 1332: ctx->boolShift++ - #####: 1333: storeBool(e->data); + -: 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); branch 0 never executed branch 1 never executed - -: 1334: } - -: 1335: } - -: 1336: else { - -: 1337: // high nibble - #####: 1338: storeTypeInHighNbl(e->data); - #####: 1339: if (ctx->boolShift == 8) { + -: 1335: } + -: 1336: } + -: 1337: else { + -: 1338: // high nibble + #####: 1339: storeTypeInHighNbl(e->data); + #####: 1340: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1340: // previous packed bool is full - -: 1341: // next byte is the new packed bools - #####: 1342: storeNew8bPackedBool(e->data); + -: 1341: // previous packed bool is full + -: 1342: // next byte is the new packed bools + #####: 1343: storeNew8bPackedBool(e->data); branch 0 never executed branch 1 never executed call 2 never executed - -: 1343: } - -: 1344: else { - #####: 1345: storeBool(e->data); -branch 0 never executed -branch 1 never executed - -: 1346: } - -: 1347: } - -: 1348: } - #####: 1349: break; - -: 1350: case DICT: - #####: 1351: dictNetSerialLevel2(r, (sDictt *)(e->data), ctx, /*packed=*/false); -call 0 never executed - #####: 1352: break; - -: 1353: case DOUBLE: - #####: 1354: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 1355: storeTypeOnly(e->data); -call 0 never executed - -: 1356: } - -: 1357: else { - -: 1358: // high nibble - #####: 1359: storeTypeInHighNbl(e->data); - -: 1360: } - #####: 1361: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 never executed - #####: 1362: break; - -: 1363: case INT: { - -: 1364: // encode int to varint - -: 1365: // v is int64_t to convert to varint - #####: 1366: i64 v = ((sIntt *)(e->data))->value; - #####: 1367: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - -: 1368: // encode v with arithmetic shifts - #####: 1369: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); -call 0 never executed - -: 1370: } - -: 1371: else { - -: 1372: // high nibble - #####: 1373: storeTypeInHighNbl(e->data); - #####: 1374: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 never executed - -: 1375: } - -: 1376: } - #####: 1377: break; - -: 1378: case STRING: - #####: 1379: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 1380: storeTypeOnly(e->data); -call 0 never executed - -: 1381: } - -: 1382: else { - -: 1383: // high nibble - #####: 1384: storeTypeInHighNbl(e->data); - -: 1385: } - #####: 1386: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 never executed - #####: 1387: break; - -: 1388: case ARRAY: - #####: 1389: arrayNetSerialLevel2(r, (sArrayt *)(e->data), ctx, /*packed=*/false); -call 0 never executed - #####: 1390: break; - -: 1391: case BYTES: - #####: 1392: B = (sBytest *)(e->data); - #####: 1393: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 1394: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); -call 0 never executed - -: 1395: } - -: 1396: else { - -: 1397: // high nibble - #####: 1398: storeTypeInHighNbl(e->data); - #####: 1399: uintToVarint(r, B->count); -call 0 never executed - -: 1400: } - #####: 1401: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - #####: 1402: break; - -: 1403: } - -: 1404: } - -: 1405: } - #####: 1406: ret; - -: 1407:} - -: 1408: - -: 1409:/** - -: 1410: * serialize array - -: 1411: * - -: 1412: * the serialized array is pushed to r. - -: 1413: * All elements are serialized recursively - -: 1414: * - -: 1415: * the data in containers is not serialized - -: 1416: * - -: 1417: * \param - -: 1418: * r small bytes object - -: 1419: * array to serialize - -: 1420: */ + -: 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: */ function arrayNetSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 1421:internal void arrayNetSerialLevel2(sBytest **r, sArrayt *array, contextt *ctx, bool packed) { - #####: 1422: sBytest *B = NULL; - #####: 1423: char *data = NULL; - -: 1424: - -: 1425: // check if all elements have same type - #####: 1426: bool allElementsHaveSameType = true; - #####: 1427: bool foundFirstType = false; - #####: 1428: char type = 0; - -: 1429: - #####: 1430: {forEachSArray(array, e) { + #####: 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) { branch 0 never executed branch 1 never executed - #####: 1431: if (!e) { + #####: 1432: if (!e) { branch 0 never executed branch 1 never executed - #####: 1432: if (foundFirstType) { + #####: 1433: if (foundFirstType) { branch 0 never executed branch 1 never executed - #####: 1433: if (type != S_UNDEFINED) { + #####: 1434: if (type != S_UNDEFINED) { branch 0 never executed branch 1 never executed - #####: 1434: allElementsHaveSameType = false; - #####: 1435: break; - -: 1436: } - -: 1437: } - -: 1438: else { - #####: 1439: type = S_UNDEFINED; - #####: 1440: foundFirstType = true; - -: 1441: } - -: 1442: } - -: 1443: else { - #####: 1444: if (foundFirstType) { + #####: 1435: allElementsHaveSameType = false; + #####: 1436: break; + -: 1437: } + -: 1438: } + -: 1439: else { + #####: 1440: type = S_UNDEFINED; + #####: 1441: foundFirstType = true; + -: 1442: } + -: 1443: } + -: 1444: else { + #####: 1445: if (foundFirstType) { branch 0 never executed branch 1 never executed - -: 1445: u8 nextType; - #####: 1446: switch(e->type) { + -: 1446: u8 nextType; + #####: 1447: switch(e->type) { branch 0 never executed branch 1 never executed branch 2 never executed - -: 1447: case DICT: - #####: 1448: nextType = isDictUniform((sDictt*)e); + -: 1448: case DICT: + #####: 1449: nextType = isDictUniform((sDictt*)e); call 0 never executed - #####: 1449: break; - -: 1450: case ARRAY: - #####: 1451: nextType = isArrayUniform((sArrayt*)e); + #####: 1450: break; + -: 1451: case ARRAY: + #####: 1452: nextType = isArrayUniform((sArrayt*)e); call 0 never executed - #####: 1452: break; - -: 1453: default: - #####: 1454: nextType = NET_SERIAL_TYPES[(u8)e->type]; - -: 1455: } - #####: 1456: if (nextType != type) { + #####: 1453: break; + -: 1454: default: + #####: 1455: nextType = NET_SERIAL_TYPES[(u8)e->type]; + -: 1456: } + #####: 1457: if (nextType != type) { branch 0 never executed branch 1 never executed - #####: 1457: allElementsHaveSameType = false; - #####: 1458: break; - -: 1459: } - -: 1460: } - -: 1461: else { - #####: 1462: switch(e->type) { + #####: 1458: allElementsHaveSameType = false; + #####: 1459: break; + -: 1460: } + -: 1461: } + -: 1462: else { + #####: 1463: switch(e->type) { branch 0 never executed branch 1 never executed branch 2 never executed - -: 1463: case DICT: - #####: 1464: type = isDictUniform((sDictt*)e); + -: 1464: case DICT: + #####: 1465: type = isDictUniform((sDictt*)e); call 0 never executed - #####: 1465: break; - -: 1466: case ARRAY: - #####: 1467: type = isArrayUniform((sArrayt*)e); + #####: 1466: break; + -: 1467: case ARRAY: + #####: 1468: type = isArrayUniform((sArrayt*)e); call 0 never executed - #####: 1468: break; - -: 1469: default: - #####: 1470: type = NET_SERIAL_TYPES[(u8)e->type]; - -: 1471: } - #####: 1472: foundFirstType = true; - -: 1473: } - -: 1474: } - -: 1475: }} - -: 1476: - #####: 1477: if (allElementsHaveSameType) { + #####: 1469: break; + -: 1470: default: + #####: 1471: type = NET_SERIAL_TYPES[(u8)e->type]; + -: 1472: } + #####: 1473: foundFirstType = true; + -: 1474: } + -: 1475: } + -: 1476: }} + -: 1477: + #####: 1478: if (allElementsHaveSameType) { branch 0 never executed branch 1 never executed - -: 1478: // pack array - #####: 1479: if (packed) { + -: 1479: // pack array + #####: 1480: if (packed) { branch 0 never executed branch 1 never executed - #####: 1480: uintToNetTypeVarint(r, type, array->count); + #####: 1481: uintToNetTypeVarint(r, type, array->count); call 0 never executed - -: 1481: } - -: 1482: else { - #####: 1483: if (ctx->nibble == lowNbl) { + -: 1482: } + -: 1483: else { + #####: 1484: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1484: sBytesPush(r, (type << 4) + UNIFORM_ARRAY); + #####: 1485: sBytesPush(r, (type << 4) + UNIFORM_ARRAY); call 0 never executed - #####: 1485: uintToVarint(r, array->count); + #####: 1486: uintToVarint(r, array->count); call 0 never executed - -: 1486: } - -: 1487: else { - -: 1488: // high nibble - #####: 1489: ctx->nibble = lowNbl; - #####: 1490: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 1491: *data |= UNIFORM_ARRAY << 4; - #####: 1492: uintToNetTypeVarint(r, type, array->count); + -: 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); call 0 never executed - -: 1493: } - -: 1494: } - -: 1495: - #####: 1496: switch(type) { + -: 1494: } + -: 1495: } + -: 1496: + #####: 1497: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -2182,142 +2183,142 @@ branch 4 never executed branch 5 never executed branch 6 never executed branch 7 never executed - -: 1497: case S_BOOL: - #####: 1498: {forEachSArray(array, e) { + -: 1498: case S_BOOL: + #####: 1499: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1499: if (!ctx->boolOffset) { + #####: 1500: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 1500: // new packed bools - #####: 1501: storeNew8bPackedBool(e); + -: 1501: // new packed bools + #####: 1502: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1502: } - -: 1503: else { - -: 1504: // there was a bool before this one, fill bits in nibbles - #####: 1505: if (ctx->boolShift == 8) { + -: 1503: } + -: 1504: else { + -: 1505: // there was a bool before this one, fill bits in nibbles + #####: 1506: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1506: // previous packed bool is full - -: 1507: // next byte is the new packed bools - #####: 1508: storeNew8bPackedBool(e); + -: 1507: // previous packed bool is full + -: 1508: // next byte is the new packed bools + #####: 1509: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1509: } - -: 1510: else { - #####: 1511: storeBool(e); + -: 1510: } + -: 1511: else { + #####: 1512: storeBool(e); branch 0 never executed branch 1 never executed - -: 1512: } - -: 1513: } - -: 1514: }} - #####: 1515: break; - -: 1516: case S_DICT: - -: 1517: case UNIFORM_DICT: - #####: 1518: {forEachSArray(array, e) { + -: 1513: } + -: 1514: } + -: 1515: }} + #####: 1516: break; + -: 1517: case S_DICT: + -: 1518: case UNIFORM_DICT: + #####: 1519: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1519: dictNetSerialLevel2(r, (sDictt *)e, ctx, /*packed=*/true); + #####: 1520: dictNetSerialLevel2(r, (sDictt *)e, ctx, /*packed=*/true); call 0 never executed - -: 1520: }} - #####: 1521: break; - -: 1522: case S_DOUBLE: - #####: 1523: {forEachSArray(array, e) { + -: 1521: }} + #####: 1522: break; + -: 1523: case S_DOUBLE: + #####: 1524: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1524: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); + #####: 1525: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); call 0 never executed - -: 1525: }} - #####: 1526: break; - -: 1527: case S_INT: - #####: 1528: {forEachSArray(array, e) { + -: 1526: }} + #####: 1527: break; + -: 1528: case S_INT: + #####: 1529: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1529: i64 v = ((sIntt *)e)->value; - #####: 1530: uintToVarint(r, (v << 1) ^ (v >> 63)); + #####: 1530: i64 v = ((sIntt *)e)->value; + #####: 1531: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 never executed - -: 1531: }} - #####: 1532: break; - -: 1533: case S_STRING: - #####: 1534: {forEachSArray(array, e) { + -: 1532: }} + #####: 1533: break; + -: 1534: case S_STRING: + #####: 1535: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1535: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); + #####: 1536: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); call 0 never executed - -: 1536: }} - #####: 1537: break; - -: 1538: case S_ARRAY: - -: 1539: case UNIFORM_ARRAY: - #####: 1540: {forEachSArray(array, e) { + -: 1537: }} + #####: 1538: break; + -: 1539: case S_ARRAY: + -: 1540: case UNIFORM_ARRAY: + #####: 1541: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1541: arrayNetSerialLevel2(r, (sArrayt *)e, ctx, /*packed=*/true); + #####: 1542: arrayNetSerialLevel2(r, (sArrayt *)e, ctx, /*packed=*/true); call 0 never executed - -: 1542: }} - #####: 1543: break; - -: 1544: case S_BYTES: - #####: 1545: {forEachSArray(array, e) { + -: 1543: }} + #####: 1544: break; + -: 1545: case S_BYTES: + #####: 1546: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1546: B = (sBytest *)e; - #####: 1547: uintToVarint(r, B->count); + #####: 1547: B = (sBytest *)e; + #####: 1548: uintToVarint(r, B->count); call 0 never executed - #####: 1548: sBytesPushBuffer(r, &(B->data), B->count); + #####: 1549: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 1549: }} - #####: 1550: break; - -: 1551: } - #####: 1552: ret; - -: 1553: } - -: 1554: - #####: 1555: if (packed) { + -: 1550: }} + #####: 1551: break; + -: 1552: } + #####: 1553: ret; + -: 1554: } + -: 1555: + #####: 1556: if (packed) { branch 0 never executed branch 1 never executed - #####: 1556: uintToVarint(r, array->count); + #####: 1557: uintToVarint(r, array->count); call 0 never executed - -: 1557: } - -: 1558: else { - #####: 1559: if (ctx->nibble == lowNbl) { + -: 1558: } + -: 1559: else { + #####: 1560: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1560: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); + #####: 1561: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); call 0 never executed - -: 1561: } - -: 1562: else { - -: 1563: // high nibble - #####: 1564: storeTypeInHighNbl(array); - #####: 1565: uintToVarint(r, array->count); + -: 1562: } + -: 1563: else { + -: 1564: // high nibble + #####: 1565: storeTypeInHighNbl(array); + #####: 1566: uintToVarint(r, array->count); call 0 never executed - -: 1566: } - -: 1567: } - -: 1568: - #####: 1569: forEachSArray(array, e) { + -: 1567: } + -: 1568: } + -: 1569: + #####: 1570: forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 1570: if (!e) { + #####: 1571: if (!e) { branch 0 never executed branch 1 never executed - -: 1571: // empty slots are represented as undefined elements - #####: 1572: if (ctx->nibble == lowNbl) { + -: 1572: // empty slots are represented as undefined elements + #####: 1573: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1573: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); + #####: 1574: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); call 0 never executed - #####: 1574: ctx->nibble = highNbl; - #####: 1575: ctx->nblOffset = (*r)->count -1; - -: 1576: } - -: 1577: else { - -: 1578: // high nibble - #####: 1579: ctx->nibble = lowNbl; - #####: 1580: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 1581: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; - -: 1582: } - -: 1583: } - -: 1584: else { - #####: 1585: switch(e->type) { + #####: 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) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -2327,387 +2328,387 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 1586: case UNDEFINED: - -: 1587: case CONTAINER: - #####: 1588: if (ctx->nibble == lowNbl) { + -: 1587: case UNDEFINED: + -: 1588: case CONTAINER: + #####: 1589: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1589: storeTypeOnly(e); + #####: 1590: storeTypeOnly(e); call 0 never executed - -: 1590: } - -: 1591: else { - -: 1592: // high nibble - #####: 1593: storeTypeInHighNbl(e); - -: 1594: } - #####: 1595: break; - -: 1596: case BOOL: - #####: 1597: if (!ctx->boolOffset) { + -: 1591: } + -: 1592: else { + -: 1593: // high nibble + #####: 1594: storeTypeInHighNbl(e); + -: 1595: } + #####: 1596: break; + -: 1597: case BOOL: + #####: 1598: if (!ctx->boolOffset) { branch 0 never executed branch 1 never executed - -: 1598: // new packed bools - #####: 1599: if (ctx->nibble == lowNbl) { + -: 1599: // new packed bools + #####: 1600: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1600: storeNew4bPackedBool(e); + #####: 1601: storeNew4bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1601: } - -: 1602: else { - -: 1603: // high nibble, next byte is packed bools - #####: 1604: storeTypeInHighNbl(e); - #####: 1605: storeNew8bPackedBool(e); + -: 1602: } + -: 1603: else { + -: 1604: // high nibble, next byte is packed bools + #####: 1605: storeTypeInHighNbl(e); + #####: 1606: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1606: } - -: 1607: } - -: 1608: else { - -: 1609: // there was a bool before this one, fill bits in nibbles - #####: 1610: if (ctx->nibble == lowNbl) { + -: 1607: } + -: 1608: } + -: 1609: else { + -: 1610: // there was a bool before this one, fill bits in nibbles + #####: 1611: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1611: if (ctx->boolShift == 8) { + #####: 1612: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1612: // previous packed bool is full - -: 1613: // this byte is the new packed bools - #####: 1614: storeNew4bPackedBool(e); + -: 1613: // previous packed bool is full + -: 1614: // this byte is the new packed bools + #####: 1615: storeNew4bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1615: } - -: 1616: else { - #####: 1617: storeTypeOnly(e); + -: 1616: } + -: 1617: else { + #####: 1618: storeTypeOnly(e); call 0 never executed - #####: 1618: storeBool(e); + #####: 1619: storeBool(e); branch 0 never executed branch 1 never executed - -: 1619: } - -: 1620: } - -: 1621: else { - -: 1622: // high nibble - #####: 1623: storeTypeInHighNbl(e); - #####: 1624: if (ctx->boolShift == 8) { + -: 1620: } + -: 1621: } + -: 1622: else { + -: 1623: // high nibble + #####: 1624: storeTypeInHighNbl(e); + #####: 1625: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - -: 1625: // previous packed bool is full - -: 1626: // next byte is the new packed bools - #####: 1627: storeNew8bPackedBool(e); + -: 1626: // previous packed bool is full + -: 1627: // next byte is the new packed bools + #####: 1628: storeNew8bPackedBool(e); branch 0 never executed branch 1 never executed call 2 never executed - -: 1628: } - -: 1629: else { - #####: 1630: storeBool(e); + -: 1629: } + -: 1630: else { + #####: 1631: storeBool(e); branch 0 never executed branch 1 never executed - -: 1631: } - -: 1632: } - -: 1633: } - #####: 1634: break; - -: 1635: case DICT: - #####: 1636: dictNetSerialLevel2(r, (sDictt *)e, ctx, /*packed=*/false); + -: 1632: } + -: 1633: } + -: 1634: } + #####: 1635: break; + -: 1636: case DICT: + #####: 1637: dictNetSerialLevel2(r, (sDictt *)e, ctx, /*packed=*/false); call 0 never executed - #####: 1637: break; - -: 1638: case DOUBLE: - #####: 1639: if (ctx->nibble == lowNbl) { + #####: 1638: break; + -: 1639: case DOUBLE: + #####: 1640: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1640: storeTypeOnly(e); + #####: 1641: storeTypeOnly(e); call 0 never executed - -: 1641: } - -: 1642: else { - -: 1643: // high nibble - #####: 1644: storeTypeInHighNbl(e); - -: 1645: } - #####: 1646: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); + -: 1642: } + -: 1643: else { + -: 1644: // high nibble + #####: 1645: storeTypeInHighNbl(e); + -: 1646: } + #####: 1647: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); call 0 never executed - #####: 1647: break; - -: 1648: case INT: { - -: 1649: // encode int to varint - -: 1650: // v is int64_t to convert to varint - #####: 1651: i64 v = ((sIntt *)&(e->type))->value; - #####: 1652: if (ctx->nibble == lowNbl) { + #####: 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) { branch 0 never executed branch 1 never executed - -: 1653: // encode v with arithmetic shifts - #####: 1654: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); + -: 1654: // encode v with arithmetic shifts + #####: 1655: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); call 0 never executed - -: 1655: } - -: 1656: else { - -: 1657: // high nibble - #####: 1658: storeTypeInHighNbl(e); - #####: 1659: uintToVarint(r, (v << 1) ^ (v >> 63)); + -: 1656: } + -: 1657: else { + -: 1658: // high nibble + #####: 1659: storeTypeInHighNbl(e); + #####: 1660: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 never executed - -: 1660: } - -: 1661: } - #####: 1662: break; - -: 1663: case STRING: - #####: 1664: if (ctx->nibble == lowNbl) { + -: 1661: } + -: 1662: } + #####: 1663: break; + -: 1664: case STRING: + #####: 1665: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1665: storeTypeOnly(e); + #####: 1666: storeTypeOnly(e); call 0 never executed - -: 1666: } - -: 1667: else { - -: 1668: // high nibble - #####: 1669: storeTypeInHighNbl(e); - -: 1670: } - #####: 1671: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); + -: 1667: } + -: 1668: else { + -: 1669: // high nibble + #####: 1670: storeTypeInHighNbl(e); + -: 1671: } + #####: 1672: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); call 0 never executed - #####: 1672: break; - -: 1673: case ARRAY: - #####: 1674: arrayNetSerialLevel2(r, (sArrayt *)e, ctx, /*packed=*/false); + #####: 1673: break; + -: 1674: case ARRAY: + #####: 1675: arrayNetSerialLevel2(r, (sArrayt *)e, ctx, /*packed=*/false); call 0 never executed - #####: 1675: break; - -: 1676: case BYTES: - #####: 1677: B = (sBytest *)e; - #####: 1678: if (ctx->nibble == lowNbl) { + #####: 1676: break; + -: 1677: case BYTES: + #####: 1678: B = (sBytest *)e; + #####: 1679: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 1679: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); + #####: 1680: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); call 0 never executed - -: 1680: } - -: 1681: else { - -: 1682: // high nibble - #####: 1683: storeTypeInHighNbl(e); - #####: 1684: uintToVarint(r, B->count); + -: 1681: } + -: 1682: else { + -: 1683: // high nibble + #####: 1684: storeTypeInHighNbl(e); + #####: 1685: uintToVarint(r, B->count); call 0 never executed - -: 1685: } - #####: 1686: sBytesPushBuffer(r, &(B->data), B->count); + -: 1686: } + #####: 1687: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - #####: 1687: break; - -: 1688: } - -: 1689: } - -: 1690: } - #####: 1691: ret; - -: 1692:} - -: 1693: + #####: 1688: break; + -: 1689: } + -: 1690: } + -: 1691: } + #####: 1692: ret; + -: 1693:} + -: 1694: function serialNetSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 1694:internal smallBytest* serialNetSerialLevel2(smallJsont *self) { - -: 1695: - #####: 1696: smallt *o = getsoG(self); -call 0 never executed - -: 1697: - #####: 1698: if (o == NULL) -branch 0 never executed -branch 1 never executed - #####: 1699: ret NULL; - -: 1700: - #####: 1701: sBytest *B = netSerialLevel2(o); -call 0 never executed - -: 1702: - #####: 1703: if (!B) { -branch 0 never executed -branch 1 never executed - #####: 1704: ret NULL; - -: 1705: } - -: 1706: - #####: 1707: createAllocateSmallBytes(r); -call 0 never executed - #####: 1708: r->B = B; - #####: 1709: ret r; - -: 1710:} - -: 1711: - -: 1712:// level 3 - -: 1713:// like level 2, elements of identical type in a row are packed - -: 1714: - -: 1715:/** - -: 1716: * serializer top function - -: 1717: */ -function netSerial called 77 returned 100% blocks executed 88% - 77: 1718:internal sBytest* netSerial(smallt *o) { - 77: 1719: sBytest *r = NULL; - 77: 1720: sBytest *B = NULL; - 77: 1721: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; - -: 1722: - 77: 1723: switch(o->type) { + #####: 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) { branch 0 taken 1% branch 1 taken 1% -branch 2 taken 47% +branch 2 taken 46% branch 3 taken 1% -branch 4 taken 1% +branch 4 taken 3% branch 5 taken 1% -branch 6 taken 47% +branch 6 taken 46% branch 7 taken 0% branch 8 taken 0% - -: 1724: case UNDEFINED: - -: 1725: case CONTAINER: - 1: 1726: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 returned 100% - 1: 1727: break; - -: 1728: case BOOL: { - 1: 1729: u8 c = NET_SERIAL_TYPES[(u8)o->type]; - -: 1730: // set bit 4 when true - 1: 1731: if (((sBoolt *)&(o->type))->value) + -: 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) branch 0 taken 100% (fallthrough) branch 1 taken 0% - 1: 1732: c |= (1<<4); - 1: 1733: sBytesPush(&r, c); -call 0 returned 100% - -: 1734: } - 1: 1735: break; - -: 1736: case DICT: - 36: 1737: dictNetSerial(&r, (sDictt *)&(o->type), &ctx, /*packing=*/NOPACKING); -call 0 returned 100% - 36: 1738: break; - -: 1739: case DOUBLE: - 1: 1740: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 returned 100% - 1: 1741: sBytesPushBuffer(&r, &((sDoublet *)&(o->type))->value, sizeof(double)); -call 0 returned 100% - 1: 1742: break; - -: 1743: case INT: { - -: 1744: // encode int to varint - -: 1745: // v is int64_t to convert to varint - 1: 1746: i64 v = ((sIntt *)&(o->type))->value; - -: 1747: // encode v with arithmetic shifts - 1: 1748: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 1749: } - 1: 1750: break; - -: 1751: case STRING: - 1: 1752: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); -call 0 returned 100% - 1: 1753: sBytesPushBuffer(&r, &((sStringt *)&(o->type))->data, sizeof(sStringt) + strlen(&(((sStringt *)&(o->type))->data)) -1); -call 0 returned 100% - 1: 1754: break; - -: 1755: case ARRAY: - 36: 1756: arrayNetSerial(&r, (sArrayt *)&(o->type), &ctx, /*packing=*/NOPACKING); -call 0 returned 100% - 36: 1757: break; - -: 1758: case BYTES: - #####: 1759: B = (sBytest *)&(o->type); - #####: 1760: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count); -call 0 never executed - #####: 1761: sBytesPushBuffer(&r, &(B->data), B->count); -call 0 never executed - #####: 1762: break; - -: 1763: } - 77: 1764: ret r; - -: 1765:} - -: 1766: - -: 1767:/** - -: 1768: * serialize dictionary - -: 1769: * - -: 1770: * the serialized dict is pushed to r. - -: 1771: * All elements are serialized recursively - -: 1772: * - -: 1773: * the data in containers is not serialized - -: 1774: * - -: 1775: * \param - -: 1776: * r small bytes object - -: 1777: * dict dictionary to serialize - -: 1778: */ + 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: */ function dictNetSerial called 79 returned 100% blocks executed 91% - 79: 1779:internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT packing) { - 79: 1780: sBytest *B = NULL; - 79: 1781: char *data = NULL; - -: 1782: - -: 1783: // check if all elements have same type - -: 1784: // then set dict type normal or uniform - -: 1785: // array and dict have to be checked recursively to know if they are normal or uniform - 79: 1786: bool allElementsHaveSameType = true; - 79: 1787: bool foundFirstType = false; - 79: 1788: char type = 0; - -: 1789: // get first element type - -: 1790: // compare to other element type - 200: 1791: {forEachSDict(dict, e) { + 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) { branch 0 taken 79% branch 1 taken 22% (fallthrough) - 157: 1792: if (e->key) { + 157: 1793: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 157: 1793: if (foundFirstType) { + 157: 1794: if (foundFirstType) { branch 0 taken 57% (fallthrough) branch 1 taken 43% - -: 1794: u8 nextType; - 89: 1795: switch(e->data->type) { + -: 1795: u8 nextType; + 89: 1796: switch(e->data->type) { branch 0 taken 17% branch 1 taken 9% branch 2 taken 74% - -: 1796: case DICT: - 15: 1797: nextType = isDictUniform((sDictt*)e->data); -call 0 returned 100% - 15: 1798: break; - -: 1799: case ARRAY: - 8: 1800: nextType = isArrayUniform((sArrayt*)e->data); -call 0 returned 100% - 8: 1801: break; - -: 1802: default: - 66: 1803: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1804: } - 89: 1805: if (nextType != type) { + -: 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) { branch 0 taken 40% (fallthrough) branch 1 taken 60% - 36: 1806: allElementsHaveSameType = false; - 36: 1807: break; - -: 1808: } - -: 1809: } - -: 1810: else { - 68: 1811: switch(e->data->type) { + 36: 1807: allElementsHaveSameType = false; + 36: 1808: break; + -: 1809: } + -: 1810: } + -: 1811: else { + 68: 1812: switch(e->data->type) { branch 0 taken 7% branch 1 taken 4% branch 2 taken 88% - -: 1812: case DICT: - 5: 1813: type = isDictUniform((sDictt*)e->data); -call 0 returned 100% - 5: 1814: break; - -: 1815: case ARRAY: - 3: 1816: type = isArrayUniform((sArrayt*)e->data); -call 0 returned 100% - 3: 1817: break; - -: 1818: default: - 60: 1819: type = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1820: } - 68: 1821: foundFirstType = true; - -: 1822: } - -: 1823: } - -: 1824: }} - -: 1825: - 79: 1826: if (allElementsHaveSameType) { + -: 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) { branch 0 taken 54% (fallthrough) branch 1 taken 46% - -: 1827: // uniform dict - -: 1828: // encode type and element count - -: 1829: - -: 1830: // in pack dictionary - 43: 1831: if (packing == PACKED) { + -: 1828: // uniform dict + -: 1829: // encode type and element count + -: 1830: + -: 1831: // in pack dictionary + 43: 1832: if (packing == PACKED) { branch 0 taken 42% (fallthrough) branch 1 taken 58% - -: 1832: // uniform dict can't be packed - -: 1833: // because there is only one type of packed arrays - 18: 1834: goto normalDict; - -: 1835: } - 25: 1836: elif (packing == UNIFORM) { + -: 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) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - -: 1837: // when the packing is uniform, there is no need to encode UNIFORM_DICT since all elements have this type - 4: 1838: uintToNetTypeVarint(r, type, dict->count); + -: 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); call 0 returned 100% - -: 1839: } - -: 1840: else { - 21: 1841: if (ctx->nibble == lowNbl) { + -: 1840: } + -: 1841: else { + 21: 1842: if (ctx->nibble == lowNbl) { branch 0 taken 90% (fallthrough) branch 1 taken 10% - 19: 1842: sBytesPush(r, (type << 4) + UNIFORM_DICT); -call 0 returned 100% - 19: 1843: uintToVarint(r, dict->count); -call 0 returned 100% - -: 1844: } - -: 1845: else { - -: 1846: // high nibble - 2: 1847: ctx->nibble = lowNbl; - 2: 1848: data = (char *)&((*r)->data) + ctx->nblOffset; - 2: 1849: *data |= UNIFORM_DICT << 4; - 2: 1850: uintToNetTypeVarint(r, type, dict->count); -call 0 returned 100% - -: 1851: } - -: 1852: } - -: 1853: - -: 1854: // encode all element keys and values - 25: 1855: switch(type) { + 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) { branch 0 taken 8% branch 1 taken 16% branch 2 taken 8% @@ -2717,250 +2718,250 @@ branch 5 taken 20% branch 6 taken 8% branch 7 taken 0% branch 8 taken 0% - -: 1856: case S_UNDEFINED: - 8: 1857: {forEachSDict(dict, e) { + -: 1857: case S_UNDEFINED: + 8: 1858: {forEachSDict(dict, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 6: 1858: if (e->key) { + 6: 1859: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 6: 1859: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); -call 0 returned 100% - -: 1860: } - -: 1861: }} - -: 1862: - 2: 1863: break; - -: 1864: case S_BOOL: - 19: 1865: {forEachSDict(dict, e) { + 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) { branch 0 taken 79% branch 1 taken 21% (fallthrough) - 15: 1866: if (e->key) { + 15: 1867: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 15: 1867: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 15: 1868: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - -: 1868: - 15: 1869: if (!ctx->boolOffset) { + -: 1869: + 15: 1870: if (!ctx->boolOffset) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 1870: // new packed bools - 3: 1871: storeNew8bPackedBool(e->data); + -: 1871: // new packed bools + 3: 1872: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 1872: } - -: 1873: else { - -: 1874: // there was a bool before this one, fill bits in nibbles - 12: 1875: if (ctx->boolShift == 8) { + -: 1873: } + -: 1874: else { + -: 1875: // there was a bool before this one, fill bits in nibbles + 12: 1876: if (ctx->boolShift == 8) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - -: 1876: // previous packed bool is full - -: 1877: // next byte is the new packed bools - 1: 1878: storeNew8bPackedBool(e->data); + -: 1877: // previous packed bool is full + -: 1878: // next byte is the new packed bools + 1: 1879: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 1879: } - -: 1880: else { - 11: 1881: storeBool(e->data); + -: 1880: } + -: 1881: else { + 11: 1882: storeBool(e->data); branch 0 taken 91% (fallthrough) branch 1 taken 9% - -: 1882: } - -: 1883: } - -: 1884: } - -: 1885: }} - 4: 1886: break; - -: 1887: case S_DICT: - -: 1888: case UNIFORM_DICT: - 6: 1889: {forEachSDict(dict, e) { + -: 1883: } + -: 1884: } + -: 1885: } + -: 1886: }} + 4: 1887: break; + -: 1888: case S_DICT: + -: 1889: case UNIFORM_DICT: + 6: 1890: {forEachSDict(dict, e) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 4: 1890: if (e->key) { + 4: 1891: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 4: 1891: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 4: 1892: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 4: 1892: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/UNIFORM); + 4: 1893: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 1893: } - -: 1894: }} - 2: 1895: break; - -: 1896: case S_DOUBLE: - 4: 1897: {forEachSDict(dict, e) { + -: 1894: } + -: 1895: }} + 2: 1896: break; + -: 1897: case S_DOUBLE: + 4: 1898: {forEachSDict(dict, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 1898: if (e->key) { + 3: 1899: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 3: 1899: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 3: 1900: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 3: 1900: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); + 3: 1901: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); call 0 returned 100% - -: 1901: } - -: 1902: }} - 1: 1903: break; - -: 1904: case S_INT: - 21: 1905: {forEachSDict(dict, e) { + -: 1902: } + -: 1903: }} + 1: 1904: break; + -: 1905: case S_INT: + 21: 1906: {forEachSDict(dict, e) { branch 0 taken 57% branch 1 taken 43% (fallthrough) - 12: 1906: if (e->key) { + 12: 1907: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 12: 1907: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 12: 1908: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 12: 1908: i64 v = ((sIntt *)(e->data))->value; - 12: 1909: uintToVarint(r, (v << 1) ^ (v >> 63)); + 12: 1909: i64 v = ((sIntt *)(e->data))->value; + 12: 1910: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 returned 100% - -: 1910: } - -: 1911: }} - 9: 1912: break; - -: 1913: case S_STRING: - 16: 1914: {forEachSDict(dict, e) { + -: 1911: } + -: 1912: }} + 9: 1913: break; + -: 1914: case S_STRING: + 16: 1915: {forEachSDict(dict, e) { branch 0 taken 69% branch 1 taken 31% (fallthrough) - 11: 1915: if (e->key) { + 11: 1916: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 11: 1916: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 11: 1917: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 11: 1917: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); + 11: 1918: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); call 0 returned 100% - -: 1918: } - -: 1919: }} - 5: 1920: break; - -: 1921: case S_ARRAY: - -: 1922: case UNIFORM_ARRAY: - 4: 1923: {forEachSDict(dict, e) { + -: 1919: } + -: 1920: }} + 5: 1921: break; + -: 1922: case S_ARRAY: + -: 1923: case UNIFORM_ARRAY: + 4: 1924: {forEachSDict(dict, e) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 2: 1924: if (e->key) { + 2: 1925: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 2: 1925: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 2: 1926: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 2: 1926: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/UNIFORM); + 2: 1927: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 1927: } - -: 1928: }} - 2: 1929: break; - -: 1930: case S_BYTES: - #####: 1931: {forEachSDict(dict, e) { + -: 1928: } + -: 1929: }} + 2: 1930: break; + -: 1931: case S_BYTES: + #####: 1932: {forEachSDict(dict, e) { branch 0 never executed branch 1 never executed - #####: 1932: if (e->key) { + #####: 1933: if (e->key) { branch 0 never executed branch 1 never executed - #####: 1933: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + #####: 1934: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 never executed - #####: 1934: B = (sBytest *)(e->data); - #####: 1935: uintToVarint(r, B->count); + #####: 1935: B = (sBytest *)(e->data); + #####: 1936: uintToVarint(r, B->count); call 0 never executed - #####: 1936: sBytesPushBuffer(r, &(B->data), B->count); + #####: 1937: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 1937: } - -: 1938: }} - #####: 1939: break; - -: 1940: } - 25: 1941: ret; - -: 1942: } - -: 1943: - -: 1944: normalDict: - -: 1945: // encode type and element count - 54: 1946: if (packing == PACKED or packing == UNIFORM) { + -: 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) { branch 0 taken 57% (fallthrough) branch 1 taken 43% branch 2 taken 13% (fallthrough) branch 3 taken 87% - -: 1947: // when the packing is packed or uniform, there is no need to encode DICT type since all elements have this type - 27: 1948: uintToVarint(r, dict->count); + -: 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); call 0 returned 100% - -: 1949: } - -: 1950: else { - 27: 1951: if (ctx->nibble == lowNbl) { + -: 1950: } + -: 1951: else { + 27: 1952: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 25: 1952: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); -call 0 returned 100% - -: 1953: } - -: 1954: else { - -: 1955: // high nibble - -: 1956: #define storeTypeInHighNbl(o)\ - -: 1957: ctx->nibble = lowNbl;\ - -: 1958: data = (char *)&((*r)->data) + ctx->nblOffset;\ - -: 1959: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 - 2: 1960: storeTypeInHighNbl(dict); - 2: 1961: uintToVarint(r, dict->count); -call 0 returned 100% - -: 1962: } - -: 1963: } - -: 1964: - 54: 1965: bool pack = false; - -: 1966: size_t packCount; - 210: 1967: enumerateSDict(dict, e, eIdx) { + 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) { branch 0 taken 74% branch 1 taken 26% (fallthrough) - 156: 1968: if (e->key) { + 156: 1969: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 156: 1969: if (!pack) { + 156: 1970: if (!pack) { branch 0 taken 76% (fallthrough) branch 1 taken 24% - -: 1970: // scan dict for packing - 118: 1971: if ((dict->count - eIdx) > 3) { + -: 1971: // scan dict for packing + 118: 1972: if ((dict->count - eIdx) > 3) { branch 0 taken 35% (fallthrough) branch 1 taken 65% - -: 1972: // at least 4 elements, less than that is not worth it - 41: 1973: if ( e->data->type == DICT + -: 1973: // at least 4 elements, less than that is not worth it + 41: 1974: if ( e->data->type == DICT branch 0 taken 93% (fallthrough) branch 1 taken 7% - 38: 1974: or e->data->type == DOUBLE + 38: 1975: or e->data->type == DOUBLE branch 0 taken 95% (fallthrough) branch 1 taken 5% - 36: 1975: or e->data->type == INT + 36: 1976: or e->data->type == INT branch 0 taken 94% (fallthrough) branch 1 taken 6% - 34: 1976: or e->data->type == STRING + 34: 1977: or e->data->type == STRING branch 0 taken 94% (fallthrough) branch 1 taken 6% - 32: 1977: or e->data->type == ARRAY + 32: 1978: or e->data->type == ARRAY branch 0 taken 94% (fallthrough) branch 1 taken 6% - 30: 1978: or e->data->type == BYTES) { + 30: 1979: or e->data->type == BYTES) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - 11: 1979: type = e->data->type; - 11: 1980: packCount = 1; - 11: 1981: sDictElemt *element = &((dict)->elements) + eIdx +1; - 49: 1982: for (size_t i = eIdx+1; i < (dict)->count ; i++, element = &((dict)->elements) + i) { + 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) { branch 0 taken 100% branch 1 taken 0% (fallthrough) - 49: 1983: if (element->key) { + 49: 1984: if (element->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 49: 1984: if (element->data->type != type) { + 49: 1985: if (element->data->type != type) { branch 0 taken 22% (fallthrough) branch 1 taken 78% - 11: 1985: break; - -: 1986: } - 38: 1987: packCount++; - -: 1988: } // element->key - -: 1989: } // for - 11: 1990: if (packCount > 3) { + 11: 1986: break; + -: 1987: } + 38: 1988: packCount++; + -: 1989: } // element->key + -: 1990: } // for + 11: 1991: if (packCount > 3) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 11: 1991: type = PACKED_NET_SERIAL_TYPES[(u8)type]; - 11: 1992: pack = true; - -: 1993: } - -: 1994: } // test current element type - -: 1995: } // is dict big enough - -: 1996: } // not already packing - -: 1997: - -: 1998: // encode key - 156: 1999: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); -call 0 returned 100% - -: 2000: - -: 2001: // encode value - 156: 2002: switch(e->data->type) { + 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) { branch 0 taken 17% branch 1 taken 20% branch 2 taken 13% @@ -2970,535 +2971,535 @@ branch 5 taken 14% branch 6 taken 8% branch 7 taken 0% branch 8 taken 0% - -: 2003: case UNDEFINED: - -: 2004: case CONTAINER: - 26: 2005: if (ctx->nibble == lowNbl) { + -: 2004: case UNDEFINED: + -: 2005: case CONTAINER: + 26: 2006: if (ctx->nibble == lowNbl) { branch 0 taken 92% (fallthrough) branch 1 taken 8% - -: 2006: #define storeTypeOnly(o)\ - -: 2007: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ - -: 2008: ctx->nibble = highNbl;\ - -: 2009: ctx->nblOffset = (*r)->count -1 - 24: 2010: storeTypeOnly(e->data); -call 0 returned 100% - -: 2011: } - -: 2012: else { - 2: 2013: storeTypeInHighNbl(e->data); - -: 2014: } - 26: 2015: break; - -: 2016: case BOOL: - 31: 2017: if (!ctx->boolOffset) { + -: 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) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - -: 2018: // new packed bools - 5: 2019: if (ctx->nibble == lowNbl) { + -: 2019: // new packed bools + 5: 2020: if (ctx->nibble == lowNbl) { branch 0 taken 60% (fallthrough) branch 1 taken 40% - -: 2020: #define storeNew4bPackedBool(o)\ - -: 2021: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ - -: 2022: /* set bit 4 when true */\ - -: 2023: if (((sBoolt *)(o))->value)\ - -: 2024: c |= (1<<4);\ - -: 2025: sBytesPush(r, c);\ - -: 2026: ctx->boolShift = 5;\ - -: 2027: ctx->boolOffset = (*r)->count -1 - 3: 2028: storeNew4bPackedBool(e->data); + -: 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); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2029: } - -: 2030: else { - -: 2031: // high nibble, next byte is packed bools - 2: 2032: storeTypeInHighNbl(e->data); - -: 2033: #define storeNew8bPackedBool(o)\ - -: 2034: u8 c = 0;\ - -: 2035: if (((sBoolt *)(o))->value)\ - -: 2036: c = 1;\ - -: 2037: sBytesPush(r, c);\ - -: 2038: ctx->boolShift = 1;\ - -: 2039: ctx->boolOffset = (*r)->count -1 - 2: 2040: storeNew8bPackedBool(e->data); + -: 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); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2041: } - -: 2042: } - -: 2043: else { - -: 2044: // there was a bool before this one, fill bits in nibbles - 26: 2045: if (ctx->nibble == lowNbl) { + -: 2042: } + -: 2043: } + -: 2044: else { + -: 2045: // there was a bool before this one, fill bits in nibbles + 26: 2046: if (ctx->nibble == lowNbl) { branch 0 taken 58% (fallthrough) branch 1 taken 42% - 15: 2046: if (ctx->boolShift == 8) { + 15: 2047: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - -: 2047: // previous packed bool is full - -: 2048: // this byte is the new packed bools - 1: 2049: storeNew4bPackedBool(e->data); + -: 2048: // previous packed bool is full + -: 2049: // this byte is the new packed bools + 1: 2050: storeNew4bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2050: } - -: 2051: else { - 14: 2052: storeTypeOnly(e->data); -call 0 returned 100% - -: 2053: #define storeBool(o)\ - -: 2054: data = (char *)&((*r)->data) + ctx->boolOffset;\ - -: 2055: if (((sBoolt *)(o))->value)\ - -: 2056: *data |= 1 << ctx->boolShift;\ - -: 2057: ctx->boolShift++ - 14: 2058: storeBool(e->data); + -: 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); branch 0 taken 100% (fallthrough) branch 1 taken 0% - -: 2059: } - -: 2060: } - -: 2061: else { - -: 2062: // high nibble - 11: 2063: storeTypeInHighNbl(e->data); - 11: 2064: if (ctx->boolShift == 8) { + -: 2060: } + -: 2061: } + -: 2062: else { + -: 2063: // high nibble + 11: 2064: storeTypeInHighNbl(e->data); + 11: 2065: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 2065: // previous packed bool is full - -: 2066: // next byte is the new packed bools - 2: 2067: storeNew8bPackedBool(e->data); + -: 2066: // previous packed bool is full + -: 2067: // next byte is the new packed bools + 2: 2068: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2068: } - -: 2069: else { - 9: 2070: storeBool(e->data); + -: 2069: } + -: 2070: else { + 9: 2071: storeBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% - -: 2071: } - -: 2072: } - -: 2073: } - 31: 2074: break; - -: 2075: case DICT: - 20: 2076: if (pack) { + -: 2072: } + -: 2073: } + -: 2074: } + 31: 2075: break; + -: 2076: case DICT: + 20: 2077: if (pack) { branch 0 taken 75% (fallthrough) branch 1 taken 25% - 15: 2077: if (type) { + 15: 2078: if (type) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2078: // this is the first packed element - 3: 2079: if (ctx->nibble == lowNbl) { + -: 2079: // this is the first packed element + 3: 2080: if (ctx->nibble == lowNbl) { branch 0 taken 67% (fallthrough) branch 1 taken 33% - 2: 2080: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2081: } - -: 2082: else { - -: 2083: // high nibble - -: 2084: // store type in high nibble - 1: 2085: ctx->nibble = lowNbl; - 1: 2086: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2087: *data |= type << 4; - 1: 2088: uintToVarint(r, packCount); -call 0 returned 100% - -: 2089: } - 3: 2090: type = 0; - -: 2091: } // if type - -: 2092: - 15: 2093: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2094: // stop packing when packCount == 0 - 15: 2095: packCount--; - 15: 2096: if (!packCount) pack = false; + 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; branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2097: } // if pack - -: 2098: else - 5: 2099: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/NOPACKING); + -: 2098: } // if pack + -: 2099: else + 5: 2100: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/NOPACKING); call 0 returned 100% - 20: 2100: break; - -: 2101: case DOUBLE: - 12: 2102: if (pack) { + 20: 2101: break; + -: 2102: case DOUBLE: + 12: 2103: if (pack) { branch 0 taken 83% (fallthrough) branch 1 taken 17% - 10: 2103: if (type) { + 10: 2104: if (type) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2104: // this is the first packed element - 2: 2105: if (ctx->nibble == lowNbl) { + -: 2105: // this is the first packed element + 2: 2106: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2106: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2107: } - -: 2108: else { - -: 2109: // high nibble - -: 2110: // store type in high nibble - 1: 2111: ctx->nibble = lowNbl; - 1: 2112: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2113: *data |= type << 4; - 1: 2114: uintToVarint(r, packCount); -call 0 returned 100% - -: 2115: } - 2: 2116: type = 0; - -: 2117: } // if type - -: 2118: - 10: 2119: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 returned 100% - -: 2120: // stop packing when packCount == 0 - 10: 2121: packCount--; - 10: 2122: if (!packCount) pack = false; + 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; branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2123: } // if pack - -: 2124: else { - 2: 2125: if (ctx->nibble == lowNbl) { + -: 2124: } // if pack + -: 2125: else { + 2: 2126: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2126: storeTypeOnly(e->data); -call 0 returned 100% - -: 2127: } - -: 2128: else { - -: 2129: // high nibble - 1: 2130: storeTypeInHighNbl(e->data); - -: 2131: } - 2: 2132: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 returned 100% - -: 2133: } - 12: 2134: break; - -: 2135: case INT: - 32: 2136: if (pack) { + 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) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 2137: if (type) { + 8: 2138: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2138: // this is the first packed element - 2: 2139: if (ctx->nibble == lowNbl) { + -: 2139: // this is the first packed element + 2: 2140: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2140: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2141: } - -: 2142: else { - -: 2143: // high nibble - -: 2144: // store type in high nibble - 1: 2145: ctx->nibble = lowNbl; - 1: 2146: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2147: *data |= type << 4; - 1: 2148: uintToVarint(r, packCount); -call 0 returned 100% - -: 2149: } - 2: 2150: type = 0; - -: 2151: } // if type - -: 2152: - 8: 2153: i64 v = ((sIntt *)(e->data))->value; - 8: 2154: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2155: // stop packing when packCount == 0 - 8: 2156: packCount--; - 8: 2157: if (!packCount) pack = false; + 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; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2158: } // if pack - -: 2159: else { - -: 2160: // encode int to varint - -: 2161: // v is int64_t to convert to varint - 24: 2162: i64 v = ((sIntt *)(e->data))->value; - 24: 2163: if (ctx->nibble == lowNbl) { + -: 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) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - -: 2164: // encode v with arithmetic shifts - 12: 2165: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2166: } - -: 2167: else { - -: 2168: // high nibble - 12: 2169: storeTypeInHighNbl(e->data); - 12: 2170: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2171: } - -: 2172: } - 32: 2173: break; - -: 2174: case STRING: - 22: 2175: if (pack) { + -: 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) { branch 0 taken 36% (fallthrough) branch 1 taken 64% - 8: 2176: if (type) { + 8: 2177: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2177: // this is the first packed element - 2: 2178: if (ctx->nibble == lowNbl) { + -: 2178: // this is the first packed element + 2: 2179: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2179: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2180: } - -: 2181: else { - -: 2182: // high nibble - -: 2183: // store type in high nibble - 1: 2184: ctx->nibble = lowNbl; - 1: 2185: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2186: *data |= type << 4; - 1: 2187: uintToVarint(r, packCount); -call 0 returned 100% - -: 2188: } - 2: 2189: type = 0; - -: 2190: } // if type - -: 2191: - 8: 2192: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 returned 100% - -: 2193: // stop packing when packCount == 0 - 8: 2194: packCount--; - 8: 2195: if (!packCount) pack = false; + 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; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2196: } // if pack - -: 2197: else { - 14: 2198: if (ctx->nibble == lowNbl) { + -: 2197: } // if pack + -: 2198: else { + 14: 2199: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 13: 2199: storeTypeOnly(e->data); -call 0 returned 100% - -: 2200: } - -: 2201: else { - -: 2202: // high nibble - 1: 2203: storeTypeInHighNbl(e->data); - -: 2204: } - 14: 2205: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 returned 100% - -: 2206: } - 22: 2207: break; - -: 2208: case ARRAY: - 13: 2209: if (pack) { + 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) { branch 0 taken 62% (fallthrough) branch 1 taken 38% - 8: 2210: if (type) { + 8: 2211: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2211: // this is the first packed element - 2: 2212: if (ctx->nibble == lowNbl) { + -: 2212: // this is the first packed element + 2: 2213: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2213: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2214: } - -: 2215: else { - -: 2216: // high nibble - -: 2217: // store type in high nibble - 1: 2218: ctx->nibble = lowNbl; - 1: 2219: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2220: *data |= type << 4; - 1: 2221: uintToVarint(r, packCount); -call 0 returned 100% - -: 2222: } - 2: 2223: type = 0; - -: 2224: } // if type - -: 2225: - 8: 2226: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2227: // stop packing when packCount == 0 - 8: 2228: packCount--; - 8: 2229: if (!packCount) pack = false; + 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; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2230: } // if pack - -: 2231: else - 5: 2232: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/NOPACKING); -call 0 returned 100% - 13: 2233: break; - -: 2234: case BYTES: - #####: 2235: if (pack) { -branch 0 never executed -branch 1 never executed - #####: 2236: if (type) { -branch 0 never executed -branch 1 never executed - -: 2237: // this is the first packed element - #####: 2238: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 2239: uintToNetTypeVarint(r, type, packCount); -call 0 never executed - -: 2240: } - -: 2241: else { - -: 2242: // high nibble - -: 2243: // store type in high nibble - #####: 2244: ctx->nibble = lowNbl; - #####: 2245: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 2246: *data |= type << 4; - #####: 2247: uintToVarint(r, packCount); -call 0 never executed - -: 2248: } - #####: 2249: type = 0; - -: 2250: } // if type - -: 2251: - #####: 2252: B = (sBytest *)(e->data); - #####: 2253: uintToVarint(r, B->count); -call 0 never executed - #####: 2254: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - -: 2255: // stop packing when packCount == 0 - #####: 2256: packCount--; - #####: 2257: if (!packCount) pack = false; -branch 0 never executed -branch 1 never executed - -: 2258: } // if pack - -: 2259: else { - #####: 2260: B = (sBytest *)(e->data); - #####: 2261: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 2262: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); -call 0 never executed - -: 2263: } - -: 2264: else { - -: 2265: // high nibble - #####: 2266: storeTypeInHighNbl(e->data); - #####: 2267: uintToVarint(r, B->count); -call 0 never executed - -: 2268: } - #####: 2269: sBytesPushBuffer(r, &(B->data), B->count); -call 0 never executed - -: 2270: } - #####: 2271: break; - -: 2272: } - -: 2273: } - -: 2274: } - 54: 2275: ret; - -: 2276:} - -: 2277: - -: 2278:/** - -: 2279: * serialize array - -: 2280: * - -: 2281: * the serialized array is pushed to r. - -: 2282: * All elements are serialized recursively - -: 2283: * - -: 2284: * the data in containers is not serialized - -: 2285: * - -: 2286: * \param - -: 2287: * r small bytes object - -: 2288: * array to serialize - -: 2289: */ + -: 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: */ function arrayNetSerial called 73 returned 100% blocks executed 86% - 73: 2290:internal void arrayNetSerial(sBytest **r, sArrayt *array, contextt *ctx, packingT packing) { - 73: 2291: sBytest *B = NULL; - 73: 2292: char *data = NULL; - -: 2293: - -: 2294: // check if all elements have same type - -: 2295: // then set array type normal or uniform - -: 2296: // array and dict have to be checked recursively to know if they are normal or uniform - 73: 2297: bool allElementsHaveSameType = true; - 73: 2298: bool foundFirstType = false; - 73: 2299: char type = 0; - -: 2300: - -: 2301: // get first element type - -: 2302: // compare to other element type - -: 2303: // null element are interpreted as undefined - 217: 2304: {forEachSArray(array, e) { + 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) { branch 0 taken 82% branch 1 taken 18% (fallthrough) - 177: 2305: if (!e) { + 177: 2306: if (!e) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2306: if (foundFirstType) { + #####: 2307: if (foundFirstType) { branch 0 never executed branch 1 never executed - #####: 2307: if (type != S_UNDEFINED) { + #####: 2308: if (type != S_UNDEFINED) { branch 0 never executed branch 1 never executed - #####: 2308: allElementsHaveSameType = false; - #####: 2309: break; - -: 2310: } - -: 2311: } - -: 2312: else { - #####: 2313: type = S_UNDEFINED; - #####: 2314: foundFirstType = true; - -: 2315: } - -: 2316: } - -: 2317: else { - 177: 2318: if (foundFirstType) { + #####: 2309: allElementsHaveSameType = false; + #####: 2310: break; + -: 2311: } + -: 2312: } + -: 2313: else { + #####: 2314: type = S_UNDEFINED; + #####: 2315: foundFirstType = true; + -: 2316: } + -: 2317: } + -: 2318: else { + 177: 2319: if (foundFirstType) { branch 0 taken 61% (fallthrough) branch 1 taken 39% - -: 2319: u8 nextType; - 108: 2320: switch(e->type) { + -: 2320: u8 nextType; + 108: 2321: switch(e->type) { branch 0 taken 6% branch 1 taken 10% branch 2 taken 83% - -: 2321: case DICT: - 7: 2322: nextType = isDictUniform((sDictt*)e); -call 0 returned 100% - 7: 2323: break; - -: 2324: case ARRAY: - 11: 2325: nextType = isArrayUniform((sArrayt*)e); -call 0 returned 100% - 11: 2326: break; - -: 2327: default: - 90: 2328: nextType = NET_SERIAL_TYPES[(u8)e->type]; - -: 2329: } - 108: 2330: if (nextType != type) { + -: 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) { branch 0 taken 31% (fallthrough) branch 1 taken 69% - 33: 2331: allElementsHaveSameType = false; - 33: 2332: break; - -: 2333: } - -: 2334: } - -: 2335: else { - 69: 2336: switch(e->type) { + 33: 2332: allElementsHaveSameType = false; + 33: 2333: break; + -: 2334: } + -: 2335: } + -: 2336: else { + 69: 2337: switch(e->type) { branch 0 taken 7% branch 1 taken 9% branch 2 taken 84% - -: 2337: case DICT: - 5: 2338: type = isDictUniform((sDictt*)e); -call 0 returned 100% - 5: 2339: break; - -: 2340: case ARRAY: - 6: 2341: type = isArrayUniform((sArrayt*)e); -call 0 returned 100% - 6: 2342: break; - -: 2343: default: - 58: 2344: type = NET_SERIAL_TYPES[(u8)e->type]; - -: 2345: } - 69: 2346: foundFirstType = true; - -: 2347: } - -: 2348: } - -: 2349: }} - -: 2350: - 73: 2351: if (allElementsHaveSameType) { + -: 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) { branch 0 taken 55% (fallthrough) branch 1 taken 45% - -: 2352: // uniform array - -: 2353: // encode type and element count - -: 2354: - -: 2355: // in pack array - 40: 2356: if (packing == PACKED) { + -: 2353: // uniform array + -: 2354: // encode type and element count + -: 2355: + -: 2356: // in pack array + 40: 2357: if (packing == PACKED) { branch 0 taken 40% (fallthrough) branch 1 taken 60% - -: 2357: // uniform array can't be packed - -: 2358: // because there is only one type of packed arrays - 16: 2359: goto normalArray; - -: 2360: } - 24: 2361: elif (packing == UNIFORM) { + -: 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) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - -: 2362: // when the packing is uniform, there is no need to encode UNIFORM_ARRAY since all elements have this type - 2: 2363: uintToNetTypeVarint(r, type, array->count); + -: 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); call 0 returned 100% - -: 2364: } - -: 2365: else { - 22: 2366: if (ctx->nibble == lowNbl) { + -: 2365: } + -: 2366: else { + 22: 2367: if (ctx->nibble == lowNbl) { branch 0 taken 77% (fallthrough) branch 1 taken 23% - 17: 2367: sBytesPush(r, (type << 4) + UNIFORM_ARRAY); -call 0 returned 100% - 17: 2368: uintToVarint(r, array->count); -call 0 returned 100% - -: 2369: } - -: 2370: else { - -: 2371: // high nibble - 5: 2372: ctx->nibble = lowNbl; - 5: 2373: data = (char *)&((*r)->data) + ctx->nblOffset; - 5: 2374: *data |= UNIFORM_ARRAY << 4; - 5: 2375: uintToNetTypeVarint(r, type, array->count); -call 0 returned 100% - -: 2376: } - -: 2377: } - -: 2378: - -: 2379: // encode all element values - 24: 2380: switch(type) { + 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) { branch 0 taken 8% branch 1 taken 8% branch 2 taken 4% @@ -3507,207 +3508,207 @@ branch 4 taken 4% branch 5 taken 17% branch 6 taken 0% branch 7 taken 13% - -: 2381: case S_BOOL: - 16: 2382: {forEachSArray(array, e) { + -: 2382: case S_BOOL: + 16: 2383: {forEachSArray(array, e) { branch 0 taken 88% branch 1 taken 13% (fallthrough) - 14: 2383: if (!ctx->boolOffset) { + 14: 2384: if (!ctx->boolOffset) { branch 0 taken 14% (fallthrough) branch 1 taken 86% - -: 2384: // new packed bools - 2: 2385: storeNew8bPackedBool(e); + -: 2385: // new packed bools + 2: 2386: storeNew8bPackedBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2386: } - -: 2387: else { - -: 2388: // there was a bool before this one, fill bits in nibbles - 12: 2389: if (ctx->boolShift == 8) { + -: 2387: } + -: 2388: else { + -: 2389: // there was a bool before this one, fill bits in nibbles + 12: 2390: if (ctx->boolShift == 8) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - -: 2390: // previous packed bool is full - -: 2391: // next byte is the new packed bools - 1: 2392: storeNew8bPackedBool(e); + -: 2391: // previous packed bool is full + -: 2392: // next byte is the new packed bools + 1: 2393: storeNew8bPackedBool(e); branch 0 taken 0% (fallthrough) branch 1 taken 100% call 2 returned 100% - -: 2393: } - -: 2394: else { - 11: 2395: storeBool(e); + -: 2394: } + -: 2395: else { + 11: 2396: storeBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% - -: 2396: } - -: 2397: } - -: 2398: }} - 2: 2399: break; - -: 2400: case S_DICT: - -: 2401: case UNIFORM_DICT: - 6: 2402: {forEachSArray(array, e) { + -: 2397: } + -: 2398: } + -: 2399: }} + 2: 2400: break; + -: 2401: case S_DICT: + -: 2402: case UNIFORM_DICT: + 6: 2403: {forEachSArray(array, e) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 4: 2403: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/UNIFORM); + 4: 2404: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 2404: }} - 2: 2405: break; - -: 2406: case S_DOUBLE: - 4: 2407: {forEachSArray(array, e) { + -: 2405: }} + 2: 2406: break; + -: 2407: case S_DOUBLE: + 4: 2408: {forEachSArray(array, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 2408: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); + 3: 2409: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); call 0 returned 100% - -: 2409: }} - 1: 2410: break; - -: 2411: case S_INT: - 49: 2412: {forEachSArray(array, e) { + -: 2410: }} + 1: 2411: break; + -: 2412: case S_INT: + 49: 2413: {forEachSArray(array, e) { branch 0 taken 78% branch 1 taken 22% (fallthrough) - 38: 2413: i64 v = ((sIntt *)e)->value; - 38: 2414: uintToVarint(r, (v << 1) ^ (v >> 63)); + 38: 2414: i64 v = ((sIntt *)e)->value; + 38: 2415: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 returned 100% - -: 2415: }} - 11: 2416: break; - -: 2417: case S_STRING: - 4: 2418: {forEachSArray(array, e) { + -: 2416: }} + 11: 2417: break; + -: 2418: case S_STRING: + 4: 2419: {forEachSArray(array, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 2419: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); + 3: 2420: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); call 0 returned 100% - -: 2420: }} - 1: 2421: break; - -: 2422: case S_ARRAY: - -: 2423: case UNIFORM_ARRAY: - 10: 2424: {forEachSArray(array, e) { + -: 2421: }} + 1: 2422: break; + -: 2423: case S_ARRAY: + -: 2424: case UNIFORM_ARRAY: + 10: 2425: {forEachSArray(array, e) { branch 0 taken 60% branch 1 taken 40% (fallthrough) - 6: 2425: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/UNIFORM); + 6: 2426: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 2426: }} - 4: 2427: break; - -: 2428: case S_BYTES: - #####: 2429: {forEachSArray(array, e) { + -: 2427: }} + 4: 2428: break; + -: 2429: case S_BYTES: + #####: 2430: {forEachSArray(array, e) { branch 0 never executed branch 1 never executed - #####: 2430: B = (sBytest *)e; - #####: 2431: uintToVarint(r, B->count); + #####: 2431: B = (sBytest *)e; + #####: 2432: uintToVarint(r, B->count); call 0 never executed - #####: 2432: sBytesPushBuffer(r, &(B->data), B->count); + #####: 2433: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 2433: }} - #####: 2434: break; - -: 2435: } - 24: 2436: ret; - -: 2437: } - -: 2438: - -: 2439: normalArray: - -: 2440: // encode type and element count - 49: 2441: if (packing == PACKED or packing == UNIFORM) { + -: 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) { branch 0 taken 67% (fallthrough) branch 1 taken 33% branch 2 taken 18% (fallthrough) branch 3 taken 82% - -: 2442: // when the packing is packed or uniform, there is no need to encode ARRAY type since all elements have this type - 22: 2443: uintToVarint(r, array->count); + -: 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); call 0 returned 100% - -: 2444: } - -: 2445: else { - 27: 2446: if (ctx->nibble == lowNbl) { + -: 2445: } + -: 2446: else { + 27: 2447: if (ctx->nibble == lowNbl) { branch 0 taken 96% (fallthrough) branch 1 taken 4% - 26: 2447: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); -call 0 returned 100% - -: 2448: } - -: 2449: else { - -: 2450: // high nibble - 1: 2451: storeTypeInHighNbl(array); - 1: 2452: uintToVarint(r, array->count); -call 0 returned 100% - -: 2453: } - -: 2454: } - -: 2455: - 49: 2456: bool pack = false; - -: 2457: size_t packCount; - 203: 2458: enumerateSArray(array, e, eIdx) { + 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) { branch 0 taken 76% branch 1 taken 24% (fallthrough) - 154: 2459: if (!e) { + 154: 2460: if (!e) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 2460: // empty slots are represented as undefined elements - #####: 2461: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 2462: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); -call 0 never executed - #####: 2463: ctx->nibble = highNbl; - #####: 2464: ctx->nblOffset = (*r)->count -1; - -: 2465: } - -: 2466: else { - -: 2467: // high nibble - #####: 2468: ctx->nibble = lowNbl; - #####: 2469: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 2470: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; - -: 2471: } - -: 2472: } - -: 2473: else { - 154: 2474: if (!pack) { + -: 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) { branch 0 taken 81% (fallthrough) branch 1 taken 19% - -: 2475: // scan array for packing - 124: 2476: if ((array->count - eIdx) > 3) { + -: 2476: // scan array for packing + 124: 2477: if ((array->count - eIdx) > 3) { branch 0 taken 32% (fallthrough) branch 1 taken 68% - -: 2477: // at least 4 elements, less than that is not worth it - 40: 2478: if ( e->type == DICT + -: 2478: // at least 4 elements, less than that is not worth it + 40: 2479: if ( e->type == DICT branch 0 taken 90% (fallthrough) branch 1 taken 10% - 36: 2479: or e->type == DOUBLE + 36: 2480: or e->type == DOUBLE branch 0 taken 94% (fallthrough) branch 1 taken 6% - 34: 2480: or e->type == INT + 34: 2481: or e->type == INT branch 0 taken 91% (fallthrough) branch 1 taken 9% - 31: 2481: or e->type == STRING + 31: 2482: or e->type == STRING branch 0 taken 94% (fallthrough) branch 1 taken 6% - 29: 2482: or e->type == ARRAY + 29: 2483: or e->type == ARRAY branch 0 taken 93% (fallthrough) branch 1 taken 7% - 27: 2483: or e->type == BYTES) { + 27: 2484: or e->type == BYTES) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - 13: 2484: type = e->type; - 13: 2485: packCount = 1; - 13: 2486: smallt *element = ((smallt **) &((array)->data))[eIdx+1]; - 45: 2487: for (size_t i = eIdx+1; i < (array)->count ; i++, element = ((smallt **) &((array)->data))[i]) { + 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]) { branch 0 taken 100% branch 1 taken 0% (fallthrough) - 45: 2488: if (!element) { + 45: 2489: if (!element) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 2489: // null element are undefined - #####: 2490: break; - -: 2491: } - -: 2492: else { - 45: 2493: if (element->type != type) { + -: 2490: // null element are undefined + #####: 2491: break; + -: 2492: } + -: 2493: else { + 45: 2494: if (element->type != type) { branch 0 taken 29% (fallthrough) branch 1 taken 71% - 13: 2494: break; - -: 2495: } - 32: 2496: packCount++; - -: 2497: } // if element - -: 2498: } // for - 13: 2499: if (packCount > 3) { + 13: 2495: break; + -: 2496: } + 32: 2497: packCount++; + -: 2498: } // if element + -: 2499: } // for + 13: 2500: if (packCount > 3) { branch 0 taken 77% (fallthrough) branch 1 taken 23% - 10: 2500: type = PACKED_NET_SERIAL_TYPES[(u8)type]; - 10: 2501: pack = true; - -: 2502: } - -: 2503: } // test current element type - -: 2504: } // is array big enough - -: 2505: } // not already packing - -: 2506: - -: 2507: // encode element value - 154: 2508: switch(e->type) { + 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) { branch 0 taken 18% branch 1 taken 22% branch 2 taken 10% @@ -3717,419 +3718,419 @@ branch 5 taken 14% branch 6 taken 10% branch 7 taken 0% branch 8 taken 0% - -: 2509: case UNDEFINED: - -: 2510: case CONTAINER: - 28: 2511: if (ctx->nibble == lowNbl) { + -: 2510: case UNDEFINED: + -: 2511: case CONTAINER: + 28: 2512: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 26: 2512: storeTypeOnly(e); -call 0 returned 100% - -: 2513: } - -: 2514: else { - -: 2515: // high nibble - 2: 2516: storeTypeInHighNbl(e); - -: 2517: } - 28: 2518: break; - -: 2519: case BOOL: - 34: 2520: if (!ctx->boolOffset) { + 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) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 2521: // new packed bools - 6: 2522: if (ctx->nibble == lowNbl) { + -: 2522: // new packed bools + 6: 2523: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 3: 2523: storeNew4bPackedBool(e); + 3: 2524: storeNew4bPackedBool(e); branch 0 taken 67% (fallthrough) branch 1 taken 33% call 2 returned 100% - -: 2524: } - -: 2525: else { - -: 2526: // high nibble, next byte is packed bools - 3: 2527: storeTypeInHighNbl(e); - 3: 2528: storeNew8bPackedBool(e); + -: 2525: } + -: 2526: else { + -: 2527: // high nibble, next byte is packed bools + 3: 2528: storeTypeInHighNbl(e); + 3: 2529: storeNew8bPackedBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2529: } - -: 2530: } - -: 2531: else { - -: 2532: // there was a bool before this one, fill bits in nibbles - 28: 2533: if (ctx->nibble == lowNbl) { + -: 2530: } + -: 2531: } + -: 2532: else { + -: 2533: // there was a bool before this one, fill bits in nibbles + 28: 2534: if (ctx->nibble == lowNbl) { branch 0 taken 61% (fallthrough) branch 1 taken 39% - 17: 2534: if (ctx->boolShift == 8) { + 17: 2535: if (ctx->boolShift == 8) { branch 0 taken 12% (fallthrough) branch 1 taken 88% - -: 2535: // previous packed bool is full - -: 2536: // this byte is the new packed bools - 2: 2537: storeNew4bPackedBool(e); + -: 2536: // previous packed bool is full + -: 2537: // this byte is the new packed bools + 2: 2538: storeNew4bPackedBool(e); branch 0 taken 50% (fallthrough) branch 1 taken 50% call 2 returned 100% - -: 2538: } - -: 2539: else { - 15: 2540: storeTypeOnly(e); + -: 2539: } + -: 2540: else { + 15: 2541: storeTypeOnly(e); call 0 returned 100% - 15: 2541: storeBool(e); + 15: 2542: storeBool(e); branch 0 taken 53% (fallthrough) branch 1 taken 47% - -: 2542: } - -: 2543: } - -: 2544: else { - -: 2545: // high nibble - 11: 2546: storeTypeInHighNbl(e); - 11: 2547: if (ctx->boolShift == 8) { + -: 2543: } + -: 2544: } + -: 2545: else { + -: 2546: // high nibble + 11: 2547: storeTypeInHighNbl(e); + 11: 2548: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 2548: // previous packed bool is full - -: 2549: // next byte is the new packed bools - 2: 2550: storeNew8bPackedBool(e); + -: 2549: // previous packed bool is full + -: 2550: // next byte is the new packed bools + 2: 2551: storeNew8bPackedBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2551: } - -: 2552: else { - 9: 2553: storeBool(e); + -: 2552: } + -: 2553: else { + 9: 2554: storeBool(e); branch 0 taken 78% (fallthrough) branch 1 taken 22% - -: 2554: } - -: 2555: } - -: 2556: } - 34: 2557: break; - -: 2558: case DICT: - 15: 2559: if (pack) { + -: 2555: } + -: 2556: } + -: 2557: } + 34: 2558: break; + -: 2559: case DICT: + 15: 2560: if (pack) { branch 0 taken 53% (fallthrough) branch 1 taken 47% - 8: 2560: if (type) { + 8: 2561: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2561: // this is the first packed element - 2: 2562: if (ctx->nibble == lowNbl) { + -: 2562: // this is the first packed element + 2: 2563: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2563: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2564: } - -: 2565: else { - -: 2566: // high nibble - -: 2567: // store type in high nibble - 1: 2568: ctx->nibble = lowNbl; - 1: 2569: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2570: *data |= type << 4; - 1: 2571: uintToVarint(r, packCount); -call 0 returned 100% - -: 2572: } - 2: 2573: type = 0; - -: 2574: } // if type - -: 2575: - 8: 2576: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2577: // stop packing when packCount == 0 - 8: 2578: packCount--; - 8: 2579: if (!packCount) pack = false; + 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; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2580: } // if pack - -: 2581: else - 7: 2582: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/NOPACKING); + -: 2581: } // if pack + -: 2582: else + 7: 2583: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/NOPACKING); call 0 returned 100% - 15: 2583: break; - -: 2584: case DOUBLE: - 10: 2585: if (pack) { + 15: 2584: break; + -: 2585: case DOUBLE: + 10: 2586: if (pack) { branch 0 taken 80% (fallthrough) branch 1 taken 20% - 8: 2586: if (type) { + 8: 2587: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2587: // this is the first packed element - 2: 2588: if (ctx->nibble == lowNbl) { + -: 2588: // this is the first packed element + 2: 2589: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2589: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2590: } - -: 2591: else { - -: 2592: // high nibble - -: 2593: // store type in high nibble - 1: 2594: ctx->nibble = lowNbl; - 1: 2595: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2596: *data |= type << 4; - 1: 2597: uintToVarint(r, packCount); -call 0 returned 100% - -: 2598: } - 2: 2599: type = 0; - -: 2600: } // if type - -: 2601: - 8: 2602: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); -call 0 returned 100% - -: 2603: // stop packing when packCount == 0 - 8: 2604: packCount--; - 8: 2605: if (!packCount) pack = false; + 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; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2606: } // if pack - -: 2607: else { - 2: 2608: if (ctx->nibble == lowNbl) { + -: 2607: } // if pack + -: 2608: else { + 2: 2609: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2609: storeTypeOnly(e); -call 0 returned 100% - -: 2610: } - -: 2611: else { - -: 2612: // high nibble - 1: 2613: storeTypeInHighNbl(e); - -: 2614: } - 2: 2615: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); -call 0 returned 100% - -: 2616: } - 10: 2617: break; - -: 2618: case INT: - 30: 2619: if (pack) { + 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) { branch 0 taken 27% (fallthrough) branch 1 taken 73% - 8: 2620: if (type) { + 8: 2621: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2621: // this is the first packed element - 2: 2622: if (ctx->nibble == lowNbl) { + -: 2622: // this is the first packed element + 2: 2623: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2623: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2624: } - -: 2625: else { - -: 2626: // high nibble - -: 2627: // store type in high nibble - 1: 2628: ctx->nibble = lowNbl; - 1: 2629: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2630: *data |= type << 4; - 1: 2631: uintToVarint(r, packCount); -call 0 returned 100% - -: 2632: } - 2: 2633: type = 0; - -: 2634: } // if type - -: 2635: - 8: 2636: i64 v = ((sIntt *)&(e->type))->value; - 8: 2637: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2638: // stop packing when packCount == 0 - 8: 2639: packCount--; - 8: 2640: if (!packCount) pack = false; + 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; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2641: } // if pack - -: 2642: else { - -: 2643: // encode int to varint - -: 2644: // v is int64_t to convert to varint - 22: 2645: i64 v = ((sIntt *)&(e->type))->value; - 22: 2646: if (ctx->nibble == lowNbl) { + -: 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) { branch 0 taken 82% (fallthrough) branch 1 taken 18% - -: 2647: // encode v with arithmetic shifts - 18: 2648: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2649: } - -: 2650: else { - -: 2651: // high nibble - 4: 2652: storeTypeInHighNbl(e); - 4: 2653: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2654: } - -: 2655: } - 30: 2656: break; - -: 2657: case STRING: - 21: 2658: if (pack) { + -: 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) { branch 0 taken 38% (fallthrough) branch 1 taken 62% - 8: 2659: if (type) { + 8: 2660: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2660: // this is the first packed element - 2: 2661: if (ctx->nibble == lowNbl) { + -: 2661: // this is the first packed element + 2: 2662: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2662: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2663: } - -: 2664: else { - -: 2665: // high nibble - -: 2666: // store type in high nibble - 1: 2667: ctx->nibble = lowNbl; - 1: 2668: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2669: *data |= type << 4; - 1: 2670: uintToVarint(r, packCount); -call 0 returned 100% - -: 2671: } - 2: 2672: type = 0; - -: 2673: } // if type - -: 2674: - 8: 2675: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); -call 0 returned 100% - -: 2676: // stop packing when packCount == 0 - 8: 2677: packCount--; - 8: 2678: if (!packCount) pack = false; + 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; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2679: } // if pack - -: 2680: else { - 13: 2681: if (ctx->nibble == lowNbl) { + -: 2680: } // if pack + -: 2681: else { + 13: 2682: if (ctx->nibble == lowNbl) { branch 0 taken 69% (fallthrough) branch 1 taken 31% - 9: 2682: storeTypeOnly(e); -call 0 returned 100% - -: 2683: } - -: 2684: else { - -: 2685: // high nibble - 4: 2686: storeTypeInHighNbl(e); - -: 2687: } - 13: 2688: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); -call 0 returned 100% - -: 2689: } - 21: 2690: break; - -: 2691: case ARRAY: - 16: 2692: if (pack) { + 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) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 8: 2693: if (type) { + 8: 2694: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2694: // this is the first packed element - 2: 2695: if (ctx->nibble == lowNbl) { + -: 2695: // this is the first packed element + 2: 2696: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2696: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2697: } - -: 2698: else { - -: 2699: // high nibble - -: 2700: // store type in high nibble - 1: 2701: ctx->nibble = lowNbl; - 1: 2702: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2703: *data |= type << 4; - 1: 2704: uintToVarint(r, packCount); -call 0 returned 100% - -: 2705: } - 2: 2706: type = 0; - -: 2707: } // if type - -: 2708: - 8: 2709: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2710: // stop packing when packCount == 0 - 8: 2711: packCount--; - 8: 2712: if (!packCount) pack = false; + 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; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2713: } // if pack - -: 2714: else - 8: 2715: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/NOPACKING); + -: 2714: } // if pack + -: 2715: else + 8: 2716: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/NOPACKING); call 0 returned 100% - 16: 2716: break; - -: 2717: case BYTES: - #####: 2718: if (pack) { + 16: 2717: break; + -: 2718: case BYTES: + #####: 2719: if (pack) { branch 0 never executed branch 1 never executed - #####: 2719: if (type) { + #####: 2720: if (type) { branch 0 never executed branch 1 never executed - -: 2720: // this is the first packed element - #####: 2721: if (ctx->nibble == lowNbl) { + -: 2721: // this is the first packed element + #####: 2722: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 2722: uintToNetTypeVarint(r, type, packCount); + #####: 2723: uintToNetTypeVarint(r, type, packCount); call 0 never executed - -: 2723: } - -: 2724: else { - -: 2725: // high nibble - -: 2726: // store type in high nibble - #####: 2727: ctx->nibble = lowNbl; - #####: 2728: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 2729: *data |= type << 4; - #####: 2730: uintToVarint(r, packCount); + -: 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); call 0 never executed - -: 2731: } - #####: 2732: type = 0; - -: 2733: } // if type - -: 2734: - #####: 2735: B = (sBytest *)e; - #####: 2736: uintToVarint(r, B->count); + -: 2732: } + #####: 2733: type = 0; + -: 2734: } // if type + -: 2735: + #####: 2736: B = (sBytest *)e; + #####: 2737: uintToVarint(r, B->count); call 0 never executed - #####: 2737: sBytesPushBuffer(r, &(B->data), B->count); + #####: 2738: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 2738: // stop packing when packCount == 0 - #####: 2739: packCount--; - #####: 2740: if (!packCount) pack = false; + -: 2739: // stop packing when packCount == 0 + #####: 2740: packCount--; + #####: 2741: if (!packCount) pack = false; branch 0 never executed branch 1 never executed - -: 2741: } // if pack - -: 2742: else { - #####: 2743: B = (sBytest *)e; - #####: 2744: if (ctx->nibble == lowNbl) { + -: 2742: } // if pack + -: 2743: else { + #####: 2744: B = (sBytest *)e; + #####: 2745: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 2745: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); + #####: 2746: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); call 0 never executed - -: 2746: } - -: 2747: else { - -: 2748: // high nibble - #####: 2749: storeTypeInHighNbl(e); - #####: 2750: uintToVarint(r, B->count); + -: 2747: } + -: 2748: else { + -: 2749: // high nibble + #####: 2750: storeTypeInHighNbl(e); + #####: 2751: uintToVarint(r, B->count); call 0 never executed - -: 2751: } - #####: 2752: sBytesPushBuffer(r, &(B->data), B->count); + -: 2752: } + #####: 2753: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 2753: } - #####: 2754: break; - -: 2755: } - -: 2756: } - -: 2757: } - 49: 2758: ret; - -: 2759:} - -: 2760: -function serialNetSerial called 77 returned 100% blocks executed 80% - 77: 2761:internal smallBytest* serialNetSerial(smallJsont *self) { - -: 2762: - 77: 2763: smallt *o = getsoG(self); + -: 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); call 0 returned 100% - -: 2764: - 77: 2765: if (o == NULL) + -: 2765: + 78: 2766: if (o == NULL) branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2766: ret NULL; - -: 2767: - 77: 2768: sBytest *B = netSerial(o); + #####: 2767: ret NULL; + -: 2768: + 78: 2769: sBytest *B = netSerial(o); call 0 returned 100% - -: 2769: - 77: 2770: if (!B) { + -: 2770: + 78: 2771: if (!B) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2771: ret NULL; - -: 2772: } - -: 2773: - 77: 2774: createAllocateSmallBytes(r); -call 0 returned 100% - 77: 2775: r->B = B; - 77: 2776: ret r; - -: 2777:} - -: 2778: - -: 2779:// ------------------------------------- - -: 2780:// Deserializers - -: 2781: - -: 2782:// level 0 - -: 2783:// like smallJson with ints and length encoded as varints - -: 2784: - -: 2785:/** - -: 2786: * deserializer top function - -: 2787: */ + #####: 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: */ function netDeserialLevel0 called 0 returned 0% blocks executed 0% - #####: 2788:internal smallt* netDeserialLevel0(sBytest *obj) { - #####: 2789: smallt *r = NULL; - #####: 2790: double *D = NULL; - #####: 2791: char *s = NULL; - #####: 2792: sBytest *B = NULL; - -: 2793: uint32_t count; - #####: 2794: char *data = NULL; - -: 2795: - #####: 2796: switch(obj->data & 0xF) { + #####: 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) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4139,103 +4140,103 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 2797: case S_UNDEFINED: - #####: 2798: r = (smallt *) allocSUndefined(); -call 0 never executed - #####: 2799: break; - -: 2800: case S_BOOL: - #####: 2801: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 never executed - #####: 2802: break; - -: 2803: case S_DICT: - #####: 2804: data = (char *)&(obj->data); - #####: 2805: dictNetDeserialLevel0((sDictt **)&r, &data); -call 0 never executed - #####: 2806: break; - -: 2807: case S_DOUBLE: - #####: 2808: data = &(obj->data)+1; - #####: 2809: D = (double *)data; - #####: 2810: r = (smallt *) allocSDouble(*D); -call 0 never executed - #####: 2811: break; - -: 2812: case S_INT: - #####: 2813: data = &(obj->data); - #####: 2814: i64 v = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 2815: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 2816: r = (smallt *) allocSInt(v); -call 0 never executed - #####: 2817: break; - -: 2818: case S_STRING: - #####: 2819: s = (char *)&(obj->data)+1; - #####: 2820: r = (smallt *) allocSStringTiny(s); -call 0 never executed - #####: 2821: break; - -: 2822: case S_ARRAY: - #####: 2823: data = (char *)&(obj->data); - #####: 2824: arrayNetDeserialLevel0((sArrayt **)&r, &data); -call 0 never executed - #####: 2825: break; - -: 2826: case S_BYTES: - #####: 2827: B = allocSBytes(); -call 0 never executed - #####: 2828: data = &(obj->data); - #####: 2829: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 2830: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 2831: r = (smallt *)B; - #####: 2832: break; - -: 2833: } - -: 2834: - #####: 2835: ret r; - -: 2836:} - -: 2837: - -: 2838:/** - -: 2839: * deserialize dictionary from data - -: 2840: * - -: 2841: * a new dictionary is allocated - -: 2842: * - -: 2843: * \param - -: 2844: * dict dictionary holding the elements - -: 2845: * data serialized dictionary - -: 2846: */ + -: 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: */ function dictNetDeserialLevel0 called 0 returned 0% blocks executed 0% - #####: 2847:internal void dictNetDeserialLevel0(sDictt **dict, char **data) { - #####: 2848: sUndefinedt *u = NULL; - #####: 2849: sBoolt *bo = NULL; - #####: 2850: double *D = NULL; - #####: 2851: sDoublet *Do = NULL; - #####: 2852: sDictt *d = NULL; - #####: 2853: sIntt *io = NULL; - #####: 2854: char *s = NULL; - #####: 2855: sStringt *so = NULL; - #####: 2856: sArrayt *a = NULL; - #####: 2857: sBytest *B = NULL; - -: 2858: uint32_t count; - -: 2859: uint32_t dictCount; - -: 2860: - #####: 2861: dictCount = netTypeVarintToUint((u8**)data); -call 0 never executed - -: 2862: - #####: 2863: if (!dictCount) { -branch 0 never executed -branch 1 never executed - #####: 2864: *dict = allocSDict(); -call 0 never executed - #####: 2865: ret; - -: 2866: } - -: 2867: - #####: 2868: loop(dictCount) { -branch 0 never executed -branch 1 never executed - -: 2869: char type; - -: 2870: char *key; - #####: 2871: key = *data; - #####: 2872: *data += strlen(key)+1; - #####: 2873: type = **data; - -: 2874: - #####: 2875: switch(type & 0xF) { + #####: 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) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4245,119 +4246,119 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 2876: case S_UNDEFINED: - #####: 2877: (*data)++; - #####: 2878: u = allocSUndefined(); -call 0 never executed - #####: 2879: sDictPushTiny(dict, key, (smallt *) u); -call 0 never executed - #####: 2880: break; - -: 2881: case S_BOOL: - #####: 2882: (*data)++; - #####: 2883: bo = allocSBool(type & 0x10); -call 0 never executed - #####: 2884: sDictPushTiny(dict, key, (smallt *) bo); -call 0 never executed - #####: 2885: break; - -: 2886: case S_DICT: - #####: 2887: d = NULL; - #####: 2888: dictNetDeserialLevel0(&d, data); -call 0 never executed - #####: 2889: sDictPushTiny(dict, key, (smallt *) d); -call 0 never executed - #####: 2890: break; - -: 2891: case S_DOUBLE: - #####: 2892: (*data)++; - #####: 2893: D = (double *)(*data); - #####: 2894: *data += sizeof(double); - #####: 2895: Do = allocSDouble(*D); -call 0 never executed - #####: 2896: sDictPushTiny(dict, key, (smallt *) Do); -call 0 never executed - #####: 2897: break; - -: 2898: case S_INT: { - #####: 2899: i64 v = netTypeVarintToUint((u8**)data); -call 0 never executed - #####: 2900: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 2901: io = allocSInt(v); -call 0 never executed - #####: 2902: sDictPushTiny(dict, key, (smallt *) io); -call 0 never executed - -: 2903: } - #####: 2904: break; - -: 2905: case S_STRING: - #####: 2906: (*data)++; - #####: 2907: s = (char *)(*data); - #####: 2908: *data += strlen(s)+1; - #####: 2909: so = allocSStringTiny(s); -call 0 never executed - #####: 2910: sDictPushTiny(dict, key, (smallt *) so); -call 0 never executed - #####: 2911: break; - -: 2912: case S_ARRAY: - #####: 2913: a = NULL; - #####: 2914: arrayNetDeserialLevel0(&a, data); -call 0 never executed - #####: 2915: sDictPushTiny(dict, key, (smallt *) a); -call 0 never executed - #####: 2916: break; - -: 2917: case S_BYTES: - #####: 2918: B = allocSBytes(); -call 0 never executed - #####: 2919: count = netTypeVarintToUint((u8**)data); -call 0 never executed - #####: 2920: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 2921: *data += count; - #####: 2922: sDictPushTiny(dict, key, (smallt *) B); -call 0 never executed - #####: 2923: break; - -: 2924: } - -: 2925: } - -: 2926:} - -: 2927: - -: 2928:/** - -: 2929: * deserialize array from data - -: 2930: * - -: 2931: * a new array is allocated - -: 2932: * - -: 2933: * \param - -: 2934: * array holding the elements - -: 2935: * data serialized dictionary - -: 2936: */ + -: 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: */ function arrayNetDeserialLevel0 called 0 returned 0% blocks executed 0% - #####: 2937:internal void arrayNetDeserialLevel0(sArrayt **array, char **data) { - #####: 2938: sUndefinedt *u = NULL; - #####: 2939: sBoolt *bo = NULL; - #####: 2940: double *D = NULL; - #####: 2941: sDoublet *Do = NULL; - #####: 2942: sDictt *d = NULL; - #####: 2943: sIntt *io = NULL; - #####: 2944: char *s = NULL; - #####: 2945: sStringt *so = NULL; - #####: 2946: sArrayt *a = NULL; - #####: 2947: sBytest *B = NULL; - -: 2948: uint32_t count; - -: 2949: uint32_t arrayCount; - -: 2950: - #####: 2951: arrayCount = netTypeVarintToUint((u8**)data); + #####: 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); call 0 never executed - -: 2952: - #####: 2953: if (!arrayCount) { + -: 2953: + #####: 2954: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 2954: *array = allocSArray();; + #####: 2955: *array = allocSArray();; call 0 never executed - #####: 2955: ret; - -: 2956: } - -: 2957: - #####: 2958: loop(arrayCount) { + #####: 2956: ret; + -: 2957: } + -: 2958: + #####: 2959: loop(arrayCount) { branch 0 never executed branch 1 never executed - -: 2959: char type; - #####: 2960: type = **data; - -: 2961: - #####: 2962: switch(type & 0xF) { + -: 2960: char type; + #####: 2961: type = **data; + -: 2962: + #####: 2963: switch(type & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4367,125 +4368,125 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 2963: case S_UNDEFINED: - #####: 2964: (*data)++; - #####: 2965: u = allocSUndefined(); + -: 2964: case S_UNDEFINED: + #####: 2965: (*data)++; + #####: 2966: u = allocSUndefined(); call 0 never executed - #####: 2966: sArrayPushTiny(array, (smallt *) u); + #####: 2967: sArrayPushTiny(array, (smallt *) u); call 0 never executed - #####: 2967: break; - -: 2968: case S_BOOL: - #####: 2969: (*data)++; - #####: 2970: bo = allocSBool(type & 0x10); + #####: 2968: break; + -: 2969: case S_BOOL: + #####: 2970: (*data)++; + #####: 2971: bo = allocSBool(type & 0x10); call 0 never executed - #####: 2971: sArrayPushTiny(array, (smallt *) bo); + #####: 2972: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - #####: 2972: break; - -: 2973: case S_DICT: - #####: 2974: d = NULL; - #####: 2975: dictNetDeserialLevel0(&d, data); + #####: 2973: break; + -: 2974: case S_DICT: + #####: 2975: d = NULL; + #####: 2976: dictNetDeserialLevel0(&d, data); call 0 never executed - #####: 2976: sArrayPushTiny(array, (smallt *) d); + #####: 2977: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 2977: break; - -: 2978: case S_DOUBLE: - #####: 2979: (*data)++; - #####: 2980: D = (double *)(*data); - #####: 2981: *data += sizeof(double); - #####: 2982: Do = allocSDouble(*D); + #####: 2978: break; + -: 2979: case S_DOUBLE: + #####: 2980: (*data)++; + #####: 2981: D = (double *)(*data); + #####: 2982: *data += sizeof(double); + #####: 2983: Do = allocSDouble(*D); call 0 never executed - #####: 2983: sArrayPushTiny(array, (smallt *) Do); + #####: 2984: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - #####: 2984: break; - -: 2985: case S_INT: { - #####: 2986: i64 v = netTypeVarintToUint((u8**)data); + #####: 2985: break; + -: 2986: case S_INT: { + #####: 2987: i64 v = netTypeVarintToUint((u8**)data); call 0 never executed - #####: 2987: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 2988: io = allocSInt(v); + #####: 2988: v = (v >> 1) ^ ((v << 63) >> 63); + #####: 2989: io = allocSInt(v); call 0 never executed - #####: 2989: sArrayPushTiny(array, (smallt *) io); + #####: 2990: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 2990: } - #####: 2991: break; - -: 2992: case S_STRING: - #####: 2993: (*data)++; - #####: 2994: s = (char *)(*data); - #####: 2995: *data += strlen(s)+1; - #####: 2996: so = allocSStringTiny(s); + -: 2991: } + #####: 2992: break; + -: 2993: case S_STRING: + #####: 2994: (*data)++; + #####: 2995: s = (char *)(*data); + #####: 2996: *data += strlen(s)+1; + #####: 2997: so = allocSStringTiny(s); call 0 never executed - #####: 2997: sArrayPushTiny(array, (smallt *) so); + #####: 2998: sArrayPushTiny(array, (smallt *) so); call 0 never executed - #####: 2998: break; - -: 2999: case S_ARRAY: - #####: 3000: a = NULL; - #####: 3001: arrayNetDeserialLevel0(&a, data); + #####: 2999: break; + -: 3000: case S_ARRAY: + #####: 3001: a = NULL; + #####: 3002: arrayNetDeserialLevel0(&a, data); call 0 never executed - #####: 3002: sArrayPushTiny(array, (smallt *) a); + #####: 3003: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 3003: break; - -: 3004: case S_BYTES: - #####: 3005: B = allocSBytes(); + #####: 3004: break; + -: 3005: case S_BYTES: + #####: 3006: B = allocSBytes(); call 0 never executed - #####: 3006: count = netTypeVarintToUint((u8**)data); + #####: 3007: count = netTypeVarintToUint((u8**)data); call 0 never executed - #####: 3007: sBytesPushBuffer(&B, data, count); + #####: 3008: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3008: *data += count; - #####: 3009: sArrayPushTiny(array, (smallt *) B); + #####: 3009: *data += count; + #####: 3010: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 3010: break; - -: 3011: } - -: 3012: } - -: 3013:} - -: 3014: + #####: 3011: break; + -: 3012: } + -: 3013: } + -: 3014:} + -: 3015: function deserialNetSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 3015:internal smallJsont* deserialNetSerialLevel0(smallJsont *self, smallBytest *data) { - -: 3016: - #####: 3017: if (!data or !data->B or !data->B->count) { + #####: 3016:internal smallJsont* deserialNetSerialLevel0(smallJsont *self, smallBytest *data) { + -: 3017: + #####: 3018: 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 - #####: 3018: ret self; - -: 3019: } - -: 3020: - #####: 3021: smallt *o = netDeserialLevel0(data->B); -call 0 never executed - -: 3022: - #####: 3023: if (!o) { -branch 0 never executed -branch 1 never executed - #####: 3024: ret self; - -: 3025: } - -: 3026: - #####: 3027: freeG(self); -call 0 never executed - -: 3028: - #####: 3029: setsoG(self, o); -call 0 never executed - -: 3030: - #####: 3031: ret self; - -: 3032:} - -: 3033: - -: 3034:// level 1 - -: 3035:// like level 0 with type encoded in nibbles and bools are packed - -: 3036: - -: 3037:/** - -: 3038: * deserializer top function - -: 3039: */ + #####: 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: */ function netDeserialLevel1 called 0 returned 0% blocks executed 0% - #####: 3040:internal smallt* netDeserialLevel1(sBytest *obj) { - #####: 3041: smallt *r = NULL; - #####: 3042: double *D = NULL; - #####: 3043: char *s = NULL; - #####: 3044: sBytest *B = NULL; - -: 3045: uint32_t count; - #####: 3046: char *data = NULL; - #####: 3047: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; - -: 3048: - #####: 3049: switch(obj->data & 0xF) { + #####: 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) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4495,130 +4496,130 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 3050: case S_UNDEFINED: - #####: 3051: r = (smallt *) allocSUndefined(); -call 0 never executed - #####: 3052: break; - -: 3053: case S_BOOL: - #####: 3054: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 never executed - #####: 3055: break; - -: 3056: case S_DICT: - #####: 3057: data = (char *)&(obj->data); - -: 3058: //debug - ctx.dbuf = (u8*) data; - #####: 3059: dictNetDeserialLevel1((sDictt **)&r, (u8**)&data, &ctx); -call 0 never executed - #####: 3060: break; - -: 3061: case S_DOUBLE: - #####: 3062: data = &(obj->data)+1; - #####: 3063: D = (double *)data; - #####: 3064: r = (smallt *) allocSDouble(*D); -call 0 never executed - #####: 3065: break; - -: 3066: case S_INT: - #####: 3067: data = &(obj->data); - #####: 3068: i64 v = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 3069: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3070: r = (smallt *) allocSInt(v); -call 0 never executed - #####: 3071: break; - -: 3072: case S_STRING: - #####: 3073: s = (char *)&(obj->data)+1; - #####: 3074: r = (smallt *) allocSStringTiny(s); -call 0 never executed - #####: 3075: break; - -: 3076: case S_ARRAY: - #####: 3077: data = (char *)&(obj->data); - -: 3078: //debug - ctx.dbuf = (u8*) data; - #####: 3079: arrayNetDeserialLevel1((sArrayt **)&r, (u8**)&data, &ctx); -call 0 never executed - #####: 3080: break; - -: 3081: case S_BYTES: - #####: 3082: B = allocSBytes(); -call 0 never executed - #####: 3083: data = &(obj->data); - #####: 3084: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 3085: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 3086: r = (smallt *)B; - #####: 3087: break; - -: 3088: } - -: 3089: - #####: 3090: ret r; - -: 3091:} - -: 3092: - -: 3093:/** - -: 3094: * deserialize dictionary from data - -: 3095: * - -: 3096: * a new dictionary is allocated - -: 3097: * - -: 3098: * \param - -: 3099: * dict dictionary holding the elements - -: 3100: * data serialized dictionary - -: 3101: */ + -: 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: */ function dictNetDeserialLevel1 called 0 returned 0% blocks executed 0% - #####: 3102:internal void dictNetDeserialLevel1(sDictt **dict, u8 **data, contextt *ctx) { - #####: 3103: sUndefinedt *u = NULL; - #####: 3104: sBoolt *bo = NULL; - #####: 3105: double *D = NULL; - #####: 3106: sDoublet *Do = NULL; - #####: 3107: sDictt *d = NULL; - #####: 3108: sIntt *io = NULL; - #####: 3109: char *s = NULL; - #####: 3110: sStringt *so = NULL; - #####: 3111: sArrayt *a = NULL; - #####: 3112: sBytest *B = NULL; - -: 3113: uint32_t count; - -: 3114: uint32_t dictCount; - -: 3115: - #####: 3116: if (ctx->nibble == lowNbl) { + #####: 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) { branch 0 never executed branch 1 never executed - #####: 3117: dictCount = netTypeVarintToUint(data); + #####: 3118: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3118: } - -: 3119: else { - -: 3120: // high nibble - -: 3121: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; - -: 3122: #define readTypeInHighNbl\ - -: 3123: ctx->nibble = lowNbl;\ - -: 3124: if (ctx->nblAddr == *data)\ - -: 3125: /* data points to the type, next byte is count */\ - -: 3126: (*data)++ - #####: 3127: readTypeInHighNbl; + -: 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; branch 0 never executed branch 1 never executed - #####: 3128: dictCount = varintToUint(data); + #####: 3129: dictCount = varintToUint(data); call 0 never executed - -: 3129: } - -: 3130: - #####: 3131: if (!dictCount) { + -: 3130: } + -: 3131: + #####: 3132: if (!dictCount) { branch 0 never executed branch 1 never executed - #####: 3132: *dict = allocSDict(); + #####: 3133: *dict = allocSDict(); call 0 never executed - #####: 3133: ret; - -: 3134: } - -: 3135: - #####: 3136: loop(dictCount) { + #####: 3134: ret; + -: 3135: } + -: 3136: + #####: 3137: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3137: char *key = (char*)*data; - #####: 3138: *data += strlen(key)+1; - -: 3139: char type; - #####: 3140: if (ctx->nibble == lowNbl) { + #####: 3138: char *key = (char*)*data; + #####: 3139: *data += strlen(key)+1; + -: 3140: char type; + #####: 3141: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3141: type = (**data) & 0xF; - -: 3142: } - -: 3143: else { - -: 3144: // high nibble - #####: 3145: type = (*ctx->nblAddr) >> 4; - -: 3146: } - -: 3147: - #####: 3148: switch(type) { + #####: 3142: type = (**data) & 0xF; + -: 3143: } + -: 3144: else { + -: 3145: // high nibble + #####: 3146: type = (*ctx->nblAddr) >> 4; + -: 3147: } + -: 3148: + #####: 3149: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4628,261 +4629,261 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 3149: case S_UNDEFINED: - #####: 3150: if (ctx->nibble == lowNbl) { + -: 3150: case S_UNDEFINED: + #####: 3151: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3151: #define readTypeOnly\ - -: 3152: ctx->nibble = highNbl;\ - -: 3153: ctx->nblAddr = *data;\ - -: 3154: (*data)++ - #####: 3155: readTypeOnly; - -: 3156: } - -: 3157: else { - -: 3158: // high nibble - #####: 3159: readTypeInHighNbl; + -: 3152: #define readTypeOnly\ + -: 3153: ctx->nibble = highNbl;\ + -: 3154: ctx->nblAddr = *data;\ + -: 3155: (*data)++ + #####: 3156: readTypeOnly; + -: 3157: } + -: 3158: else { + -: 3159: // high nibble + #####: 3160: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3160: } - #####: 3161: u = allocSUndefined(); + -: 3161: } + #####: 3162: u = allocSUndefined(); call 0 never executed - #####: 3162: sDictPushTiny(dict, key, (smallt *) u); + #####: 3163: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - #####: 3163: break; - -: 3164: case S_BOOL: - #####: 3165: if (!ctx->boolAddr) { + #####: 3164: break; + -: 3165: case S_BOOL: + #####: 3166: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3166: // new packed bools - #####: 3167: if (ctx->nibble == lowNbl) { + -: 3167: // new packed bools + #####: 3168: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3168: #define read4bPackedBool\ - -: 3169: ctx->boolShift = 5;\ - -: 3170: ctx->boolAddr = *data;\ - -: 3171: (*data)++ - #####: 3172: read4bPackedBool; - #####: 3173: bo = allocSBool((*ctx->boolAddr) & 0x10); + -: 3169: #define read4bPackedBool\ + -: 3170: ctx->boolShift = 5;\ + -: 3171: ctx->boolAddr = *data;\ + -: 3172: (*data)++ + #####: 3173: read4bPackedBool; + #####: 3174: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3174: } - -: 3175: else { - -: 3176: // high nibble - #####: 3177: readTypeInHighNbl; + -: 3175: } + -: 3176: else { + -: 3177: // high nibble + #####: 3178: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3178: #define read8bPackedBool\ - -: 3179: ctx->boolShift = 1;\ - -: 3180: ctx->boolAddr = *data;\ - -: 3181: (*data)++ - #####: 3182: read8bPackedBool; - #####: 3183: bo = allocSBool((*ctx->boolAddr) & 0x1); + -: 3179: #define read8bPackedBool\ + -: 3180: ctx->boolShift = 1;\ + -: 3181: ctx->boolAddr = *data;\ + -: 3182: (*data)++ + #####: 3183: read8bPackedBool; + #####: 3184: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3184: } - -: 3185: } - -: 3186: else { - -: 3187: // there was a bool before this one, read bits in nibbles - #####: 3188: if (ctx->nibble == lowNbl) { + -: 3185: } + -: 3186: } + -: 3187: else { + -: 3188: // there was a bool before this one, read bits in nibbles + #####: 3189: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3189: if (ctx->boolShift == 8) { + #####: 3190: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3190: read4bPackedBool; - #####: 3191: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3191: read4bPackedBool; + #####: 3192: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3192: } - -: 3193: else { - #####: 3194: readTypeOnly; - #####: 3195: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3193: } + -: 3194: else { + #####: 3195: readTypeOnly; + #####: 3196: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3196: } - -: 3197: } - -: 3198: else { - -: 3199: // high nibble - #####: 3200: readTypeInHighNbl; + -: 3197: } + -: 3198: } + -: 3199: else { + -: 3200: // high nibble + #####: 3201: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3201: if (ctx->boolShift == 8) { + #####: 3202: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3202: read8bPackedBool; - #####: 3203: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3203: read8bPackedBool; + #####: 3204: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3204: } - -: 3205: else { - -: 3206: // high nibble - #####: 3207: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3205: } + -: 3206: else { + -: 3207: // high nibble + #####: 3208: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3208: } - -: 3209: } - -: 3210: } - #####: 3211: sDictPushTiny(dict, key, (smallt *) bo); + -: 3209: } + -: 3210: } + -: 3211: } + #####: 3212: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - #####: 3212: break; - -: 3213: case S_DICT: - #####: 3214: d = NULL; - #####: 3215: dictNetDeserialLevel1(&d, data, ctx); + #####: 3213: break; + -: 3214: case S_DICT: + #####: 3215: d = NULL; + #####: 3216: dictNetDeserialLevel1(&d, data, ctx); call 0 never executed - #####: 3216: sDictPushTiny(dict, key, (smallt *) d); + #####: 3217: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - #####: 3217: break; - -: 3218: case S_DOUBLE: - #####: 3219: if (ctx->nibble == lowNbl) { + #####: 3218: break; + -: 3219: case S_DOUBLE: + #####: 3220: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3220: readTypeOnly; - -: 3221: } - -: 3222: else { - -: 3223: // high nibble - #####: 3224: readTypeInHighNbl; + #####: 3221: readTypeOnly; + -: 3222: } + -: 3223: else { + -: 3224: // high nibble + #####: 3225: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3225: } - #####: 3226: D = (double *)(*data); - #####: 3227: *data += sizeof(double); - #####: 3228: Do = allocSDouble(*D); + -: 3226: } + #####: 3227: D = (double *)(*data); + #####: 3228: *data += sizeof(double); + #####: 3229: Do = allocSDouble(*D); call 0 never executed - #####: 3229: sDictPushTiny(dict, key, (smallt *) Do); + #####: 3230: sDictPushTiny(dict, key, (smallt *) Do); call 0 never executed - #####: 3230: break; - -: 3231: case S_INT: { - -: 3232: i64 v; - #####: 3233: if (ctx->nibble == lowNbl) { + #####: 3231: break; + -: 3232: case S_INT: { + -: 3233: i64 v; + #####: 3234: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3234: v = netTypeVarintToUint((u8**)data); + #####: 3235: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3235: } - -: 3236: else { - -: 3237: // high nibble - #####: 3238: readTypeInHighNbl; + -: 3236: } + -: 3237: else { + -: 3238: // high nibble + #####: 3239: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3239: v = varintToUint(data); + #####: 3240: v = varintToUint(data); call 0 never executed - -: 3240: } - #####: 3241: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3242: io = allocSInt(v); + -: 3241: } + #####: 3242: v = (v >> 1) ^ ((v << 63) >> 63); + #####: 3243: io = allocSInt(v); call 0 never executed - #####: 3243: sDictPushTiny(dict, key, (smallt *) io); + #####: 3244: sDictPushTiny(dict, key, (smallt *) io); call 0 never executed - -: 3244: } - #####: 3245: break; - -: 3246: case S_STRING: - #####: 3247: if (ctx->nibble == lowNbl) { + -: 3245: } + #####: 3246: break; + -: 3247: case S_STRING: + #####: 3248: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3248: readTypeOnly; - -: 3249: } - -: 3250: else { - -: 3251: // high nibble - #####: 3252: readTypeInHighNbl; + #####: 3249: readTypeOnly; + -: 3250: } + -: 3251: else { + -: 3252: // high nibble + #####: 3253: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3253: } - #####: 3254: s = (char *)(*data); - #####: 3255: *data += strlen(s)+1; - #####: 3256: so = allocSStringTiny(s); + -: 3254: } + #####: 3255: s = (char *)(*data); + #####: 3256: *data += strlen(s)+1; + #####: 3257: so = allocSStringTiny(s); call 0 never executed - #####: 3257: sDictPushTiny(dict, key, (smallt *) so); + #####: 3258: sDictPushTiny(dict, key, (smallt *) so); call 0 never executed - #####: 3258: break; - -: 3259: case S_ARRAY: - #####: 3260: a = NULL; - #####: 3261: arrayNetDeserialLevel1(&a, data, ctx); + #####: 3259: break; + -: 3260: case S_ARRAY: + #####: 3261: a = NULL; + #####: 3262: arrayNetDeserialLevel1(&a, data, ctx); call 0 never executed - #####: 3262: sDictPushTiny(dict, key, (smallt *) a); + #####: 3263: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - #####: 3263: break; - -: 3264: case S_BYTES: - #####: 3265: B = allocSBytes(); + #####: 3264: break; + -: 3265: case S_BYTES: + #####: 3266: B = allocSBytes(); call 0 never executed - #####: 3266: if (ctx->nibble == lowNbl) { + #####: 3267: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3267: count = netTypeVarintToUint((u8**)data); + #####: 3268: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3268: } - -: 3269: else { - -: 3270: // high nibble - #####: 3271: readTypeInHighNbl; + -: 3269: } + -: 3270: else { + -: 3271: // high nibble + #####: 3272: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3272: count = varintToUint((u8**)data); + #####: 3273: count = varintToUint((u8**)data); call 0 never executed - -: 3273: } - #####: 3274: sBytesPushBuffer(&B, data, count); + -: 3274: } + #####: 3275: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3275: *data += count; - #####: 3276: sDictPushTiny(dict, key, (smallt *) B); + #####: 3276: *data += count; + #####: 3277: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - #####: 3277: break; - -: 3278: } - -: 3279: } - -: 3280:} - -: 3281: - -: 3282:/** - -: 3283: * deserialize array from data - -: 3284: * - -: 3285: * a new array is allocated - -: 3286: * - -: 3287: * \param - -: 3288: * array holding the elements - -: 3289: * data serialized dictionary - -: 3290: */ + #####: 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: */ function arrayNetDeserialLevel1 called 0 returned 0% blocks executed 0% - #####: 3291:internal void arrayNetDeserialLevel1(sArrayt **array, u8 **data, contextt *ctx) { - #####: 3292: sUndefinedt *u = NULL; - #####: 3293: sBoolt *bo = NULL; - #####: 3294: double *D = NULL; - #####: 3295: sDoublet *Do = NULL; - #####: 3296: sDictt *d = NULL; - #####: 3297: sIntt *io = NULL; - #####: 3298: char *s = NULL; - #####: 3299: sStringt *so = NULL; - #####: 3300: sArrayt *a = NULL; - #####: 3301: sBytest *B = NULL; - -: 3302: uint32_t count; - -: 3303: uint32_t arrayCount; - -: 3304: - #####: 3305: if (ctx->nibble == lowNbl) { + #####: 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) { branch 0 never executed branch 1 never executed - #####: 3306: arrayCount = netTypeVarintToUint(data); + #####: 3307: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 3307: } - -: 3308: else { - -: 3309: // high nibble - #####: 3310: readTypeInHighNbl; + -: 3308: } + -: 3309: else { + -: 3310: // high nibble + #####: 3311: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3311: arrayCount = varintToUint(data); + #####: 3312: arrayCount = varintToUint(data); call 0 never executed - -: 3312: } - -: 3313: - #####: 3314: if (!arrayCount) { + -: 3313: } + -: 3314: + #####: 3315: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 3315: *array = allocSArray();; + #####: 3316: *array = allocSArray();; call 0 never executed - #####: 3316: ret; - -: 3317: } - -: 3318: - #####: 3319: loop(arrayCount) { + #####: 3317: ret; + -: 3318: } + -: 3319: + #####: 3320: loop(arrayCount) { branch 0 never executed branch 1 never executed - -: 3320: char type; - #####: 3321: if (ctx->nibble == lowNbl) { + -: 3321: char type; + #####: 3322: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3322: type = (**data) & 0xF; - -: 3323: } - -: 3324: else { - -: 3325: // high nibble - #####: 3326: type = (*ctx->nblAddr) >> 4; - -: 3327: } - -: 3328: - #####: 3329: switch(type) { + #####: 3323: type = (**data) & 0xF; + -: 3324: } + -: 3325: else { + -: 3326: // high nibble + #####: 3327: type = (*ctx->nblAddr) >> 4; + -: 3328: } + -: 3329: + #####: 3330: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4892,234 +4893,234 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 3330: case S_UNDEFINED: - #####: 3331: if (ctx->nibble == lowNbl) { + -: 3331: case S_UNDEFINED: + #####: 3332: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3332: readTypeOnly; - -: 3333: } - -: 3334: else { - -: 3335: // high nibble - #####: 3336: readTypeInHighNbl; + #####: 3333: readTypeOnly; + -: 3334: } + -: 3335: else { + -: 3336: // high nibble + #####: 3337: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3337: } - #####: 3338: u = allocSUndefined(); + -: 3338: } + #####: 3339: u = allocSUndefined(); call 0 never executed - #####: 3339: sArrayPushTiny(array, (smallt *) u); + #####: 3340: sArrayPushTiny(array, (smallt *) u); call 0 never executed - #####: 3340: break; - -: 3341: case S_BOOL: - #####: 3342: if (!ctx->boolAddr) { + #####: 3341: break; + -: 3342: case S_BOOL: + #####: 3343: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3343: // new packed bools - #####: 3344: if (ctx->nibble == lowNbl) { + -: 3344: // new packed bools + #####: 3345: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3345: read4bPackedBool; - #####: 3346: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3346: read4bPackedBool; + #####: 3347: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3347: } - -: 3348: else { - -: 3349: // high nibble - #####: 3350: readTypeInHighNbl; + -: 3348: } + -: 3349: else { + -: 3350: // high nibble + #####: 3351: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3351: read8bPackedBool; - #####: 3352: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3352: read8bPackedBool; + #####: 3353: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3353: } - -: 3354: } - -: 3355: else { - -: 3356: // there was a bool before this one, read bits in nibbles - #####: 3357: if (ctx->nibble == lowNbl) { + -: 3354: } + -: 3355: } + -: 3356: else { + -: 3357: // there was a bool before this one, read bits in nibbles + #####: 3358: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3358: if (ctx->boolShift == 8) { + #####: 3359: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3359: read4bPackedBool; - #####: 3360: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3360: read4bPackedBool; + #####: 3361: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3361: } - -: 3362: else { - #####: 3363: readTypeOnly; - #####: 3364: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3362: } + -: 3363: else { + #####: 3364: readTypeOnly; + #####: 3365: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3365: } - -: 3366: } - -: 3367: else { - -: 3368: // high nibble - #####: 3369: readTypeInHighNbl; + -: 3366: } + -: 3367: } + -: 3368: else { + -: 3369: // high nibble + #####: 3370: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3370: if (ctx->boolShift == 8) { + #####: 3371: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3371: read8bPackedBool; - #####: 3372: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3372: read8bPackedBool; + #####: 3373: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3373: } - -: 3374: else { - #####: 3375: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3374: } + -: 3375: else { + #####: 3376: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3376: } - -: 3377: } - -: 3378: } - #####: 3379: sArrayPushTiny(array, (smallt *) bo); + -: 3377: } + -: 3378: } + -: 3379: } + #####: 3380: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - #####: 3380: break; - -: 3381: case S_DICT: - #####: 3382: d = NULL; - #####: 3383: dictNetDeserialLevel1(&d, data, ctx); + #####: 3381: break; + -: 3382: case S_DICT: + #####: 3383: d = NULL; + #####: 3384: dictNetDeserialLevel1(&d, data, ctx); call 0 never executed - #####: 3384: sArrayPushTiny(array, (smallt *) d); + #####: 3385: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 3385: break; - -: 3386: case S_DOUBLE: - #####: 3387: if (ctx->nibble == lowNbl) { + #####: 3386: break; + -: 3387: case S_DOUBLE: + #####: 3388: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3388: readTypeOnly; - -: 3389: } - -: 3390: else { - -: 3391: // high nibble - #####: 3392: readTypeInHighNbl; + #####: 3389: readTypeOnly; + -: 3390: } + -: 3391: else { + -: 3392: // high nibble + #####: 3393: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3393: } - #####: 3394: D = (double *)(*data); - #####: 3395: *data += sizeof(double); - #####: 3396: Do = allocSDouble(*D); + -: 3394: } + #####: 3395: D = (double *)(*data); + #####: 3396: *data += sizeof(double); + #####: 3397: Do = allocSDouble(*D); call 0 never executed - #####: 3397: sArrayPushTiny(array, (smallt *) Do); + #####: 3398: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - #####: 3398: break; - -: 3399: case S_INT: { - -: 3400: i64 v; - #####: 3401: if (ctx->nibble == lowNbl) { + #####: 3399: break; + -: 3400: case S_INT: { + -: 3401: i64 v; + #####: 3402: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3402: v = netTypeVarintToUint((u8**)data); + #####: 3403: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3403: } - -: 3404: else { - -: 3405: // high nibble - #####: 3406: readTypeInHighNbl; + -: 3404: } + -: 3405: else { + -: 3406: // high nibble + #####: 3407: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3407: v = varintToUint(data); + #####: 3408: v = varintToUint(data); call 0 never executed - -: 3408: } - #####: 3409: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3410: io = allocSInt(v); + -: 3409: } + #####: 3410: v = (v >> 1) ^ ((v << 63) >> 63); + #####: 3411: io = allocSInt(v); call 0 never executed - #####: 3411: sArrayPushTiny(array, (smallt *) io); + #####: 3412: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 3412: } - #####: 3413: break; - -: 3414: case S_STRING: - #####: 3415: if (ctx->nibble == lowNbl) { + -: 3413: } + #####: 3414: break; + -: 3415: case S_STRING: + #####: 3416: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3416: readTypeOnly; - -: 3417: } - -: 3418: else { - -: 3419: // high nibble - #####: 3420: readTypeInHighNbl; + #####: 3417: readTypeOnly; + -: 3418: } + -: 3419: else { + -: 3420: // high nibble + #####: 3421: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3421: } - #####: 3422: s = (char *)(*data); - #####: 3423: *data += strlen(s)+1; - #####: 3424: so = allocSStringTiny(s); + -: 3422: } + #####: 3423: s = (char *)(*data); + #####: 3424: *data += strlen(s)+1; + #####: 3425: so = allocSStringTiny(s); call 0 never executed - #####: 3425: sArrayPushTiny(array, (smallt *) so); + #####: 3426: sArrayPushTiny(array, (smallt *) so); call 0 never executed - #####: 3426: break; - -: 3427: case S_ARRAY: - #####: 3428: a = NULL; - #####: 3429: arrayNetDeserialLevel1(&a, data, ctx); + #####: 3427: break; + -: 3428: case S_ARRAY: + #####: 3429: a = NULL; + #####: 3430: arrayNetDeserialLevel1(&a, data, ctx); call 0 never executed - #####: 3430: sArrayPushTiny(array, (smallt *) a); + #####: 3431: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 3431: break; - -: 3432: case S_BYTES: - #####: 3433: B = allocSBytes(); + #####: 3432: break; + -: 3433: case S_BYTES: + #####: 3434: B = allocSBytes(); call 0 never executed - #####: 3434: if (ctx->nibble == lowNbl) { + #####: 3435: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3435: count = netTypeVarintToUint((u8**)data); + #####: 3436: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3436: } - -: 3437: else { - -: 3438: // high nibble - #####: 3439: readTypeInHighNbl; + -: 3437: } + -: 3438: else { + -: 3439: // high nibble + #####: 3440: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3440: count = varintToUint((u8**)data); + #####: 3441: count = varintToUint((u8**)data); call 0 never executed - -: 3441: } - #####: 3442: sBytesPushBuffer(&B, data, count); + -: 3442: } + #####: 3443: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3443: *data += count; - #####: 3444: sArrayPushTiny(array, (smallt *) B); + #####: 3444: *data += count; + #####: 3445: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 3445: break; - -: 3446: } - -: 3447: } - -: 3448:} - -: 3449: + #####: 3446: break; + -: 3447: } + -: 3448: } + -: 3449:} + -: 3450: function deserialNetSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 3450:internal smallJsont* deserialNetSerialLevel1(smallJsont *self, smallBytest *data) { - -: 3451: - #####: 3452: if (!data or !data->B or !data->B->count) { + #####: 3451:internal smallJsont* deserialNetSerialLevel1(smallJsont *self, smallBytest *data) { + -: 3452: + #####: 3453: 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 - #####: 3453: ret self; - -: 3454: } - -: 3455: - #####: 3456: smallt *o = netDeserialLevel1(data->B); -call 0 never executed - -: 3457: - #####: 3458: if (!o) { -branch 0 never executed -branch 1 never executed - #####: 3459: ret self; - -: 3460: } - -: 3461: - #####: 3462: freeG(self); -call 0 never executed - -: 3463: - #####: 3464: setsoG(self, o); -call 0 never executed - -: 3465: - #####: 3466: ret self; - -: 3467:} - -: 3468: - -: 3469:// level 2 - -: 3470:// like level 1, arrays are set to uniform when all elements are same type - -: 3471: - -: 3472:/** - -: 3473: * deserializer top function - -: 3474: */ + #####: 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: */ function netDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3475:internal smallt* netDeserialLevel2(sBytest *obj) { - #####: 3476: smallt *r = NULL; - #####: 3477: double *D = NULL; - #####: 3478: char *s = NULL; - #####: 3479: sBytest *B = NULL; - -: 3480: uint32_t count; - #####: 3481: char *data = NULL; - #####: 3482: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; - -: 3483: - #####: 3484: switch(obj->data & 0xF) { + #####: 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) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5131,150 +5132,150 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3485: case S_UNDEFINED: - #####: 3486: r = (smallt *) allocSUndefined(); -call 0 never executed - #####: 3487: break; - -: 3488: case S_BOOL: - #####: 3489: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 never executed - #####: 3490: break; - -: 3491: case S_DICT: - #####: 3492: data = (char *)&(obj->data); - -: 3493: //debug - ctx.dbuf = (u8*) data; - #####: 3494: dictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 never executed - #####: 3495: break; - -: 3496: case S_DOUBLE: - #####: 3497: data = &(obj->data)+1; - #####: 3498: D = (double *)data; - #####: 3499: r = (smallt *) allocSDouble(*D); -call 0 never executed - #####: 3500: break; - -: 3501: case S_INT: - #####: 3502: data = &(obj->data); - #####: 3503: i64 v = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 3504: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3505: r = (smallt *) allocSInt(v); -call 0 never executed - #####: 3506: break; - -: 3507: case S_STRING: - #####: 3508: s = (char *)&(obj->data)+1; - #####: 3509: r = (smallt *) allocSStringTiny(s); -call 0 never executed - #####: 3510: break; - -: 3511: case S_ARRAY: - #####: 3512: data = (char *)&(obj->data); - -: 3513: //debug - ctx.dbuf = (u8*) data; - #####: 3514: arrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 never executed - #####: 3515: break; - -: 3516: case S_BYTES: - #####: 3517: B = allocSBytes(); -call 0 never executed - #####: 3518: data = &(obj->data); - #####: 3519: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 3520: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 3521: r = (smallt *)B; - #####: 3522: break; - -: 3523: case UNIFORM_DICT: - #####: 3524: data = (char *)&(obj->data); - -: 3525: //debug - ctx.dbuf = (u8*) data; - #####: 3526: uniformDictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 never executed - #####: 3527: break; - -: 3528: case UNIFORM_ARRAY: - #####: 3529: data = (char *)&(obj->data); - -: 3530: //debug - ctx.dbuf = (u8*) data; - #####: 3531: uniformArrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 never executed - #####: 3532: break; - -: 3533: } - -: 3534: - #####: 3535: ret r; - -: 3536:} - -: 3537: - -: 3538:/** - -: 3539: * deserialize dictionary from data - -: 3540: * - -: 3541: * a new dictionary is allocated - -: 3542: * - -: 3543: * \param - -: 3544: * dict dictionary holding the elements - -: 3545: * data serialized dictionary - -: 3546: */ + -: 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: */ function dictNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3547:internal void dictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - #####: 3548: sUndefinedt *u = NULL; - #####: 3549: sBoolt *bo = NULL; - #####: 3550: double *D = NULL; - #####: 3551: sDoublet *Do = NULL; - #####: 3552: sDictt *d = NULL; - #####: 3553: sIntt *io = NULL; - #####: 3554: char *s = NULL; - #####: 3555: sStringt *so = NULL; - #####: 3556: sArrayt *a = NULL; - #####: 3557: sBytest *B = NULL; - -: 3558: uint32_t count; - -: 3559: uint32_t dictCount; - -: 3560: - #####: 3561: if (packed) { + #####: 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) { branch 0 never executed branch 1 never executed - #####: 3562: dictCount = varintToUint(data); + #####: 3563: dictCount = varintToUint(data); call 0 never executed - -: 3563: } - -: 3564: else { - #####: 3565: if (ctx->nibble == lowNbl) { + -: 3564: } + -: 3565: else { + #####: 3566: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3566: dictCount = netTypeVarintToUint(data); + #####: 3567: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3567: } - -: 3568: else { - -: 3569: // high nibble - -: 3570: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; - -: 3571: #define readTypeInHighNbl\ - -: 3572: ctx->nibble = lowNbl;\ - -: 3573: if (ctx->nblAddr == *data)\ - -: 3574: /* data points to the type, next byte is count */\ - -: 3575: (*data)++ - #####: 3576: readTypeInHighNbl; + -: 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; branch 0 never executed branch 1 never executed - #####: 3577: dictCount = varintToUint(data); + #####: 3578: dictCount = varintToUint(data); call 0 never executed - -: 3578: } - -: 3579: } - -: 3580: - #####: 3581: if (!dictCount) { + -: 3579: } + -: 3580: } + -: 3581: + #####: 3582: if (!dictCount) { branch 0 never executed branch 1 never executed - #####: 3582: *dict = allocSDict(); + #####: 3583: *dict = allocSDict(); call 0 never executed - #####: 3583: ret; - -: 3584: } - -: 3585: - #####: 3586: loop(dictCount) { + #####: 3584: ret; + -: 3585: } + -: 3586: + #####: 3587: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3587: char *key = (char*)*data; - #####: 3588: *data += strlen(key)+1; - -: 3589: char type; - #####: 3590: if (ctx->nibble == lowNbl) { + #####: 3588: char *key = (char*)*data; + #####: 3589: *data += strlen(key)+1; + -: 3590: char type; + #####: 3591: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3591: type = (**data) & 0xF; - -: 3592: } - -: 3593: else { - -: 3594: // high nibble - #####: 3595: type = (*ctx->nblAddr) >> 4; - -: 3596: } - -: 3597: - #####: 3598: switch(type) { + #####: 3592: type = (**data) & 0xF; + -: 3593: } + -: 3594: else { + -: 3595: // high nibble + #####: 3596: type = (*ctx->nblAddr) >> 4; + -: 3597: } + -: 3598: + #####: 3599: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5286,274 +5287,274 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3599: case S_UNDEFINED: - #####: 3600: if (ctx->nibble == lowNbl) { + -: 3600: case S_UNDEFINED: + #####: 3601: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3601: #define readTypeOnly\ - -: 3602: ctx->nibble = highNbl;\ - -: 3603: ctx->nblAddr = *data;\ - -: 3604: (*data)++ - #####: 3605: readTypeOnly; - -: 3606: } - -: 3607: else { - -: 3608: // high nibble - #####: 3609: readTypeInHighNbl; + -: 3602: #define readTypeOnly\ + -: 3603: ctx->nibble = highNbl;\ + -: 3604: ctx->nblAddr = *data;\ + -: 3605: (*data)++ + #####: 3606: readTypeOnly; + -: 3607: } + -: 3608: else { + -: 3609: // high nibble + #####: 3610: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3610: } - #####: 3611: u = allocSUndefined(); + -: 3611: } + #####: 3612: u = allocSUndefined(); call 0 never executed - #####: 3612: sDictPushTiny(dict, key, (smallt *) u); + #####: 3613: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - #####: 3613: break; - -: 3614: case S_BOOL: - #####: 3615: if (!ctx->boolAddr) { + #####: 3614: break; + -: 3615: case S_BOOL: + #####: 3616: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3616: // new packed bools - #####: 3617: if (ctx->nibble == lowNbl) { + -: 3617: // new packed bools + #####: 3618: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3618: #define read4bPackedBool\ - -: 3619: ctx->boolShift = 5;\ - -: 3620: ctx->boolAddr = *data;\ - -: 3621: (*data)++ - #####: 3622: read4bPackedBool; - #####: 3623: bo = allocSBool((*ctx->boolAddr) & 0x10); + -: 3619: #define read4bPackedBool\ + -: 3620: ctx->boolShift = 5;\ + -: 3621: ctx->boolAddr = *data;\ + -: 3622: (*data)++ + #####: 3623: read4bPackedBool; + #####: 3624: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3624: } - -: 3625: else { - -: 3626: // high nibble - #####: 3627: readTypeInHighNbl; + -: 3625: } + -: 3626: else { + -: 3627: // high nibble + #####: 3628: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3628: #define read8bPackedBool\ - -: 3629: ctx->boolShift = 1;\ - -: 3630: ctx->boolAddr = *data;\ - -: 3631: (*data)++ - #####: 3632: read8bPackedBool; - #####: 3633: bo = allocSBool((*ctx->boolAddr) & 0x1); + -: 3629: #define read8bPackedBool\ + -: 3630: ctx->boolShift = 1;\ + -: 3631: ctx->boolAddr = *data;\ + -: 3632: (*data)++ + #####: 3633: read8bPackedBool; + #####: 3634: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3634: } - -: 3635: } - -: 3636: else { - -: 3637: // there was a bool before this one, read bits in nibbles - #####: 3638: if (ctx->nibble == lowNbl) { + -: 3635: } + -: 3636: } + -: 3637: else { + -: 3638: // there was a bool before this one, read bits in nibbles + #####: 3639: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3639: if (ctx->boolShift == 8) { + #####: 3640: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3640: read4bPackedBool; - #####: 3641: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3641: read4bPackedBool; + #####: 3642: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3642: } - -: 3643: else { - #####: 3644: readTypeOnly; - #####: 3645: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3643: } + -: 3644: else { + #####: 3645: readTypeOnly; + #####: 3646: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3646: } - -: 3647: } - -: 3648: else { - -: 3649: // high nibble - #####: 3650: readTypeInHighNbl; + -: 3647: } + -: 3648: } + -: 3649: else { + -: 3650: // high nibble + #####: 3651: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3651: if (ctx->boolShift == 8) { + #####: 3652: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3652: read8bPackedBool; - #####: 3653: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3653: read8bPackedBool; + #####: 3654: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3654: } - -: 3655: else { - -: 3656: // high nibble - #####: 3657: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3655: } + -: 3656: else { + -: 3657: // high nibble + #####: 3658: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3658: } - -: 3659: } - -: 3660: } - #####: 3661: sDictPushTiny(dict, key, (smallt *) bo); + -: 3659: } + -: 3660: } + -: 3661: } + #####: 3662: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - #####: 3662: break; - -: 3663: case S_DICT: - #####: 3664: d = NULL; - #####: 3665: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 3663: break; + -: 3664: case S_DICT: + #####: 3665: d = NULL; + #####: 3666: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 3666: sDictPushTiny(dict, key, (smallt *) d); + #####: 3667: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - #####: 3667: break; - -: 3668: case S_DOUBLE: - #####: 3669: if (ctx->nibble == lowNbl) { + #####: 3668: break; + -: 3669: case S_DOUBLE: + #####: 3670: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3670: readTypeOnly; - -: 3671: } - -: 3672: else { - -: 3673: // high nibble - #####: 3674: readTypeInHighNbl; + #####: 3671: readTypeOnly; + -: 3672: } + -: 3673: else { + -: 3674: // high nibble + #####: 3675: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3675: } - #####: 3676: D = (double *)(*data); - #####: 3677: *data += sizeof(double); - #####: 3678: Do = allocSDouble(*D); + -: 3676: } + #####: 3677: D = (double *)(*data); + #####: 3678: *data += sizeof(double); + #####: 3679: Do = allocSDouble(*D); call 0 never executed - #####: 3679: sDictPushTiny(dict, key, (smallt *) Do); + #####: 3680: sDictPushTiny(dict, key, (smallt *) Do); call 0 never executed - #####: 3680: break; - -: 3681: case S_INT: { - -: 3682: i64 v; - #####: 3683: if (ctx->nibble == lowNbl) { + #####: 3681: break; + -: 3682: case S_INT: { + -: 3683: i64 v; + #####: 3684: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3684: v = netTypeVarintToUint((u8**)data); + #####: 3685: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3685: } - -: 3686: else { - -: 3687: // high nibble - #####: 3688: readTypeInHighNbl; + -: 3686: } + -: 3687: else { + -: 3688: // high nibble + #####: 3689: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3689: v = varintToUint(data); + #####: 3690: v = varintToUint(data); call 0 never executed - -: 3690: } - #####: 3691: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3692: io = allocSInt(v); + -: 3691: } + #####: 3692: v = (v >> 1) ^ ((v << 63) >> 63); + #####: 3693: io = allocSInt(v); call 0 never executed - #####: 3693: sDictPushTiny(dict, key, (smallt *) io); + #####: 3694: sDictPushTiny(dict, key, (smallt *) io); call 0 never executed - -: 3694: } - #####: 3695: break; - -: 3696: case S_STRING: - #####: 3697: if (ctx->nibble == lowNbl) { + -: 3695: } + #####: 3696: break; + -: 3697: case S_STRING: + #####: 3698: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3698: readTypeOnly; - -: 3699: } - -: 3700: else { - -: 3701: // high nibble - #####: 3702: readTypeInHighNbl; + #####: 3699: readTypeOnly; + -: 3700: } + -: 3701: else { + -: 3702: // high nibble + #####: 3703: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3703: } - #####: 3704: s = (char *)(*data); - #####: 3705: *data += strlen(s)+1; - #####: 3706: so = allocSStringTiny(s); + -: 3704: } + #####: 3705: s = (char *)(*data); + #####: 3706: *data += strlen(s)+1; + #####: 3707: so = allocSStringTiny(s); call 0 never executed - #####: 3707: sDictPushTiny(dict, key, (smallt *) so); + #####: 3708: sDictPushTiny(dict, key, (smallt *) so); call 0 never executed - #####: 3708: break; - -: 3709: case S_ARRAY: - #####: 3710: a = NULL; - #####: 3711: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 3709: break; + -: 3710: case S_ARRAY: + #####: 3711: a = NULL; + #####: 3712: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 3712: sDictPushTiny(dict, key, (smallt *) a); + #####: 3713: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - #####: 3713: break; - -: 3714: case S_BYTES: - #####: 3715: B = allocSBytes(); + #####: 3714: break; + -: 3715: case S_BYTES: + #####: 3716: B = allocSBytes(); call 0 never executed - #####: 3716: if (ctx->nibble == lowNbl) { + #####: 3717: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3717: count = netTypeVarintToUint((u8**)data); + #####: 3718: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3718: } - -: 3719: else { - -: 3720: // high nibble - #####: 3721: readTypeInHighNbl; + -: 3719: } + -: 3720: else { + -: 3721: // high nibble + #####: 3722: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3722: count = varintToUint((u8**)data); + #####: 3723: count = varintToUint((u8**)data); call 0 never executed - -: 3723: } - #####: 3724: sBytesPushBuffer(&B, data, count); + -: 3724: } + #####: 3725: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3725: *data += count; - #####: 3726: sDictPushTiny(dict, key, (smallt *) B); + #####: 3726: *data += count; + #####: 3727: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - #####: 3727: break; - -: 3728: case UNIFORM_DICT: - #####: 3729: d = NULL; - #####: 3730: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 3728: break; + -: 3729: case UNIFORM_DICT: + #####: 3730: d = NULL; + #####: 3731: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 3731: sDictPushTiny(dict, key, (smallt *) d); + #####: 3732: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - #####: 3732: break; - -: 3733: case UNIFORM_ARRAY: - #####: 3734: a = NULL; - #####: 3735: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 3733: break; + -: 3734: case UNIFORM_ARRAY: + #####: 3735: a = NULL; + #####: 3736: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 3736: sDictPushTiny(dict, key, (smallt *) a); + #####: 3737: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - #####: 3737: break; - -: 3738: } - -: 3739: } - -: 3740:} - -: 3741: - -: 3742:/** - -: 3743: * deserialize dictionary from data - -: 3744: * - -: 3745: * a new dictionary is allocated - -: 3746: * - -: 3747: * \param - -: 3748: * dict dictionary holding the elements - -: 3749: * data serialized dictionary - -: 3750: */ + #####: 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: */ function uniformDictNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3751:internal void uniformDictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - #####: 3752: sUndefinedt *u = NULL; - #####: 3753: sBoolt *bo = NULL; - #####: 3754: double *D = NULL; - #####: 3755: sDoublet *Do = NULL; - #####: 3756: sDictt *d = NULL; - #####: 3757: sIntt *io = NULL; - #####: 3758: char *s = NULL; - #####: 3759: sStringt *so = NULL; - #####: 3760: sArrayt *a = NULL; - #####: 3761: sBytest *B = NULL; - -: 3762: uint32_t count; - -: 3763: uint32_t dictCount; - -: 3764: u8 type; - -: 3765: - #####: 3766: if (packed) { + #####: 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) { branch 0 never executed branch 1 never executed - #####: 3767: type = (**data) & 0xF; - #####: 3768: dictCount = netTypeVarintToUint(data); + #####: 3768: type = (**data) & 0xF; + #####: 3769: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3769: } - -: 3770: else { - #####: 3771: if (ctx->nibble == lowNbl) { + -: 3770: } + -: 3771: else { + #####: 3772: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3772: type = (**data) >> 4; - #####: 3773: (*data)++; - #####: 3774: dictCount = varintToUint(data); + #####: 3773: type = (**data) >> 4; + #####: 3774: (*data)++; + #####: 3775: dictCount = varintToUint(data); call 0 never executed - -: 3775: } - -: 3776: else { - #####: 3777: readTypeInHighNbl; + -: 3776: } + -: 3777: else { + #####: 3778: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3778: type = (**data) & 0xF; - #####: 3779: dictCount = netTypeVarintToUint(data); + #####: 3779: type = (**data) & 0xF; + #####: 3780: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3780: } - -: 3781: } - -: 3782: - #####: 3783: if (!dictCount) { + -: 3781: } + -: 3782: } + -: 3783: + #####: 3784: if (!dictCount) { branch 0 never executed branch 1 never executed - #####: 3784: *dict = allocSDict(); + #####: 3785: *dict = allocSDict(); call 0 never executed - #####: 3785: ret; - -: 3786: } - -: 3787: + #####: 3786: ret; + -: 3787: } -: 3788: - #####: 3789: switch(type) { + -: 3789: + #####: 3790: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5565,237 +5566,237 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3790: case S_UNDEFINED: - #####: 3791: loop(dictCount) { + -: 3791: case S_UNDEFINED: + #####: 3792: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3792: char *key = (char*)*data; - #####: 3793: *data += strlen(key)+1; - #####: 3794: u = allocSUndefined(); + #####: 3793: char *key = (char*)*data; + #####: 3794: *data += strlen(key)+1; + #####: 3795: u = allocSUndefined(); call 0 never executed - #####: 3795: sDictPushTiny(dict, key, (smallt *) u); + #####: 3796: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - -: 3796: } - #####: 3797: break; - -: 3798: case S_BOOL: - #####: 3799: loop(dictCount) { + -: 3797: } + #####: 3798: break; + -: 3799: case S_BOOL: + #####: 3800: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3800: char *key = (char*)*data; - #####: 3801: *data += strlen(key)+1; - #####: 3802: if (!ctx->boolAddr) { + #####: 3801: char *key = (char*)*data; + #####: 3802: *data += strlen(key)+1; + #####: 3803: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - #####: 3803: read8bPackedBool; - #####: 3804: ctx->boolShift = 0; - -: 3805: } - #####: 3806: if (ctx->boolShift == 8) { + #####: 3804: read8bPackedBool; + #####: 3805: ctx->boolShift = 0; + -: 3806: } + #####: 3807: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3807: readTypeInHighNbl; + #####: 3808: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3808: read8bPackedBool; - #####: 3809: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3809: read8bPackedBool; + #####: 3810: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3810: } - -: 3811: else { - -: 3812: // high nibble - #####: 3813: readTypeInHighNbl; + -: 3811: } + -: 3812: else { + -: 3813: // high nibble + #####: 3814: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3814: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + #####: 3815: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3815: } - #####: 3816: sDictPushTiny(dict, key, (smallt *) bo); + -: 3816: } + #####: 3817: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - -: 3817: } - #####: 3818: break; - -: 3819: case S_DICT: - #####: 3820: loop(dictCount) { + -: 3818: } + #####: 3819: break; + -: 3820: case S_DICT: + #####: 3821: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3821: char *key = (char*)*data; - #####: 3822: *data += strlen(key)+1; - #####: 3823: d = NULL; - #####: 3824: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 3822: char *key = (char*)*data; + #####: 3823: *data += strlen(key)+1; + #####: 3824: d = NULL; + #####: 3825: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 3825: sDictPushTiny(dict, key, (smallt *) d); + #####: 3826: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - -: 3826: } - #####: 3827: break; - -: 3828: case S_DOUBLE: - #####: 3829: loop(dictCount) { + -: 3827: } + #####: 3828: break; + -: 3829: case S_DOUBLE: + #####: 3830: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3830: char *key = (char*)*data; - #####: 3831: *data += strlen(key)+1; - #####: 3832: D = (double *)(*data); - #####: 3833: *data += sizeof(double); - #####: 3834: Do = allocSDouble(*D); + #####: 3831: char *key = (char*)*data; + #####: 3832: *data += strlen(key)+1; + #####: 3833: D = (double *)(*data); + #####: 3834: *data += sizeof(double); + #####: 3835: Do = allocSDouble(*D); call 0 never executed - #####: 3835: sDictPushTiny(dict, key, (smallt *) Do); + #####: 3836: sDictPushTiny(dict, key, (smallt *) Do); call 0 never executed - -: 3836: } - #####: 3837: break; - -: 3838: case S_INT: - #####: 3839: loop(dictCount) { + -: 3837: } + #####: 3838: break; + -: 3839: case S_INT: + #####: 3840: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3840: char *key = (char*)*data; - #####: 3841: *data += strlen(key)+1; - #####: 3842: i64 v = varintToUint(data); + #####: 3841: char *key = (char*)*data; + #####: 3842: *data += strlen(key)+1; + #####: 3843: i64 v = varintToUint(data); call 0 never executed - #####: 3843: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 3844: io = allocSInt(v); + #####: 3844: v = (v >> 1) ^ ((v << 63) >> 63); + #####: 3845: io = allocSInt(v); call 0 never executed - #####: 3845: sDictPushTiny(dict, key, (smallt *) io); + #####: 3846: sDictPushTiny(dict, key, (smallt *) io); call 0 never executed - -: 3846: } - #####: 3847: break; - -: 3848: case S_STRING: - #####: 3849: loop(dictCount) { + -: 3847: } + #####: 3848: break; + -: 3849: case S_STRING: + #####: 3850: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3850: char *key = (char*)*data; - #####: 3851: *data += strlen(key)+1; - #####: 3852: s = (char *)(*data); - #####: 3853: *data += strlen(s)+1; - #####: 3854: so = allocSStringTiny(s); + #####: 3851: char *key = (char*)*data; + #####: 3852: *data += strlen(key)+1; + #####: 3853: s = (char *)(*data); + #####: 3854: *data += strlen(s)+1; + #####: 3855: so = allocSStringTiny(s); call 0 never executed - #####: 3855: sDictPushTiny(dict, key, (smallt *) so); + #####: 3856: sDictPushTiny(dict, key, (smallt *) so); call 0 never executed - -: 3856: } - #####: 3857: break; - -: 3858: case S_ARRAY: - #####: 3859: loop(dictCount) { + -: 3857: } + #####: 3858: break; + -: 3859: case S_ARRAY: + #####: 3860: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3860: char *key = (char*)*data; - #####: 3861: *data += strlen(key)+1; - #####: 3862: a = NULL; - #####: 3863: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 3861: char *key = (char*)*data; + #####: 3862: *data += strlen(key)+1; + #####: 3863: a = NULL; + #####: 3864: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 3864: sDictPushTiny(dict, key, (smallt *) a); + #####: 3865: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - -: 3865: } - #####: 3866: break; - -: 3867: case S_BYTES: - #####: 3868: loop(dictCount) { + -: 3866: } + #####: 3867: break; + -: 3868: case S_BYTES: + #####: 3869: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3869: char *key = (char*)*data; - #####: 3870: *data += strlen(key)+1; - #####: 3871: B = allocSBytes(); + #####: 3870: char *key = (char*)*data; + #####: 3871: *data += strlen(key)+1; + #####: 3872: B = allocSBytes(); call 0 never executed - #####: 3872: count = varintToUint((u8**)data); + #####: 3873: count = varintToUint((u8**)data); call 0 never executed - #####: 3873: sBytesPushBuffer(&B, data, count); + #####: 3874: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 3874: *data += count; - #####: 3875: sDictPushTiny(dict, key, (smallt *) B); + #####: 3875: *data += count; + #####: 3876: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - -: 3876: } - #####: 3877: break; - -: 3878: case UNIFORM_DICT: - #####: 3879: loop(dictCount) { + -: 3877: } + #####: 3878: break; + -: 3879: case UNIFORM_DICT: + #####: 3880: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3880: char *key = (char*)*data; - #####: 3881: *data += strlen(key)+1; - #####: 3882: d = NULL; - #####: 3883: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 3881: char *key = (char*)*data; + #####: 3882: *data += strlen(key)+1; + #####: 3883: d = NULL; + #####: 3884: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 3884: sDictPushTiny(dict, key, (smallt *) d); + #####: 3885: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - -: 3885: } - #####: 3886: break; - -: 3887: case UNIFORM_ARRAY: - #####: 3888: loop(dictCount) { + -: 3886: } + #####: 3887: break; + -: 3888: case UNIFORM_ARRAY: + #####: 3889: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3889: char *key = (char*)*data; - #####: 3890: *data += strlen(key)+1; - #####: 3891: a = NULL; - #####: 3892: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 3890: char *key = (char*)*data; + #####: 3891: *data += strlen(key)+1; + #####: 3892: a = NULL; + #####: 3893: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 3893: sDictPushTiny(dict, key, (smallt *) a); + #####: 3894: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - -: 3894: } - #####: 3895: break; - -: 3896: } - -: 3897:} - -: 3898: - -: 3899:/** - -: 3900: * deserialize array from data - -: 3901: * - -: 3902: * a new array is allocated - -: 3903: * - -: 3904: * \param - -: 3905: * array holding the elements - -: 3906: * data serialized dictionary - -: 3907: */ + -: 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: */ function arrayNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3908:internal void arrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - #####: 3909: sUndefinedt *u = NULL; - #####: 3910: sBoolt *bo = NULL; - #####: 3911: double *D = NULL; - #####: 3912: sDoublet *Do = NULL; - #####: 3913: sDictt *d = NULL; - #####: 3914: sIntt *io = NULL; - #####: 3915: char *s = NULL; - #####: 3916: sStringt *so = NULL; - #####: 3917: sArrayt *a = NULL; - #####: 3918: sBytest *B = NULL; - -: 3919: uint32_t count; - -: 3920: uint32_t arrayCount; - -: 3921: - #####: 3922: if (packed) { + #####: 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) { branch 0 never executed branch 1 never executed - #####: 3923: arrayCount = varintToUint(data); + #####: 3924: arrayCount = varintToUint(data); call 0 never executed - -: 3924: } - -: 3925: else { - #####: 3926: if (ctx->nibble == lowNbl) { + -: 3925: } + -: 3926: else { + #####: 3927: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3927: arrayCount = netTypeVarintToUint(data); + #####: 3928: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 3928: } - -: 3929: else { - -: 3930: // high nibble - #####: 3931: readTypeInHighNbl; + -: 3929: } + -: 3930: else { + -: 3931: // high nibble + #####: 3932: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3932: arrayCount = varintToUint(data); + #####: 3933: arrayCount = varintToUint(data); call 0 never executed - -: 3933: } - -: 3934: } - -: 3935: - #####: 3936: if (!arrayCount) { + -: 3934: } + -: 3935: } + -: 3936: + #####: 3937: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 3937: *array = allocSArray();; + #####: 3938: *array = allocSArray();; call 0 never executed - #####: 3938: ret; - -: 3939: } - -: 3940: - #####: 3941: loop(arrayCount) { + #####: 3939: ret; + -: 3940: } + -: 3941: + #####: 3942: loop(arrayCount) { branch 0 never executed branch 1 never executed - -: 3942: char type; - #####: 3943: if (ctx->nibble == lowNbl) { + -: 3943: char type; + #####: 3944: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3944: type = (**data) & 0xF; - -: 3945: } - -: 3946: else { - -: 3947: // high nibble - #####: 3948: type = (*ctx->nblAddr) >> 4; - -: 3949: } - -: 3950: - #####: 3951: switch(type) { + #####: 3945: type = (**data) & 0xF; + -: 3946: } + -: 3947: else { + -: 3948: // high nibble + #####: 3949: type = (*ctx->nblAddr) >> 4; + -: 3950: } + -: 3951: + #####: 3952: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5807,251 +5808,251 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3952: case S_UNDEFINED: - #####: 3953: if (ctx->nibble == lowNbl) { + -: 3953: case S_UNDEFINED: + #####: 3954: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3954: readTypeOnly; - -: 3955: } - -: 3956: else { - -: 3957: // high nibble - #####: 3958: readTypeInHighNbl; + #####: 3955: readTypeOnly; + -: 3956: } + -: 3957: else { + -: 3958: // high nibble + #####: 3959: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3959: } - #####: 3960: u = allocSUndefined(); + -: 3960: } + #####: 3961: u = allocSUndefined(); call 0 never executed - #####: 3961: sArrayPushTiny(array, (smallt *) u); + #####: 3962: sArrayPushTiny(array, (smallt *) u); call 0 never executed - #####: 3962: break; - -: 3963: case S_BOOL: - #####: 3964: if (!ctx->boolAddr) { + #####: 3963: break; + -: 3964: case S_BOOL: + #####: 3965: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3965: // new packed bools - #####: 3966: if (ctx->nibble == lowNbl) { + -: 3966: // new packed bools + #####: 3967: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3967: read4bPackedBool; - #####: 3968: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3968: read4bPackedBool; + #####: 3969: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3969: } - -: 3970: else { - -: 3971: // high nibble - #####: 3972: readTypeInHighNbl; + -: 3970: } + -: 3971: else { + -: 3972: // high nibble + #####: 3973: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3973: read8bPackedBool; - #####: 3974: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3974: read8bPackedBool; + #####: 3975: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3975: } - -: 3976: } - -: 3977: else { - -: 3978: // there was a bool before this one, read bits in nibbles - #####: 3979: if (ctx->nibble == lowNbl) { + -: 3976: } + -: 3977: } + -: 3978: else { + -: 3979: // there was a bool before this one, read bits in nibbles + #####: 3980: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3980: if (ctx->boolShift == 8) { + #####: 3981: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3981: read4bPackedBool; - #####: 3982: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3982: read4bPackedBool; + #####: 3983: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3983: } - -: 3984: else { - #####: 3985: readTypeOnly; - #####: 3986: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3984: } + -: 3985: else { + #####: 3986: readTypeOnly; + #####: 3987: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3987: } - -: 3988: } - -: 3989: else { - -: 3990: // high nibble - #####: 3991: readTypeInHighNbl; + -: 3988: } + -: 3989: } + -: 3990: else { + -: 3991: // high nibble + #####: 3992: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3992: if (ctx->boolShift == 8) { + #####: 3993: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3993: read8bPackedBool; - #####: 3994: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3994: read8bPackedBool; + #####: 3995: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3995: } - -: 3996: else { - #####: 3997: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3996: } + -: 3997: else { + #####: 3998: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3998: } - -: 3999: } - -: 4000: } - #####: 4001: sArrayPushTiny(array, (smallt *) bo); + -: 3999: } + -: 4000: } + -: 4001: } + #####: 4002: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - #####: 4002: break; - -: 4003: case S_DICT: - #####: 4004: d = NULL; - #####: 4005: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 4003: break; + -: 4004: case S_DICT: + #####: 4005: d = NULL; + #####: 4006: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 4006: sArrayPushTiny(array, (smallt *) d); + #####: 4007: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 4007: break; - -: 4008: case S_DOUBLE: - #####: 4009: if (ctx->nibble == lowNbl) { + #####: 4008: break; + -: 4009: case S_DOUBLE: + #####: 4010: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4010: readTypeOnly; - -: 4011: } - -: 4012: else { - -: 4013: // high nibble - #####: 4014: readTypeInHighNbl; + #####: 4011: readTypeOnly; + -: 4012: } + -: 4013: else { + -: 4014: // high nibble + #####: 4015: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 4015: } - #####: 4016: D = (double *)(*data); - #####: 4017: *data += sizeof(double); - #####: 4018: Do = allocSDouble(*D); + -: 4016: } + #####: 4017: D = (double *)(*data); + #####: 4018: *data += sizeof(double); + #####: 4019: Do = allocSDouble(*D); call 0 never executed - #####: 4019: sArrayPushTiny(array, (smallt *) Do); + #####: 4020: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - #####: 4020: break; - -: 4021: case S_INT: { - -: 4022: i64 v; - #####: 4023: if (ctx->nibble == lowNbl) { + #####: 4021: break; + -: 4022: case S_INT: { + -: 4023: i64 v; + #####: 4024: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4024: v = netTypeVarintToUint((u8**)data); + #####: 4025: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4025: } - -: 4026: else { - -: 4027: // high nibble - #####: 4028: readTypeInHighNbl; + -: 4026: } + -: 4027: else { + -: 4028: // high nibble + #####: 4029: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4029: v = varintToUint(data); + #####: 4030: v = varintToUint(data); call 0 never executed - -: 4030: } - #####: 4031: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 4032: io = allocSInt(v); + -: 4031: } + #####: 4032: v = (v >> 1) ^ ((v << 63) >> 63); + #####: 4033: io = allocSInt(v); call 0 never executed - #####: 4033: sArrayPushTiny(array, (smallt *) io); + #####: 4034: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 4034: } - #####: 4035: break; - -: 4036: case S_STRING: - #####: 4037: if (ctx->nibble == lowNbl) { + -: 4035: } + #####: 4036: break; + -: 4037: case S_STRING: + #####: 4038: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4038: readTypeOnly; - -: 4039: } - -: 4040: else { - -: 4041: // high nibble - #####: 4042: readTypeInHighNbl; + #####: 4039: readTypeOnly; + -: 4040: } + -: 4041: else { + -: 4042: // high nibble + #####: 4043: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 4043: } - #####: 4044: s = (char *)(*data); - #####: 4045: *data += strlen(s)+1; - #####: 4046: so = allocSStringTiny(s); + -: 4044: } + #####: 4045: s = (char *)(*data); + #####: 4046: *data += strlen(s)+1; + #####: 4047: so = allocSStringTiny(s); call 0 never executed - #####: 4047: sArrayPushTiny(array, (smallt *) so); + #####: 4048: sArrayPushTiny(array, (smallt *) so); call 0 never executed - #####: 4048: break; - -: 4049: case S_ARRAY: - #####: 4050: a = NULL; - #####: 4051: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 4049: break; + -: 4050: case S_ARRAY: + #####: 4051: a = NULL; + #####: 4052: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 4052: sArrayPushTiny(array, (smallt *) a); + #####: 4053: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 4053: break; - -: 4054: case S_BYTES: - #####: 4055: B = allocSBytes(); + #####: 4054: break; + -: 4055: case S_BYTES: + #####: 4056: B = allocSBytes(); call 0 never executed - #####: 4056: if (ctx->nibble == lowNbl) { + #####: 4057: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4057: count = netTypeVarintToUint((u8**)data); + #####: 4058: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4058: } - -: 4059: else { - -: 4060: // high nibble - #####: 4061: readTypeInHighNbl; + -: 4059: } + -: 4060: else { + -: 4061: // high nibble + #####: 4062: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4062: count = varintToUint((u8**)data); + #####: 4063: count = varintToUint((u8**)data); call 0 never executed - -: 4063: } - #####: 4064: sBytesPushBuffer(&B, data, count); + -: 4064: } + #####: 4065: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4065: *data += count; - #####: 4066: sArrayPushTiny(array, (smallt *) B); + #####: 4066: *data += count; + #####: 4067: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 4067: break; - -: 4068: case UNIFORM_DICT: - #####: 4069: d = NULL; - #####: 4070: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 4068: break; + -: 4069: case UNIFORM_DICT: + #####: 4070: d = NULL; + #####: 4071: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 4071: sArrayPushTiny(array, (smallt *) d); + #####: 4072: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 4072: break; - -: 4073: case UNIFORM_ARRAY: - #####: 4074: a = NULL; - #####: 4075: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 4073: break; + -: 4074: case UNIFORM_ARRAY: + #####: 4075: a = NULL; + #####: 4076: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 4076: sArrayPushTiny(array, (smallt *) a); + #####: 4077: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 4077: break; - -: 4078: } - -: 4079: } - -: 4080:} - -: 4081: + #####: 4078: break; + -: 4079: } + -: 4080: } + -: 4081:} + -: 4082: function uniformArrayNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 4082:internal void uniformArrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - #####: 4083: sUndefinedt *u = NULL; - #####: 4084: sBoolt *bo = NULL; - #####: 4085: double *D = NULL; - #####: 4086: sDoublet *Do = NULL; - #####: 4087: sDictt *d = NULL; - #####: 4088: sIntt *io = NULL; - #####: 4089: char *s = NULL; - #####: 4090: sStringt *so = NULL; - #####: 4091: sArrayt *a = NULL; - #####: 4092: sBytest *B = NULL; - -: 4093: uint32_t count; - -: 4094: uint32_t arrayCount; - -: 4095: u8 type; - -: 4096: - #####: 4097: if (packed) { + #####: 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) { branch 0 never executed branch 1 never executed - #####: 4098: type = (**data) & 0xF; - #####: 4099: arrayCount = netTypeVarintToUint(data); + #####: 4099: type = (**data) & 0xF; + #####: 4100: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 4100: } - -: 4101: else { - #####: 4102: if (ctx->nibble == lowNbl) { + -: 4101: } + -: 4102: else { + #####: 4103: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4103: type = (**data) >> 4; - #####: 4104: (*data)++; - #####: 4105: arrayCount = varintToUint(data); + #####: 4104: type = (**data) >> 4; + #####: 4105: (*data)++; + #####: 4106: arrayCount = varintToUint(data); call 0 never executed - -: 4106: } - -: 4107: else { - #####: 4108: readTypeInHighNbl; + -: 4107: } + -: 4108: else { + #####: 4109: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4109: type = (**data) & 0xF; - #####: 4110: arrayCount = netTypeVarintToUint(data); + #####: 4110: type = (**data) & 0xF; + #####: 4111: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 4111: } - -: 4112: } - -: 4113: - #####: 4114: if (!arrayCount) { + -: 4112: } + -: 4113: } + -: 4114: + #####: 4115: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 4115: *array = allocSArray();; + #####: 4116: *array = allocSArray();; call 0 never executed - #####: 4116: ret; - -: 4117: } - -: 4118: - #####: 4119: switch(type) { + #####: 4117: ret; + -: 4118: } + -: 4119: + #####: 4120: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -6063,353 +6064,353 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 4120: case S_UNDEFINED: - #####: 4121: loop(arrayCount) { + -: 4121: case S_UNDEFINED: + #####: 4122: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4122: u = allocSUndefined(); + #####: 4123: u = allocSUndefined(); call 0 never executed - #####: 4123: sArrayPushTiny(array, (smallt *) u); + #####: 4124: sArrayPushTiny(array, (smallt *) u); call 0 never executed - -: 4124: } - #####: 4125: break; - -: 4126: case S_BOOL: - #####: 4127: loop(arrayCount) { + -: 4125: } + #####: 4126: break; + -: 4127: case S_BOOL: + #####: 4128: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4128: if (!ctx->boolAddr) { + #####: 4129: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - #####: 4129: read8bPackedBool; - #####: 4130: ctx->boolShift = 0; - -: 4131: } - #####: 4132: if (ctx->boolShift == 8) { + #####: 4130: read8bPackedBool; + #####: 4131: ctx->boolShift = 0; + -: 4132: } + #####: 4133: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 4133: read8bPackedBool; - #####: 4134: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 4134: read8bPackedBool; + #####: 4135: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 4135: } - -: 4136: else { - #####: 4137: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 4136: } + -: 4137: else { + #####: 4138: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 4138: } - #####: 4139: sArrayPushTiny(array, (smallt *) bo); + -: 4139: } + #####: 4140: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - -: 4140: } - #####: 4141: break; - -: 4142: case S_DICT: - #####: 4143: loop(arrayCount) { + -: 4141: } + #####: 4142: break; + -: 4143: case S_DICT: + #####: 4144: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4144: d = NULL; - #####: 4145: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 4145: d = NULL; + #####: 4146: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 4146: sArrayPushTiny(array, (smallt *) d); + #####: 4147: sArrayPushTiny(array, (smallt *) d); call 0 never executed - -: 4147: } - #####: 4148: break; - -: 4149: case S_DOUBLE: - #####: 4150: loop(arrayCount) { + -: 4148: } + #####: 4149: break; + -: 4150: case S_DOUBLE: + #####: 4151: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4151: D = (double *)(*data); - #####: 4152: *data += sizeof(double); - #####: 4153: Do = allocSDouble(*D); + #####: 4152: D = (double *)(*data); + #####: 4153: *data += sizeof(double); + #####: 4154: Do = allocSDouble(*D); call 0 never executed - #####: 4154: sArrayPushTiny(array, (smallt *) Do); + #####: 4155: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - -: 4155: } - #####: 4156: break; - -: 4157: case S_INT: - #####: 4158: loop(arrayCount) { + -: 4156: } + #####: 4157: break; + -: 4158: case S_INT: + #####: 4159: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4159: i64 v = varintToUint(data); + #####: 4160: i64 v = varintToUint(data); call 0 never executed - #####: 4160: v = (v >> 1) ^ ((v << 63) >> 63); - #####: 4161: io = allocSInt(v); + #####: 4161: v = (v >> 1) ^ ((v << 63) >> 63); + #####: 4162: io = allocSInt(v); call 0 never executed - #####: 4162: sArrayPushTiny(array, (smallt *) io); + #####: 4163: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 4163: } - #####: 4164: break; - -: 4165: case S_STRING: - #####: 4166: loop(arrayCount) { + -: 4164: } + #####: 4165: break; + -: 4166: case S_STRING: + #####: 4167: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4167: s = (char *)(*data); - #####: 4168: *data += strlen(s)+1; - #####: 4169: so = allocSStringTiny(s); + #####: 4168: s = (char *)(*data); + #####: 4169: *data += strlen(s)+1; + #####: 4170: so = allocSStringTiny(s); call 0 never executed - #####: 4170: sArrayPushTiny(array, (smallt *) so); + #####: 4171: sArrayPushTiny(array, (smallt *) so); call 0 never executed - -: 4171: } - #####: 4172: break; - -: 4173: case S_ARRAY: - #####: 4174: loop(arrayCount) { + -: 4172: } + #####: 4173: break; + -: 4174: case S_ARRAY: + #####: 4175: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4175: a = NULL; - #####: 4176: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 4176: a = NULL; + #####: 4177: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 4177: sArrayPushTiny(array, (smallt *) a); + #####: 4178: sArrayPushTiny(array, (smallt *) a); call 0 never executed - -: 4178: } - #####: 4179: break; - -: 4180: case S_BYTES: - #####: 4181: loop(arrayCount) { + -: 4179: } + #####: 4180: break; + -: 4181: case S_BYTES: + #####: 4182: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4182: B = allocSBytes(); + #####: 4183: B = allocSBytes(); call 0 never executed - #####: 4183: count = varintToUint((u8**)data); + #####: 4184: count = varintToUint((u8**)data); call 0 never executed - #####: 4184: sBytesPushBuffer(&B, data, count); + #####: 4185: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4185: *data += count; - #####: 4186: sArrayPushTiny(array, (smallt *) B); + #####: 4186: *data += count; + #####: 4187: sArrayPushTiny(array, (smallt *) B); call 0 never executed - -: 4187: } - #####: 4188: break; - -: 4189: case UNIFORM_DICT: - #####: 4190: loop(arrayCount) { + -: 4188: } + #####: 4189: break; + -: 4190: case UNIFORM_DICT: + #####: 4191: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4191: d = NULL; - #####: 4192: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 4192: d = NULL; + #####: 4193: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 4193: sArrayPushTiny(array, (smallt *) d); + #####: 4194: sArrayPushTiny(array, (smallt *) d); call 0 never executed - -: 4194: } - #####: 4195: break; - -: 4196: case UNIFORM_ARRAY: - #####: 4197: loop(arrayCount) { + -: 4195: } + #####: 4196: break; + -: 4197: case UNIFORM_ARRAY: + #####: 4198: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4198: a = NULL; - #####: 4199: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 4199: a = NULL; + #####: 4200: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 4200: sArrayPushTiny(array, (smallt *) a); + #####: 4201: sArrayPushTiny(array, (smallt *) a); call 0 never executed - -: 4201: } - #####: 4202: break; - -: 4203: } - -: 4204:} - -: 4205: + -: 4202: } + #####: 4203: break; + -: 4204: } + -: 4205:} + -: 4206: function deserialNetSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 4206:internal smallJsont* deserialNetSerialLevel2(smallJsont *self, smallBytest *data) { - -: 4207: - #####: 4208: if (!data or !data->B or !data->B->count) { + #####: 4207:internal smallJsont* deserialNetSerialLevel2(smallJsont *self, smallBytest *data) { + -: 4208: + #####: 4209: 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 - #####: 4209: ret self; - -: 4210: } - -: 4211: - #####: 4212: smallt *o = netDeserialLevel2(data->B); -call 0 never executed - -: 4213: - #####: 4214: if (!o) { -branch 0 never executed -branch 1 never executed - #####: 4215: ret self; - -: 4216: } - -: 4217: - #####: 4218: freeG(self); -call 0 never executed - -: 4219: - #####: 4220: setsoG(self, o); -call 0 never executed - -: 4221: - #####: 4222: ret self; - -: 4223:} - -: 4224: - -: 4225:// level 3 - -: 4226:// like level 2, elements of identical type in a row are packed - -: 4227: - -: 4228:/** - -: 4229: * deserializer top function - -: 4230: */ -function netDeserial called 77 returned 100% blocks executed 85% - 77: 4231:internal smallt* netDeserial(sBytest *obj) { - 77: 4232: smallt *r = NULL; - 77: 4233: double *D = NULL; - 77: 4234: char *s = NULL; - 77: 4235: sBytest *B = NULL; - -: 4236: uint32_t count; - 77: 4237: char *data = NULL; - 77: 4238: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; - -: 4239: - 77: 4240: switch(obj->data & 0xF) { + #####: 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) { branch 0 taken 1% branch 1 taken 1% branch 2 taken 31% branch 3 taken 1% -branch 4 taken 1% +branch 4 taken 3% branch 5 taken 1% branch 6 taken 31% branch 7 taken 0% -branch 8 taken 16% -branch 9 taken 16% +branch 8 taken 15% +branch 9 taken 15% branch 10 taken 0% - -: 4241: case S_UNDEFINED: - 1: 4242: r = (smallt *) allocSUndefined(); -call 0 returned 100% - 1: 4243: break; - -: 4244: case S_BOOL: - 1: 4245: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 returned 100% - 1: 4246: break; - -: 4247: case S_DICT: - 24: 4248: data = (char *)&(obj->data); - -: 4249: //debug - ctx.dbuf = (u8*) data; - 24: 4250: dictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 24: 4251: break; - -: 4252: case S_DOUBLE: - 1: 4253: data = &(obj->data)+1; - 1: 4254: D = (double *)data; - 1: 4255: r = (smallt *) allocSDouble(*D); -call 0 returned 100% - 1: 4256: break; - -: 4257: case S_INT: - 1: 4258: data = &(obj->data); - 1: 4259: i64 v = netTypeVarintToUint((u8**)&data); -call 0 returned 100% - 1: 4260: v = (v >> 1) ^ ((v << 63) >> 63); - 1: 4261: r = (smallt *) allocSInt(v); -call 0 returned 100% - 1: 4262: break; - -: 4263: case S_STRING: - 1: 4264: s = (char *)&(obj->data)+1; - 1: 4265: r = (smallt *) allocSStringTiny(s); -call 0 returned 100% - 1: 4266: break; - -: 4267: case S_ARRAY: - 24: 4268: data = (char *)&(obj->data); - -: 4269: //debug - ctx.dbuf = (u8*) data; - 24: 4270: arrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 24: 4271: break; - -: 4272: case S_BYTES: - #####: 4273: B = allocSBytes(); -call 0 never executed - #####: 4274: data = &(obj->data); - #####: 4275: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 4276: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 4277: r = (smallt *)B; - #####: 4278: break; - -: 4279: case UNIFORM_DICT: - 12: 4280: data = (char *)&(obj->data); - -: 4281: //debug - ctx.dbuf = (u8*) data; - 12: 4282: uniformDictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 12: 4283: break; - -: 4284: case UNIFORM_ARRAY: - 12: 4285: data = (char *)&(obj->data); - -: 4286: //debug - ctx.dbuf = (u8*) data; - 12: 4287: uniformArrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 12: 4288: break; - -: 4289: } - -: 4290: - 77: 4291: ret r; - -: 4292:} - -: 4293: - -: 4294:/** - -: 4295: * deserialize dictionary from data - -: 4296: * - -: 4297: * a new dictionary is allocated - -: 4298: * - -: 4299: * \param - -: 4300: * dict dictionary holding the elements - -: 4301: * data serialized dictionary - -: 4302: */ + -: 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: */ function dictNetDeserial called 54 returned 100% blocks executed 78% - 54: 4303:internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - 54: 4304: sUndefinedt *u = NULL; - 54: 4305: sBoolt *bo = NULL; - 54: 4306: double *D = NULL; - 54: 4307: sDoublet *Do = NULL; - 54: 4308: sDictt *d = NULL; - 54: 4309: sIntt *io = NULL; - 54: 4310: char *s = NULL; - 54: 4311: sStringt *so = NULL; - 54: 4312: sArrayt *a = NULL; - 54: 4313: sBytest *B = NULL; - -: 4314: uint32_t count; - -: 4315: uint32_t dictCount; - -: 4316: - 54: 4317: if (packed) { + 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) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 27: 4318: dictCount = varintToUint(data); + 27: 4319: dictCount = varintToUint(data); call 0 returned 100% - -: 4319: } - -: 4320: else { - 27: 4321: if (ctx->nibble == lowNbl) { + -: 4320: } + -: 4321: else { + 27: 4322: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 25: 4322: dictCount = netTypeVarintToUint(data); -call 0 returned 100% - -: 4323: } - -: 4324: else { - -: 4325: // high nibble - -: 4326: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; - -: 4327: #define readTypeInHighNbl\ - -: 4328: ctx->nibble = lowNbl;\ - -: 4329: if (ctx->nblAddr == *data)\ - -: 4330: /* data points to the type, next byte is count */\ - -: 4331: (*data)++ - 2: 4332: readTypeInHighNbl; + 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; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 2: 4333: dictCount = varintToUint(data); + 2: 4334: dictCount = varintToUint(data); call 0 returned 100% - -: 4334: } - -: 4335: } - -: 4336: - 54: 4337: if (!dictCount) { + -: 4335: } + -: 4336: } + -: 4337: + 54: 4338: if (!dictCount) { branch 0 taken 19% (fallthrough) branch 1 taken 81% - 10: 4338: *dict = allocSDict(); -call 0 returned 100% - 10: 4339: ret; - -: 4340: } - -: 4341: - 44: 4342: bool inPack = false; - -: 4343: u8 packedType; - -: 4344: size_t packCount; - 200: 4345: loop(dictCount) { + 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) { branch 0 taken 78% branch 1 taken 22% (fallthrough) - 156: 4346: char *key = (char*)*data; - 156: 4347: *data += strlen(key)+1; - -: 4348: char type; - 156: 4349: if (inPack) { + 156: 4347: char *key = (char*)*data; + 156: 4348: *data += strlen(key)+1; + -: 4349: char type; + 156: 4350: if (inPack) { branch 0 taken 24% (fallthrough) branch 1 taken 76% - 38: 4350: type = packedType; - -: 4351: } - -: 4352: else { - 118: 4353: if (ctx->nibble == lowNbl) { + 38: 4351: type = packedType; + -: 4352: } + -: 4353: else { + 118: 4354: if (ctx->nibble == lowNbl) { branch 0 taken 67% (fallthrough) branch 1 taken 33% - 79: 4354: type = (**data) & 0xF; - -: 4355: } - -: 4356: else { - -: 4357: // high nibble - 39: 4358: type = (*ctx->nblAddr) >> 4; - -: 4359: } - -: 4360: } - -: 4361: - 156: 4362: switch(type) { + 79: 4355: type = (**data) & 0xF; + -: 4356: } + -: 4357: else { + -: 4358: // high nibble + 39: 4359: type = (*ctx->nblAddr) >> 4; + -: 4360: } + -: 4361: } + -: 4362: + 156: 4363: switch(type) { branch 0 taken 17% branch 1 taken 20% branch 2 taken 1% @@ -6427,483 +6428,483 @@ branch 13 taken 0% branch 14 taken 3% branch 15 taken 3% branch 16 taken 0% - -: 4363: case S_UNDEFINED: - 26: 4364: if (ctx->nibble == lowNbl) { + -: 4364: case S_UNDEFINED: + 26: 4365: if (ctx->nibble == lowNbl) { branch 0 taken 92% (fallthrough) branch 1 taken 8% - -: 4365: #define readTypeOnly\ - -: 4366: ctx->nibble = highNbl;\ - -: 4367: ctx->nblAddr = *data;\ - -: 4368: (*data)++ - 24: 4369: readTypeOnly; - -: 4370: } - -: 4371: else { - -: 4372: // high nibble - 2: 4373: readTypeInHighNbl; + -: 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; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4374: } - 26: 4375: u = allocSUndefined(); + -: 4375: } + 26: 4376: u = allocSUndefined(); call 0 returned 100% - 26: 4376: sDictPushTiny(dict, key, (smallt *) u); + 26: 4377: sDictPushTiny(dict, key, (smallt *) u); call 0 returned 100% - 26: 4377: break; - -: 4378: case S_BOOL: - 31: 4379: if (!ctx->boolAddr) { + 26: 4378: break; + -: 4379: case S_BOOL: + 31: 4380: if (!ctx->boolAddr) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - -: 4380: // new packed bools - 5: 4381: if (ctx->nibble == lowNbl) { + -: 4381: // new packed bools + 5: 4382: if (ctx->nibble == lowNbl) { branch 0 taken 60% (fallthrough) branch 1 taken 40% - -: 4382: #define read4bPackedBool\ - -: 4383: ctx->boolShift = 5;\ - -: 4384: ctx->boolAddr = *data;\ - -: 4385: (*data)++ - 3: 4386: read4bPackedBool; - 3: 4387: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 returned 100% - -: 4388: } - -: 4389: else { - -: 4390: // high nibble - 2: 4391: readTypeInHighNbl; + -: 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; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4392: #define read8bPackedBool\ - -: 4393: ctx->boolShift = 1;\ - -: 4394: ctx->boolAddr = *data;\ - -: 4395: (*data)++ - 2: 4396: read8bPackedBool; - 2: 4397: bo = allocSBool((*ctx->boolAddr) & 0x1); -call 0 returned 100% - -: 4398: } - -: 4399: } - -: 4400: else { - -: 4401: // there was a bool before this one, read bits in nibbles - 26: 4402: if (ctx->nibble == lowNbl) { + -: 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) { branch 0 taken 58% (fallthrough) branch 1 taken 42% - 15: 4403: if (ctx->boolShift == 8) { + 15: 4404: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - 1: 4404: read4bPackedBool; - 1: 4405: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 returned 100% - -: 4406: } - -: 4407: else { - 14: 4408: readTypeOnly; - 14: 4409: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); -call 0 returned 100% - -: 4410: } - -: 4411: } - -: 4412: else { - -: 4413: // high nibble - 11: 4414: readTypeInHighNbl; + 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; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 11: 4415: if (ctx->boolShift == 8) { + 11: 4416: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - 2: 4416: read8bPackedBool; - 2: 4417: bo = allocSBool((*ctx->boolAddr) & 0x1); + 2: 4417: read8bPackedBool; + 2: 4418: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 4418: } - -: 4419: else { - -: 4420: // high nibble - 9: 4421: readTypeInHighNbl; + -: 4419: } + -: 4420: else { + -: 4421: // high nibble + 9: 4422: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 9: 4422: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + 9: 4423: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 4423: } - -: 4424: } - -: 4425: } - 31: 4426: sDictPushTiny(dict, key, (smallt *) bo); + -: 4424: } + -: 4425: } + -: 4426: } + 31: 4427: sDictPushTiny(dict, key, (smallt *) bo); call 0 returned 100% - 31: 4427: break; - -: 4428: case S_DICT: - 1: 4429: d = NULL; - 1: 4430: dictNetDeserial(&d, data, ctx, /*packed=*/false); + 31: 4428: break; + -: 4429: case S_DICT: + 1: 4430: d = NULL; + 1: 4431: dictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 1: 4431: sDictPushTiny(dict, key, (smallt *) d); + 1: 4432: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - 1: 4432: break; - -: 4433: case S_DOUBLE: - 2: 4434: if (ctx->nibble == lowNbl) { + 1: 4433: break; + -: 4434: case S_DOUBLE: + 2: 4435: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4435: readTypeOnly; - -: 4436: } - -: 4437: else { - -: 4438: // high nibble - 1: 4439: readTypeInHighNbl; + 1: 4436: readTypeOnly; + -: 4437: } + -: 4438: else { + -: 4439: // high nibble + 1: 4440: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4440: } - 2: 4441: D = (double *)(*data); - 2: 4442: *data += sizeof(double); - 2: 4443: Do = allocSDouble(*D); + -: 4441: } + 2: 4442: D = (double *)(*data); + 2: 4443: *data += sizeof(double); + 2: 4444: Do = allocSDouble(*D); call 0 returned 100% - 2: 4444: sDictPushTiny(dict, key, (smallt *) Do); + 2: 4445: sDictPushTiny(dict, key, (smallt *) Do); call 0 returned 100% - 2: 4445: break; - -: 4446: case S_INT: { - -: 4447: i64 v; - 24: 4448: if (ctx->nibble == lowNbl) { + 2: 4446: break; + -: 4447: case S_INT: { + -: 4448: i64 v; + 24: 4449: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 12: 4449: v = netTypeVarintToUint((u8**)data); + 12: 4450: v = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4450: } - -: 4451: else { - -: 4452: // high nibble - 12: 4453: readTypeInHighNbl; + -: 4451: } + -: 4452: else { + -: 4453: // high nibble + 12: 4454: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 12: 4454: v = varintToUint(data); + 12: 4455: v = varintToUint(data); call 0 returned 100% - -: 4455: } - 24: 4456: v = (v >> 1) ^ ((v << 63) >> 63); - 24: 4457: io = allocSInt(v); + -: 4456: } + 24: 4457: v = (v >> 1) ^ ((v << 63) >> 63); + 24: 4458: io = allocSInt(v); call 0 returned 100% - 24: 4458: sDictPushTiny(dict, key, (smallt *) io); + 24: 4459: sDictPushTiny(dict, key, (smallt *) io); call 0 returned 100% - -: 4459: } - 24: 4460: break; - -: 4461: case S_STRING: - 14: 4462: if (ctx->nibble == lowNbl) { + -: 4460: } + 24: 4461: break; + -: 4462: case S_STRING: + 14: 4463: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 13: 4463: readTypeOnly; - -: 4464: } - -: 4465: else { - -: 4466: // high nibble - 1: 4467: readTypeInHighNbl; + 13: 4464: readTypeOnly; + -: 4465: } + -: 4466: else { + -: 4467: // high nibble + 1: 4468: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4468: } - 14: 4469: s = (char *)(*data); - 14: 4470: *data += strlen(s)+1; - 14: 4471: so = allocSStringTiny(s); + -: 4469: } + 14: 4470: s = (char *)(*data); + 14: 4471: *data += strlen(s)+1; + 14: 4472: so = allocSStringTiny(s); call 0 returned 100% - 14: 4472: sDictPushTiny(dict, key, (smallt *) so); + 14: 4473: sDictPushTiny(dict, key, (smallt *) so); call 0 returned 100% - 14: 4473: break; - -: 4474: case S_ARRAY: - 1: 4475: a = NULL; - 1: 4476: arrayNetDeserial(&a, data, ctx, /*packed=*/false); + 14: 4474: break; + -: 4475: case S_ARRAY: + 1: 4476: a = NULL; + 1: 4477: arrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 1: 4477: sDictPushTiny(dict, key, (smallt *) a); + 1: 4478: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - 1: 4478: break; - -: 4479: case S_BYTES: - #####: 4480: B = allocSBytes(); + 1: 4479: break; + -: 4480: case S_BYTES: + #####: 4481: B = allocSBytes(); call 0 never executed - #####: 4481: if (ctx->nibble == lowNbl) { + #####: 4482: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4482: count = netTypeVarintToUint((u8**)data); + #####: 4483: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4483: } - -: 4484: else { - -: 4485: // high nibble - #####: 4486: readTypeInHighNbl; + -: 4484: } + -: 4485: else { + -: 4486: // high nibble + #####: 4487: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4487: count = varintToUint((u8**)data); + #####: 4488: count = varintToUint((u8**)data); call 0 never executed - -: 4488: } - #####: 4489: sBytesPushBuffer(&B, data, count); + -: 4489: } + #####: 4490: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4490: *data += count; - #####: 4491: sDictPushTiny(dict, key, (smallt *) B); + #####: 4491: *data += count; + #####: 4492: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - #####: 4492: break; - -: 4493: case PK_DICT: - 15: 4494: if (!inPack) { + #####: 4493: break; + -: 4494: case PK_DICT: + 15: 4495: if (!inPack) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - 3: 4495: inPack = true; - 3: 4496: if (ctx->nibble == lowNbl) { + 3: 4496: inPack = true; + 3: 4497: if (ctx->nibble == lowNbl) { branch 0 taken 67% (fallthrough) branch 1 taken 33% - 2: 4497: packCount = netTypeVarintToUint((u8**)data); + 2: 4498: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4498: } - -: 4499: else { - -: 4500: // high nibble - 1: 4501: readTypeInHighNbl; + -: 4499: } + -: 4500: else { + -: 4501: // high nibble + 1: 4502: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4502: packCount = varintToUint((u8**)data); + 1: 4503: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4503: } - 3: 4504: packedType = PK_DICT; - -: 4505: } - -: 4506: - 15: 4507: d = NULL; - 15: 4508: dictNetDeserial(&d, data, ctx, /*packed=*/true); + -: 4504: } + 3: 4505: packedType = PK_DICT; + -: 4506: } + -: 4507: + 15: 4508: d = NULL; + 15: 4509: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 15: 4509: sDictPushTiny(dict, key, (smallt *) d); + 15: 4510: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - -: 4510: // stop unpacking when packCount == 0 - 15: 4511: packCount--; - 15: 4512: if (!packCount) inPack = false; + -: 4511: // stop unpacking when packCount == 0 + 15: 4512: packCount--; + 15: 4513: if (!packCount) inPack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - 15: 4513: break; - -: 4514: case PK_DOUBLE: - 10: 4515: if (!inPack) { + 15: 4514: break; + -: 4515: case PK_DOUBLE: + 10: 4516: if (!inPack) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - 2: 4516: inPack = true; - 2: 4517: if (ctx->nibble == lowNbl) { + 2: 4517: inPack = true; + 2: 4518: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4518: packCount = netTypeVarintToUint((u8**)data); + 1: 4519: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4519: } - -: 4520: else { - -: 4521: // high nibble - 1: 4522: readTypeInHighNbl; + -: 4520: } + -: 4521: else { + -: 4522: // high nibble + 1: 4523: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4523: packCount = varintToUint((u8**)data); + 1: 4524: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4524: } - 2: 4525: packedType = PK_DOUBLE; - -: 4526: } - -: 4527: - 10: 4528: D = (double *)(*data); - 10: 4529: *data += sizeof(double); - 10: 4530: Do = allocSDouble(*D); + -: 4525: } + 2: 4526: packedType = PK_DOUBLE; + -: 4527: } + -: 4528: + 10: 4529: D = (double *)(*data); + 10: 4530: *data += sizeof(double); + 10: 4531: Do = allocSDouble(*D); call 0 returned 100% - 10: 4531: sDictPushTiny(dict, key, (smallt *) Do); + 10: 4532: sDictPushTiny(dict, key, (smallt *) Do); call 0 returned 100% - -: 4532: // stop unpacking when packCount == 0 - 10: 4533: packCount--; - 10: 4534: if (!packCount) inPack = false; + -: 4533: // stop unpacking when packCount == 0 + 10: 4534: packCount--; + 10: 4535: if (!packCount) inPack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - 10: 4535: break; - -: 4536: case PK_INT: - 8: 4537: if (!inPack) { + 10: 4536: break; + -: 4537: case PK_INT: + 8: 4538: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4538: inPack = true; - 2: 4539: if (ctx->nibble == lowNbl) { + 2: 4539: inPack = true; + 2: 4540: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4540: packCount = netTypeVarintToUint((u8**)data); + 1: 4541: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4541: } - -: 4542: else { - -: 4543: // high nibble - 1: 4544: readTypeInHighNbl; + -: 4542: } + -: 4543: else { + -: 4544: // high nibble + 1: 4545: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4545: packCount = varintToUint((u8**)data); + 1: 4546: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4546: } - 2: 4547: packedType = PK_INT; - -: 4548: } - -: 4549: - 8: 4550: i64 v = varintToUint(data); + -: 4547: } + 2: 4548: packedType = PK_INT; + -: 4549: } + -: 4550: + 8: 4551: i64 v = varintToUint(data); call 0 returned 100% - 8: 4551: v = (v >> 1) ^ ((v << 63) >> 63); - 8: 4552: io = allocSInt(v); + 8: 4552: v = (v >> 1) ^ ((v << 63) >> 63); + 8: 4553: io = allocSInt(v); call 0 returned 100% - 8: 4553: sDictPushTiny(dict, key, (smallt *) io); + 8: 4554: sDictPushTiny(dict, key, (smallt *) io); call 0 returned 100% - -: 4554: // stop unpacking when packCount == 0 - 8: 4555: packCount--; - 8: 4556: if (!packCount) inPack = false; + -: 4555: // stop unpacking when packCount == 0 + 8: 4556: packCount--; + 8: 4557: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4557: break; - -: 4558: case PK_STRING: - 8: 4559: if (!inPack) { + 8: 4558: break; + -: 4559: case PK_STRING: + 8: 4560: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4560: inPack = true; - 2: 4561: if (ctx->nibble == lowNbl) { + 2: 4561: inPack = true; + 2: 4562: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4562: packCount = netTypeVarintToUint((u8**)data); + 1: 4563: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4563: } - -: 4564: else { - -: 4565: // high nibble - 1: 4566: readTypeInHighNbl; + -: 4564: } + -: 4565: else { + -: 4566: // high nibble + 1: 4567: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4567: packCount = varintToUint((u8**)data); + 1: 4568: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4568: } - 2: 4569: packedType = PK_STRING; - -: 4570: } - -: 4571: - 8: 4572: s = (char *)(*data); - 8: 4573: *data += strlen(s)+1; - 8: 4574: so = allocSStringTiny(s); + -: 4569: } + 2: 4570: packedType = PK_STRING; + -: 4571: } + -: 4572: + 8: 4573: s = (char *)(*data); + 8: 4574: *data += strlen(s)+1; + 8: 4575: so = allocSStringTiny(s); call 0 returned 100% - 8: 4575: sDictPushTiny(dict, key, (smallt *) so); + 8: 4576: sDictPushTiny(dict, key, (smallt *) so); call 0 returned 100% - -: 4576: // stop unpacking when packCount == 0 - 8: 4577: packCount--; - 8: 4578: if (!packCount) inPack = false; + -: 4577: // stop unpacking when packCount == 0 + 8: 4578: packCount--; + 8: 4579: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4579: break; - -: 4580: case PK_ARRAY: - 8: 4581: if (!inPack) { + 8: 4580: break; + -: 4581: case PK_ARRAY: + 8: 4582: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4582: inPack = true; - 2: 4583: if (ctx->nibble == lowNbl) { + 2: 4583: inPack = true; + 2: 4584: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4584: packCount = netTypeVarintToUint((u8**)data); + 1: 4585: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4585: } - -: 4586: else { - -: 4587: // high nibble - 1: 4588: readTypeInHighNbl; + -: 4586: } + -: 4587: else { + -: 4588: // high nibble + 1: 4589: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4589: packCount = varintToUint((u8**)data); + 1: 4590: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4590: } - 2: 4591: packedType = PK_ARRAY; - -: 4592: } - -: 4593: - 8: 4594: a = NULL; - 8: 4595: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + -: 4591: } + 2: 4592: packedType = PK_ARRAY; + -: 4593: } + -: 4594: + 8: 4595: a = NULL; + 8: 4596: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 8: 4596: sDictPushTiny(dict, key, (smallt *) a); + 8: 4597: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - -: 4597: // stop unpacking when packCount == 0 - 8: 4598: packCount--; - 8: 4599: if (!packCount) inPack = false; + -: 4598: // stop unpacking when packCount == 0 + 8: 4599: packCount--; + 8: 4600: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4600: break; - -: 4601: case PK_BYTES: - #####: 4602: if (!inPack) { + 8: 4601: break; + -: 4602: case PK_BYTES: + #####: 4603: if (!inPack) { branch 0 never executed branch 1 never executed - #####: 4603: inPack = true; - #####: 4604: if (ctx->nibble == lowNbl) { + #####: 4604: inPack = true; + #####: 4605: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4605: packCount = netTypeVarintToUint((u8**)data); + #####: 4606: packCount = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4606: } - -: 4607: else { - -: 4608: // high nibble - #####: 4609: readTypeInHighNbl; + -: 4607: } + -: 4608: else { + -: 4609: // high nibble + #####: 4610: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4610: packCount = varintToUint((u8**)data); + #####: 4611: packCount = varintToUint((u8**)data); call 0 never executed - -: 4611: } - #####: 4612: packedType = PK_BYTES; - -: 4613: } - -: 4614: - #####: 4615: B = allocSBytes(); + -: 4612: } + #####: 4613: packedType = PK_BYTES; + -: 4614: } + -: 4615: + #####: 4616: B = allocSBytes(); call 0 never executed - #####: 4616: count = varintToUint((u8**)data); + #####: 4617: count = varintToUint((u8**)data); call 0 never executed - #####: 4617: sBytesPushBuffer(&B, data, count); + #####: 4618: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4618: *data += count; - #####: 4619: sDictPushTiny(dict, key, (smallt *) B); + #####: 4619: *data += count; + #####: 4620: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - -: 4620: // stop unpacking when packCount == 0 - #####: 4621: packCount--; - #####: 4622: if (!packCount) inPack = false; + -: 4621: // stop unpacking when packCount == 0 + #####: 4622: packCount--; + #####: 4623: if (!packCount) inPack = false; branch 0 never executed branch 1 never executed - #####: 4623: break; - -: 4624: case UNIFORM_DICT: - 4: 4625: d = NULL; - 4: 4626: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); + #####: 4624: break; + -: 4625: case UNIFORM_DICT: + 4: 4626: d = NULL; + 4: 4627: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 4: 4627: sDictPushTiny(dict, key, (smallt *) d); + 4: 4628: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - 4: 4628: break; - -: 4629: case UNIFORM_ARRAY: - 4: 4630: a = NULL; - 4: 4631: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); + 4: 4629: break; + -: 4630: case UNIFORM_ARRAY: + 4: 4631: a = NULL; + 4: 4632: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 4: 4632: sDictPushTiny(dict, key, (smallt *) a); + 4: 4633: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - 4: 4633: break; - -: 4634: } - -: 4635: } - -: 4636:} - -: 4637: - -: 4638:/** - -: 4639: * deserialize dictionary from data - -: 4640: * - -: 4641: * a new dictionary is allocated - -: 4642: * - -: 4643: * \param - -: 4644: * dict dictionary holding the elements - -: 4645: * data serialized dictionary - -: 4646: */ + 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: */ function uniformDictNetDeserial called 25 returned 100% blocks executed 87% - 25: 4647:internal void uniformDictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - 25: 4648: sUndefinedt *u = NULL; - 25: 4649: sBoolt *bo = NULL; - 25: 4650: double *D = NULL; - 25: 4651: sDoublet *Do = NULL; - 25: 4652: sDictt *d = NULL; - 25: 4653: sIntt *io = NULL; - 25: 4654: char *s = NULL; - 25: 4655: sStringt *so = NULL; - 25: 4656: sArrayt *a = NULL; - 25: 4657: sBytest *B = NULL; - -: 4658: uint32_t count; - -: 4659: uint32_t dictCount; - -: 4660: u8 type; - -: 4661: - 25: 4662: if (packed) { + 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) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - 4: 4663: type = (**data) & 0xF; - 4: 4664: dictCount = netTypeVarintToUint(data); + 4: 4664: type = (**data) & 0xF; + 4: 4665: dictCount = netTypeVarintToUint(data); call 0 returned 100% - -: 4665: } - -: 4666: else { - 21: 4667: if (ctx->nibble == lowNbl) { + -: 4666: } + -: 4667: else { + 21: 4668: if (ctx->nibble == lowNbl) { branch 0 taken 90% (fallthrough) branch 1 taken 10% - 19: 4668: type = (**data) >> 4; - 19: 4669: (*data)++; - 19: 4670: dictCount = varintToUint(data); + 19: 4669: type = (**data) >> 4; + 19: 4670: (*data)++; + 19: 4671: dictCount = varintToUint(data); call 0 returned 100% - -: 4671: } - -: 4672: else { - 2: 4673: readTypeInHighNbl; + -: 4672: } + -: 4673: else { + 2: 4674: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 2: 4674: type = (**data) & 0xF; - 2: 4675: dictCount = netTypeVarintToUint(data); + 2: 4675: type = (**data) & 0xF; + 2: 4676: dictCount = netTypeVarintToUint(data); call 0 returned 100% - -: 4676: } - -: 4677: } - -: 4678: - 25: 4679: if (!dictCount) { + -: 4677: } + -: 4678: } + -: 4679: + 25: 4680: if (!dictCount) { branch 0 taken 4% (fallthrough) branch 1 taken 96% - 1: 4680: *dict = allocSDict(); + 1: 4681: *dict = allocSDict(); call 0 returned 100% - 1: 4681: ret; - -: 4682: } - -: 4683: + 1: 4682: ret; + -: 4683: } -: 4684: - 24: 4685: switch(type) { + -: 4685: + 24: 4686: switch(type) { branch 0 taken 4% branch 1 taken 17% branch 2 taken 4% @@ -6915,247 +6916,247 @@ branch 7 taken 0% branch 8 taken 4% branch 9 taken 4% branch 10 taken 0% - -: 4686: case S_UNDEFINED: - 7: 4687: loop(dictCount) { + -: 4687: case S_UNDEFINED: + 7: 4688: loop(dictCount) { branch 0 taken 86% branch 1 taken 14% (fallthrough) - 6: 4688: char *key = (char*)*data; - 6: 4689: *data += strlen(key)+1; - 6: 4690: u = allocSUndefined(); + 6: 4689: char *key = (char*)*data; + 6: 4690: *data += strlen(key)+1; + 6: 4691: u = allocSUndefined(); call 0 returned 100% - 6: 4691: sDictPushTiny(dict, key, (smallt *) u); + 6: 4692: sDictPushTiny(dict, key, (smallt *) u); call 0 returned 100% - -: 4692: } - 1: 4693: break; - -: 4694: case S_BOOL: - 19: 4695: loop(dictCount) { + -: 4693: } + 1: 4694: break; + -: 4695: case S_BOOL: + 19: 4696: loop(dictCount) { branch 0 taken 79% branch 1 taken 21% (fallthrough) - 15: 4696: char *key = (char*)*data; - 15: 4697: *data += strlen(key)+1; - 15: 4698: if (!ctx->boolAddr) { + 15: 4697: char *key = (char*)*data; + 15: 4698: *data += strlen(key)+1; + 15: 4699: if (!ctx->boolAddr) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - 3: 4699: read8bPackedBool; - 3: 4700: ctx->boolShift = 0; - -: 4701: } - 15: 4702: if (ctx->boolShift == 8) { + 3: 4700: read8bPackedBool; + 3: 4701: ctx->boolShift = 0; + -: 4702: } + 15: 4703: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - 1: 4703: readTypeInHighNbl; + 1: 4704: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4704: read8bPackedBool; - 1: 4705: bo = allocSBool((*ctx->boolAddr) & 0x1); + 1: 4705: read8bPackedBool; + 1: 4706: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 4706: } - -: 4707: else { - -: 4708: // high nibble - 14: 4709: readTypeInHighNbl; + -: 4707: } + -: 4708: else { + -: 4709: // high nibble + 14: 4710: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 14: 4710: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + 14: 4711: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 4711: } - 15: 4712: sDictPushTiny(dict, key, (smallt *) bo); + -: 4712: } + 15: 4713: sDictPushTiny(dict, key, (smallt *) bo); call 0 returned 100% - -: 4713: } - 4: 4714: break; - -: 4715: case S_DICT: - 3: 4716: loop(dictCount) { + -: 4714: } + 4: 4715: break; + -: 4716: case S_DICT: + 3: 4717: loop(dictCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 4717: char *key = (char*)*data; - 2: 4718: *data += strlen(key)+1; - 2: 4719: d = NULL; - 2: 4720: dictNetDeserial(&d, data, ctx, /*packed=*/true); + 2: 4718: char *key = (char*)*data; + 2: 4719: *data += strlen(key)+1; + 2: 4720: d = NULL; + 2: 4721: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 2: 4721: sDictPushTiny(dict, key, (smallt *) d); + 2: 4722: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - -: 4722: } - 1: 4723: break; - -: 4724: case S_DOUBLE: - 4: 4725: loop(dictCount) { + -: 4723: } + 1: 4724: break; + -: 4725: case S_DOUBLE: + 4: 4726: loop(dictCount) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 4726: char *key = (char*)*data; - 3: 4727: *data += strlen(key)+1; - 3: 4728: D = (double *)(*data); - 3: 4729: *data += sizeof(double); - 3: 4730: Do = allocSDouble(*D); -call 0 returned 100% - 3: 4731: sDictPushTiny(dict, key, (smallt *) Do); -call 0 returned 100% - -: 4732: } - 1: 4733: break; - -: 4734: case S_INT: - 21: 4735: loop(dictCount) { + 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) { branch 0 taken 57% branch 1 taken 43% (fallthrough) - 12: 4736: char *key = (char*)*data; - 12: 4737: *data += strlen(key)+1; - 12: 4738: i64 v = varintToUint(data); + 12: 4737: char *key = (char*)*data; + 12: 4738: *data += strlen(key)+1; + 12: 4739: i64 v = varintToUint(data); call 0 returned 100% - 12: 4739: v = (v >> 1) ^ ((v << 63) >> 63); - 12: 4740: io = allocSInt(v); + 12: 4740: v = (v >> 1) ^ ((v << 63) >> 63); + 12: 4741: io = allocSInt(v); call 0 returned 100% - 12: 4741: sDictPushTiny(dict, key, (smallt *) io); + 12: 4742: sDictPushTiny(dict, key, (smallt *) io); call 0 returned 100% - -: 4742: } - 9: 4743: break; - -: 4744: case S_STRING: - 16: 4745: loop(dictCount) { + -: 4743: } + 9: 4744: break; + -: 4745: case S_STRING: + 16: 4746: loop(dictCount) { branch 0 taken 69% branch 1 taken 31% (fallthrough) - 11: 4746: char *key = (char*)*data; - 11: 4747: *data += strlen(key)+1; - 11: 4748: s = (char *)(*data); - 11: 4749: *data += strlen(s)+1; - 11: 4750: so = allocSStringTiny(s); -call 0 returned 100% - 11: 4751: sDictPushTiny(dict, key, (smallt *) so); -call 0 returned 100% - -: 4752: } - 5: 4753: break; - -: 4754: case S_ARRAY: - 2: 4755: loop(dictCount) { + 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) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 1: 4756: char *key = (char*)*data; - 1: 4757: *data += strlen(key)+1; - 1: 4758: a = NULL; - 1: 4759: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + 1: 4757: char *key = (char*)*data; + 1: 4758: *data += strlen(key)+1; + 1: 4759: a = NULL; + 1: 4760: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 1: 4760: sDictPushTiny(dict, key, (smallt *) a); + 1: 4761: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - -: 4761: } - 1: 4762: break; - -: 4763: case S_BYTES: - #####: 4764: loop(dictCount) { + -: 4762: } + 1: 4763: break; + -: 4764: case S_BYTES: + #####: 4765: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 4765: char *key = (char*)*data; - #####: 4766: *data += strlen(key)+1; - #####: 4767: B = allocSBytes(); + #####: 4766: char *key = (char*)*data; + #####: 4767: *data += strlen(key)+1; + #####: 4768: B = allocSBytes(); call 0 never executed - #####: 4768: count = varintToUint((u8**)data); + #####: 4769: count = varintToUint((u8**)data); call 0 never executed - #####: 4769: sBytesPushBuffer(&B, data, count); + #####: 4770: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4770: *data += count; - #####: 4771: sDictPushTiny(dict, key, (smallt *) B); + #####: 4771: *data += count; + #####: 4772: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - -: 4772: } - #####: 4773: break; - -: 4774: case UNIFORM_DICT: - 3: 4775: loop(dictCount) { + -: 4773: } + #####: 4774: break; + -: 4775: case UNIFORM_DICT: + 3: 4776: loop(dictCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 4776: char *key = (char*)*data; - 2: 4777: *data += strlen(key)+1; - 2: 4778: d = NULL; - 2: 4779: uniformDictNetDeserial(&d, data, ctx, /*packed=*/true); + 2: 4777: char *key = (char*)*data; + 2: 4778: *data += strlen(key)+1; + 2: 4779: d = NULL; + 2: 4780: uniformDictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 2: 4780: sDictPushTiny(dict, key, (smallt *) d); + 2: 4781: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - -: 4781: } - 1: 4782: break; - -: 4783: case UNIFORM_ARRAY: - 2: 4784: loop(dictCount) { + -: 4782: } + 1: 4783: break; + -: 4784: case UNIFORM_ARRAY: + 2: 4785: loop(dictCount) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 1: 4785: char *key = (char*)*data; - 1: 4786: *data += strlen(key)+1; - 1: 4787: a = NULL; - 1: 4788: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/true); -call 0 returned 100% - 1: 4789: sDictPushTiny(dict, key, (smallt *) a); -call 0 returned 100% - -: 4790: } - 1: 4791: break; - -: 4792: } - -: 4793:} - -: 4794: - -: 4795:/** - -: 4796: * deserialize array from data - -: 4797: * - -: 4798: * a new array is allocated - -: 4799: * - -: 4800: * \param - -: 4801: * array holding the elements - -: 4802: * data serialized dictionary - -: 4803: */ + 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: */ function arrayNetDeserial called 49 returned 100% blocks executed 78% - 49: 4804:internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - 49: 4805: sUndefinedt *u = NULL; - 49: 4806: sBoolt *bo = NULL; - 49: 4807: double *D = NULL; - 49: 4808: sDoublet *Do = NULL; - 49: 4809: sDictt *d = NULL; - 49: 4810: sIntt *io = NULL; - 49: 4811: char *s = NULL; - 49: 4812: sStringt *so = NULL; - 49: 4813: sArrayt *a = NULL; - 49: 4814: sBytest *B = NULL; - -: 4815: uint32_t count; - -: 4816: uint32_t arrayCount; - -: 4817: - 49: 4818: if (packed) { + 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) { branch 0 taken 45% (fallthrough) branch 1 taken 55% - 22: 4819: arrayCount = varintToUint(data); + 22: 4820: arrayCount = varintToUint(data); call 0 returned 100% - -: 4820: } - -: 4821: else { - 27: 4822: if (ctx->nibble == lowNbl) { + -: 4821: } + -: 4822: else { + 27: 4823: if (ctx->nibble == lowNbl) { branch 0 taken 96% (fallthrough) branch 1 taken 4% - 26: 4823: arrayCount = netTypeVarintToUint(data); + 26: 4824: arrayCount = netTypeVarintToUint(data); call 0 returned 100% - -: 4824: } - -: 4825: else { - -: 4826: // high nibble - 1: 4827: readTypeInHighNbl; + -: 4825: } + -: 4826: else { + -: 4827: // high nibble + 1: 4828: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4828: arrayCount = varintToUint(data); + 1: 4829: arrayCount = varintToUint(data); call 0 returned 100% - -: 4829: } - -: 4830: } - -: 4831: - 49: 4832: if (!arrayCount) { + -: 4830: } + -: 4831: } + -: 4832: + 49: 4833: if (!arrayCount) { branch 0 taken 4% (fallthrough) branch 1 taken 96% - 2: 4833: *array = allocSArray();; -call 0 returned 100% - 2: 4834: ret; - -: 4835: } - -: 4836: - 47: 4837: bool inPack = false; - -: 4838: u8 packedType; - -: 4839: size_t packCount; - 201: 4840: loop(arrayCount) { + 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) { branch 0 taken 77% branch 1 taken 23% (fallthrough) - -: 4841: char type; - 154: 4842: if (inPack) { + -: 4842: char type; + 154: 4843: if (inPack) { branch 0 taken 19% (fallthrough) branch 1 taken 81% - 30: 4843: type = packedType; - -: 4844: } - -: 4845: else { - 124: 4846: if (ctx->nibble == lowNbl) { + 30: 4844: type = packedType; + -: 4845: } + -: 4846: else { + 124: 4847: if (ctx->nibble == lowNbl) { branch 0 taken 72% (fallthrough) branch 1 taken 28% - 89: 4847: type = (**data) & 0xF; - -: 4848: } - -: 4849: else { - -: 4850: // high nibble - 35: 4851: type = (*ctx->nblAddr) >> 4; - -: 4852: } - -: 4853: } - -: 4854: - 154: 4855: switch(type) { + 89: 4848: type = (**data) & 0xF; + -: 4849: } + -: 4850: else { + -: 4851: // high nibble + 35: 4852: type = (*ctx->nblAddr) >> 4; + -: 4853: } + -: 4854: } + -: 4855: + 154: 4856: switch(type) { branch 0 taken 18% branch 1 taken 22% branch 2 taken 1% @@ -7173,457 +7174,457 @@ branch 13 taken 0% branch 14 taken 3% branch 15 taken 4% branch 16 taken 0% - -: 4856: case S_UNDEFINED: - 28: 4857: if (ctx->nibble == lowNbl) { + -: 4857: case S_UNDEFINED: + 28: 4858: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 26: 4858: readTypeOnly; - -: 4859: } - -: 4860: else { - -: 4861: // high nibble - 2: 4862: readTypeInHighNbl; + 26: 4859: readTypeOnly; + -: 4860: } + -: 4861: else { + -: 4862: // high nibble + 2: 4863: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4863: } - 28: 4864: u = allocSUndefined(); + -: 4864: } + 28: 4865: u = allocSUndefined(); call 0 returned 100% - 28: 4865: sArrayPushTiny(array, (smallt *) u); + 28: 4866: sArrayPushTiny(array, (smallt *) u); call 0 returned 100% - 28: 4866: break; - -: 4867: case S_BOOL: - 34: 4868: if (!ctx->boolAddr) { + 28: 4867: break; + -: 4868: case S_BOOL: + 34: 4869: if (!ctx->boolAddr) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 4869: // new packed bools - 6: 4870: if (ctx->nibble == lowNbl) { + -: 4870: // new packed bools + 6: 4871: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 3: 4871: read4bPackedBool; - 3: 4872: bo = allocSBool((*ctx->boolAddr) & 0x10); + 3: 4872: read4bPackedBool; + 3: 4873: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 returned 100% - -: 4873: } - -: 4874: else { - -: 4875: // high nibble - 3: 4876: readTypeInHighNbl; + -: 4874: } + -: 4875: else { + -: 4876: // high nibble + 3: 4877: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 3: 4877: read8bPackedBool; - 3: 4878: bo = allocSBool((*ctx->boolAddr) & 0x1); -call 0 returned 100% - -: 4879: } - -: 4880: } - -: 4881: else { - -: 4882: // there was a bool before this one, read bits in nibbles - 28: 4883: if (ctx->nibble == lowNbl) { + 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) { branch 0 taken 61% (fallthrough) branch 1 taken 39% - 17: 4884: if (ctx->boolShift == 8) { + 17: 4885: if (ctx->boolShift == 8) { branch 0 taken 12% (fallthrough) branch 1 taken 88% - 2: 4885: read4bPackedBool; - 2: 4886: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 returned 100% - -: 4887: } - -: 4888: else { - 15: 4889: readTypeOnly; - 15: 4890: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); -call 0 returned 100% - -: 4891: } - -: 4892: } - -: 4893: else { - -: 4894: // high nibble - 11: 4895: readTypeInHighNbl; + 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; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 11: 4896: if (ctx->boolShift == 8) { + 11: 4897: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - 2: 4897: read8bPackedBool; - 2: 4898: bo = allocSBool((*ctx->boolAddr) & 0x1); + 2: 4898: read8bPackedBool; + 2: 4899: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 4899: } - -: 4900: else { - 9: 4901: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 4900: } + -: 4901: else { + 9: 4902: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 4902: } - -: 4903: } - -: 4904: } - 34: 4905: sArrayPushTiny(array, (smallt *) bo); + -: 4903: } + -: 4904: } + -: 4905: } + 34: 4906: sArrayPushTiny(array, (smallt *) bo); call 0 returned 100% - 34: 4906: break; - -: 4907: case S_DICT: - 2: 4908: d = NULL; - 2: 4909: dictNetDeserial(&d, data, ctx, /*packed=*/false); + 34: 4907: break; + -: 4908: case S_DICT: + 2: 4909: d = NULL; + 2: 4910: dictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 2: 4910: sArrayPushTiny(array, (smallt *) d); + 2: 4911: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - 2: 4911: break; - -: 4912: case S_DOUBLE: - 2: 4913: if (ctx->nibble == lowNbl) { + 2: 4912: break; + -: 4913: case S_DOUBLE: + 2: 4914: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4914: readTypeOnly; - -: 4915: } - -: 4916: else { - -: 4917: // high nibble - 1: 4918: readTypeInHighNbl; + 1: 4915: readTypeOnly; + -: 4916: } + -: 4917: else { + -: 4918: // high nibble + 1: 4919: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4919: } - 2: 4920: D = (double *)(*data); - 2: 4921: *data += sizeof(double); - 2: 4922: Do = allocSDouble(*D); + -: 4920: } + 2: 4921: D = (double *)(*data); + 2: 4922: *data += sizeof(double); + 2: 4923: Do = allocSDouble(*D); call 0 returned 100% - 2: 4923: sArrayPushTiny(array, (smallt *) Do); + 2: 4924: sArrayPushTiny(array, (smallt *) Do); call 0 returned 100% - 2: 4924: break; - -: 4925: case S_INT: { - -: 4926: i64 v; - 22: 4927: if (ctx->nibble == lowNbl) { + 2: 4925: break; + -: 4926: case S_INT: { + -: 4927: i64 v; + 22: 4928: if (ctx->nibble == lowNbl) { branch 0 taken 82% (fallthrough) branch 1 taken 18% - 18: 4928: v = netTypeVarintToUint((u8**)data); + 18: 4929: v = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4929: } - -: 4930: else { - -: 4931: // high nibble - 4: 4932: readTypeInHighNbl; + -: 4930: } + -: 4931: else { + -: 4932: // high nibble + 4: 4933: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 4: 4933: v = varintToUint(data); + 4: 4934: v = varintToUint(data); call 0 returned 100% - -: 4934: } - 22: 4935: v = (v >> 1) ^ ((v << 63) >> 63); - 22: 4936: io = allocSInt(v); + -: 4935: } + 22: 4936: v = (v >> 1) ^ ((v << 63) >> 63); + 22: 4937: io = allocSInt(v); call 0 returned 100% - 22: 4937: sArrayPushTiny(array, (smallt *) io); + 22: 4938: sArrayPushTiny(array, (smallt *) io); call 0 returned 100% - -: 4938: } - 22: 4939: break; - -: 4940: case S_STRING: - 13: 4941: if (ctx->nibble == lowNbl) { + -: 4939: } + 22: 4940: break; + -: 4941: case S_STRING: + 13: 4942: if (ctx->nibble == lowNbl) { branch 0 taken 69% (fallthrough) branch 1 taken 31% - 9: 4942: readTypeOnly; - -: 4943: } - -: 4944: else { - -: 4945: // high nibble - 4: 4946: readTypeInHighNbl; + 9: 4943: readTypeOnly; + -: 4944: } + -: 4945: else { + -: 4946: // high nibble + 4: 4947: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4947: } - 13: 4948: s = (char *)(*data); - 13: 4949: *data += strlen(s)+1; - 13: 4950: so = allocSStringTiny(s); + -: 4948: } + 13: 4949: s = (char *)(*data); + 13: 4950: *data += strlen(s)+1; + 13: 4951: so = allocSStringTiny(s); call 0 returned 100% - 13: 4951: sArrayPushTiny(array, (smallt *) so); + 13: 4952: sArrayPushTiny(array, (smallt *) so); call 0 returned 100% - 13: 4952: break; - -: 4953: case S_ARRAY: - 2: 4954: a = NULL; - 2: 4955: arrayNetDeserial(&a, data, ctx, /*packed=*/false); + 13: 4953: break; + -: 4954: case S_ARRAY: + 2: 4955: a = NULL; + 2: 4956: arrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 2: 4956: sArrayPushTiny(array, (smallt *) a); + 2: 4957: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - 2: 4957: break; - -: 4958: case S_BYTES: - #####: 4959: B = allocSBytes(); + 2: 4958: break; + -: 4959: case S_BYTES: + #####: 4960: B = allocSBytes(); call 0 never executed - #####: 4960: if (ctx->nibble == lowNbl) { + #####: 4961: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4961: count = netTypeVarintToUint((u8**)data); + #####: 4962: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4962: } - -: 4963: else { - -: 4964: // high nibble - #####: 4965: readTypeInHighNbl; + -: 4963: } + -: 4964: else { + -: 4965: // high nibble + #####: 4966: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4966: count = varintToUint((u8**)data); + #####: 4967: count = varintToUint((u8**)data); call 0 never executed - -: 4967: } - #####: 4968: sBytesPushBuffer(&B, data, count); + -: 4968: } + #####: 4969: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 4969: *data += count; - #####: 4970: sArrayPushTiny(array, (smallt *) B); + #####: 4970: *data += count; + #####: 4971: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 4971: break; - -: 4972: case PK_DICT: - 8: 4973: if (!inPack) { + #####: 4972: break; + -: 4973: case PK_DICT: + 8: 4974: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4974: inPack = true; - 2: 4975: if (ctx->nibble == lowNbl) { + 2: 4975: inPack = true; + 2: 4976: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4976: packCount = netTypeVarintToUint((u8**)data); + 1: 4977: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4977: } - -: 4978: else { - -: 4979: // high nibble - 1: 4980: readTypeInHighNbl; + -: 4978: } + -: 4979: else { + -: 4980: // high nibble + 1: 4981: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4981: packCount = varintToUint((u8**)data); + 1: 4982: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4982: } - 2: 4983: packedType = PK_DICT; - -: 4984: } - -: 4985: - 8: 4986: d = NULL; - 8: 4987: dictNetDeserial(&d, data, ctx, /*packed=*/true); + -: 4983: } + 2: 4984: packedType = PK_DICT; + -: 4985: } + -: 4986: + 8: 4987: d = NULL; + 8: 4988: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 8: 4988: sArrayPushTiny(array, (smallt *) d); + 8: 4989: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - -: 4989: // stop unpacking when packCount == 0 - 8: 4990: packCount--; - 8: 4991: if (!packCount) inPack = false; + -: 4990: // stop unpacking when packCount == 0 + 8: 4991: packCount--; + 8: 4992: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4992: break; - -: 4993: case PK_DOUBLE: - 8: 4994: if (!inPack) { + 8: 4993: break; + -: 4994: case PK_DOUBLE: + 8: 4995: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4995: inPack = true; - 2: 4996: if (ctx->nibble == lowNbl) { + 2: 4996: inPack = true; + 2: 4997: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4997: packCount = netTypeVarintToUint((u8**)data); + 1: 4998: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4998: } - -: 4999: else { - -: 5000: // high nibble - 1: 5001: readTypeInHighNbl; + -: 4999: } + -: 5000: else { + -: 5001: // high nibble + 1: 5002: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5002: packCount = varintToUint((u8**)data); + 1: 5003: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5003: } - 2: 5004: packedType = PK_DOUBLE; - -: 5005: } - -: 5006: - 8: 5007: D = (double *)(*data); - 8: 5008: *data += sizeof(double); - 8: 5009: Do = allocSDouble(*D); + -: 5004: } + 2: 5005: packedType = PK_DOUBLE; + -: 5006: } + -: 5007: + 8: 5008: D = (double *)(*data); + 8: 5009: *data += sizeof(double); + 8: 5010: Do = allocSDouble(*D); call 0 returned 100% - 8: 5010: sArrayPushTiny(array, (smallt *) Do); + 8: 5011: sArrayPushTiny(array, (smallt *) Do); call 0 returned 100% - -: 5011: // stop unpacking when packCount == 0 - 8: 5012: packCount--; - 8: 5013: if (!packCount) inPack = false; + -: 5012: // stop unpacking when packCount == 0 + 8: 5013: packCount--; + 8: 5014: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5014: break; - -: 5015: case PK_INT: - 8: 5016: if (!inPack) { + 8: 5015: break; + -: 5016: case PK_INT: + 8: 5017: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 5017: inPack = true; - 2: 5018: if (ctx->nibble == lowNbl) { + 2: 5018: inPack = true; + 2: 5019: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 5019: packCount = netTypeVarintToUint((u8**)data); + 1: 5020: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5020: } - -: 5021: else { - -: 5022: // high nibble - 1: 5023: readTypeInHighNbl; + -: 5021: } + -: 5022: else { + -: 5023: // high nibble + 1: 5024: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5024: packCount = varintToUint((u8**)data); + 1: 5025: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5025: } - 2: 5026: packedType = PK_INT; - -: 5027: } - -: 5028: - 8: 5029: i64 v = varintToUint(data); + -: 5026: } + 2: 5027: packedType = PK_INT; + -: 5028: } + -: 5029: + 8: 5030: i64 v = varintToUint(data); call 0 returned 100% - 8: 5030: v = (v >> 1) ^ ((v << 63) >> 63); - 8: 5031: io = allocSInt(v); + 8: 5031: v = (v >> 1) ^ ((v << 63) >> 63); + 8: 5032: io = allocSInt(v); call 0 returned 100% - 8: 5032: sArrayPushTiny(array, (smallt *) io); + 8: 5033: sArrayPushTiny(array, (smallt *) io); call 0 returned 100% - -: 5033: // stop unpacking when packCount == 0 - 8: 5034: packCount--; - 8: 5035: if (!packCount) inPack = false; + -: 5034: // stop unpacking when packCount == 0 + 8: 5035: packCount--; + 8: 5036: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5036: break; - -: 5037: case PK_STRING: - 8: 5038: if (!inPack) { + 8: 5037: break; + -: 5038: case PK_STRING: + 8: 5039: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 5039: inPack = true; - 2: 5040: if (ctx->nibble == lowNbl) { + 2: 5040: inPack = true; + 2: 5041: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 5041: packCount = netTypeVarintToUint((u8**)data); + 1: 5042: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5042: } - -: 5043: else { - -: 5044: // high nibble - 1: 5045: readTypeInHighNbl; + -: 5043: } + -: 5044: else { + -: 5045: // high nibble + 1: 5046: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5046: packCount = varintToUint((u8**)data); + 1: 5047: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5047: } - 2: 5048: packedType = PK_STRING; - -: 5049: } - -: 5050: - 8: 5051: s = (char *)(*data); - 8: 5052: *data += strlen(s)+1; - 8: 5053: so = allocSStringTiny(s); + -: 5048: } + 2: 5049: packedType = PK_STRING; + -: 5050: } + -: 5051: + 8: 5052: s = (char *)(*data); + 8: 5053: *data += strlen(s)+1; + 8: 5054: so = allocSStringTiny(s); call 0 returned 100% - 8: 5054: sArrayPushTiny(array, (smallt *) so); + 8: 5055: sArrayPushTiny(array, (smallt *) so); call 0 returned 100% - -: 5055: // stop unpacking when packCount == 0 - 8: 5056: packCount--; - 8: 5057: if (!packCount) inPack = false; + -: 5056: // stop unpacking when packCount == 0 + 8: 5057: packCount--; + 8: 5058: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5058: break; - -: 5059: case PK_ARRAY: - 8: 5060: if (!inPack) { + 8: 5059: break; + -: 5060: case PK_ARRAY: + 8: 5061: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 5061: inPack = true; - 2: 5062: if (ctx->nibble == lowNbl) { + 2: 5062: inPack = true; + 2: 5063: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 5063: packCount = netTypeVarintToUint((u8**)data); + 1: 5064: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5064: } - -: 5065: else { - -: 5066: // high nibble - 1: 5067: readTypeInHighNbl; + -: 5065: } + -: 5066: else { + -: 5067: // high nibble + 1: 5068: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5068: packCount = varintToUint((u8**)data); + 1: 5069: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5069: } - 2: 5070: packedType = PK_ARRAY; - -: 5071: } - -: 5072: - 8: 5073: a = NULL; - 8: 5074: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + -: 5070: } + 2: 5071: packedType = PK_ARRAY; + -: 5072: } + -: 5073: + 8: 5074: a = NULL; + 8: 5075: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 8: 5075: sArrayPushTiny(array, (smallt *) a); + 8: 5076: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - -: 5076: // stop unpacking when packCount == 0 - 8: 5077: packCount--; - 8: 5078: if (!packCount) inPack = false; + -: 5077: // stop unpacking when packCount == 0 + 8: 5078: packCount--; + 8: 5079: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5079: break; - -: 5080: case PK_BYTES: - #####: 5081: if (!inPack) { + 8: 5080: break; + -: 5081: case PK_BYTES: + #####: 5082: if (!inPack) { branch 0 never executed branch 1 never executed - #####: 5082: inPack = true; - #####: 5083: if (ctx->nibble == lowNbl) { + #####: 5083: inPack = true; + #####: 5084: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 5084: packCount = netTypeVarintToUint((u8**)data); + #####: 5085: packCount = netTypeVarintToUint((u8**)data); call 0 never executed - -: 5085: } - -: 5086: else { - -: 5087: // high nibble - #####: 5088: readTypeInHighNbl; + -: 5086: } + -: 5087: else { + -: 5088: // high nibble + #####: 5089: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 5089: packCount = varintToUint((u8**)data); + #####: 5090: packCount = varintToUint((u8**)data); call 0 never executed - -: 5090: } - #####: 5091: packedType = PK_BYTES; - -: 5092: } - -: 5093: - #####: 5094: B = allocSBytes(); + -: 5091: } + #####: 5092: packedType = PK_BYTES; + -: 5093: } + -: 5094: + #####: 5095: B = allocSBytes(); call 0 never executed - #####: 5095: count = varintToUint((u8**)data); + #####: 5096: count = varintToUint((u8**)data); call 0 never executed - #####: 5096: sBytesPushBuffer(&B, data, count); + #####: 5097: sBytesPushBuffer(&B, data, count); call 0 never executed - #####: 5097: *data += count; - #####: 5098: sArrayPushTiny(array, (smallt *) B); + #####: 5098: *data += count; + #####: 5099: sArrayPushTiny(array, (smallt *) B); call 0 never executed - -: 5099: // stop unpacking when packCount == 0 - #####: 5100: packCount--; - #####: 5101: if (!packCount) inPack = false; + -: 5100: // stop unpacking when packCount == 0 + #####: 5101: packCount--; + #####: 5102: if (!packCount) inPack = false; branch 0 never executed branch 1 never executed - #####: 5102: break; - -: 5103: case UNIFORM_DICT: - 5: 5104: d = NULL; - 5: 5105: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); + #####: 5103: break; + -: 5104: case UNIFORM_DICT: + 5: 5105: d = NULL; + 5: 5106: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 5: 5106: sArrayPushTiny(array, (smallt *) d); + 5: 5107: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - 5: 5107: break; - -: 5108: case UNIFORM_ARRAY: - 6: 5109: a = NULL; - 6: 5110: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); + 5: 5108: break; + -: 5109: case UNIFORM_ARRAY: + 6: 5110: a = NULL; + 6: 5111: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 6: 5111: sArrayPushTiny(array, (smallt *) a); + 6: 5112: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - 6: 5112: break; - -: 5113: } - -: 5114: } - -: 5115:} - -: 5116: + 6: 5113: break; + -: 5114: } + -: 5115: } + -: 5116:} + -: 5117: function uniformArrayNetDeserial called 24 returned 100% blocks executed 89% - 24: 5117:internal void uniformArrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - 24: 5118: sUndefinedt *u = NULL; - 24: 5119: sBoolt *bo = NULL; - 24: 5120: double *D = NULL; - 24: 5121: sDoublet *Do = NULL; - 24: 5122: sDictt *d = NULL; - 24: 5123: sIntt *io = NULL; - 24: 5124: char *s = NULL; - 24: 5125: sStringt *so = NULL; - 24: 5126: sArrayt *a = NULL; - 24: 5127: sBytest *B = NULL; - -: 5128: uint32_t count; - -: 5129: uint32_t arrayCount; - -: 5130: u8 type; - -: 5131: - 24: 5132: if (packed) { + 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) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - 2: 5133: type = (**data) & 0xF; - 2: 5134: arrayCount = netTypeVarintToUint(data); + 2: 5134: type = (**data) & 0xF; + 2: 5135: arrayCount = netTypeVarintToUint(data); call 0 returned 100% - -: 5135: } - -: 5136: else { - 22: 5137: if (ctx->nibble == lowNbl) { + -: 5136: } + -: 5137: else { + 22: 5138: if (ctx->nibble == lowNbl) { branch 0 taken 77% (fallthrough) branch 1 taken 23% - 17: 5138: type = (**data) >> 4; - 17: 5139: (*data)++; - 17: 5140: arrayCount = varintToUint(data); + 17: 5139: type = (**data) >> 4; + 17: 5140: (*data)++; + 17: 5141: arrayCount = varintToUint(data); call 0 returned 100% - -: 5141: } - -: 5142: else { - 5: 5143: readTypeInHighNbl; + -: 5142: } + -: 5143: else { + 5: 5144: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 5: 5144: type = (**data) & 0xF; - 5: 5145: arrayCount = netTypeVarintToUint(data); + 5: 5145: type = (**data) & 0xF; + 5: 5146: arrayCount = netTypeVarintToUint(data); call 0 returned 100% - -: 5146: } - -: 5147: } - -: 5148: - 24: 5149: if (!arrayCount) { + -: 5147: } + -: 5148: } + -: 5149: + 24: 5150: if (!arrayCount) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - 2: 5150: *array = allocSArray();; + 2: 5151: *array = allocSArray();; call 0 returned 100% - 2: 5151: ret; - -: 5152: } - -: 5153: - 22: 5154: switch(type) { + 2: 5152: ret; + -: 5153: } + -: 5154: + 22: 5155: switch(type) { branch 0 taken 5% branch 1 taken 9% branch 2 taken 5% @@ -7635,169 +7636,169 @@ branch 7 taken 0% branch 8 taken 5% branch 9 taken 5% branch 10 taken 0% - -: 5155: case S_UNDEFINED: - 7: 5156: loop(arrayCount) { + -: 5156: case S_UNDEFINED: + 7: 5157: loop(arrayCount) { branch 0 taken 86% branch 1 taken 14% (fallthrough) - 6: 5157: u = allocSUndefined(); + 6: 5158: u = allocSUndefined(); call 0 returned 100% - 6: 5158: sArrayPushTiny(array, (smallt *) u); + 6: 5159: sArrayPushTiny(array, (smallt *) u); call 0 returned 100% - -: 5159: } - 1: 5160: break; - -: 5161: case S_BOOL: - 16: 5162: loop(arrayCount) { + -: 5160: } + 1: 5161: break; + -: 5162: case S_BOOL: + 16: 5163: loop(arrayCount) { branch 0 taken 88% branch 1 taken 13% (fallthrough) - 14: 5163: if (!ctx->boolAddr) { + 14: 5164: if (!ctx->boolAddr) { branch 0 taken 14% (fallthrough) branch 1 taken 86% - 2: 5164: read8bPackedBool; - 2: 5165: ctx->boolShift = 0; - -: 5166: } - 14: 5167: if (ctx->boolShift == 8) { + 2: 5165: read8bPackedBool; + 2: 5166: ctx->boolShift = 0; + -: 5167: } + 14: 5168: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - 1: 5168: read8bPackedBool; - 1: 5169: bo = allocSBool((*ctx->boolAddr) & 0x1); + 1: 5169: read8bPackedBool; + 1: 5170: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 5170: } - -: 5171: else { - 13: 5172: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 5171: } + -: 5172: else { + 13: 5173: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 5173: } - 14: 5174: sArrayPushTiny(array, (smallt *) bo); + -: 5174: } + 14: 5175: sArrayPushTiny(array, (smallt *) bo); call 0 returned 100% - -: 5175: } - 2: 5176: break; - -: 5177: case S_DICT: - 3: 5178: loop(arrayCount) { + -: 5176: } + 2: 5177: break; + -: 5178: case S_DICT: + 3: 5179: loop(arrayCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 5179: d = NULL; - 2: 5180: dictNetDeserial(&d, data, ctx, /*packed=*/true); + 2: 5180: d = NULL; + 2: 5181: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 2: 5181: sArrayPushTiny(array, (smallt *) d); + 2: 5182: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - -: 5182: } - 1: 5183: break; - -: 5184: case S_DOUBLE: - 4: 5185: loop(arrayCount) { + -: 5183: } + 1: 5184: break; + -: 5185: case S_DOUBLE: + 4: 5186: loop(arrayCount) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 5186: D = (double *)(*data); - 3: 5187: *data += sizeof(double); - 3: 5188: Do = allocSDouble(*D); + 3: 5187: D = (double *)(*data); + 3: 5188: *data += sizeof(double); + 3: 5189: Do = allocSDouble(*D); call 0 returned 100% - 3: 5189: sArrayPushTiny(array, (smallt *) Do); + 3: 5190: sArrayPushTiny(array, (smallt *) Do); call 0 returned 100% - -: 5190: } - 1: 5191: break; - -: 5192: case S_INT: - 49: 5193: loop(arrayCount) { + -: 5191: } + 1: 5192: break; + -: 5193: case S_INT: + 49: 5194: loop(arrayCount) { branch 0 taken 78% branch 1 taken 22% (fallthrough) - 38: 5194: i64 v = varintToUint(data); + 38: 5195: i64 v = varintToUint(data); call 0 returned 100% - 38: 5195: v = (v >> 1) ^ ((v << 63) >> 63); - 38: 5196: io = allocSInt(v); + 38: 5196: v = (v >> 1) ^ ((v << 63) >> 63); + 38: 5197: io = allocSInt(v); call 0 returned 100% - 38: 5197: sArrayPushTiny(array, (smallt *) io); + 38: 5198: sArrayPushTiny(array, (smallt *) io); call 0 returned 100% - -: 5198: } - 11: 5199: break; - -: 5200: case S_STRING: - 4: 5201: loop(arrayCount) { + -: 5199: } + 11: 5200: break; + -: 5201: case S_STRING: + 4: 5202: loop(arrayCount) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 5202: s = (char *)(*data); - 3: 5203: *data += strlen(s)+1; - 3: 5204: so = allocSStringTiny(s); + 3: 5203: s = (char *)(*data); + 3: 5204: *data += strlen(s)+1; + 3: 5205: so = allocSStringTiny(s); call 0 returned 100% - 3: 5205: sArrayPushTiny(array, (smallt *) so); + 3: 5206: sArrayPushTiny(array, (smallt *) so); call 0 returned 100% - -: 5206: } - 1: 5207: break; - -: 5208: case S_ARRAY: - 8: 5209: loop(arrayCount) { + -: 5207: } + 1: 5208: break; + -: 5209: case S_ARRAY: + 8: 5210: loop(arrayCount) { branch 0 taken 63% branch 1 taken 38% (fallthrough) - 5: 5210: a = NULL; - 5: 5211: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + 5: 5211: a = NULL; + 5: 5212: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 5: 5212: sArrayPushTiny(array, (smallt *) a); + 5: 5213: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - -: 5213: } - 3: 5214: break; - -: 5215: case S_BYTES: - #####: 5216: loop(arrayCount) { + -: 5214: } + 3: 5215: break; + -: 5216: case S_BYTES: + #####: 5217: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 5217: B = allocSBytes(); + #####: 5218: B = allocSBytes(); call 0 never executed - #####: 5218: count = varintToUint((u8**)data); + #####: 5219: count = varintToUint((u8**)data); call 0 never executed - #####: 5219: sBytesPushBuffer(&B, data, count); + #####: 522