netSerial

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

commit 17c2e3283c3f6a2fd4c147c5c5e05fd4a0f00be9
parent c456ea4fa839d76c2cd1dc77c0c1495b5a20a04c
Author: Remy Noulin <loader2x@gmail.com>
Date:   Sun, 27 Oct 2019 17:37:38 +0100

fix dict count in serializer when there are deleted elements

memcheckNetSerial.c |   19 +
netSerial.c         |   24 +-
netSerial.c.gcov    | 7408 ++++++++++++++++++++++++++-------------------------
package.yml         |    2 +-
test.c              |    4 +
testNetSerial.c     |   19 +
6 files changed, 3773 insertions(+), 3703 deletions(-)

Diffstat:
MmemcheckNetSerial.c | 19+++++++++++++++++++
MnetSerial.c | 24+++++++++++++++++-------
MnetSerial.c.gcov | 7408++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mpackage.yml | 2+-
Mtest.c | 4++++
MtestNetSerial.c | 19+++++++++++++++++++
6 files changed, 3773 insertions(+), 3703 deletions(-)

diff --git a/memcheckNetSerial.c b/memcheckNetSerial.c @@ -762,6 +762,25 @@ void dictT(void) { createSmallDict(dd); createSmallArray(a); + // dict with a deleted element (empty with dict->count == 1) + initiateG(&d); + setG(&d, "0", NULL); + delElemG(&d, "0"); + setTopG(&n, &d); + logVarG(&n); + B = serialG(&n); + logI("len %u", lenG(B)); + logSI("%s",toHexSepS(getValG(B), lenG(B), " ")); + s = sToString((smallt *) B->B); + ck_assert_str_eq(s, "[0x0e,0x00]"); + free(s); + deserialG(&ds, B); + s = toStringG(&ds); + ck_assert_str_eq(s, "{}"); + free(s); + terminateG(B); + freeManyG(&n, &ds); + // null and uniform dict initiateG(&d); setG(&d, "0", NULL); diff --git a/netSerial.c b/netSerial.c @@ -1782,6 +1782,16 @@ internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT p sBytest *B = NULL; char *data = NULL; + // compute allocated element count and use that instead of dict->count + // when elements are deleted, some positions are NULL + // and should not be counted + u32 cnt =0; + {forEachSDict(dict, e) { + if (e->key) { + inc cnt; + } + }} + // check if all elements have same type // then set dict type normal or uniform // array and dict have to be checked recursively to know if they are normal or uniform @@ -1837,19 +1847,19 @@ internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT p } elif (packing == UNIFORM) { // when the packing is uniform, there is no need to encode UNIFORM_DICT since all elements have this type - uintToNetTypeVarint(r, type, dict->count); + uintToNetTypeVarint(r, type, cnt); } else { if (ctx->nibble == lowNbl) { sBytesPush(r, (type << 4) + UNIFORM_DICT); - uintToVarint(r, dict->count); + uintToVarint(r, cnt); } else { // high nibble ctx->nibble = lowNbl; data = (char *)&((*r)->data) + ctx->nblOffset; *data |= UNIFORM_DICT << 4; - uintToNetTypeVarint(r, type, dict->count); + uintToNetTypeVarint(r, type, cnt); } } @@ -1947,11 +1957,11 @@ internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT p // encode type and element count if (packing == PACK or packing == UNIFORM) { // when the packing is packed or uniform, there is no need to encode DICT type since all elements have this type - uintToVarint(r, dict->count); + uintToVarint(r, cnt); } else { if (ctx->nibble == lowNbl) { - uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); + uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], cnt); } else { // high nibble @@ -1960,7 +1970,7 @@ internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT p data = (char *)&((*r)->data) + ctx->nblOffset;\ *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 storeTypeInHighNbl(dict); - uintToVarint(r, dict->count); + uintToVarint(r, cnt); } } @@ -1970,7 +1980,7 @@ internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT p if (e->key) { if (!pack) { // scan dict for packing - if ((dict->count - eIdx) > 3) { + if ((cnt - eIdx) > 3) { // at least 4 elements, less than that is not worth it if ( e->data->type == DICT or e->data->type == DOUBLE diff --git a/netSerial.c.gcov b/netSerial.c.gcov @@ -1,4 +1,4 @@ - -: 0:Source:/home/rlp/git/sw/publicGits/netSerial/netSerial.c + -: 0:Source:/home/remy/git/sw/publicGits/netSerial/netSerial.c -: 0:Graph:netSerial.gcno -: 0:Data:netSerial.gcda -: 0:Runs:7 @@ -260,7 +260,8 @@ function initiateAllocateNetSerialLevel0 called 0 returned 0% blocks executed 0% #####: 166: if (self) { branch 0 never executed branch 1 never executed - #####: 167: (*self) = malloc(sizeof(smallJsont)); + #####: 167: initiateG(self); // call initiateAllocateSmallJson to initialize the container recycling system +call 0 never executed #####: 168: if (*self) { branch 0 never executed branch 1 never executed @@ -276,7 +277,8 @@ function initiateAllocateNetSerialLevel1 called 0 returned 0% blocks executed 0% #####: 176: if (self) { branch 0 never executed branch 1 never executed - #####: 177: (*self) = malloc(sizeof(smallJsont)); + #####: 177: initiateG(self); // call initiateAllocateSmallJson to initialize the container recycling system +call 0 never executed #####: 178: if (*self) { branch 0 never executed branch 1 never executed @@ -292,7 +294,8 @@ function initiateAllocateNetSerialLevel2 called 0 returned 0% blocks executed 0% #####: 186: if (self) { branch 0 never executed branch 1 never executed - #####: 187: (*self) = malloc(sizeof(smallJsont)); + #####: 187: initiateG(self); // call initiateAllocateSmallJson to initialize the container recycling system +call 0 never executed #####: 188: if (*self) { branch 0 never executed branch 1 never executed @@ -308,7 +311,8 @@ function initiateAllocateNetSerial called 0 returned 0% blocks executed 0% #####: 196: if (self) { branch 0 never executed branch 1 never executed - #####: 197: (*self) = malloc(sizeof(smallJsont)); + #####: 197: initiateG(self); // call initiateAllocateSmallJson to initialize the container recycling system +call 0 never executed #####: 198: if (*self) { branch 0 never executed branch 1 never executed @@ -408,11 +412,11 @@ call 0 returned 100% -: 269:/** -: 270: * encode uint as varuint -: 271: */ -function uintToVarint called 190 returned 100% blocks executed 90% - 190: 272:internal void uintToVarint(sBytest **buf, u64 value) { - 190: 273: u64 c = value; - 190: 274: u8 b = c & 0x7F; - 190: 275: if (c & 0xFFFFFFFFFFFFFF80) { +function uintToVarint called 191 returned 100% blocks executed 90% + 191: 272:internal void uintToVarint(sBytest **buf, u64 value) { + 191: 273: u64 c = value; + 191: 274: u8 b = c & 0x7F; + 191: 275: if (c & 0xFFFFFFFFFFFFFF80) { branch 0 taken 2% (fallthrough) branch 1 taken 98% 3: 276: b |= 0x80; @@ -434,9 +438,9 @@ call 0 returned 100% -: 286: } -: 287: } -: 288: else - 187: 289: sBytesPush(buf, b); + 188: 289: sBytesPush(buf, b); call 0 returned 100% - 190: 290:} + 191: 290:} -: 291: -: 292:/** -: 293: * decode type and varuint to uint @@ -463,13 +467,13 @@ branch 1 taken 83% (fallthrough) -: 311:/** -: 312: * decode varuint to uint -: 313: */ -function varintToUint called 190 returned 100% blocks executed 100% - 190: 314:internal u64 varintToUint(u8 **buf) { - 190: 315: u64 r = 0; +function varintToUint called 191 returned 100% blocks executed 100% + 191: 314:internal u64 varintToUint(u8 **buf) { + 191: 315: u64 r = 0; -: 316: - 190: 317: r = (**buf) & 0x7F; - 190: 318: u8 c = 1; - 383: 319: while (**buf & 0x80) { + 191: 317: r = (**buf) & 0x7F; + 191: 318: u8 c = 1; + 385: 319: while (**buf & 0x80) { branch 0 taken 2% branch 1 taken 98% (fallthrough) 3: 320: (*buf)++; @@ -477,8 +481,8 @@ branch 1 taken 98% (fallthrough) 3: 322: r |= (**buf & 0x7FUL) << (7*c); 3: 323: c++; -: 324: } - 190: 325: (*buf)++; - 190: 326: ret r; + 191: 325: (*buf)++; + 191: 326: ret r; -: 327:} -: 328: -: 329:// ------------------------------------- @@ -2526,20 +2530,20 @@ call 0 never executed -: 1717:/** -: 1718: * serializer top function -: 1719: */ -function netSerial called 85 returned 100% blocks executed 88% - 85: 1720:internal sBytest* netSerial(smallt *o) { - 85: 1721: sBytest *r = NULL; - 85: 1722: sBytest *B = NULL; - 85: 1723: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; +function netSerial called 86 returned 100% blocks executed 88% + 86: 1720:internal sBytest* netSerial(smallt *o) { + 86: 1721: sBytest *r = NULL; + 86: 1722: sBytest *B = NULL; + 86: 1723: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0}; -: 1724: - 85: 1725: switch(o->type) { + 86: 1725: switch(o->type) { branch 0 taken 1% branch 1 taken 1% -branch 2 taken 46% +branch 2 taken 47% branch 3 taken 1% -branch 4 taken 4% +branch 4 taken 3% branch 5 taken 1% -branch 6 taken 46% +branch 6 taken 45% branch 7 taken 0% branch 8 taken 0% -: 1726: case UNDEFINED: @@ -2559,9 +2563,9 @@ call 0 returned 100% -: 1736: } 1: 1737: break; -: 1738: case DICT: - 39: 1739: dictNetSerial(&r, (sDictt *)&(o->type), &ctx, /*packing=*/NOPACKING); + 40: 1739: dictNetSerial(&r, (sDictt *)&(o->type), &ctx, /*packing=*/NOPACKING); call 0 returned 100% - 39: 1740: break; + 40: 1740: break; -: 1741: case DOUBLE: 1: 1742: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]); call 0 returned 100% @@ -2595,7 +2599,7 @@ call 0 never executed call 0 never executed #####: 1764: break; -: 1765: } - 85: 1766: ret r; + 86: 1766: ret r; -: 1767:} -: 1768: -: 1769:/** @@ -2610,367 +2614,381 @@ call 0 never executed -: 1778: * r small bytes object -: 1779: * dict dictionary to serialize -: 1780: */ -function dictNetSerial called 82 returned 100% blocks executed 96% - 82: 1781:internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT packing) { - 82: 1782: sBytest *B = NULL; - 82: 1783: char *data = NULL; +function dictNetSerial called 83 returned 100% blocks executed 96% + 83: 1781:internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT packing) { + 83: 1782: sBytest *B = NULL; + 83: 1783: char *data = NULL; -: 1784: - -: 1785: // check if all elements have same type - -: 1786: // then set dict type normal or uniform - -: 1787: // array and dict have to be checked recursively to know if they are normal or uniform - 82: 1788: bool allElementsHaveSameType = true; - 82: 1789: bool foundFirstType = false; - 82: 1790: char type = 0; - -: 1791: // get first element type - -: 1792: // compare to other element type - 207: 1793: {forEachSDict(dict, e) { -branch 0 taken 79% -branch 1 taken 21% (fallthrough) - 163: 1794: if (e->key) { -branch 0 taken 100% (fallthrough) -branch 1 taken 0% - 163: 1795: if (foundFirstType) { + -: 1785: // compute allocated element count and use that instead of dict->count + -: 1786: // when elements are deleted, some positions are NULL + -: 1787: // and should not be counted + 83: 1788: u32 cnt =0; + 302: 1789: {forEachSDict(dict, e) { +branch 0 taken 73% +branch 1 taken 27% (fallthrough) + 219: 1790: if (e->key) { +branch 0 taken 99% (fallthrough) +branch 1 taken 1% + 218: 1791: inc cnt; + -: 1792: } + -: 1793: }} + -: 1794: + -: 1795: // check if all elements have same type + -: 1796: // then set dict type normal or uniform + -: 1797: // array and dict have to be checked recursively to know if they are normal or uniform + 83: 1798: bool allElementsHaveSameType = true; + 83: 1799: bool foundFirstType = false; + 83: 1800: char type = 0; + -: 1801: // get first element type + -: 1802: // compare to other element type + 209: 1803: {forEachSDict(dict, e) { +branch 0 taken 78% +branch 1 taken 22% (fallthrough) + 164: 1804: if (e->key) { +branch 0 taken 99% (fallthrough) +branch 1 taken 1% + 163: 1805: if (foundFirstType) { branch 0 taken 56% (fallthrough) branch 1 taken 44% - -: 1796: u8 nextType; - 92: 1797: switch(e->data->type) { + -: 1806: u8 nextType; + 92: 1807: switch(e->data->type) { branch 0 taken 16% branch 1 taken 11% branch 2 taken 73% - -: 1798: case DICT: - 15: 1799: nextType = isDictUniform((sDictt*)e->data); -call 0 returned 100% - 15: 1800: break; - -: 1801: case ARRAY: - 10: 1802: nextType = isArrayUniform((sArrayt*)e->data); -call 0 returned 100% - 10: 1803: break; - -: 1804: default: - 67: 1805: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1806: } - 92: 1807: if (nextType != type) { + -: 1808: case DICT: + 15: 1809: nextType = isDictUniform((sDictt*)e->data); +call 0 returned 100% + 15: 1810: break; + -: 1811: case ARRAY: + 10: 1812: nextType = isArrayUniform((sArrayt*)e->data); +call 0 returned 100% + 10: 1813: break; + -: 1814: default: + 67: 1815: nextType = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1816: } + 92: 1817: if (nextType != type) { branch 0 taken 41% (fallthrough) branch 1 taken 59% - 38: 1808: allElementsHaveSameType = false; - 38: 1809: break; - -: 1810: } - -: 1811: } - -: 1812: else { - 71: 1813: switch(e->data->type) { + 38: 1818: allElementsHaveSameType = false; + 38: 1819: break; + -: 1820: } + -: 1821: } + -: 1822: else { + 71: 1823: switch(e->data->type) { branch 0 taken 7% branch 1 taken 4% branch 2 taken 89% - -: 1814: case DICT: - 5: 1815: type = isDictUniform((sDictt*)e->data); -call 0 returned 100% - 5: 1816: break; - -: 1817: case ARRAY: - 3: 1818: type = isArrayUniform((sArrayt*)e->data); -call 0 returned 100% - 3: 1819: break; - -: 1820: default: - 63: 1821: type = NET_SERIAL_TYPES[(u8)e->data->type]; - -: 1822: } - 71: 1823: foundFirstType = true; - -: 1824: } - -: 1825: } - -: 1826: }} - -: 1827: - 82: 1828: if (allElementsHaveSameType) { + -: 1824: case DICT: + 5: 1825: type = isDictUniform((sDictt*)e->data); +call 0 returned 100% + 5: 1826: break; + -: 1827: case ARRAY: + 3: 1828: type = isArrayUniform((sArrayt*)e->data); +call 0 returned 100% + 3: 1829: break; + -: 1830: default: + 63: 1831: type = NET_SERIAL_TYPES[(u8)e->data->type]; + -: 1832: } + 71: 1833: foundFirstType = true; + -: 1834: } + -: 1835: } + -: 1836: }} + -: 1837: + 83: 1838: if (allElementsHaveSameType) { branch 0 taken 54% (fallthrough) branch 1 taken 46% - -: 1829: // uniform dict - -: 1830: // encode type and element count - -: 1831: - -: 1832: // in pack dictionary - 44: 1833: if (packing == PACKED) { -branch 0 taken 41% (fallthrough) -branch 1 taken 59% - -: 1834: // uniform dict can't be packed - -: 1835: // because there is only one type of packed arrays - 18: 1836: goto normalDict; - -: 1837: } - 26: 1838: elif (packing == UNIFORM) { + -: 1839: // uniform dict + -: 1840: // encode type and element count + -: 1841: + -: 1842: // in pack dictionary + 45: 1843: if (packing == PACK) { +branch 0 taken 40% (fallthrough) +branch 1 taken 60% + -: 1844: // uniform dict can't be packed + -: 1845: // because there is only one type of packed arrays + 18: 1846: goto normalDict; + -: 1847: } + 27: 1848: elif (packing == UNIFORM) { branch 0 taken 15% (fallthrough) branch 1 taken 85% - -: 1839: // when the packing is uniform, there is no need to encode UNIFORM_DICT since all elements have this type - 4: 1840: uintToNetTypeVarint(r, type, dict->count); + -: 1849: // when the packing is uniform, there is no need to encode UNIFORM_DICT since all elements have this type + 4: 1850: uintToNetTypeVarint(r, type, cnt); call 0 returned 100% - -: 1841: } - -: 1842: else { - 22: 1843: if (ctx->nibble == lowNbl) { + -: 1851: } + -: 1852: else { + 23: 1853: if (ctx->nibble == lowNbl) { branch 0 taken 91% (fallthrough) branch 1 taken 9% - 20: 1844: sBytesPush(r, (type << 4) + UNIFORM_DICT); -call 0 returned 100% - 20: 1845: uintToVarint(r, dict->count); -call 0 returned 100% - -: 1846: } - -: 1847: else { - -: 1848: // high nibble - 2: 1849: ctx->nibble = lowNbl; - 2: 1850: data = (char *)&((*r)->data) + ctx->nblOffset; - 2: 1851: *data |= UNIFORM_DICT << 4; - 2: 1852: uintToNetTypeVarint(r, type, dict->count); -call 0 returned 100% - -: 1853: } - -: 1854: } - -: 1855: - -: 1856: // encode all element keys and values - 26: 1857: switch(type) { -branch 0 taken 8% + 21: 1854: sBytesPush(r, (type << 4) + UNIFORM_DICT); +call 0 returned 100% + 21: 1855: uintToVarint(r, cnt); +call 0 returned 100% + -: 1856: } + -: 1857: else { + -: 1858: // high nibble + 2: 1859: ctx->nibble = lowNbl; + 2: 1860: data = (char *)&((*r)->data) + ctx->nblOffset; + 2: 1861: *data |= UNIFORM_DICT << 4; + 2: 1862: uintToNetTypeVarint(r, type, cnt); +call 0 returned 100% + -: 1863: } + -: 1864: } + -: 1865: + -: 1866: // encode all element keys and values + 27: 1867: switch(type) { +branch 0 taken 11% branch 1 taken 15% -branch 2 taken 8% +branch 2 taken 7% branch 3 taken 4% -branch 4 taken 35% +branch 4 taken 33% branch 5 taken 19% -branch 6 taken 8% +branch 6 taken 7% branch 7 taken 4% branch 8 taken 0% - -: 1858: case S_UNDEFINED: - 8: 1859: {forEachSDict(dict, e) { -branch 0 taken 75% -branch 1 taken 25% (fallthrough) - 6: 1860: if (e->key) { -branch 0 taken 100% (fallthrough) -branch 1 taken 0% - 6: 1861: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); -call 0 returned 100% - -: 1862: } - -: 1863: }} - -: 1864: - 2: 1865: break; - -: 1866: case S_BOOL: - 19: 1867: {forEachSDict(dict, e) { + -: 1868: case S_UNDEFINED: + 10: 1869: {forEachSDict(dict, e) { +branch 0 taken 70% +branch 1 taken 30% (fallthrough) + 7: 1870: if (e->key) { +branch 0 taken 86% (fallthrough) +branch 1 taken 14% + 6: 1871: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); +call 0 returned 100% + -: 1872: } + -: 1873: }} + -: 1874: + 3: 1875: break; + -: 1876: case S_BOOL: + 19: 1877: {forEachSDict(dict, e) { branch 0 taken 79% branch 1 taken 21% (fallthrough) - 15: 1868: if (e->key) { + 15: 1878: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 15: 1869: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 15: 1879: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - -: 1870: - 15: 1871: if (!ctx->boolOffset) { + -: 1880: + 15: 1881: if (!ctx->boolOffset) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 1872: // new packed bools - 3: 1873: storeNew8bPackedBool(e->data); + -: 1882: // new packed bools + 3: 1883: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 1874: } - -: 1875: else { - -: 1876: // there was a bool before this one, fill bits in nibbles - 12: 1877: if (ctx->boolShift == 8) { + -: 1884: } + -: 1885: else { + -: 1886: // there was a bool before this one, fill bits in nibbles + 12: 1887: if (ctx->boolShift == 8) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - -: 1878: // previous packed bool is full - -: 1879: // next byte is the new packed bools - 1: 1880: storeNew8bPackedBool(e->data); + -: 1888: // previous packed bool is full + -: 1889: // next byte is the new packed bools + 1: 1890: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 1881: } - -: 1882: else { - 11: 1883: storeBool(e->data); + -: 1891: } + -: 1892: else { + 11: 1893: storeBool(e->data); branch 0 taken 91% (fallthrough) branch 1 taken 9% - -: 1884: } - -: 1885: } - -: 1886: } - -: 1887: }} - 4: 1888: break; - -: 1889: case S_DICT: - -: 1890: case UNIFORM_DICT: - 6: 1891: {forEachSDict(dict, e) { + -: 1894: } + -: 1895: } + -: 1896: } + -: 1897: }} + 4: 1898: break; + -: 1899: case S_DICT: + -: 1900: case UNIFORM_DICT: + 6: 1901: {forEachSDict(dict, e) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 4: 1892: if (e->key) { + 4: 1902: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 4: 1893: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 4: 1903: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 4: 1894: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/UNIFORM); + 4: 1904: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 1895: } - -: 1896: }} - 2: 1897: break; - -: 1898: case S_DOUBLE: - 4: 1899: {forEachSDict(dict, e) { + -: 1905: } + -: 1906: }} + 2: 1907: break; + -: 1908: case S_DOUBLE: + 4: 1909: {forEachSDict(dict, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 1900: if (e->key) { + 3: 1910: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 3: 1901: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 3: 1911: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 3: 1902: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); + 3: 1912: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); call 0 returned 100% - -: 1903: } - -: 1904: }} - 1: 1905: break; - -: 1906: case S_INT: - 21: 1907: {forEachSDict(dict, e) { + -: 1913: } + -: 1914: }} + 1: 1915: break; + -: 1916: case S_INT: + 21: 1917: {forEachSDict(dict, e) { branch 0 taken 57% branch 1 taken 43% (fallthrough) - 12: 1908: if (e->key) { + 12: 1918: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 12: 1909: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 12: 1919: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 12: 1910: i64 v = ((sIntt *)(e->data))->value; - 12: 1911: uintToVarint(r, (v << 1) ^ (v >> 63)); + 12: 1920: i64 v = ((sIntt *)(e->data))->value; + 12: 1921: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 returned 100% - -: 1912: } - -: 1913: }} - 9: 1914: break; - -: 1915: case S_STRING: - 16: 1916: {forEachSDict(dict, e) { + -: 1922: } + -: 1923: }} + 9: 1924: break; + -: 1925: case S_STRING: + 16: 1926: {forEachSDict(dict, e) { branch 0 taken 69% branch 1 taken 31% (fallthrough) - 11: 1917: if (e->key) { + 11: 1927: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 11: 1918: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 11: 1928: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 11: 1919: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); + 11: 1929: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); call 0 returned 100% - -: 1920: } - -: 1921: }} - 5: 1922: break; - -: 1923: case S_ARRAY: - -: 1924: case UNIFORM_ARRAY: - 4: 1925: {forEachSDict(dict, e) { + -: 1930: } + -: 1931: }} + 5: 1932: break; + -: 1933: case S_ARRAY: + -: 1934: case UNIFORM_ARRAY: + 4: 1935: {forEachSDict(dict, e) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 2: 1926: if (e->key) { + 2: 1936: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 2: 1927: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); + 2: 1937: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); call 0 returned 100% - 2: 1928: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/UNIFORM); + 2: 1938: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 1929: } - -: 1930: }} - 2: 1931: break; - -: 1932: case S_BYTES: - 3: 1933: {forEachSDict(dict, e) { + -: 1939: } + -: 1940: }} + 2: 1941: break; + -: 1942: case S_BYTES: + 3: 1943: {forEachSDict(dict, e) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 1934: if (e->key) { + 2: 1944: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 2: 1935: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); -call 0 returned 100% - 2: 1936: B = (sBytest *)(e->data); - 2: 1937: uintToVarint(r, B->count); -call 0 returned 100% - 2: 1938: sBytesPushBuffer(r, &(B->data), B->count); -call 0 returned 100% - -: 1939: } - -: 1940: }} - 1: 1941: break; - -: 1942: } - 26: 1943: ret; - -: 1944: } - -: 1945: - -: 1946: normalDict: - -: 1947: // encode type and element count - 56: 1948: if (packing == PACKED or packing == UNIFORM) { + 2: 1945: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); +call 0 returned 100% + 2: 1946: B = (sBytest *)(e->data); + 2: 1947: uintToVarint(r, B->count); +call 0 returned 100% + 2: 1948: sBytesPushBuffer(r, &(B->data), B->count); +call 0 returned 100% + -: 1949: } + -: 1950: }} + 1: 1951: break; + -: 1952: } + 27: 1953: ret; + -: 1954: } + -: 1955: + -: 1956: normalDict: + -: 1957: // encode type and element count + 56: 1958: if (packing == PACK or packing == UNIFORM) { branch 0 taken 59% (fallthrough) branch 1 taken 41% branch 2 taken 12% (fallthrough) branch 3 taken 88% - -: 1949: // when the packing is packed or uniform, there is no need to encode DICT type since all elements have this type - 27: 1950: uintToVarint(r, dict->count); + -: 1959: // when the packing is packed or uniform, there is no need to encode DICT type since all elements have this type + 27: 1960: uintToVarint(r, cnt); call 0 returned 100% - -: 1951: } - -: 1952: else { - 29: 1953: if (ctx->nibble == lowNbl) { + -: 1961: } + -: 1962: else { + 29: 1963: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 27: 1954: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count); -call 0 returned 100% - -: 1955: } - -: 1956: else { - -: 1957: // high nibble - -: 1958: #define storeTypeInHighNbl(o)\ - -: 1959: ctx->nibble = lowNbl;\ - -: 1960: data = (char *)&((*r)->data) + ctx->nblOffset;\ - -: 1961: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 - 2: 1962: storeTypeInHighNbl(dict); - 2: 1963: uintToVarint(r, dict->count); -call 0 returned 100% - -: 1964: } - -: 1965: } - -: 1966: - 56: 1967: bool pack = false; - -: 1968: size_t packCount; - 219: 1969: enumerateSDict(dict, e, eIdx) { + 27: 1964: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], cnt); +call 0 returned 100% + -: 1965: } + -: 1966: else { + -: 1967: // high nibble + -: 1968: #define storeTypeInHighNbl(o)\ + -: 1969: ctx->nibble = lowNbl;\ + -: 1970: data = (char *)&((*r)->data) + ctx->nblOffset;\ + -: 1971: *data |= NET_SERIAL_TYPES[(u8)o->type] << 4 + 2: 1972: storeTypeInHighNbl(dict); + 2: 1973: uintToVarint(r, cnt); +call 0 returned 100% + -: 1974: } + -: 1975: } + -: 1976: + 56: 1977: bool pack = false; + -: 1978: size_t packCount; + 219: 1979: enumerateSDict(dict, e, eIdx) { branch 0 taken 74% branch 1 taken 26% (fallthrough) - 163: 1970: if (e->key) { + 163: 1980: if (e->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 163: 1971: if (!pack) { + 163: 1981: if (!pack) { branch 0 taken 77% (fallthrough) branch 1 taken 23% - -: 1972: // scan dict for packing - 125: 1973: if ((dict->count - eIdx) > 3) { + -: 1982: // scan dict for packing + 125: 1983: if ((cnt - eIdx) > 3) { branch 0 taken 34% (fallthrough) branch 1 taken 66% - -: 1974: // at least 4 elements, less than that is not worth it - 42: 1975: if ( e->data->type == DICT + -: 1984: // at least 4 elements, less than that is not worth it + 42: 1985: if ( e->data->type == DICT branch 0 taken 93% (fallthrough) branch 1 taken 7% - 39: 1976: or e->data->type == DOUBLE + 39: 1986: or e->data->type == DOUBLE branch 0 taken 95% (fallthrough) branch 1 taken 5% - 37: 1977: or e->data->type == INT + 37: 1987: or e->data->type == INT branch 0 taken 95% (fallthrough) branch 1 taken 5% - 35: 1978: or e->data->type == STRING + 35: 1988: or e->data->type == STRING branch 0 taken 94% (fallthrough) branch 1 taken 6% - 33: 1979: or e->data->type == ARRAY + 33: 1989: or e->data->type == ARRAY branch 0 taken 94% (fallthrough) branch 1 taken 6% - 31: 1980: or e->data->type == BYTES) { + 31: 1990: or e->data->type == BYTES) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - 11: 1981: type = e->data->type; - 11: 1982: packCount = 1; - 11: 1983: sDictElemt *element = &((dict)->elements) + eIdx +1; - 49: 1984: for (size_t i = eIdx+1; i < (dict)->count ; i++, element = &((dict)->elements) + i) { + 11: 1991: type = e->data->type; + 11: 1992: packCount = 1; + 11: 1993: sDictElemt *element = &((dict)->elements) + eIdx +1; + 49: 1994: for (size_t i = eIdx+1; i < (dict)->count ; i++, element = &((dict)->elements) + i) { branch 0 taken 100% branch 1 taken 0% (fallthrough) - 49: 1985: if (element->key) { + 49: 1995: if (element->key) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 49: 1986: if (element->data->type != type) { + 49: 1996: if (element->data->type != type) { branch 0 taken 22% (fallthrough) branch 1 taken 78% - 11: 1987: break; - -: 1988: } - 38: 1989: packCount++; - -: 1990: } // element->key - -: 1991: } // for - 11: 1992: if (packCount > 3) { + 11: 1997: break; + -: 1998: } + 38: 1999: packCount++; + -: 2000: } // element->key + -: 2001: } // for + 11: 2002: if (packCount > 3) { branch 0 taken 100% (fallthrough) branch 1 taken 0% - 11: 1993: type = PACKED_NET_SERIAL_TYPES[(u8)type]; - 11: 1994: pack = true; - -: 1995: } - -: 1996: } // test current element type - -: 1997: } // is dict big enough - -: 1998: } // not already packing - -: 1999: - -: 2000: // encode key - 163: 2001: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); -call 0 returned 100% - -: 2002: - -: 2003: // encode value - 163: 2004: switch(e->data->type) { + 11: 2003: type = PACKED_NET_SERIAL_TYPES[(u8)type]; + 11: 2004: pack = true; + -: 2005: } + -: 2006: } // test current element type + -: 2007: } // is dict big enough + -: 2008: } // not already packing + -: 2009: + -: 2010: // encode key + 163: 2011: sBytesPushBuffer(r, e->key, strlen(e->key) + 1); +call 0 returned 100% + -: 2012: + -: 2013: // encode value + 163: 2014: switch(e->data->type) { branch 0 taken 18% branch 1 taken 19% branch 2 taken 12% @@ -2980,535 +2998,535 @@ branch 5 taken 13% branch 6 taken 9% branch 7 taken 1% branch 8 taken 0% - -: 2005: case UNDEFINED: - -: 2006: case CONTAINER: - 29: 2007: if (ctx->nibble == lowNbl) { + -: 2015: case UNDEFINED: + -: 2016: case CONTAINER: + 29: 2017: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - -: 2008: #define storeTypeOnly(o)\ - -: 2009: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ - -: 2010: ctx->nibble = highNbl;\ - -: 2011: ctx->nblOffset = (*r)->count -1 - 27: 2012: storeTypeOnly(e->data); -call 0 returned 100% - -: 2013: } - -: 2014: else { - 2: 2015: storeTypeInHighNbl(e->data); - -: 2016: } - 29: 2017: break; - -: 2018: case BOOL: - 31: 2019: if (!ctx->boolOffset) { + -: 2018: #define storeTypeOnly(o)\ + -: 2019: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\ + -: 2020: ctx->nibble = highNbl;\ + -: 2021: ctx->nblOffset = (*r)->count -1 + 27: 2022: storeTypeOnly(e->data); +call 0 returned 100% + -: 2023: } + -: 2024: else { + 2: 2025: storeTypeInHighNbl(e->data); + -: 2026: } + 29: 2027: break; + -: 2028: case BOOL: + 31: 2029: if (!ctx->boolOffset) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - -: 2020: // new packed bools - 5: 2021: if (ctx->nibble == lowNbl) { + -: 2030: // new packed bools + 5: 2031: if (ctx->nibble == lowNbl) { branch 0 taken 60% (fallthrough) branch 1 taken 40% - -: 2022: #define storeNew4bPackedBool(o)\ - -: 2023: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ - -: 2024: /* set bit 4 when true */\ - -: 2025: if (((sBoolt *)(o))->value)\ - -: 2026: c |= (1<<4);\ - -: 2027: sBytesPush(r, c);\ - -: 2028: ctx->boolShift = 5;\ - -: 2029: ctx->boolOffset = (*r)->count -1 - 3: 2030: storeNew4bPackedBool(e->data); + -: 2032: #define storeNew4bPackedBool(o)\ + -: 2033: u8 c = NET_SERIAL_TYPES[(u8)o->type];\ + -: 2034: /* set bit 4 when true */\ + -: 2035: if (((sBoolt *)(o))->value)\ + -: 2036: c |= (1<<4);\ + -: 2037: sBytesPush(r, c);\ + -: 2038: ctx->boolShift = 5;\ + -: 2039: ctx->boolOffset = (*r)->count -1 + 3: 2040: storeNew4bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2031: } - -: 2032: else { - -: 2033: // high nibble, next byte is packed bools - 2: 2034: storeTypeInHighNbl(e->data); - -: 2035: #define storeNew8bPackedBool(o)\ - -: 2036: u8 c = 0;\ - -: 2037: if (((sBoolt *)(o))->value)\ - -: 2038: c = 1;\ - -: 2039: sBytesPush(r, c);\ - -: 2040: ctx->boolShift = 1;\ - -: 2041: ctx->boolOffset = (*r)->count -1 - 2: 2042: storeNew8bPackedBool(e->data); + -: 2041: } + -: 2042: else { + -: 2043: // high nibble, next byte is packed bools + 2: 2044: storeTypeInHighNbl(e->data); + -: 2045: #define storeNew8bPackedBool(o)\ + -: 2046: u8 c = 0;\ + -: 2047: if (((sBoolt *)(o))->value)\ + -: 2048: c = 1;\ + -: 2049: sBytesPush(r, c);\ + -: 2050: ctx->boolShift = 1;\ + -: 2051: ctx->boolOffset = (*r)->count -1 + 2: 2052: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2043: } - -: 2044: } - -: 2045: else { - -: 2046: // there was a bool before this one, fill bits in nibbles - 26: 2047: if (ctx->nibble == lowNbl) { + -: 2053: } + -: 2054: } + -: 2055: else { + -: 2056: // there was a bool before this one, fill bits in nibbles + 26: 2057: if (ctx->nibble == lowNbl) { branch 0 taken 58% (fallthrough) branch 1 taken 42% - 15: 2048: if (ctx->boolShift == 8) { + 15: 2058: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - -: 2049: // previous packed bool is full - -: 2050: // this byte is the new packed bools - 1: 2051: storeNew4bPackedBool(e->data); + -: 2059: // previous packed bool is full + -: 2060: // this byte is the new packed bools + 1: 2061: storeNew4bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2052: } - -: 2053: else { - 14: 2054: storeTypeOnly(e->data); -call 0 returned 100% - -: 2055: #define storeBool(o)\ - -: 2056: data = (char *)&((*r)->data) + ctx->boolOffset;\ - -: 2057: if (((sBoolt *)(o))->value)\ - -: 2058: *data |= 1 << ctx->boolShift;\ - -: 2059: ctx->boolShift++ - 14: 2060: storeBool(e->data); + -: 2062: } + -: 2063: else { + 14: 2064: storeTypeOnly(e->data); +call 0 returned 100% + -: 2065: #define storeBool(o)\ + -: 2066: data = (char *)&((*r)->data) + ctx->boolOffset;\ + -: 2067: if (((sBoolt *)(o))->value)\ + -: 2068: *data |= 1 << ctx->boolShift;\ + -: 2069: ctx->boolShift++ + 14: 2070: storeBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% - -: 2061: } - -: 2062: } - -: 2063: else { - -: 2064: // high nibble - 11: 2065: storeTypeInHighNbl(e->data); - 11: 2066: if (ctx->boolShift == 8) { + -: 2071: } + -: 2072: } + -: 2073: else { + -: 2074: // high nibble + 11: 2075: storeTypeInHighNbl(e->data); + 11: 2076: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 2067: // previous packed bool is full - -: 2068: // next byte is the new packed bools - 2: 2069: storeNew8bPackedBool(e->data); + -: 2077: // previous packed bool is full + -: 2078: // next byte is the new packed bools + 2: 2079: storeNew8bPackedBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2070: } - -: 2071: else { - 9: 2072: storeBool(e->data); + -: 2080: } + -: 2081: else { + 9: 2082: storeBool(e->data); branch 0 taken 100% (fallthrough) branch 1 taken 0% - -: 2073: } - -: 2074: } - -: 2075: } - 31: 2076: break; - -: 2077: case DICT: - 20: 2078: if (pack) { + -: 2083: } + -: 2084: } + -: 2085: } + 31: 2086: break; + -: 2087: case DICT: + 20: 2088: if (pack) { branch 0 taken 75% (fallthrough) branch 1 taken 25% - 15: 2079: if (type) { + 15: 2089: if (type) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2080: // this is the first packed element - 3: 2081: if (ctx->nibble == lowNbl) { + -: 2090: // this is the first packed element + 3: 2091: if (ctx->nibble == lowNbl) { branch 0 taken 67% (fallthrough) branch 1 taken 33% - 2: 2082: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2083: } - -: 2084: else { - -: 2085: // high nibble - -: 2086: // store type in high nibble - 1: 2087: ctx->nibble = lowNbl; - 1: 2088: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2089: *data |= type << 4; - 1: 2090: uintToVarint(r, packCount); -call 0 returned 100% - -: 2091: } - 3: 2092: type = 0; - -: 2093: } // if type - -: 2094: - 15: 2095: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2096: // stop packing when packCount == 0 - 15: 2097: packCount--; - 15: 2098: if (!packCount) pack = false; + 2: 2092: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2093: } + -: 2094: else { + -: 2095: // high nibble + -: 2096: // store type in high nibble + 1: 2097: ctx->nibble = lowNbl; + 1: 2098: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2099: *data |= type << 4; + 1: 2100: uintToVarint(r, packCount); +call 0 returned 100% + -: 2101: } + 3: 2102: type = 0; + -: 2103: } // if type + -: 2104: + 15: 2105: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/PACK); +call 0 returned 100% + -: 2106: // stop packing when packCount == 0 + 15: 2107: packCount--; + 15: 2108: if (!packCount) pack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2099: } // if pack - -: 2100: else - 5: 2101: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/NOPACKING); + -: 2109: } // if pack + -: 2110: else + 5: 2111: dictNetSerial(r, (sDictt *)(e->data), ctx, /*packing=*/NOPACKING); call 0 returned 100% - 20: 2102: break; - -: 2103: case DOUBLE: - 12: 2104: if (pack) { + 20: 2112: break; + -: 2113: case DOUBLE: + 12: 2114: if (pack) { branch 0 taken 83% (fallthrough) branch 1 taken 17% - 10: 2105: if (type) { + 10: 2115: if (type) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2106: // this is the first packed element - 2: 2107: if (ctx->nibble == lowNbl) { + -: 2116: // this is the first packed element + 2: 2117: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2108: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2109: } - -: 2110: else { - -: 2111: // high nibble - -: 2112: // store type in high nibble - 1: 2113: ctx->nibble = lowNbl; - 1: 2114: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2115: *data |= type << 4; - 1: 2116: uintToVarint(r, packCount); -call 0 returned 100% - -: 2117: } - 2: 2118: type = 0; - -: 2119: } // if type - -: 2120: - 10: 2121: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 returned 100% - -: 2122: // stop packing when packCount == 0 - 10: 2123: packCount--; - 10: 2124: if (!packCount) pack = false; + 1: 2118: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2119: } + -: 2120: else { + -: 2121: // high nibble + -: 2122: // store type in high nibble + 1: 2123: ctx->nibble = lowNbl; + 1: 2124: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2125: *data |= type << 4; + 1: 2126: uintToVarint(r, packCount); +call 0 returned 100% + -: 2127: } + 2: 2128: type = 0; + -: 2129: } // if type + -: 2130: + 10: 2131: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); +call 0 returned 100% + -: 2132: // stop packing when packCount == 0 + 10: 2133: packCount--; + 10: 2134: if (!packCount) pack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - -: 2125: } // if pack - -: 2126: else { - 2: 2127: if (ctx->nibble == lowNbl) { + -: 2135: } // if pack + -: 2136: else { + 2: 2137: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2128: storeTypeOnly(e->data); -call 0 returned 100% - -: 2129: } - -: 2130: else { - -: 2131: // high nibble - 1: 2132: storeTypeInHighNbl(e->data); - -: 2133: } - 2: 2134: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); -call 0 returned 100% - -: 2135: } - 12: 2136: break; - -: 2137: case INT: - 32: 2138: if (pack) { + 1: 2138: storeTypeOnly(e->data); +call 0 returned 100% + -: 2139: } + -: 2140: else { + -: 2141: // high nibble + 1: 2142: storeTypeInHighNbl(e->data); + -: 2143: } + 2: 2144: sBytesPushBuffer(r, &((sDoublet *)(e->data))->value, sizeof(double)); +call 0 returned 100% + -: 2145: } + 12: 2146: break; + -: 2147: case INT: + 32: 2148: if (pack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 2139: if (type) { + 8: 2149: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2140: // this is the first packed element - 2: 2141: if (ctx->nibble == lowNbl) { + -: 2150: // this is the first packed element + 2: 2151: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2142: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2143: } - -: 2144: else { - -: 2145: // high nibble - -: 2146: // store type in high nibble - 1: 2147: ctx->nibble = lowNbl; - 1: 2148: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2149: *data |= type << 4; - 1: 2150: uintToVarint(r, packCount); -call 0 returned 100% - -: 2151: } - 2: 2152: type = 0; - -: 2153: } // if type - -: 2154: - 8: 2155: i64 v = ((sIntt *)(e->data))->value; - 8: 2156: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2157: // stop packing when packCount == 0 - 8: 2158: packCount--; - 8: 2159: if (!packCount) pack = false; + 1: 2152: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2153: } + -: 2154: else { + -: 2155: // high nibble + -: 2156: // store type in high nibble + 1: 2157: ctx->nibble = lowNbl; + 1: 2158: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2159: *data |= type << 4; + 1: 2160: uintToVarint(r, packCount); +call 0 returned 100% + -: 2161: } + 2: 2162: type = 0; + -: 2163: } // if type + -: 2164: + 8: 2165: i64 v = ((sIntt *)(e->data))->value; + 8: 2166: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2167: // stop packing when packCount == 0 + 8: 2168: packCount--; + 8: 2169: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2160: } // if pack - -: 2161: else { - -: 2162: // encode int to varint - -: 2163: // v is int64_t to convert to varint - 24: 2164: i64 v = ((sIntt *)(e->data))->value; - 24: 2165: if (ctx->nibble == lowNbl) { + -: 2170: } // if pack + -: 2171: else { + -: 2172: // encode int to varint + -: 2173: // v is int64_t to convert to varint + 24: 2174: i64 v = ((sIntt *)(e->data))->value; + 24: 2175: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - -: 2166: // encode v with arithmetic shifts - 12: 2167: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2168: } - -: 2169: else { - -: 2170: // high nibble - 12: 2171: storeTypeInHighNbl(e->data); - 12: 2172: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2173: } - -: 2174: } - 32: 2175: break; - -: 2176: case STRING: - 22: 2177: if (pack) { + -: 2176: // encode v with arithmetic shifts + 12: 2177: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2178: } + -: 2179: else { + -: 2180: // high nibble + 12: 2181: storeTypeInHighNbl(e->data); + 12: 2182: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2183: } + -: 2184: } + 32: 2185: break; + -: 2186: case STRING: + 22: 2187: if (pack) { branch 0 taken 36% (fallthrough) branch 1 taken 64% - 8: 2178: if (type) { + 8: 2188: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2179: // this is the first packed element - 2: 2180: if (ctx->nibble == lowNbl) { + -: 2189: // this is the first packed element + 2: 2190: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2181: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2182: } - -: 2183: else { - -: 2184: // high nibble - -: 2185: // store type in high nibble - 1: 2186: ctx->nibble = lowNbl; - 1: 2187: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2188: *data |= type << 4; - 1: 2189: uintToVarint(r, packCount); -call 0 returned 100% - -: 2190: } - 2: 2191: type = 0; - -: 2192: } // if type - -: 2193: - 8: 2194: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 returned 100% - -: 2195: // stop packing when packCount == 0 - 8: 2196: packCount--; - 8: 2197: if (!packCount) pack = false; + 1: 2191: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2192: } + -: 2193: else { + -: 2194: // high nibble + -: 2195: // store type in high nibble + 1: 2196: ctx->nibble = lowNbl; + 1: 2197: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2198: *data |= type << 4; + 1: 2199: uintToVarint(r, packCount); +call 0 returned 100% + -: 2200: } + 2: 2201: type = 0; + -: 2202: } // if type + -: 2203: + 8: 2204: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); +call 0 returned 100% + -: 2205: // stop packing when packCount == 0 + 8: 2206: packCount--; + 8: 2207: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2198: } // if pack - -: 2199: else { - 14: 2200: if (ctx->nibble == lowNbl) { + -: 2208: } // if pack + -: 2209: else { + 14: 2210: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 13: 2201: storeTypeOnly(e->data); -call 0 returned 100% - -: 2202: } - -: 2203: else { - -: 2204: // high nibble - 1: 2205: storeTypeInHighNbl(e->data); - -: 2206: } - 14: 2207: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); -call 0 returned 100% - -: 2208: } - 22: 2209: break; - -: 2210: case ARRAY: - 15: 2211: if (pack) { + 13: 2211: storeTypeOnly(e->data); +call 0 returned 100% + -: 2212: } + -: 2213: else { + -: 2214: // high nibble + 1: 2215: storeTypeInHighNbl(e->data); + -: 2216: } + 14: 2217: sBytesPushBuffer(r, &((sStringt *)(e->data))->data, sizeof(sStringt) + strlen(&(((sStringt *)(e->data))->data)) -1); +call 0 returned 100% + -: 2218: } + 22: 2219: break; + -: 2220: case ARRAY: + 15: 2221: if (pack) { branch 0 taken 53% (fallthrough) branch 1 taken 47% - 8: 2212: if (type) { + 8: 2222: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2213: // this is the first packed element - 2: 2214: if (ctx->nibble == lowNbl) { + -: 2223: // this is the first packed element + 2: 2224: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2215: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2216: } - -: 2217: else { - -: 2218: // high nibble - -: 2219: // store type in high nibble - 1: 2220: ctx->nibble = lowNbl; - 1: 2221: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2222: *data |= type << 4; - 1: 2223: uintToVarint(r, packCount); -call 0 returned 100% - -: 2224: } - 2: 2225: type = 0; - -: 2226: } // if type - -: 2227: - 8: 2228: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2229: // stop packing when packCount == 0 - 8: 2230: packCount--; - 8: 2231: if (!packCount) pack = false; + 1: 2225: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2226: } + -: 2227: else { + -: 2228: // high nibble + -: 2229: // store type in high nibble + 1: 2230: ctx->nibble = lowNbl; + 1: 2231: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2232: *data |= type << 4; + 1: 2233: uintToVarint(r, packCount); +call 0 returned 100% + -: 2234: } + 2: 2235: type = 0; + -: 2236: } // if type + -: 2237: + 8: 2238: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/PACK); +call 0 returned 100% + -: 2239: // stop packing when packCount == 0 + 8: 2240: packCount--; + 8: 2241: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2232: } // if pack - -: 2233: else - 7: 2234: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/NOPACKING); + -: 2242: } // if pack + -: 2243: else + 7: 2244: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/NOPACKING); call 0 returned 100% - 15: 2235: break; - -: 2236: case BYTES: - 2: 2237: if (pack) { + 15: 2245: break; + -: 2246: case BYTES: + 2: 2247: if (pack) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2238: if (type) { + #####: 2248: if (type) { branch 0 never executed branch 1 never executed - -: 2239: // this is the first packed element - #####: 2240: if (ctx->nibble == lowNbl) { + -: 2249: // this is the first packed element + #####: 2250: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 2241: uintToNetTypeVarint(r, type, packCount); + #####: 2251: uintToNetTypeVarint(r, type, packCount); call 0 never executed - -: 2242: } - -: 2243: else { - -: 2244: // high nibble - -: 2245: // store type in high nibble - #####: 2246: ctx->nibble = lowNbl; - #####: 2247: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 2248: *data |= type << 4; - #####: 2249: uintToVarint(r, packCount); + -: 2252: } + -: 2253: else { + -: 2254: // high nibble + -: 2255: // store type in high nibble + #####: 2256: ctx->nibble = lowNbl; + #####: 2257: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 2258: *data |= type << 4; + #####: 2259: uintToVarint(r, packCount); call 0 never executed - -: 2250: } - #####: 2251: type = 0; - -: 2252: } // if type - -: 2253: - #####: 2254: B = (sBytest *)(e->data); - #####: 2255: uintToVarint(r, B->count); + -: 2260: } + #####: 2261: type = 0; + -: 2262: } // if type + -: 2263: + #####: 2264: B = (sBytest *)(e->data); + #####: 2265: uintToVarint(r, B->count); call 0 never executed - #####: 2256: sBytesPushBuffer(r, &(B->data), B->count); + #####: 2266: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 2257: // stop packing when packCount == 0 - #####: 2258: packCount--; - #####: 2259: if (!packCount) pack = false; + -: 2267: // stop packing when packCount == 0 + #####: 2268: packCount--; + #####: 2269: if (!packCount) pack = false; branch 0 never executed branch 1 never executed - -: 2260: } // if pack - -: 2261: else { - 2: 2262: B = (sBytest *)(e->data); - 2: 2263: if (ctx->nibble == lowNbl) { + -: 2270: } // if pack + -: 2271: else { + 2: 2272: B = (sBytest *)(e->data); + 2: 2273: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2264: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); -call 0 returned 100% - -: 2265: } - -: 2266: else { - -: 2267: // high nibble - 1: 2268: storeTypeInHighNbl(e->data); - 1: 2269: uintToVarint(r, B->count); -call 0 returned 100% - -: 2270: } - 2: 2271: sBytesPushBuffer(r, &(B->data), B->count); -call 0 returned 100% - -: 2272: } - 2: 2273: break; - -: 2274: } - -: 2275: } - -: 2276: } - 56: 2277: ret; - -: 2278:} - -: 2279: - -: 2280:/** - -: 2281: * serialize array - -: 2282: * - -: 2283: * the serialized array is pushed to r. - -: 2284: * All elements are serialized recursively - -: 2285: * - -: 2286: * the data in containers is not serialized - -: 2287: * - -: 2288: * \param - -: 2289: * r small bytes object - -: 2290: * array to serialize - -: 2291: */ + 1: 2274: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count); +call 0 returned 100% + -: 2275: } + -: 2276: else { + -: 2277: // high nibble + 1: 2278: storeTypeInHighNbl(e->data); + 1: 2279: uintToVarint(r, B->count); +call 0 returned 100% + -: 2280: } + 2: 2281: sBytesPushBuffer(r, &(B->data), B->count); +call 0 returned 100% + -: 2282: } + 2: 2283: break; + -: 2284: } + -: 2285: } + -: 2286: } + 56: 2287: ret; + -: 2288:} + -: 2289: + -: 2290:/** + -: 2291: * serialize array + -: 2292: * + -: 2293: * the serialized array is pushed to r. + -: 2294: * All elements are serialized recursively + -: 2295: * + -: 2296: * the data in containers is not serialized + -: 2297: * + -: 2298: * \param + -: 2299: * r small bytes object + -: 2300: * array to serialize + -: 2301: */ function arrayNetSerial called 78 returned 100% blocks executed 91% - 78: 2292:internal void arrayNetSerial(sBytest **r, sArrayt *array, contextt *ctx, packingT packing) { - 78: 2293: sBytest *B = NULL; - 78: 2294: char *data = NULL; - -: 2295: - -: 2296: // check if all elements have same type - -: 2297: // then set array type normal or uniform - -: 2298: // array and dict have to be checked recursively to know if they are normal or uniform - 78: 2299: bool allElementsHaveSameType = true; - 78: 2300: bool foundFirstType = false; - 78: 2301: char type = 0; - -: 2302: - -: 2303: // get first element type - -: 2304: // compare to other element type - -: 2305: // null element are interpreted as undefined - 230: 2306: {forEachSArray(array, e) { + 78: 2302:internal void arrayNetSerial(sBytest **r, sArrayt *array, contextt *ctx, packingT packing) { + 78: 2303: sBytest *B = NULL; + 78: 2304: char *data = NULL; + -: 2305: + -: 2306: // check if all elements have same type + -: 2307: // then set array type normal or uniform + -: 2308: // array and dict have to be checked recursively to know if they are normal or uniform + 78: 2309: bool allElementsHaveSameType = true; + 78: 2310: bool foundFirstType = false; + 78: 2311: char type = 0; + -: 2312: + -: 2313: // get first element type + -: 2314: // compare to other element type + -: 2315: // null element are interpreted as undefined + 230: 2316: {forEachSArray(array, e) { branch 0 taken 82% branch 1 taken 18% (fallthrough) - 189: 2307: if (!e) { + 189: 2317: if (!e) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2308: if (foundFirstType) { + #####: 2318: if (foundFirstType) { branch 0 never executed branch 1 never executed - #####: 2309: if (type != S_UNDEFINED) { + #####: 2319: if (type != S_UNDEFINED) { branch 0 never executed branch 1 never executed - #####: 2310: allElementsHaveSameType = false; - #####: 2311: break; - -: 2312: } - -: 2313: } - -: 2314: else { - #####: 2315: type = S_UNDEFINED; - #####: 2316: foundFirstType = true; - -: 2317: } - -: 2318: } - -: 2319: else { - 189: 2320: if (foundFirstType) { + #####: 2320: allElementsHaveSameType = false; + #####: 2321: break; + -: 2322: } + -: 2323: } + -: 2324: else { + #####: 2325: type = S_UNDEFINED; + #####: 2326: foundFirstType = true; + -: 2327: } + -: 2328: } + -: 2329: else { + 189: 2330: if (foundFirstType) { branch 0 taken 61% (fallthrough) branch 1 taken 39% - -: 2321: u8 nextType; - 115: 2322: switch(e->type) { + -: 2331: u8 nextType; + 115: 2332: switch(e->type) { branch 0 taken 6% branch 1 taken 10% branch 2 taken 84% - -: 2323: case DICT: - 7: 2324: nextType = isDictUniform((sDictt*)e); -call 0 returned 100% - 7: 2325: break; - -: 2326: case ARRAY: - 11: 2327: nextType = isArrayUniform((sArrayt*)e); -call 0 returned 100% - 11: 2328: break; - -: 2329: default: - 97: 2330: nextType = NET_SERIAL_TYPES[(u8)e->type]; - -: 2331: } - 115: 2332: if (nextType != type) { + -: 2333: case DICT: + 7: 2334: nextType = isDictUniform((sDictt*)e); +call 0 returned 100% + 7: 2335: break; + -: 2336: case ARRAY: + 11: 2337: nextType = isArrayUniform((sArrayt*)e); +call 0 returned 100% + 11: 2338: break; + -: 2339: default: + 97: 2340: nextType = NET_SERIAL_TYPES[(u8)e->type]; + -: 2341: } + 115: 2342: if (nextType != type) { branch 0 taken 32% (fallthrough) branch 1 taken 68% - 37: 2333: allElementsHaveSameType = false; - 37: 2334: break; - -: 2335: } - -: 2336: } - -: 2337: else { - 74: 2338: switch(e->type) { + 37: 2343: allElementsHaveSameType = false; + 37: 2344: break; + -: 2345: } + -: 2346: } + -: 2347: else { + 74: 2348: switch(e->type) { branch 0 taken 7% branch 1 taken 8% branch 2 taken 85% - -: 2339: case DICT: - 5: 2340: type = isDictUniform((sDictt*)e); -call 0 returned 100% - 5: 2341: break; - -: 2342: case ARRAY: - 6: 2343: type = isArrayUniform((sArrayt*)e); -call 0 returned 100% - 6: 2344: break; - -: 2345: default: - 63: 2346: type = NET_SERIAL_TYPES[(u8)e->type]; - -: 2347: } - 74: 2348: foundFirstType = true; - -: 2349: } - -: 2350: } - -: 2351: }} - -: 2352: - 78: 2353: if (allElementsHaveSameType) { + -: 2349: case DICT: + 5: 2350: type = isDictUniform((sDictt*)e); +call 0 returned 100% + 5: 2351: break; + -: 2352: case ARRAY: + 6: 2353: type = isArrayUniform((sArrayt*)e); +call 0 returned 100% + 6: 2354: break; + -: 2355: default: + 63: 2356: type = NET_SERIAL_TYPES[(u8)e->type]; + -: 2357: } + 74: 2358: foundFirstType = true; + -: 2359: } + -: 2360: } + -: 2361: }} + -: 2362: + 78: 2363: if (allElementsHaveSameType) { branch 0 taken 53% (fallthrough) branch 1 taken 47% - -: 2354: // uniform array - -: 2355: // encode type and element count - -: 2356: - -: 2357: // in pack array - 41: 2358: if (packing == PACKED) { + -: 2364: // uniform array + -: 2365: // encode type and element count + -: 2366: + -: 2367: // in pack array + 41: 2368: if (packing == PACK) { branch 0 taken 39% (fallthrough) branch 1 taken 61% - -: 2359: // uniform array can't be packed - -: 2360: // because there is only one type of packed arrays - 16: 2361: goto normalArray; - -: 2362: } - 25: 2363: elif (packing == UNIFORM) { + -: 2369: // uniform array can't be packed + -: 2370: // because there is only one type of packed arrays + 16: 2371: goto normalArray; + -: 2372: } + 25: 2373: elif (packing == UNIFORM) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - -: 2364: // when the packing is uniform, there is no need to encode UNIFORM_ARRAY since all elements have this type - 2: 2365: uintToNetTypeVarint(r, type, array->count); + -: 2374: // when the packing is uniform, there is no need to encode UNIFORM_ARRAY since all elements have this type + 2: 2375: uintToNetTypeVarint(r, type, array->count); call 0 returned 100% - -: 2366: } - -: 2367: else { - 23: 2368: if (ctx->nibble == lowNbl) { + -: 2376: } + -: 2377: else { + 23: 2378: if (ctx->nibble == lowNbl) { branch 0 taken 78% (fallthrough) branch 1 taken 22% - 18: 2369: sBytesPush(r, (type << 4) + UNIFORM_ARRAY); -call 0 returned 100% - 18: 2370: uintToVarint(r, array->count); -call 0 returned 100% - -: 2371: } - -: 2372: else { - -: 2373: // high nibble - 5: 2374: ctx->nibble = lowNbl; - 5: 2375: data = (char *)&((*r)->data) + ctx->nblOffset; - 5: 2376: *data |= UNIFORM_ARRAY << 4; - 5: 2377: uintToNetTypeVarint(r, type, array->count); -call 0 returned 100% - -: 2378: } - -: 2379: } - -: 2380: - -: 2381: // encode all element values - 25: 2382: switch(type) { + 18: 2379: sBytesPush(r, (type << 4) + UNIFORM_ARRAY); +call 0 returned 100% + 18: 2380: uintToVarint(r, array->count); +call 0 returned 100% + -: 2381: } + -: 2382: else { + -: 2383: // high nibble + 5: 2384: ctx->nibble = lowNbl; + 5: 2385: data = (char *)&((*r)->data) + ctx->nblOffset; + 5: 2386: *data |= UNIFORM_ARRAY << 4; + 5: 2387: uintToNetTypeVarint(r, type, array->count); +call 0 returned 100% + -: 2388: } + -: 2389: } + -: 2390: + -: 2391: // encode all element values + 25: 2392: switch(type) { branch 0 taken 8% branch 1 taken 8% branch 2 taken 4% @@ -3517,207 +3535,207 @@ branch 4 taken 4% branch 5 taken 16% branch 6 taken 4% branch 7 taken 12% - -: 2383: case S_BOOL: - 16: 2384: {forEachSArray(array, e) { + -: 2393: case S_BOOL: + 16: 2394: {forEachSArray(array, e) { branch 0 taken 88% branch 1 taken 13% (fallthrough) - 14: 2385: if (!ctx->boolOffset) { + 14: 2395: if (!ctx->boolOffset) { branch 0 taken 14% (fallthrough) branch 1 taken 86% - -: 2386: // new packed bools - 2: 2387: storeNew8bPackedBool(e); + -: 2396: // new packed bools + 2: 2397: storeNew8bPackedBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2388: } - -: 2389: else { - -: 2390: // there was a bool before this one, fill bits in nibbles - 12: 2391: if (ctx->boolShift == 8) { + -: 2398: } + -: 2399: else { + -: 2400: // there was a bool before this one, fill bits in nibbles + 12: 2401: if (ctx->boolShift == 8) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - -: 2392: // previous packed bool is full - -: 2393: // next byte is the new packed bools - 1: 2394: storeNew8bPackedBool(e); + -: 2402: // previous packed bool is full + -: 2403: // next byte is the new packed bools + 1: 2404: storeNew8bPackedBool(e); branch 0 taken 0% (fallthrough) branch 1 taken 100% call 2 returned 100% - -: 2395: } - -: 2396: else { - 11: 2397: storeBool(e); + -: 2405: } + -: 2406: else { + 11: 2407: storeBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% - -: 2398: } - -: 2399: } - -: 2400: }} - 2: 2401: break; - -: 2402: case S_DICT: - -: 2403: case UNIFORM_DICT: - 6: 2404: {forEachSArray(array, e) { + -: 2408: } + -: 2409: } + -: 2410: }} + 2: 2411: break; + -: 2412: case S_DICT: + -: 2413: case UNIFORM_DICT: + 6: 2414: {forEachSArray(array, e) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 4: 2405: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/UNIFORM); + 4: 2415: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 2406: }} - 2: 2407: break; - -: 2408: case S_DOUBLE: - 4: 2409: {forEachSArray(array, e) { + -: 2416: }} + 2: 2417: break; + -: 2418: case S_DOUBLE: + 4: 2419: {forEachSArray(array, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 2410: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); + 3: 2420: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); call 0 returned 100% - -: 2411: }} - 1: 2412: break; - -: 2413: case S_INT: - 49: 2414: {forEachSArray(array, e) { + -: 2421: }} + 1: 2422: break; + -: 2423: case S_INT: + 49: 2424: {forEachSArray(array, e) { branch 0 taken 78% branch 1 taken 22% (fallthrough) - 38: 2415: i64 v = ((sIntt *)e)->value; - 38: 2416: uintToVarint(r, (v << 1) ^ (v >> 63)); + 38: 2425: i64 v = ((sIntt *)e)->value; + 38: 2426: uintToVarint(r, (v << 1) ^ (v >> 63)); call 0 returned 100% - -: 2417: }} - 11: 2418: break; - -: 2419: case S_STRING: - 4: 2420: {forEachSArray(array, e) { + -: 2427: }} + 11: 2428: break; + -: 2429: case S_STRING: + 4: 2430: {forEachSArray(array, e) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 2421: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); + 3: 2431: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); call 0 returned 100% - -: 2422: }} - 1: 2423: break; - -: 2424: case S_ARRAY: - -: 2425: case UNIFORM_ARRAY: - 10: 2426: {forEachSArray(array, e) { + -: 2432: }} + 1: 2433: break; + -: 2434: case S_ARRAY: + -: 2435: case UNIFORM_ARRAY: + 10: 2436: {forEachSArray(array, e) { branch 0 taken 60% branch 1 taken 40% (fallthrough) - 6: 2427: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/UNIFORM); + 6: 2437: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/UNIFORM); call 0 returned 100% - -: 2428: }} - 4: 2429: break; - -: 2430: case S_BYTES: - 3: 2431: {forEachSArray(array, e) { + -: 2438: }} + 4: 2439: break; + -: 2440: case S_BYTES: + 3: 2441: {forEachSArray(array, e) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 2432: B = (sBytest *)e; - 2: 2433: uintToVarint(r, B->count); -call 0 returned 100% - 2: 2434: sBytesPushBuffer(r, &(B->data), B->count); -call 0 returned 100% - -: 2435: }} - 1: 2436: break; - -: 2437: } - 25: 2438: ret; - -: 2439: } - -: 2440: - -: 2441: normalArray: - -: 2442: // encode type and element count - 53: 2443: if (packing == PACKED or packing == UNIFORM) { + 2: 2442: B = (sBytest *)e; + 2: 2443: uintToVarint(r, B->count); +call 0 returned 100% + 2: 2444: sBytesPushBuffer(r, &(B->data), B->count); +call 0 returned 100% + -: 2445: }} + 1: 2446: break; + -: 2447: } + 25: 2448: ret; + -: 2449: } + -: 2450: + -: 2451: normalArray: + -: 2452: // encode type and element count + 53: 2453: if (packing == PACK or packing == UNIFORM) { branch 0 taken 70% (fallthrough) branch 1 taken 30% branch 2 taken 16% (fallthrough) branch 3 taken 84% - -: 2444: // when the packing is packed or uniform, there is no need to encode ARRAY type since all elements have this type - 22: 2445: uintToVarint(r, array->count); + -: 2454: // when the packing is packed or uniform, there is no need to encode ARRAY type since all elements have this type + 22: 2455: uintToVarint(r, array->count); call 0 returned 100% - -: 2446: } - -: 2447: else { - 31: 2448: if (ctx->nibble == lowNbl) { + -: 2456: } + -: 2457: else { + 31: 2458: if (ctx->nibble == lowNbl) { branch 0 taken 90% (fallthrough) branch 1 taken 10% - 28: 2449: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); -call 0 returned 100% - -: 2450: } - -: 2451: else { - -: 2452: // high nibble - 3: 2453: storeTypeInHighNbl(array); - 3: 2454: uintToVarint(r, array->count); -call 0 returned 100% - -: 2455: } - -: 2456: } - -: 2457: - 53: 2458: bool pack = false; - -: 2459: size_t packCount; - 218: 2460: enumerateSArray(array, e, eIdx) { + 28: 2459: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count); +call 0 returned 100% + -: 2460: } + -: 2461: else { + -: 2462: // high nibble + 3: 2463: storeTypeInHighNbl(array); + 3: 2464: uintToVarint(r, array->count); +call 0 returned 100% + -: 2465: } + -: 2466: } + -: 2467: + 53: 2468: bool pack = false; + -: 2469: size_t packCount; + 218: 2470: enumerateSArray(array, e, eIdx) { branch 0 taken 76% branch 1 taken 24% (fallthrough) - 165: 2461: if (!e) { + 165: 2471: if (!e) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 2462: // empty slots are represented as undefined elements - #####: 2463: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 2464: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); -call 0 never executed - #####: 2465: ctx->nibble = highNbl; - #####: 2466: ctx->nblOffset = (*r)->count -1; - -: 2467: } - -: 2468: else { - -: 2469: // high nibble - #####: 2470: ctx->nibble = lowNbl; - #####: 2471: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 2472: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; - -: 2473: } - -: 2474: } - -: 2475: else { - 165: 2476: if (!pack) { + -: 2472: // empty slots are represented as undefined elements + #####: 2473: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 2474: sBytesPush(r, NET_SERIAL_TYPES[UNDEFINED]); +call 0 never executed + #####: 2475: ctx->nibble = highNbl; + #####: 2476: ctx->nblOffset = (*r)->count -1; + -: 2477: } + -: 2478: else { + -: 2479: // high nibble + #####: 2480: ctx->nibble = lowNbl; + #####: 2481: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 2482: *data |= NET_SERIAL_TYPES[UNDEFINED] << 4; + -: 2483: } + -: 2484: } + -: 2485: else { + 165: 2486: if (!pack) { branch 0 taken 82% (fallthrough) branch 1 taken 18% - -: 2477: // scan array for packing - 135: 2478: if ((array->count - eIdx) > 3) { + -: 2487: // scan array for packing + 135: 2488: if ((array->count - eIdx) > 3) { branch 0 taken 30% (fallthrough) branch 1 taken 70% - -: 2479: // at least 4 elements, less than that is not worth it - 41: 2480: if ( e->type == DICT + -: 2489: // at least 4 elements, less than that is not worth it + 41: 2490: if ( e->type == DICT branch 0 taken 90% (fallthrough) branch 1 taken 10% - 37: 2481: or e->type == DOUBLE + 37: 2491: or e->type == DOUBLE branch 0 taken 95% (fallthrough) branch 1 taken 5% - 35: 2482: or e->type == INT + 35: 2492: or e->type == INT branch 0 taken 89% (fallthrough) branch 1 taken 11% - 31: 2483: or e->type == STRING + 31: 2493: or e->type == STRING branch 0 taken 94% (fallthrough) branch 1 taken 6% - 29: 2484: or e->type == ARRAY + 29: 2494: or e->type == ARRAY branch 0 taken 93% (fallthrough) branch 1 taken 7% - 27: 2485: or e->type == BYTES) { + 27: 2495: or e->type == BYTES) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - 14: 2486: type = e->type; - 14: 2487: packCount = 1; - 14: 2488: smallt *element = ((smallt **) &((array)->data))[eIdx+1]; - 47: 2489: for (size_t i = eIdx+1; i < (array)->count ; i++, element = ((smallt **) &((array)->data))[i]) { + 14: 2496: type = e->type; + 14: 2497: packCount = 1; + 14: 2498: smallt *element = ((smallt **) &((array)->data))[eIdx+1]; + 47: 2499: for (size_t i = eIdx+1; i < (array)->count ; i++, element = ((smallt **) &((array)->data))[i]) { branch 0 taken 100% branch 1 taken 0% (fallthrough) - 47: 2490: if (!element) { + 47: 2500: if (!element) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 2491: // null element are undefined - #####: 2492: break; - -: 2493: } - -: 2494: else { - 47: 2495: if (element->type != type) { + -: 2501: // null element are undefined + #####: 2502: break; + -: 2503: } + -: 2504: else { + 47: 2505: if (element->type != type) { branch 0 taken 30% (fallthrough) branch 1 taken 70% - 14: 2496: break; - -: 2497: } - 33: 2498: packCount++; - -: 2499: } // if element - -: 2500: } // for - 14: 2501: if (packCount > 3) { + 14: 2506: break; + -: 2507: } + 33: 2508: packCount++; + -: 2509: } // if element + -: 2510: } // for + 14: 2511: if (packCount > 3) { branch 0 taken 71% (fallthrough) branch 1 taken 29% - 10: 2502: type = PACKED_NET_SERIAL_TYPES[(u8)type]; - 10: 2503: pack = true; - -: 2504: } - -: 2505: } // test current element type - -: 2506: } // is array big enough - -: 2507: } // not already packing - -: 2508: - -: 2509: // encode element value - 165: 2510: switch(e->type) { + 10: 2512: type = PACKED_NET_SERIAL_TYPES[(u8)type]; + 10: 2513: pack = true; + -: 2514: } + -: 2515: } // test current element type + -: 2516: } // is array big enough + -: 2517: } // not already packing + -: 2518: + -: 2519: // encode element value + 165: 2520: switch(e->type) { branch 0 taken 18% branch 1 taken 22% branch 2 taken 9% @@ -3727,419 +3745,419 @@ branch 5 taken 13% branch 6 taken 10% branch 7 taken 1% branch 8 taken 0% - -: 2511: case UNDEFINED: - -: 2512: case CONTAINER: - 29: 2513: if (ctx->nibble == lowNbl) { + -: 2521: case UNDEFINED: + -: 2522: case CONTAINER: + 29: 2523: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 27: 2514: storeTypeOnly(e); -call 0 returned 100% - -: 2515: } - -: 2516: else { - -: 2517: // high nibble - 2: 2518: storeTypeInHighNbl(e); - -: 2519: } - 29: 2520: break; - -: 2521: case BOOL: - 36: 2522: if (!ctx->boolOffset) { + 27: 2524: storeTypeOnly(e); +call 0 returned 100% + -: 2525: } + -: 2526: else { + -: 2527: // high nibble + 2: 2528: storeTypeInHighNbl(e); + -: 2529: } + 29: 2530: break; + -: 2531: case BOOL: + 36: 2532: if (!ctx->boolOffset) { branch 0 taken 22% (fallthrough) branch 1 taken 78% - -: 2523: // new packed bools - 8: 2524: if (ctx->nibble == lowNbl) { + -: 2533: // new packed bools + 8: 2534: if (ctx->nibble == lowNbl) { branch 0 taken 63% (fallthrough) branch 1 taken 38% - 5: 2525: storeNew4bPackedBool(e); + 5: 2535: storeNew4bPackedBool(e); branch 0 taken 80% (fallthrough) branch 1 taken 20% call 2 returned 100% - -: 2526: } - -: 2527: else { - -: 2528: // high nibble, next byte is packed bools - 3: 2529: storeTypeInHighNbl(e); - 3: 2530: storeNew8bPackedBool(e); + -: 2536: } + -: 2537: else { + -: 2538: // high nibble, next byte is packed bools + 3: 2539: storeTypeInHighNbl(e); + 3: 2540: storeNew8bPackedBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2531: } - -: 2532: } - -: 2533: else { - -: 2534: // there was a bool before this one, fill bits in nibbles - 28: 2535: if (ctx->nibble == lowNbl) { + -: 2541: } + -: 2542: } + -: 2543: else { + -: 2544: // there was a bool before this one, fill bits in nibbles + 28: 2545: if (ctx->nibble == lowNbl) { branch 0 taken 61% (fallthrough) branch 1 taken 39% - 17: 2536: if (ctx->boolShift == 8) { + 17: 2546: if (ctx->boolShift == 8) { branch 0 taken 12% (fallthrough) branch 1 taken 88% - -: 2537: // previous packed bool is full - -: 2538: // this byte is the new packed bools - 2: 2539: storeNew4bPackedBool(e); + -: 2547: // previous packed bool is full + -: 2548: // this byte is the new packed bools + 2: 2549: storeNew4bPackedBool(e); branch 0 taken 50% (fallthrough) branch 1 taken 50% call 2 returned 100% - -: 2540: } - -: 2541: else { - 15: 2542: storeTypeOnly(e); + -: 2550: } + -: 2551: else { + 15: 2552: storeTypeOnly(e); call 0 returned 100% - 15: 2543: storeBool(e); + 15: 2553: storeBool(e); branch 0 taken 53% (fallthrough) branch 1 taken 47% - -: 2544: } - -: 2545: } - -: 2546: else { - -: 2547: // high nibble - 11: 2548: storeTypeInHighNbl(e); - 11: 2549: if (ctx->boolShift == 8) { + -: 2554: } + -: 2555: } + -: 2556: else { + -: 2557: // high nibble + 11: 2558: storeTypeInHighNbl(e); + 11: 2559: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - -: 2550: // previous packed bool is full - -: 2551: // next byte is the new packed bools - 2: 2552: storeNew8bPackedBool(e); + -: 2560: // previous packed bool is full + -: 2561: // next byte is the new packed bools + 2: 2562: storeNew8bPackedBool(e); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% - -: 2553: } - -: 2554: else { - 9: 2555: storeBool(e); + -: 2563: } + -: 2564: else { + 9: 2565: storeBool(e); branch 0 taken 78% (fallthrough) branch 1 taken 22% - -: 2556: } - -: 2557: } - -: 2558: } - 36: 2559: break; - -: 2560: case DICT: - 15: 2561: if (pack) { + -: 2566: } + -: 2567: } + -: 2568: } + 36: 2569: break; + -: 2570: case DICT: + 15: 2571: if (pack) { branch 0 taken 53% (fallthrough) branch 1 taken 47% - 8: 2562: if (type) { + 8: 2572: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2563: // this is the first packed element - 2: 2564: if (ctx->nibble == lowNbl) { + -: 2573: // this is the first packed element + 2: 2574: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2565: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2566: } - -: 2567: else { - -: 2568: // high nibble - -: 2569: // store type in high nibble - 1: 2570: ctx->nibble = lowNbl; - 1: 2571: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2572: *data |= type << 4; - 1: 2573: uintToVarint(r, packCount); -call 0 returned 100% - -: 2574: } - 2: 2575: type = 0; - -: 2576: } // if type - -: 2577: - 8: 2578: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2579: // stop packing when packCount == 0 - 8: 2580: packCount--; - 8: 2581: if (!packCount) pack = false; + 1: 2575: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2576: } + -: 2577: else { + -: 2578: // high nibble + -: 2579: // store type in high nibble + 1: 2580: ctx->nibble = lowNbl; + 1: 2581: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2582: *data |= type << 4; + 1: 2583: uintToVarint(r, packCount); +call 0 returned 100% + -: 2584: } + 2: 2585: type = 0; + -: 2586: } // if type + -: 2587: + 8: 2588: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/PACK); +call 0 returned 100% + -: 2589: // stop packing when packCount == 0 + 8: 2590: packCount--; + 8: 2591: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2582: } // if pack - -: 2583: else - 7: 2584: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/NOPACKING); + -: 2592: } // if pack + -: 2593: else + 7: 2594: dictNetSerial(r, (sDictt *)e, ctx, /*packing=*/NOPACKING); call 0 returned 100% - 15: 2585: break; - -: 2586: case DOUBLE: - 10: 2587: if (pack) { + 15: 2595: break; + -: 2596: case DOUBLE: + 10: 2597: if (pack) { branch 0 taken 80% (fallthrough) branch 1 taken 20% - 8: 2588: if (type) { + 8: 2598: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2589: // this is the first packed element - 2: 2590: if (ctx->nibble == lowNbl) { + -: 2599: // this is the first packed element + 2: 2600: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2591: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2592: } - -: 2593: else { - -: 2594: // high nibble - -: 2595: // store type in high nibble - 1: 2596: ctx->nibble = lowNbl; - 1: 2597: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2598: *data |= type << 4; - 1: 2599: uintToVarint(r, packCount); -call 0 returned 100% - -: 2600: } - 2: 2601: type = 0; - -: 2602: } // if type - -: 2603: - 8: 2604: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); -call 0 returned 100% - -: 2605: // stop packing when packCount == 0 - 8: 2606: packCount--; - 8: 2607: if (!packCount) pack = false; + 1: 2601: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2602: } + -: 2603: else { + -: 2604: // high nibble + -: 2605: // store type in high nibble + 1: 2606: ctx->nibble = lowNbl; + 1: 2607: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2608: *data |= type << 4; + 1: 2609: uintToVarint(r, packCount); +call 0 returned 100% + -: 2610: } + 2: 2611: type = 0; + -: 2612: } // if type + -: 2613: + 8: 2614: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); +call 0 returned 100% + -: 2615: // stop packing when packCount == 0 + 8: 2616: packCount--; + 8: 2617: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2608: } // if pack - -: 2609: else { - 2: 2610: if (ctx->nibble == lowNbl) { + -: 2618: } // if pack + -: 2619: else { + 2: 2620: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2611: storeTypeOnly(e); -call 0 returned 100% - -: 2612: } - -: 2613: else { - -: 2614: // high nibble - 1: 2615: storeTypeInHighNbl(e); - -: 2616: } - 2: 2617: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); -call 0 returned 100% - -: 2618: } - 10: 2619: break; - -: 2620: case INT: - 36: 2621: if (pack) { + 1: 2621: storeTypeOnly(e); +call 0 returned 100% + -: 2622: } + -: 2623: else { + -: 2624: // high nibble + 1: 2625: storeTypeInHighNbl(e); + -: 2626: } + 2: 2627: sBytesPushBuffer(r, &((sDoublet *)e)->value, sizeof(double)); +call 0 returned 100% + -: 2628: } + 10: 2629: break; + -: 2630: case INT: + 36: 2631: if (pack) { branch 0 taken 22% (fallthrough) branch 1 taken 78% - 8: 2622: if (type) { + 8: 2632: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2623: // this is the first packed element - 2: 2624: if (ctx->nibble == lowNbl) { + -: 2633: // this is the first packed element + 2: 2634: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2625: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2626: } - -: 2627: else { - -: 2628: // high nibble - -: 2629: // store type in high nibble - 1: 2630: ctx->nibble = lowNbl; - 1: 2631: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2632: *data |= type << 4; - 1: 2633: uintToVarint(r, packCount); -call 0 returned 100% - -: 2634: } - 2: 2635: type = 0; - -: 2636: } // if type - -: 2637: - 8: 2638: i64 v = ((sIntt *)&(e->type))->value; - 8: 2639: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2640: // stop packing when packCount == 0 - 8: 2641: packCount--; - 8: 2642: if (!packCount) pack = false; + 1: 2635: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2636: } + -: 2637: else { + -: 2638: // high nibble + -: 2639: // store type in high nibble + 1: 2640: ctx->nibble = lowNbl; + 1: 2641: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2642: *data |= type << 4; + 1: 2643: uintToVarint(r, packCount); +call 0 returned 100% + -: 2644: } + 2: 2645: type = 0; + -: 2646: } // if type + -: 2647: + 8: 2648: i64 v = ((sIntt *)&(e->type))->value; + 8: 2649: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2650: // stop packing when packCount == 0 + 8: 2651: packCount--; + 8: 2652: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2643: } // if pack - -: 2644: else { - -: 2645: // encode int to varint - -: 2646: // v is int64_t to convert to varint - 28: 2647: i64 v = ((sIntt *)&(e->type))->value; - 28: 2648: if (ctx->nibble == lowNbl) { + -: 2653: } // if pack + -: 2654: else { + -: 2655: // encode int to varint + -: 2656: // v is int64_t to convert to varint + 28: 2657: i64 v = ((sIntt *)&(e->type))->value; + 28: 2658: if (ctx->nibble == lowNbl) { branch 0 taken 86% (fallthrough) branch 1 taken 14% - -: 2649: // encode v with arithmetic shifts - 24: 2650: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2651: } - -: 2652: else { - -: 2653: // high nibble - 4: 2654: storeTypeInHighNbl(e); - 4: 2655: uintToVarint(r, (v << 1) ^ (v >> 63)); -call 0 returned 100% - -: 2656: } - -: 2657: } - 36: 2658: break; - -: 2659: case STRING: - 21: 2660: if (pack) { + -: 2659: // encode v with arithmetic shifts + 24: 2660: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2661: } + -: 2662: else { + -: 2663: // high nibble + 4: 2664: storeTypeInHighNbl(e); + 4: 2665: uintToVarint(r, (v << 1) ^ (v >> 63)); +call 0 returned 100% + -: 2666: } + -: 2667: } + 36: 2668: break; + -: 2669: case STRING: + 21: 2670: if (pack) { branch 0 taken 38% (fallthrough) branch 1 taken 62% - 8: 2661: if (type) { + 8: 2671: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2662: // this is the first packed element - 2: 2663: if (ctx->nibble == lowNbl) { + -: 2672: // this is the first packed element + 2: 2673: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2664: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2665: } - -: 2666: else { - -: 2667: // high nibble - -: 2668: // store type in high nibble - 1: 2669: ctx->nibble = lowNbl; - 1: 2670: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2671: *data |= type << 4; - 1: 2672: uintToVarint(r, packCount); -call 0 returned 100% - -: 2673: } - 2: 2674: type = 0; - -: 2675: } // if type - -: 2676: - 8: 2677: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); -call 0 returned 100% - -: 2678: // stop packing when packCount == 0 - 8: 2679: packCount--; - 8: 2680: if (!packCount) pack = false; + 1: 2674: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2675: } + -: 2676: else { + -: 2677: // high nibble + -: 2678: // store type in high nibble + 1: 2679: ctx->nibble = lowNbl; + 1: 2680: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2681: *data |= type << 4; + 1: 2682: uintToVarint(r, packCount); +call 0 returned 100% + -: 2683: } + 2: 2684: type = 0; + -: 2685: } // if type + -: 2686: + 8: 2687: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); +call 0 returned 100% + -: 2688: // stop packing when packCount == 0 + 8: 2689: packCount--; + 8: 2690: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2681: } // if pack - -: 2682: else { - 13: 2683: if (ctx->nibble == lowNbl) { + -: 2691: } // if pack + -: 2692: else { + 13: 2693: if (ctx->nibble == lowNbl) { branch 0 taken 69% (fallthrough) branch 1 taken 31% - 9: 2684: storeTypeOnly(e); -call 0 returned 100% - -: 2685: } - -: 2686: else { - -: 2687: // high nibble - 4: 2688: storeTypeInHighNbl(e); - -: 2689: } - 13: 2690: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); -call 0 returned 100% - -: 2691: } - 21: 2692: break; - -: 2693: case ARRAY: - 16: 2694: if (pack) { + 9: 2694: storeTypeOnly(e); +call 0 returned 100% + -: 2695: } + -: 2696: else { + -: 2697: // high nibble + 4: 2698: storeTypeInHighNbl(e); + -: 2699: } + 13: 2700: sBytesPushBuffer(r, &((sStringt *)e)->data, sizeof(sStringt) + strlen(&(((sStringt *)e)->data)) -1); +call 0 returned 100% + -: 2701: } + 21: 2702: break; + -: 2703: case ARRAY: + 16: 2704: if (pack) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 8: 2695: if (type) { + 8: 2705: if (type) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2696: // this is the first packed element - 2: 2697: if (ctx->nibble == lowNbl) { + -: 2706: // this is the first packed element + 2: 2707: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2698: uintToNetTypeVarint(r, type, packCount); -call 0 returned 100% - -: 2699: } - -: 2700: else { - -: 2701: // high nibble - -: 2702: // store type in high nibble - 1: 2703: ctx->nibble = lowNbl; - 1: 2704: data = (char *)&((*r)->data) + ctx->nblOffset; - 1: 2705: *data |= type << 4; - 1: 2706: uintToVarint(r, packCount); -call 0 returned 100% - -: 2707: } - 2: 2708: type = 0; - -: 2709: } // if type - -: 2710: - 8: 2711: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/PACKED); -call 0 returned 100% - -: 2712: // stop packing when packCount == 0 - 8: 2713: packCount--; - 8: 2714: if (!packCount) pack = false; + 1: 2708: uintToNetTypeVarint(r, type, packCount); +call 0 returned 100% + -: 2709: } + -: 2710: else { + -: 2711: // high nibble + -: 2712: // store type in high nibble + 1: 2713: ctx->nibble = lowNbl; + 1: 2714: data = (char *)&((*r)->data) + ctx->nblOffset; + 1: 2715: *data |= type << 4; + 1: 2716: uintToVarint(r, packCount); +call 0 returned 100% + -: 2717: } + 2: 2718: type = 0; + -: 2719: } // if type + -: 2720: + 8: 2721: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/PACK); +call 0 returned 100% + -: 2722: // stop packing when packCount == 0 + 8: 2723: packCount--; + 8: 2724: if (!packCount) pack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - -: 2715: } // if pack - -: 2716: else - 8: 2717: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/NOPACKING); + -: 2725: } // if pack + -: 2726: else + 8: 2727: arrayNetSerial(r, (sArrayt *)e, ctx, /*packing=*/NOPACKING); call 0 returned 100% - 16: 2718: break; - -: 2719: case BYTES: - 2: 2720: if (pack) { + 16: 2728: break; + -: 2729: case BYTES: + 2: 2730: if (pack) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2721: if (type) { + #####: 2731: if (type) { branch 0 never executed branch 1 never executed - -: 2722: // this is the first packed element - #####: 2723: if (ctx->nibble == lowNbl) { + -: 2732: // this is the first packed element + #####: 2733: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 2724: uintToNetTypeVarint(r, type, packCount); + #####: 2734: uintToNetTypeVarint(r, type, packCount); call 0 never executed - -: 2725: } - -: 2726: else { - -: 2727: // high nibble - -: 2728: // store type in high nibble - #####: 2729: ctx->nibble = lowNbl; - #####: 2730: data = (char *)&((*r)->data) + ctx->nblOffset; - #####: 2731: *data |= type << 4; - #####: 2732: uintToVarint(r, packCount); + -: 2735: } + -: 2736: else { + -: 2737: // high nibble + -: 2738: // store type in high nibble + #####: 2739: ctx->nibble = lowNbl; + #####: 2740: data = (char *)&((*r)->data) + ctx->nblOffset; + #####: 2741: *data |= type << 4; + #####: 2742: uintToVarint(r, packCount); call 0 never executed - -: 2733: } - #####: 2734: type = 0; - -: 2735: } // if type - -: 2736: - #####: 2737: B = (sBytest *)e; - #####: 2738: uintToVarint(r, B->count); + -: 2743: } + #####: 2744: type = 0; + -: 2745: } // if type + -: 2746: + #####: 2747: B = (sBytest *)e; + #####: 2748: uintToVarint(r, B->count); call 0 never executed - #####: 2739: sBytesPushBuffer(r, &(B->data), B->count); + #####: 2749: sBytesPushBuffer(r, &(B->data), B->count); call 0 never executed - -: 2740: // stop packing when packCount == 0 - #####: 2741: packCount--; - #####: 2742: if (!packCount) pack = false; + -: 2750: // stop packing when packCount == 0 + #####: 2751: packCount--; + #####: 2752: if (!packCount) pack = false; branch 0 never executed branch 1 never executed - -: 2743: } // if pack - -: 2744: else { - 2: 2745: B = (sBytest *)e; - 2: 2746: if (ctx->nibble == lowNbl) { + -: 2753: } // if pack + -: 2754: else { + 2: 2755: B = (sBytest *)e; + 2: 2756: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 2747: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); -call 0 returned 100% - -: 2748: } - -: 2749: else { - -: 2750: // high nibble - 1: 2751: storeTypeInHighNbl(e); - 1: 2752: uintToVarint(r, B->count); -call 0 returned 100% - -: 2753: } - 2: 2754: sBytesPushBuffer(r, &(B->data), B->count); -call 0 returned 100% - -: 2755: } - 2: 2756: break; - -: 2757: } - -: 2758: } - -: 2759: } - 53: 2760: ret; - -: 2761:} - -: 2762: -function serialNetSerial called 85 returned 100% blocks executed 80% - 85: 2763:internal smallBytest* serialNetSerial(smallJsont *self) { - -: 2764: - 85: 2765: smallt *o = getsoG(self); -call 0 returned 100% - -: 2766: - 85: 2767: if (o == NULL) + 1: 2757: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count); +call 0 returned 100% + -: 2758: } + -: 2759: else { + -: 2760: // high nibble + 1: 2761: storeTypeInHighNbl(e); + 1: 2762: uintToVarint(r, B->count); +call 0 returned 100% + -: 2763: } + 2: 2764: sBytesPushBuffer(r, &(B->data), B->count); +call 0 returned 100% + -: 2765: } + 2: 2766: break; + -: 2767: } + -: 2768: } + -: 2769: } + 53: 2770: ret; + -: 2771:} + -: 2772: +function serialNetSerial called 86 returned 100% blocks executed 80% + 86: 2773:internal smallBytest* serialNetSerial(smallJsont *self) { + -: 2774: + 86: 2775: smallt *o = getsoG(self); +call 0 returned 100% + -: 2776: + 86: 2777: if (o == NULL) branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2768: ret NULL; - -: 2769: - 85: 2770: sBytest *B = netSerial(o); + #####: 2778: ret NULL; + -: 2779: + 86: 2780: sBytest *B = netSerial(o); call 0 returned 100% - -: 2771: - 85: 2772: if (!B) { + -: 2781: + 86: 2782: if (!B) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 2773: ret NULL; - -: 2774: } - -: 2775: - 85: 2776: createAllocateSmallBytes(r); -call 0 returned 100% - 85: 2777: r->B = B; - 85: 2778: ret r; - -: 2779:} - -: 2780: - -: 2781:// ------------------------------------- - -: 2782:// Deserializers - -: 2783: - -: 2784:// level 0 - -: 2785:// like smallJson with ints and length encoded as varints - -: 2786: - -: 2787:/** - -: 2788: * deserializer top function - -: 2789: */ + #####: 2783: ret NULL; + -: 2784: } + -: 2785: + 86: 2786: createAllocateSmallBytes(r); +call 0 returned 100% + 86: 2787: r->B = B; + 86: 2788: ret r; + -: 2789:} + -: 2790: + -: 2791:// ------------------------------------- + -: 2792:// Deserializers + -: 2793: + -: 2794:// level 0 + -: 2795:// like smallJson with ints and length encoded as varints + -: 2796: + -: 2797:/** + -: 2798: * deserializer top function + -: 2799: */ function netDeserialLevel0 called 0 returned 0% blocks executed 0% - #####: 2790:internal smallt* netDeserialLevel0(sBytest *obj) { - #####: 2791: smallt *r = NULL; - #####: 2792: double *D = NULL; - #####: 2793: char *s = NULL; - #####: 2794: sBytest *B = NULL; - -: 2795: uint32_t count; - #####: 2796: char *data = NULL; - -: 2797: - #####: 2798: switch(obj->data & 0xF) { + #####: 2800:internal smallt* netDeserialLevel0(sBytest *obj) { + #####: 2801: smallt *r = NULL; + #####: 2802: double *D = NULL; + #####: 2803: char *s = NULL; + #####: 2804: sBytest *B = NULL; + -: 2805: uint32_t count; + #####: 2806: char *data = NULL; + -: 2807: + #####: 2808: switch(obj->data & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4149,103 +4167,103 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 2799: case S_UNDEFINED: - #####: 2800: r = (smallt *) allocSUndefined(); -call 0 never executed - #####: 2801: break; - -: 2802: case S_BOOL: - #####: 2803: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 never executed - #####: 2804: break; - -: 2805: case S_DICT: - #####: 2806: data = (char *)&(obj->data); - #####: 2807: dictNetDeserialLevel0((sDictt **)&r, &data); + -: 2809: case S_UNDEFINED: + #####: 2810: r = (smallt *) allocSUndefined(); call 0 never executed - #####: 2808: break; - -: 2809: case S_DOUBLE: - #####: 2810: data = &(obj->data)+1; - #####: 2811: D = (double *)data; - #####: 2812: r = (smallt *) allocSDouble(*D); + #####: 2811: break; + -: 2812: case S_BOOL: + #####: 2813: r = (smallt *) allocSBool(obj->data & 0x10); call 0 never executed - #####: 2813: break; - -: 2814: case S_INT: - #####: 2815: data = &(obj->data); - #####: 2816: u64 v = netTypeVarintToUint((u8**)&data); + #####: 2814: break; + -: 2815: case S_DICT: + #####: 2816: data = (char *)&(obj->data); + #####: 2817: dictNetDeserialLevel0((sDictt **)&r, &data); call 0 never executed - #####: 2817: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 2818: r = (smallt *) allocSInt(v); -call 0 never executed - #####: 2819: break; - -: 2820: case S_STRING: - #####: 2821: s = (char *)&(obj->data)+1; - #####: 2822: r = (smallt *) allocSStringTiny(s); + #####: 2818: break; + -: 2819: case S_DOUBLE: + #####: 2820: data = &(obj->data)+1; + #####: 2821: D = (double *)data; + #####: 2822: r = (smallt *) allocSDouble(*D); call 0 never executed #####: 2823: break; - -: 2824: case S_ARRAY: - #####: 2825: data = (char *)&(obj->data); - #####: 2826: arrayNetDeserialLevel0((sArrayt **)&r, &data); -call 0 never executed - #####: 2827: break; - -: 2828: case S_BYTES: - #####: 2829: B = allocSBytes(); -call 0 never executed - #####: 2830: data = &(obj->data); - #####: 2831: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 2832: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 2833: r = (smallt *)B; - #####: 2834: break; - -: 2835: } - -: 2836: - #####: 2837: ret r; - -: 2838:} - -: 2839: - -: 2840:/** - -: 2841: * deserialize dictionary from data - -: 2842: * - -: 2843: * a new dictionary is allocated - -: 2844: * - -: 2845: * \param - -: 2846: * dict dictionary holding the elements - -: 2847: * data serialized dictionary - -: 2848: */ + -: 2824: case S_INT: + #####: 2825: data = &(obj->data); + #####: 2826: u64 v = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 2827: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 2828: r = (smallt *) allocSInt(v); +call 0 never executed + #####: 2829: break; + -: 2830: case S_STRING: + #####: 2831: s = (char *)&(obj->data)+1; + #####: 2832: r = (smallt *) allocSStringTiny(s); +call 0 never executed + #####: 2833: break; + -: 2834: case S_ARRAY: + #####: 2835: data = (char *)&(obj->data); + #####: 2836: arrayNetDeserialLevel0((sArrayt **)&r, &data); +call 0 never executed + #####: 2837: break; + -: 2838: case S_BYTES: + #####: 2839: B = allocSBytes(); +call 0 never executed + #####: 2840: data = &(obj->data); + #####: 2841: count = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 2842: sBytesPushBuffer(&B, data, count); +call 0 never executed + #####: 2843: r = (smallt *)B; + #####: 2844: break; + -: 2845: } + -: 2846: + #####: 2847: ret r; + -: 2848:} + -: 2849: + -: 2850:/** + -: 2851: * deserialize dictionary from data + -: 2852: * + -: 2853: * a new dictionary is allocated + -: 2854: * + -: 2855: * \param + -: 2856: * dict dictionary holding the elements + -: 2857: * data serialized dictionary + -: 2858: */ function dictNetDeserialLevel0 called 0 returned 0% blocks executed 0% - #####: 2849:internal void dictNetDeserialLevel0(sDictt **dict, char **data) { - #####: 2850: sUndefinedt *u = NULL; - #####: 2851: sBoolt *bo = NULL; - #####: 2852: double *D = NULL; - #####: 2853: sDoublet *Do = NULL; - #####: 2854: sDictt *d = NULL; - #####: 2855: sIntt *io = NULL; - #####: 2856: char *s = NULL; - #####: 2857: sStringt *so = NULL; - #####: 2858: sArrayt *a = NULL; - #####: 2859: sBytest *B = NULL; - -: 2860: uint32_t count; - -: 2861: uint32_t dictCount; - -: 2862: - #####: 2863: dictCount = netTypeVarintToUint((u8**)data); -call 0 never executed - -: 2864: - #####: 2865: if (!dictCount) { -branch 0 never executed -branch 1 never executed - #####: 2866: *dict = allocSDict(); -call 0 never executed - #####: 2867: ret; - -: 2868: } - -: 2869: - #####: 2870: loop(dictCount) { -branch 0 never executed -branch 1 never executed - -: 2871: char type; - -: 2872: char *key; - #####: 2873: key = *data; - #####: 2874: *data += strlen(key)+1; - #####: 2875: type = **data; - -: 2876: - #####: 2877: switch(type & 0xF) { + #####: 2859:internal void dictNetDeserialLevel0(sDictt **dict, char **data) { + #####: 2860: sUndefinedt *u = NULL; + #####: 2861: sBoolt *bo = NULL; + #####: 2862: double *D = NULL; + #####: 2863: sDoublet *Do = NULL; + #####: 2864: sDictt *d = NULL; + #####: 2865: sIntt *io = NULL; + #####: 2866: char *s = NULL; + #####: 2867: sStringt *so = NULL; + #####: 2868: sArrayt *a = NULL; + #####: 2869: sBytest *B = NULL; + -: 2870: uint32_t count; + -: 2871: uint32_t dictCount; + -: 2872: + #####: 2873: dictCount = netTypeVarintToUint((u8**)data); +call 0 never executed + -: 2874: + #####: 2875: if (!dictCount) { +branch 0 never executed +branch 1 never executed + #####: 2876: *dict = allocSDict(); +call 0 never executed + #####: 2877: ret; + -: 2878: } + -: 2879: + #####: 2880: loop(dictCount) { +branch 0 never executed +branch 1 never executed + -: 2881: char type; + -: 2882: char *key; + #####: 2883: key = *data; + #####: 2884: *data += strlen(key)+1; + #####: 2885: type = **data; + -: 2886: + #####: 2887: switch(type & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4255,119 +4273,119 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 2878: case S_UNDEFINED: - #####: 2879: (*data)++; - #####: 2880: u = allocSUndefined(); + -: 2888: case S_UNDEFINED: + #####: 2889: (*data)++; + #####: 2890: u = allocSUndefined(); call 0 never executed - #####: 2881: sDictPushTiny(dict, key, (smallt *) u); + #####: 2891: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - #####: 2882: break; - -: 2883: case S_BOOL: - #####: 2884: (*data)++; - #####: 2885: bo = allocSBool(type & 0x10); + #####: 2892: break; + -: 2893: case S_BOOL: + #####: 2894: (*data)++; + #####: 2895: bo = allocSBool(type & 0x10); call 0 never executed - #####: 2886: sDictPushTiny(dict, key, (smallt *) bo); + #####: 2896: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - #####: 2887: break; - -: 2888: case S_DICT: - #####: 2889: d = NULL; - #####: 2890: dictNetDeserialLevel0(&d, data); + #####: 2897: break; + -: 2898: case S_DICT: + #####: 2899: d = NULL; + #####: 2900: dictNetDeserialLevel0(&d, data); call 0 never executed - #####: 2891: sDictPushTiny(dict, key, (smallt *) d); + #####: 2901: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - #####: 2892: break; - -: 2893: case S_DOUBLE: - #####: 2894: (*data)++; - #####: 2895: D = (double *)(*data); - #####: 2896: *data += sizeof(double); - #####: 2897: Do = allocSDouble(*D); -call 0 never executed - #####: 2898: sDictPushTiny(dict, key, (smallt *) Do); -call 0 never executed - #####: 2899: break; - -: 2900: case S_INT: { - #####: 2901: u64 v = netTypeVarintToUint((u8**)data); -call 0 never executed - #####: 2902: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 2903: io = allocSInt(v); -call 0 never executed - #####: 2904: sDictPushTiny(dict, key, (smallt *) io); -call 0 never executed - -: 2905: } - #####: 2906: break; - -: 2907: case S_STRING: - #####: 2908: (*data)++; - #####: 2909: s = (char *)(*data); - #####: 2910: *data += strlen(s)+1; - #####: 2911: so = allocSStringTiny(s); -call 0 never executed - #####: 2912: sDictPushTiny(dict, key, (smallt *) so); -call 0 never executed - #####: 2913: break; - -: 2914: case S_ARRAY: - #####: 2915: a = NULL; - #####: 2916: arrayNetDeserialLevel0(&a, data); -call 0 never executed - #####: 2917: sDictPushTiny(dict, key, (smallt *) a); -call 0 never executed - #####: 2918: break; - -: 2919: case S_BYTES: - #####: 2920: B = allocSBytes(); -call 0 never executed - #####: 2921: count = netTypeVarintToUint((u8**)data); -call 0 never executed - #####: 2922: sBytesPushBuffer(&B, *data, count); -call 0 never executed - #####: 2923: *data += count; - #####: 2924: sDictPushTiny(dict, key, (smallt *) B); -call 0 never executed - #####: 2925: break; - -: 2926: } - -: 2927: } - -: 2928:} - -: 2929: - -: 2930:/** - -: 2931: * deserialize array from data - -: 2932: * - -: 2933: * a new array is allocated - -: 2934: * - -: 2935: * \param - -: 2936: * array holding the elements - -: 2937: * data serialized dictionary - -: 2938: */ + #####: 2902: break; + -: 2903: case S_DOUBLE: + #####: 2904: (*data)++; + #####: 2905: D = (double *)(*data); + #####: 2906: *data += sizeof(double); + #####: 2907: Do = allocSDouble(*D); +call 0 never executed + #####: 2908: sDictPushTiny(dict, key, (smallt *) Do); +call 0 never executed + #####: 2909: break; + -: 2910: case S_INT: { + #####: 2911: u64 v = netTypeVarintToUint((u8**)data); +call 0 never executed + #####: 2912: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 2913: io = allocSInt(v); +call 0 never executed + #####: 2914: sDictPushTiny(dict, key, (smallt *) io); +call 0 never executed + -: 2915: } + #####: 2916: break; + -: 2917: case S_STRING: + #####: 2918: (*data)++; + #####: 2919: s = (char *)(*data); + #####: 2920: *data += strlen(s)+1; + #####: 2921: so = allocSStringTiny(s); +call 0 never executed + #####: 2922: sDictPushTiny(dict, key, (smallt *) so); +call 0 never executed + #####: 2923: break; + -: 2924: case S_ARRAY: + #####: 2925: a = NULL; + #####: 2926: arrayNetDeserialLevel0(&a, data); +call 0 never executed + #####: 2927: sDictPushTiny(dict, key, (smallt *) a); +call 0 never executed + #####: 2928: break; + -: 2929: case S_BYTES: + #####: 2930: B = allocSBytes(); +call 0 never executed + #####: 2931: count = netTypeVarintToUint((u8**)data); +call 0 never executed + #####: 2932: sBytesPushBuffer(&B, *data, count); +call 0 never executed + #####: 2933: *data += count; + #####: 2934: sDictPushTiny(dict, key, (smallt *) B); +call 0 never executed + #####: 2935: break; + -: 2936: } + -: 2937: } + -: 2938:} + -: 2939: + -: 2940:/** + -: 2941: * deserialize array from data + -: 2942: * + -: 2943: * a new array is allocated + -: 2944: * + -: 2945: * \param + -: 2946: * array holding the elements + -: 2947: * data serialized dictionary + -: 2948: */ function arrayNetDeserialLevel0 called 0 returned 0% blocks executed 0% - #####: 2939:internal void arrayNetDeserialLevel0(sArrayt **array, char **data) { - #####: 2940: sUndefinedt *u = NULL; - #####: 2941: sBoolt *bo = NULL; - #####: 2942: double *D = NULL; - #####: 2943: sDoublet *Do = NULL; - #####: 2944: sDictt *d = NULL; - #####: 2945: sIntt *io = NULL; - #####: 2946: char *s = NULL; - #####: 2947: sStringt *so = NULL; - #####: 2948: sArrayt *a = NULL; - #####: 2949: sBytest *B = NULL; - -: 2950: uint32_t count; - -: 2951: uint32_t arrayCount; - -: 2952: - #####: 2953: arrayCount = netTypeVarintToUint((u8**)data); + #####: 2949:internal void arrayNetDeserialLevel0(sArrayt **array, char **data) { + #####: 2950: sUndefinedt *u = NULL; + #####: 2951: sBoolt *bo = NULL; + #####: 2952: double *D = NULL; + #####: 2953: sDoublet *Do = NULL; + #####: 2954: sDictt *d = NULL; + #####: 2955: sIntt *io = NULL; + #####: 2956: char *s = NULL; + #####: 2957: sStringt *so = NULL; + #####: 2958: sArrayt *a = NULL; + #####: 2959: sBytest *B = NULL; + -: 2960: uint32_t count; + -: 2961: uint32_t arrayCount; + -: 2962: + #####: 2963: arrayCount = netTypeVarintToUint((u8**)data); call 0 never executed - -: 2954: - #####: 2955: if (!arrayCount) { + -: 2964: + #####: 2965: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 2956: *array = allocSArray();; + #####: 2966: *array = allocSArray();; call 0 never executed - #####: 2957: ret; - -: 2958: } - -: 2959: - #####: 2960: loop(arrayCount) { + #####: 2967: ret; + -: 2968: } + -: 2969: + #####: 2970: loop(arrayCount) { branch 0 never executed branch 1 never executed - -: 2961: char type; - #####: 2962: type = **data; - -: 2963: - #####: 2964: switch(type & 0xF) { + -: 2971: char type; + #####: 2972: type = **data; + -: 2973: + #####: 2974: switch(type & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4377,125 +4395,125 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 2965: case S_UNDEFINED: - #####: 2966: (*data)++; - #####: 2967: u = allocSUndefined(); + -: 2975: case S_UNDEFINED: + #####: 2976: (*data)++; + #####: 2977: u = allocSUndefined(); call 0 never executed - #####: 2968: sArrayPushTiny(array, (smallt *) u); + #####: 2978: sArrayPushTiny(array, (smallt *) u); call 0 never executed - #####: 2969: break; - -: 2970: case S_BOOL: - #####: 2971: (*data)++; - #####: 2972: bo = allocSBool(type & 0x10); + #####: 2979: break; + -: 2980: case S_BOOL: + #####: 2981: (*data)++; + #####: 2982: bo = allocSBool(type & 0x10); call 0 never executed - #####: 2973: sArrayPushTiny(array, (smallt *) bo); + #####: 2983: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - #####: 2974: break; - -: 2975: case S_DICT: - #####: 2976: d = NULL; - #####: 2977: dictNetDeserialLevel0(&d, data); + #####: 2984: break; + -: 2985: case S_DICT: + #####: 2986: d = NULL; + #####: 2987: dictNetDeserialLevel0(&d, data); call 0 never executed - #####: 2978: sArrayPushTiny(array, (smallt *) d); + #####: 2988: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 2979: break; - -: 2980: case S_DOUBLE: - #####: 2981: (*data)++; - #####: 2982: D = (double *)(*data); - #####: 2983: *data += sizeof(double); - #####: 2984: Do = allocSDouble(*D); + #####: 2989: break; + -: 2990: case S_DOUBLE: + #####: 2991: (*data)++; + #####: 2992: D = (double *)(*data); + #####: 2993: *data += sizeof(double); + #####: 2994: Do = allocSDouble(*D); call 0 never executed - #####: 2985: sArrayPushTiny(array, (smallt *) Do); + #####: 2995: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - #####: 2986: break; - -: 2987: case S_INT: { - #####: 2988: u64 v = netTypeVarintToUint((u8**)data); + #####: 2996: break; + -: 2997: case S_INT: { + #####: 2998: u64 v = netTypeVarintToUint((u8**)data); call 0 never executed - #####: 2989: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 2990: io = allocSInt(v); + #####: 2999: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3000: io = allocSInt(v); call 0 never executed - #####: 2991: sArrayPushTiny(array, (smallt *) io); + #####: 3001: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 2992: } - #####: 2993: break; - -: 2994: case S_STRING: - #####: 2995: (*data)++; - #####: 2996: s = (char *)(*data); - #####: 2997: *data += strlen(s)+1; - #####: 2998: so = allocSStringTiny(s); + -: 3002: } + #####: 3003: break; + -: 3004: case S_STRING: + #####: 3005: (*data)++; + #####: 3006: s = (char *)(*data); + #####: 3007: *data += strlen(s)+1; + #####: 3008: so = allocSStringTiny(s); call 0 never executed - #####: 2999: sArrayPushTiny(array, (smallt *) so); + #####: 3009: sArrayPushTiny(array, (smallt *) so); call 0 never executed - #####: 3000: break; - -: 3001: case S_ARRAY: - #####: 3002: a = NULL; - #####: 3003: arrayNetDeserialLevel0(&a, data); + #####: 3010: break; + -: 3011: case S_ARRAY: + #####: 3012: a = NULL; + #####: 3013: arrayNetDeserialLevel0(&a, data); call 0 never executed - #####: 3004: sArrayPushTiny(array, (smallt *) a); + #####: 3014: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 3005: break; - -: 3006: case S_BYTES: - #####: 3007: B = allocSBytes(); + #####: 3015: break; + -: 3016: case S_BYTES: + #####: 3017: B = allocSBytes(); call 0 never executed - #####: 3008: count = netTypeVarintToUint((u8**)data); + #####: 3018: count = netTypeVarintToUint((u8**)data); call 0 never executed - #####: 3009: sBytesPushBuffer(&B, *data, count); + #####: 3019: sBytesPushBuffer(&B, *data, count); call 0 never executed - #####: 3010: *data += count; - #####: 3011: sArrayPushTiny(array, (smallt *) B); + #####: 3020: *data += count; + #####: 3021: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 3012: break; - -: 3013: } - -: 3014: } - -: 3015:} - -: 3016: + #####: 3022: break; + -: 3023: } + -: 3024: } + -: 3025:} + -: 3026: function deserialNetSerialLevel0 called 0 returned 0% blocks executed 0% - #####: 3017:internal smallJsont* deserialNetSerialLevel0(smallJsont *self, smallBytest *data) { - -: 3018: - #####: 3019: if (!data or !data->B or !data->B->count) { + #####: 3027:internal smallJsont* deserialNetSerialLevel0(smallJsont *self, smallBytest *data) { + -: 3028: + #####: 3029: 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 - #####: 3020: ret self; - -: 3021: } - -: 3022: - #####: 3023: smallt *o = netDeserialLevel0(data->B); + #####: 3030: ret self; + -: 3031: } + -: 3032: + #####: 3033: smallt *o = netDeserialLevel0(data->B); call 0 never executed - -: 3024: - #####: 3025: if (!o) { + -: 3034: + #####: 3035: if (!o) { branch 0 never executed branch 1 never executed - #####: 3026: ret self; - -: 3027: } - -: 3028: - #####: 3029: freeG(self); -call 0 never executed - -: 3030: - #####: 3031: setsoG(self, o); -call 0 never executed - -: 3032: - #####: 3033: ret self; - -: 3034:} - -: 3035: - -: 3036:// level 1 - -: 3037:// like level 0 with type encoded in nibbles and bools are packed + #####: 3036: ret self; + -: 3037: } -: 3038: - -: 3039:/** - -: 3040: * deserializer top function - -: 3041: */ + #####: 3039: freeG(self); +call 0 never executed + -: 3040: + #####: 3041: setsoG(self, o); +call 0 never executed + -: 3042: + #####: 3043: ret self; + -: 3044:} + -: 3045: + -: 3046:// level 1 + -: 3047:// like level 0 with type encoded in nibbles and bools are packed + -: 3048: + -: 3049:/** + -: 3050: * deserializer top function + -: 3051: */ function netDeserialLevel1 called 0 returned 0% blocks executed 0% - #####: 3042:internal smallt* netDeserialLevel1(sBytest *obj) { - #####: 3043: smallt *r = NULL; - #####: 3044: double *D = NULL; - #####: 3045: char *s = NULL; - #####: 3046: sBytest *B = NULL; - -: 3047: uint32_t count; - #####: 3048: char *data = NULL; - #####: 3049: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; - -: 3050: - #####: 3051: switch(obj->data & 0xF) { + #####: 3052:internal smallt* netDeserialLevel1(sBytest *obj) { + #####: 3053: smallt *r = NULL; + #####: 3054: double *D = NULL; + #####: 3055: char *s = NULL; + #####: 3056: sBytest *B = NULL; + -: 3057: uint32_t count; + #####: 3058: char *data = NULL; + #####: 3059: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; + -: 3060: + #####: 3061: switch(obj->data & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4505,130 +4523,130 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 3052: case S_UNDEFINED: - #####: 3053: r = (smallt *) allocSUndefined(); -call 0 never executed - #####: 3054: break; - -: 3055: case S_BOOL: - #####: 3056: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 never executed - #####: 3057: break; - -: 3058: case S_DICT: - #####: 3059: data = (char *)&(obj->data); - -: 3060: //debug - ctx.dbuf = (u8*) data; - #####: 3061: dictNetDeserialLevel1((sDictt **)&r, (u8**)&data, &ctx); + -: 3062: case S_UNDEFINED: + #####: 3063: r = (smallt *) allocSUndefined(); call 0 never executed - #####: 3062: break; - -: 3063: case S_DOUBLE: - #####: 3064: data = &(obj->data)+1; - #####: 3065: D = (double *)data; - #####: 3066: r = (smallt *) allocSDouble(*D); + #####: 3064: break; + -: 3065: case S_BOOL: + #####: 3066: r = (smallt *) allocSBool(obj->data & 0x10); call 0 never executed #####: 3067: break; - -: 3068: case S_INT: - #####: 3069: data = &(obj->data); - #####: 3070: u64 v = netTypeVarintToUint((u8**)&data); + -: 3068: case S_DICT: + #####: 3069: data = (char *)&(obj->data); + -: 3070: //debug - ctx.dbuf = (u8*) data; + #####: 3071: dictNetDeserialLevel1((sDictt **)&r, (u8**)&data, &ctx); call 0 never executed - #####: 3071: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 3072: r = (smallt *) allocSInt(v); -call 0 never executed - #####: 3073: break; - -: 3074: case S_STRING: - #####: 3075: s = (char *)&(obj->data)+1; - #####: 3076: r = (smallt *) allocSStringTiny(s); + #####: 3072: break; + -: 3073: case S_DOUBLE: + #####: 3074: data = &(obj->data)+1; + #####: 3075: D = (double *)data; + #####: 3076: r = (smallt *) allocSDouble(*D); call 0 never executed #####: 3077: break; - -: 3078: case S_ARRAY: - #####: 3079: data = (char *)&(obj->data); - -: 3080: //debug - ctx.dbuf = (u8*) data; - #####: 3081: arrayNetDeserialLevel1((sArrayt **)&r, (u8**)&data, &ctx); -call 0 never executed - #####: 3082: break; - -: 3083: case S_BYTES: - #####: 3084: B = allocSBytes(); -call 0 never executed - #####: 3085: data = &(obj->data); - #####: 3086: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 3087: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 3088: r = (smallt *)B; - #####: 3089: break; - -: 3090: } - -: 3091: - #####: 3092: ret r; - -: 3093:} - -: 3094: - -: 3095:/** - -: 3096: * deserialize dictionary from data - -: 3097: * - -: 3098: * a new dictionary is allocated - -: 3099: * - -: 3100: * \param - -: 3101: * dict dictionary holding the elements - -: 3102: * data serialized dictionary - -: 3103: */ + -: 3078: case S_INT: + #####: 3079: data = &(obj->data); + #####: 3080: u64 v = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 3081: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3082: r = (smallt *) allocSInt(v); +call 0 never executed + #####: 3083: break; + -: 3084: case S_STRING: + #####: 3085: s = (char *)&(obj->data)+1; + #####: 3086: r = (smallt *) allocSStringTiny(s); +call 0 never executed + #####: 3087: break; + -: 3088: case S_ARRAY: + #####: 3089: data = (char *)&(obj->data); + -: 3090: //debug - ctx.dbuf = (u8*) data; + #####: 3091: arrayNetDeserialLevel1((sArrayt **)&r, (u8**)&data, &ctx); +call 0 never executed + #####: 3092: break; + -: 3093: case S_BYTES: + #####: 3094: B = allocSBytes(); +call 0 never executed + #####: 3095: data = &(obj->data); + #####: 3096: count = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 3097: sBytesPushBuffer(&B, data, count); +call 0 never executed + #####: 3098: r = (smallt *)B; + #####: 3099: break; + -: 3100: } + -: 3101: + #####: 3102: ret r; + -: 3103:} + -: 3104: + -: 3105:/** + -: 3106: * deserialize dictionary from data + -: 3107: * + -: 3108: * a new dictionary is allocated + -: 3109: * + -: 3110: * \param + -: 3111: * dict dictionary holding the elements + -: 3112: * data serialized dictionary + -: 3113: */ function dictNetDeserialLevel1 called 0 returned 0% blocks executed 0% - #####: 3104:internal void dictNetDeserialLevel1(sDictt **dict, u8 **data, contextt *ctx) { - #####: 3105: sUndefinedt *u = NULL; - #####: 3106: sBoolt *bo = NULL; - #####: 3107: double *D = NULL; - #####: 3108: sDoublet *Do = NULL; - #####: 3109: sDictt *d = NULL; - #####: 3110: sIntt *io = NULL; - #####: 3111: char *s = NULL; - #####: 3112: sStringt *so = NULL; - #####: 3113: sArrayt *a = NULL; - #####: 3114: sBytest *B = NULL; - -: 3115: uint32_t count; - -: 3116: uint32_t dictCount; - -: 3117: - #####: 3118: if (ctx->nibble == lowNbl) { + #####: 3114:internal void dictNetDeserialLevel1(sDictt **dict, u8 **data, contextt *ctx) { + #####: 3115: sUndefinedt *u = NULL; + #####: 3116: sBoolt *bo = NULL; + #####: 3117: double *D = NULL; + #####: 3118: sDoublet *Do = NULL; + #####: 3119: sDictt *d = NULL; + #####: 3120: sIntt *io = NULL; + #####: 3121: char *s = NULL; + #####: 3122: sStringt *so = NULL; + #####: 3123: sArrayt *a = NULL; + #####: 3124: sBytest *B = NULL; + -: 3125: uint32_t count; + -: 3126: uint32_t dictCount; + -: 3127: + #####: 3128: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3119: dictCount = netTypeVarintToUint(data); + #####: 3129: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3120: } - -: 3121: else { - -: 3122: // high nibble - -: 3123: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; - -: 3124: #define readTypeInHighNbl\ - -: 3125: ctx->nibble = lowNbl;\ - -: 3126: if (ctx->nblAddr == *data)\ - -: 3127: /* data points to the type, next byte is count */\ - -: 3128: (*data)++ - #####: 3129: readTypeInHighNbl; + -: 3130: } + -: 3131: else { + -: 3132: // high nibble + -: 3133: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; + -: 3134: #define readTypeInHighNbl\ + -: 3135: ctx->nibble = lowNbl;\ + -: 3136: if (ctx->nblAddr == *data)\ + -: 3137: /* data points to the type, next byte is count */\ + -: 3138: (*data)++ + #####: 3139: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3130: dictCount = varintToUint(data); + #####: 3140: dictCount = varintToUint(data); call 0 never executed - -: 3131: } - -: 3132: - #####: 3133: if (!dictCount) { + -: 3141: } + -: 3142: + #####: 3143: if (!dictCount) { branch 0 never executed branch 1 never executed - #####: 3134: *dict = allocSDict(); + #####: 3144: *dict = allocSDict(); call 0 never executed - #####: 3135: ret; - -: 3136: } - -: 3137: - #####: 3138: loop(dictCount) { + #####: 3145: ret; + -: 3146: } + -: 3147: + #####: 3148: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3139: char *key = (char*)*data; - #####: 3140: *data += strlen(key)+1; - -: 3141: char type; - #####: 3142: if (ctx->nibble == lowNbl) { + #####: 3149: char *key = (char*)*data; + #####: 3150: *data += strlen(key)+1; + -: 3151: char type; + #####: 3152: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3143: type = (**data) & 0xF; - -: 3144: } - -: 3145: else { - -: 3146: // high nibble - #####: 3147: type = (*ctx->nblAddr) >> 4; - -: 3148: } - -: 3149: - #####: 3150: switch(type) { + #####: 3153: type = (**data) & 0xF; + -: 3154: } + -: 3155: else { + -: 3156: // high nibble + #####: 3157: type = (*ctx->nblAddr) >> 4; + -: 3158: } + -: 3159: + #####: 3160: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4638,261 +4656,261 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 3151: case S_UNDEFINED: - #####: 3152: if (ctx->nibble == lowNbl) { + -: 3161: case S_UNDEFINED: + #####: 3162: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3153: #define readTypeOnly\ - -: 3154: ctx->nibble = highNbl;\ - -: 3155: ctx->nblAddr = *data;\ - -: 3156: (*data)++ - #####: 3157: readTypeOnly; - -: 3158: } - -: 3159: else { - -: 3160: // high nibble - #####: 3161: readTypeInHighNbl; + -: 3163: #define readTypeOnly\ + -: 3164: ctx->nibble = highNbl;\ + -: 3165: ctx->nblAddr = *data;\ + -: 3166: (*data)++ + #####: 3167: readTypeOnly; + -: 3168: } + -: 3169: else { + -: 3170: // high nibble + #####: 3171: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3162: } - #####: 3163: u = allocSUndefined(); + -: 3172: } + #####: 3173: u = allocSUndefined(); call 0 never executed - #####: 3164: sDictPushTiny(dict, key, (smallt *) u); + #####: 3174: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - #####: 3165: break; - -: 3166: case S_BOOL: - #####: 3167: if (!ctx->boolAddr) { + #####: 3175: break; + -: 3176: case S_BOOL: + #####: 3177: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3168: // new packed bools - #####: 3169: if (ctx->nibble == lowNbl) { + -: 3178: // new packed bools + #####: 3179: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3170: #define read4bPackedBool\ - -: 3171: ctx->boolShift = 5;\ - -: 3172: ctx->boolAddr = *data;\ - -: 3173: (*data)++ - #####: 3174: read4bPackedBool; - #####: 3175: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 never executed - -: 3176: } - -: 3177: else { - -: 3178: // high nibble - #####: 3179: readTypeInHighNbl; -branch 0 never executed -branch 1 never executed - -: 3180: #define read8bPackedBool\ - -: 3181: ctx->boolShift = 1;\ + -: 3180: #define read4bPackedBool\ + -: 3181: ctx->boolShift = 5;\ -: 3182: ctx->boolAddr = *data;\ -: 3183: (*data)++ - #####: 3184: read8bPackedBool; - #####: 3185: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3184: read4bPackedBool; + #####: 3185: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed -: 3186: } - -: 3187: } - -: 3188: else { - -: 3189: // there was a bool before this one, read bits in nibbles - #####: 3190: if (ctx->nibble == lowNbl) { + -: 3187: else { + -: 3188: // high nibble + #####: 3189: readTypeInHighNbl; +branch 0 never executed +branch 1 never executed + -: 3190: #define read8bPackedBool\ + -: 3191: ctx->boolShift = 1;\ + -: 3192: ctx->boolAddr = *data;\ + -: 3193: (*data)++ + #####: 3194: read8bPackedBool; + #####: 3195: bo = allocSBool((*ctx->boolAddr) & 0x1); +call 0 never executed + -: 3196: } + -: 3197: } + -: 3198: else { + -: 3199: // there was a bool before this one, read bits in nibbles + #####: 3200: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3191: if (ctx->boolShift == 8) { + #####: 3201: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3192: read4bPackedBool; - #####: 3193: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3202: read4bPackedBool; + #####: 3203: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3194: } - -: 3195: else { - #####: 3196: readTypeOnly; - #####: 3197: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3204: } + -: 3205: else { + #####: 3206: readTypeOnly; + #####: 3207: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3198: } - -: 3199: } - -: 3200: else { - -: 3201: // high nibble - #####: 3202: readTypeInHighNbl; + -: 3208: } + -: 3209: } + -: 3210: else { + -: 3211: // high nibble + #####: 3212: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3203: if (ctx->boolShift == 8) { + #####: 3213: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3204: read8bPackedBool; - #####: 3205: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3214: read8bPackedBool; + #####: 3215: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3206: } - -: 3207: else { - -: 3208: // high nibble - #####: 3209: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3216: } + -: 3217: else { + -: 3218: // high nibble + #####: 3219: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3210: } - -: 3211: } - -: 3212: } - #####: 3213: sDictPushTiny(dict, key, (smallt *) bo); + -: 3220: } + -: 3221: } + -: 3222: } + #####: 3223: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - #####: 3214: break; - -: 3215: case S_DICT: - #####: 3216: d = NULL; - #####: 3217: dictNetDeserialLevel1(&d, data, ctx); + #####: 3224: break; + -: 3225: case S_DICT: + #####: 3226: d = NULL; + #####: 3227: dictNetDeserialLevel1(&d, data, ctx); call 0 never executed - #####: 3218: sDictPushTiny(dict, key, (smallt *) d); + #####: 3228: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - #####: 3219: break; - -: 3220: case S_DOUBLE: - #####: 3221: if (ctx->nibble == lowNbl) { + #####: 3229: break; + -: 3230: case S_DOUBLE: + #####: 3231: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3222: readTypeOnly; - -: 3223: } - -: 3224: else { - -: 3225: // high nibble - #####: 3226: readTypeInHighNbl; + #####: 3232: readTypeOnly; + -: 3233: } + -: 3234: else { + -: 3235: // high nibble + #####: 3236: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3227: } - #####: 3228: D = (double *)(*data); - #####: 3229: *data += sizeof(double); - #####: 3230: Do = allocSDouble(*D); + -: 3237: } + #####: 3238: D = (double *)(*data); + #####: 3239: *data += sizeof(double); + #####: 3240: Do = allocSDouble(*D); call 0 never executed - #####: 3231: sDictPushTiny(dict, key, (smallt *) Do); + #####: 3241: sDictPushTiny(dict, key, (smallt *) Do); call 0 never executed - #####: 3232: break; - -: 3233: case S_INT: { - -: 3234: u64 v; - #####: 3235: if (ctx->nibble == lowNbl) { + #####: 3242: break; + -: 3243: case S_INT: { + -: 3244: u64 v; + #####: 3245: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3236: v = netTypeVarintToUint((u8**)data); + #####: 3246: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3237: } - -: 3238: else { - -: 3239: // high nibble - #####: 3240: readTypeInHighNbl; + -: 3247: } + -: 3248: else { + -: 3249: // high nibble + #####: 3250: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3241: v = varintToUint(data); + #####: 3251: v = varintToUint(data); call 0 never executed - -: 3242: } - #####: 3243: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 3244: io = allocSInt(v); + -: 3252: } + #####: 3253: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3254: io = allocSInt(v); call 0 never executed - #####: 3245: sDictPushTiny(dict, key, (smallt *) io); + #####: 3255: sDictPushTiny(dict, key, (smallt *) io); call 0 never executed - -: 3246: } - #####: 3247: break; - -: 3248: case S_STRING: - #####: 3249: if (ctx->nibble == lowNbl) { + -: 3256: } + #####: 3257: break; + -: 3258: case S_STRING: + #####: 3259: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3250: readTypeOnly; - -: 3251: } - -: 3252: else { - -: 3253: // high nibble - #####: 3254: readTypeInHighNbl; + #####: 3260: readTypeOnly; + -: 3261: } + -: 3262: else { + -: 3263: // high nibble + #####: 3264: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3255: } - #####: 3256: s = (char *)(*data); - #####: 3257: *data += strlen(s)+1; - #####: 3258: so = allocSStringTiny(s); + -: 3265: } + #####: 3266: s = (char *)(*data); + #####: 3267: *data += strlen(s)+1; + #####: 3268: so = allocSStringTiny(s); call 0 never executed - #####: 3259: sDictPushTiny(dict, key, (smallt *) so); + #####: 3269: sDictPushTiny(dict, key, (smallt *) so); call 0 never executed - #####: 3260: break; - -: 3261: case S_ARRAY: - #####: 3262: a = NULL; - #####: 3263: arrayNetDeserialLevel1(&a, data, ctx); + #####: 3270: break; + -: 3271: case S_ARRAY: + #####: 3272: a = NULL; + #####: 3273: arrayNetDeserialLevel1(&a, data, ctx); call 0 never executed - #####: 3264: sDictPushTiny(dict, key, (smallt *) a); + #####: 3274: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - #####: 3265: break; - -: 3266: case S_BYTES: - #####: 3267: B = allocSBytes(); + #####: 3275: break; + -: 3276: case S_BYTES: + #####: 3277: B = allocSBytes(); call 0 never executed - #####: 3268: if (ctx->nibble == lowNbl) { + #####: 3278: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3269: count = netTypeVarintToUint((u8**)data); + #####: 3279: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3270: } - -: 3271: else { - -: 3272: // high nibble - #####: 3273: readTypeInHighNbl; + -: 3280: } + -: 3281: else { + -: 3282: // high nibble + #####: 3283: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3274: count = varintToUint((u8**)data); + #####: 3284: count = varintToUint((u8**)data); call 0 never executed - -: 3275: } - #####: 3276: sBytesPushBuffer(&B, *data, count); + -: 3285: } + #####: 3286: sBytesPushBuffer(&B, *data, count); call 0 never executed - #####: 3277: *data += count; - #####: 3278: sDictPushTiny(dict, key, (smallt *) B); + #####: 3287: *data += count; + #####: 3288: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed - #####: 3279: break; - -: 3280: } - -: 3281: } - -: 3282:} - -: 3283: - -: 3284:/** - -: 3285: * deserialize array from data - -: 3286: * - -: 3287: * a new array is allocated - -: 3288: * - -: 3289: * \param - -: 3290: * array holding the elements - -: 3291: * data serialized dictionary - -: 3292: */ + #####: 3289: break; + -: 3290: } + -: 3291: } + -: 3292:} + -: 3293: + -: 3294:/** + -: 3295: * deserialize array from data + -: 3296: * + -: 3297: * a new array is allocated + -: 3298: * + -: 3299: * \param + -: 3300: * array holding the elements + -: 3301: * data serialized dictionary + -: 3302: */ function arrayNetDeserialLevel1 called 0 returned 0% blocks executed 0% - #####: 3293:internal void arrayNetDeserialLevel1(sArrayt **array, u8 **data, contextt *ctx) { - #####: 3294: sUndefinedt *u = NULL; - #####: 3295: sBoolt *bo = NULL; - #####: 3296: double *D = NULL; - #####: 3297: sDoublet *Do = NULL; - #####: 3298: sDictt *d = NULL; - #####: 3299: sIntt *io = NULL; - #####: 3300: char *s = NULL; - #####: 3301: sStringt *so = NULL; - #####: 3302: sArrayt *a = NULL; - #####: 3303: sBytest *B = NULL; - -: 3304: uint32_t count; - -: 3305: uint32_t arrayCount; - -: 3306: - #####: 3307: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 3308: arrayCount = netTypeVarintToUint(data); + #####: 3303:internal void arrayNetDeserialLevel1(sArrayt **array, u8 **data, contextt *ctx) { + #####: 3304: sUndefinedt *u = NULL; + #####: 3305: sBoolt *bo = NULL; + #####: 3306: double *D = NULL; + #####: 3307: sDoublet *Do = NULL; + #####: 3308: sDictt *d = NULL; + #####: 3309: sIntt *io = NULL; + #####: 3310: char *s = NULL; + #####: 3311: sStringt *so = NULL; + #####: 3312: sArrayt *a = NULL; + #####: 3313: sBytest *B = NULL; + -: 3314: uint32_t count; + -: 3315: uint32_t arrayCount; + -: 3316: + #####: 3317: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 3318: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 3309: } - -: 3310: else { - -: 3311: // high nibble - #####: 3312: readTypeInHighNbl; + -: 3319: } + -: 3320: else { + -: 3321: // high nibble + #####: 3322: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3313: arrayCount = varintToUint(data); + #####: 3323: arrayCount = varintToUint(data); call 0 never executed - -: 3314: } - -: 3315: - #####: 3316: if (!arrayCount) { + -: 3324: } + -: 3325: + #####: 3326: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 3317: *array = allocSArray();; + #####: 3327: *array = allocSArray();; call 0 never executed - #####: 3318: ret; - -: 3319: } - -: 3320: - #####: 3321: loop(arrayCount) { + #####: 3328: ret; + -: 3329: } + -: 3330: + #####: 3331: loop(arrayCount) { branch 0 never executed branch 1 never executed - -: 3322: char type; - #####: 3323: if (ctx->nibble == lowNbl) { + -: 3332: char type; + #####: 3333: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3324: type = (**data) & 0xF; - -: 3325: } - -: 3326: else { - -: 3327: // high nibble - #####: 3328: type = (*ctx->nblAddr) >> 4; - -: 3329: } - -: 3330: - #####: 3331: switch(type) { + #####: 3334: type = (**data) & 0xF; + -: 3335: } + -: 3336: else { + -: 3337: // high nibble + #####: 3338: type = (*ctx->nblAddr) >> 4; + -: 3339: } + -: 3340: + #####: 3341: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -4902,234 +4920,234 @@ branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed - -: 3332: case S_UNDEFINED: - #####: 3333: if (ctx->nibble == lowNbl) { + -: 3342: case S_UNDEFINED: + #####: 3343: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3334: readTypeOnly; - -: 3335: } - -: 3336: else { - -: 3337: // high nibble - #####: 3338: readTypeInHighNbl; + #####: 3344: readTypeOnly; + -: 3345: } + -: 3346: else { + -: 3347: // high nibble + #####: 3348: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3339: } - #####: 3340: u = allocSUndefined(); + -: 3349: } + #####: 3350: u = allocSUndefined(); call 0 never executed - #####: 3341: sArrayPushTiny(array, (smallt *) u); + #####: 3351: sArrayPushTiny(array, (smallt *) u); call 0 never executed - #####: 3342: break; - -: 3343: case S_BOOL: - #####: 3344: if (!ctx->boolAddr) { + #####: 3352: break; + -: 3353: case S_BOOL: + #####: 3354: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3345: // new packed bools - #####: 3346: if (ctx->nibble == lowNbl) { + -: 3355: // new packed bools + #####: 3356: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3347: read4bPackedBool; - #####: 3348: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3357: read4bPackedBool; + #####: 3358: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3349: } - -: 3350: else { - -: 3351: // high nibble - #####: 3352: readTypeInHighNbl; + -: 3359: } + -: 3360: else { + -: 3361: // high nibble + #####: 3362: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3353: read8bPackedBool; - #####: 3354: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3363: read8bPackedBool; + #####: 3364: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3355: } - -: 3356: } - -: 3357: else { - -: 3358: // there was a bool before this one, read bits in nibbles - #####: 3359: if (ctx->nibble == lowNbl) { + -: 3365: } + -: 3366: } + -: 3367: else { + -: 3368: // there was a bool before this one, read bits in nibbles + #####: 3369: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3360: if (ctx->boolShift == 8) { + #####: 3370: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3361: read4bPackedBool; - #####: 3362: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3371: read4bPackedBool; + #####: 3372: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3363: } - -: 3364: else { - #####: 3365: readTypeOnly; - #####: 3366: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3373: } + -: 3374: else { + #####: 3375: readTypeOnly; + #####: 3376: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3367: } - -: 3368: } - -: 3369: else { - -: 3370: // high nibble - #####: 3371: readTypeInHighNbl; + -: 3377: } + -: 3378: } + -: 3379: else { + -: 3380: // high nibble + #####: 3381: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3372: if (ctx->boolShift == 8) { + #####: 3382: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3373: read8bPackedBool; - #####: 3374: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3383: read8bPackedBool; + #####: 3384: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3375: } - -: 3376: else { - #####: 3377: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3385: } + -: 3386: else { + #####: 3387: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3378: } - -: 3379: } - -: 3380: } - #####: 3381: sArrayPushTiny(array, (smallt *) bo); + -: 3388: } + -: 3389: } + -: 3390: } + #####: 3391: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - #####: 3382: break; - -: 3383: case S_DICT: - #####: 3384: d = NULL; - #####: 3385: dictNetDeserialLevel1(&d, data, ctx); + #####: 3392: break; + -: 3393: case S_DICT: + #####: 3394: d = NULL; + #####: 3395: dictNetDeserialLevel1(&d, data, ctx); call 0 never executed - #####: 3386: sArrayPushTiny(array, (smallt *) d); + #####: 3396: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 3387: break; - -: 3388: case S_DOUBLE: - #####: 3389: if (ctx->nibble == lowNbl) { + #####: 3397: break; + -: 3398: case S_DOUBLE: + #####: 3399: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3390: readTypeOnly; - -: 3391: } - -: 3392: else { - -: 3393: // high nibble - #####: 3394: readTypeInHighNbl; + #####: 3400: readTypeOnly; + -: 3401: } + -: 3402: else { + -: 3403: // high nibble + #####: 3404: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3395: } - #####: 3396: D = (double *)(*data); - #####: 3397: *data += sizeof(double); - #####: 3398: Do = allocSDouble(*D); + -: 3405: } + #####: 3406: D = (double *)(*data); + #####: 3407: *data += sizeof(double); + #####: 3408: Do = allocSDouble(*D); call 0 never executed - #####: 3399: sArrayPushTiny(array, (smallt *) Do); + #####: 3409: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - #####: 3400: break; - -: 3401: case S_INT: { - -: 3402: u64 v; - #####: 3403: if (ctx->nibble == lowNbl) { + #####: 3410: break; + -: 3411: case S_INT: { + -: 3412: u64 v; + #####: 3413: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3404: v = netTypeVarintToUint((u8**)data); + #####: 3414: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3405: } - -: 3406: else { - -: 3407: // high nibble - #####: 3408: readTypeInHighNbl; + -: 3415: } + -: 3416: else { + -: 3417: // high nibble + #####: 3418: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3409: v = varintToUint(data); + #####: 3419: v = varintToUint(data); call 0 never executed - -: 3410: } - #####: 3411: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 3412: io = allocSInt(v); + -: 3420: } + #####: 3421: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3422: io = allocSInt(v); call 0 never executed - #####: 3413: sArrayPushTiny(array, (smallt *) io); + #####: 3423: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 3414: } - #####: 3415: break; - -: 3416: case S_STRING: - #####: 3417: if (ctx->nibble == lowNbl) { + -: 3424: } + #####: 3425: break; + -: 3426: case S_STRING: + #####: 3427: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3418: readTypeOnly; - -: 3419: } - -: 3420: else { - -: 3421: // high nibble - #####: 3422: readTypeInHighNbl; + #####: 3428: readTypeOnly; + -: 3429: } + -: 3430: else { + -: 3431: // high nibble + #####: 3432: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3423: } - #####: 3424: s = (char *)(*data); - #####: 3425: *data += strlen(s)+1; - #####: 3426: so = allocSStringTiny(s); + -: 3433: } + #####: 3434: s = (char *)(*data); + #####: 3435: *data += strlen(s)+1; + #####: 3436: so = allocSStringTiny(s); call 0 never executed - #####: 3427: sArrayPushTiny(array, (smallt *) so); + #####: 3437: sArrayPushTiny(array, (smallt *) so); call 0 never executed - #####: 3428: break; - -: 3429: case S_ARRAY: - #####: 3430: a = NULL; - #####: 3431: arrayNetDeserialLevel1(&a, data, ctx); + #####: 3438: break; + -: 3439: case S_ARRAY: + #####: 3440: a = NULL; + #####: 3441: arrayNetDeserialLevel1(&a, data, ctx); call 0 never executed - #####: 3432: sArrayPushTiny(array, (smallt *) a); + #####: 3442: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 3433: break; - -: 3434: case S_BYTES: - #####: 3435: B = allocSBytes(); + #####: 3443: break; + -: 3444: case S_BYTES: + #####: 3445: B = allocSBytes(); call 0 never executed - #####: 3436: if (ctx->nibble == lowNbl) { + #####: 3446: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3437: count = netTypeVarintToUint((u8**)data); + #####: 3447: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3438: } - -: 3439: else { - -: 3440: // high nibble - #####: 3441: readTypeInHighNbl; + -: 3448: } + -: 3449: else { + -: 3450: // high nibble + #####: 3451: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3442: count = varintToUint((u8**)data); + #####: 3452: count = varintToUint((u8**)data); call 0 never executed - -: 3443: } - #####: 3444: sBytesPushBuffer(&B, *data, count); + -: 3453: } + #####: 3454: sBytesPushBuffer(&B, *data, count); call 0 never executed - #####: 3445: *data += count; - #####: 3446: sArrayPushTiny(array, (smallt *) B); + #####: 3455: *data += count; + #####: 3456: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 3447: break; - -: 3448: } - -: 3449: } - -: 3450:} - -: 3451: + #####: 3457: break; + -: 3458: } + -: 3459: } + -: 3460:} + -: 3461: function deserialNetSerialLevel1 called 0 returned 0% blocks executed 0% - #####: 3452:internal smallJsont* deserialNetSerialLevel1(smallJsont *self, smallBytest *data) { - -: 3453: - #####: 3454: if (!data or !data->B or !data->B->count) { + #####: 3462:internal smallJsont* deserialNetSerialLevel1(smallJsont *self, smallBytest *data) { + -: 3463: + #####: 3464: 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 - #####: 3455: ret self; - -: 3456: } - -: 3457: - #####: 3458: smallt *o = netDeserialLevel1(data->B); + #####: 3465: ret self; + -: 3466: } + -: 3467: + #####: 3468: smallt *o = netDeserialLevel1(data->B); call 0 never executed - -: 3459: - #####: 3460: if (!o) { + -: 3469: + #####: 3470: if (!o) { branch 0 never executed branch 1 never executed - #####: 3461: ret self; - -: 3462: } - -: 3463: - #####: 3464: freeG(self); -call 0 never executed - -: 3465: - #####: 3466: setsoG(self, o); -call 0 never executed - -: 3467: - #####: 3468: ret self; - -: 3469:} - -: 3470: - -: 3471:// level 2 - -: 3472:// like level 1, arrays are set to uniform when all elements are same type + #####: 3471: ret self; + -: 3472: } -: 3473: - -: 3474:/** - -: 3475: * deserializer top function - -: 3476: */ + #####: 3474: freeG(self); +call 0 never executed + -: 3475: + #####: 3476: setsoG(self, o); +call 0 never executed + -: 3477: + #####: 3478: ret self; + -: 3479:} + -: 3480: + -: 3481:// level 2 + -: 3482:// like level 1, arrays are set to uniform when all elements are same type + -: 3483: + -: 3484:/** + -: 3485: * deserializer top function + -: 3486: */ function netDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3477:internal smallt* netDeserialLevel2(sBytest *obj) { - #####: 3478: smallt *r = NULL; - #####: 3479: double *D = NULL; - #####: 3480: char *s = NULL; - #####: 3481: sBytest *B = NULL; - -: 3482: uint32_t count; - #####: 3483: char *data = NULL; - #####: 3484: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; - -: 3485: - #####: 3486: switch(obj->data & 0xF) { + #####: 3487:internal smallt* netDeserialLevel2(sBytest *obj) { + #####: 3488: smallt *r = NULL; + #####: 3489: double *D = NULL; + #####: 3490: char *s = NULL; + #####: 3491: sBytest *B = NULL; + -: 3492: uint32_t count; + #####: 3493: char *data = NULL; + #####: 3494: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; + -: 3495: + #####: 3496: switch(obj->data & 0xF) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5141,150 +5159,150 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3487: case S_UNDEFINED: - #####: 3488: r = (smallt *) allocSUndefined(); -call 0 never executed - #####: 3489: break; - -: 3490: case S_BOOL: - #####: 3491: r = (smallt *) allocSBool(obj->data & 0x10); -call 0 never executed - #####: 3492: break; - -: 3493: case S_DICT: - #####: 3494: data = (char *)&(obj->data); - -: 3495: //debug - ctx.dbuf = (u8*) data; - #####: 3496: dictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); + -: 3497: case S_UNDEFINED: + #####: 3498: r = (smallt *) allocSUndefined(); call 0 never executed - #####: 3497: break; - -: 3498: case S_DOUBLE: - #####: 3499: data = &(obj->data)+1; - #####: 3500: D = (double *)data; - #####: 3501: r = (smallt *) allocSDouble(*D); + #####: 3499: break; + -: 3500: case S_BOOL: + #####: 3501: r = (smallt *) allocSBool(obj->data & 0x10); call 0 never executed #####: 3502: break; - -: 3503: case S_INT: - #####: 3504: data = &(obj->data); - #####: 3505: u64 v = netTypeVarintToUint((u8**)&data); + -: 3503: case S_DICT: + #####: 3504: data = (char *)&(obj->data); + -: 3505: //debug - ctx.dbuf = (u8*) data; + #####: 3506: dictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); call 0 never executed - #####: 3506: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 3507: r = (smallt *) allocSInt(v); -call 0 never executed - #####: 3508: break; - -: 3509: case S_STRING: - #####: 3510: s = (char *)&(obj->data)+1; - #####: 3511: r = (smallt *) allocSStringTiny(s); + #####: 3507: break; + -: 3508: case S_DOUBLE: + #####: 3509: data = &(obj->data)+1; + #####: 3510: D = (double *)data; + #####: 3511: r = (smallt *) allocSDouble(*D); call 0 never executed #####: 3512: break; - -: 3513: case S_ARRAY: - #####: 3514: data = (char *)&(obj->data); - -: 3515: //debug - ctx.dbuf = (u8*) data; - #####: 3516: arrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); + -: 3513: case S_INT: + #####: 3514: data = &(obj->data); + #####: 3515: u64 v = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 3516: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3517: r = (smallt *) allocSInt(v); call 0 never executed - #####: 3517: break; - -: 3518: case S_BYTES: - #####: 3519: B = allocSBytes(); + #####: 3518: break; + -: 3519: case S_STRING: + #####: 3520: s = (char *)&(obj->data)+1; + #####: 3521: r = (smallt *) allocSStringTiny(s); call 0 never executed - #####: 3520: data = &(obj->data); - #####: 3521: count = netTypeVarintToUint((u8**)&data); + #####: 3522: break; + -: 3523: case S_ARRAY: + #####: 3524: data = (char *)&(obj->data); + -: 3525: //debug - ctx.dbuf = (u8*) data; + #####: 3526: arrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); call 0 never executed - #####: 3522: sBytesPushBuffer(&B, data, count); + #####: 3527: break; + -: 3528: case S_BYTES: + #####: 3529: B = allocSBytes(); call 0 never executed - #####: 3523: r = (smallt *)B; - #####: 3524: break; - -: 3525: case UNIFORM_DICT: - #####: 3526: data = (char *)&(obj->data); - -: 3527: //debug - ctx.dbuf = (u8*) data; - #####: 3528: uniformDictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); + #####: 3530: data = &(obj->data); + #####: 3531: count = netTypeVarintToUint((u8**)&data); call 0 never executed - #####: 3529: break; - -: 3530: case UNIFORM_ARRAY: - #####: 3531: data = (char *)&(obj->data); - -: 3532: //debug - ctx.dbuf = (u8*) data; - #####: 3533: uniformArrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); + #####: 3532: sBytesPushBuffer(&B, data, count); call 0 never executed + #####: 3533: r = (smallt *)B; #####: 3534: break; - -: 3535: } - -: 3536: - #####: 3537: ret r; - -: 3538:} - -: 3539: - -: 3540:/** - -: 3541: * deserialize dictionary from data - -: 3542: * - -: 3543: * a new dictionary is allocated - -: 3544: * - -: 3545: * \param - -: 3546: * dict dictionary holding the elements - -: 3547: * data serialized dictionary - -: 3548: */ + -: 3535: case UNIFORM_DICT: + #####: 3536: data = (char *)&(obj->data); + -: 3537: //debug - ctx.dbuf = (u8*) data; + #####: 3538: uniformDictNetDeserialLevel2((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 never executed + #####: 3539: break; + -: 3540: case UNIFORM_ARRAY: + #####: 3541: data = (char *)&(obj->data); + -: 3542: //debug - ctx.dbuf = (u8*) data; + #####: 3543: uniformArrayNetDeserialLevel2((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 never executed + #####: 3544: break; + -: 3545: } + -: 3546: + #####: 3547: ret r; + -: 3548:} + -: 3549: + -: 3550:/** + -: 3551: * deserialize dictionary from data + -: 3552: * + -: 3553: * a new dictionary is allocated + -: 3554: * + -: 3555: * \param + -: 3556: * dict dictionary holding the elements + -: 3557: * data serialized dictionary + -: 3558: */ function dictNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3549:internal void dictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - #####: 3550: sUndefinedt *u = NULL; - #####: 3551: sBoolt *bo = NULL; - #####: 3552: double *D = NULL; - #####: 3553: sDoublet *Do = NULL; - #####: 3554: sDictt *d = NULL; - #####: 3555: sIntt *io = NULL; - #####: 3556: char *s = NULL; - #####: 3557: sStringt *so = NULL; - #####: 3558: sArrayt *a = NULL; - #####: 3559: sBytest *B = NULL; - -: 3560: uint32_t count; - -: 3561: uint32_t dictCount; - -: 3562: - #####: 3563: if (packed) { + #####: 3559:internal void dictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { + #####: 3560: sUndefinedt *u = NULL; + #####: 3561: sBoolt *bo = NULL; + #####: 3562: double *D = NULL; + #####: 3563: sDoublet *Do = NULL; + #####: 3564: sDictt *d = NULL; + #####: 3565: sIntt *io = NULL; + #####: 3566: char *s = NULL; + #####: 3567: sStringt *so = NULL; + #####: 3568: sArrayt *a = NULL; + #####: 3569: sBytest *B = NULL; + -: 3570: uint32_t count; + -: 3571: uint32_t dictCount; + -: 3572: + #####: 3573: if (packed) { branch 0 never executed branch 1 never executed - #####: 3564: dictCount = varintToUint(data); + #####: 3574: dictCount = varintToUint(data); call 0 never executed - -: 3565: } - -: 3566: else { - #####: 3567: if (ctx->nibble == lowNbl) { + -: 3575: } + -: 3576: else { + #####: 3577: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3568: dictCount = netTypeVarintToUint(data); + #####: 3578: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3569: } - -: 3570: else { - -: 3571: // high nibble - -: 3572: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; - -: 3573: #define readTypeInHighNbl\ - -: 3574: ctx->nibble = lowNbl;\ - -: 3575: if (ctx->nblAddr == *data)\ - -: 3576: /* data points to the type, next byte is count */\ - -: 3577: (*data)++ - #####: 3578: readTypeInHighNbl; + -: 3579: } + -: 3580: else { + -: 3581: // high nibble + -: 3582: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; + -: 3583: #define readTypeInHighNbl\ + -: 3584: ctx->nibble = lowNbl;\ + -: 3585: if (ctx->nblAddr == *data)\ + -: 3586: /* data points to the type, next byte is count */\ + -: 3587: (*data)++ + #####: 3588: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3579: dictCount = varintToUint(data); + #####: 3589: dictCount = varintToUint(data); call 0 never executed - -: 3580: } - -: 3581: } - -: 3582: - #####: 3583: if (!dictCount) { + -: 3590: } + -: 3591: } + -: 3592: + #####: 3593: if (!dictCount) { branch 0 never executed branch 1 never executed - #####: 3584: *dict = allocSDict(); + #####: 3594: *dict = allocSDict(); call 0 never executed - #####: 3585: ret; - -: 3586: } - -: 3587: - #####: 3588: loop(dictCount) { + #####: 3595: ret; + -: 3596: } + -: 3597: + #####: 3598: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3589: char *key = (char*)*data; - #####: 3590: *data += strlen(key)+1; - -: 3591: char type; - #####: 3592: if (ctx->nibble == lowNbl) { + #####: 3599: char *key = (char*)*data; + #####: 3600: *data += strlen(key)+1; + -: 3601: char type; + #####: 3602: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3593: type = (**data) & 0xF; - -: 3594: } - -: 3595: else { - -: 3596: // high nibble - #####: 3597: type = (*ctx->nblAddr) >> 4; - -: 3598: } - -: 3599: - #####: 3600: switch(type) { + #####: 3603: type = (**data) & 0xF; + -: 3604: } + -: 3605: else { + -: 3606: // high nibble + #####: 3607: type = (*ctx->nblAddr) >> 4; + -: 3608: } + -: 3609: + #####: 3610: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5296,274 +5314,274 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3601: case S_UNDEFINED: - #####: 3602: if (ctx->nibble == lowNbl) { + -: 3611: case S_UNDEFINED: + #####: 3612: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3603: #define readTypeOnly\ - -: 3604: ctx->nibble = highNbl;\ - -: 3605: ctx->nblAddr = *data;\ - -: 3606: (*data)++ - #####: 3607: readTypeOnly; - -: 3608: } - -: 3609: else { - -: 3610: // high nibble - #####: 3611: readTypeInHighNbl; + -: 3613: #define readTypeOnly\ + -: 3614: ctx->nibble = highNbl;\ + -: 3615: ctx->nblAddr = *data;\ + -: 3616: (*data)++ + #####: 3617: readTypeOnly; + -: 3618: } + -: 3619: else { + -: 3620: // high nibble + #####: 3621: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3612: } - #####: 3613: u = allocSUndefined(); + -: 3622: } + #####: 3623: u = allocSUndefined(); call 0 never executed - #####: 3614: sDictPushTiny(dict, key, (smallt *) u); + #####: 3624: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - #####: 3615: break; - -: 3616: case S_BOOL: - #####: 3617: if (!ctx->boolAddr) { + #####: 3625: break; + -: 3626: case S_BOOL: + #####: 3627: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3618: // new packed bools - #####: 3619: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - -: 3620: #define read4bPackedBool\ - -: 3621: ctx->boolShift = 5;\ - -: 3622: ctx->boolAddr = *data;\ - -: 3623: (*data)++ - #####: 3624: read4bPackedBool; - #####: 3625: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 never executed - -: 3626: } - -: 3627: else { - -: 3628: // high nibble - #####: 3629: readTypeInHighNbl; + -: 3628: // new packed bools + #####: 3629: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - -: 3630: #define read8bPackedBool\ - -: 3631: ctx->boolShift = 1;\ + -: 3630: #define read4bPackedBool\ + -: 3631: ctx->boolShift = 5;\ -: 3632: ctx->boolAddr = *data;\ -: 3633: (*data)++ - #####: 3634: read8bPackedBool; - #####: 3635: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3634: read4bPackedBool; + #####: 3635: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed -: 3636: } - -: 3637: } - -: 3638: else { - -: 3639: // there was a bool before this one, read bits in nibbles - #####: 3640: if (ctx->nibble == lowNbl) { + -: 3637: else { + -: 3638: // high nibble + #####: 3639: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3641: if (ctx->boolShift == 8) { + -: 3640: #define read8bPackedBool\ + -: 3641: ctx->boolShift = 1;\ + -: 3642: ctx->boolAddr = *data;\ + -: 3643: (*data)++ + #####: 3644: read8bPackedBool; + #####: 3645: bo = allocSBool((*ctx->boolAddr) & 0x1); +call 0 never executed + -: 3646: } + -: 3647: } + -: 3648: else { + -: 3649: // there was a bool before this one, read bits in nibbles + #####: 3650: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 3651: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3642: read4bPackedBool; - #####: 3643: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3652: read4bPackedBool; + #####: 3653: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3644: } - -: 3645: else { - #####: 3646: readTypeOnly; - #####: 3647: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3654: } + -: 3655: else { + #####: 3656: readTypeOnly; + #####: 3657: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3648: } - -: 3649: } - -: 3650: else { - -: 3651: // high nibble - #####: 3652: readTypeInHighNbl; + -: 3658: } + -: 3659: } + -: 3660: else { + -: 3661: // high nibble + #####: 3662: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3653: if (ctx->boolShift == 8) { + #####: 3663: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3654: read8bPackedBool; - #####: 3655: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3664: read8bPackedBool; + #####: 3665: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3656: } - -: 3657: else { - -: 3658: // high nibble - #####: 3659: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3666: } + -: 3667: else { + -: 3668: // high nibble + #####: 3669: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3660: } - -: 3661: } - -: 3662: } - #####: 3663: sDictPushTiny(dict, key, (smallt *) bo); + -: 3670: } + -: 3671: } + -: 3672: } + #####: 3673: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - #####: 3664: break; - -: 3665: case S_DICT: - #####: 3666: d = NULL; - #####: 3667: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 3674: break; + -: 3675: case S_DICT: + #####: 3676: d = NULL; + #####: 3677: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 3668: sDictPushTiny(dict, key, (smallt *) d); + #####: 3678: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - #####: 3669: break; - -: 3670: case S_DOUBLE: - #####: 3671: if (ctx->nibble == lowNbl) { + #####: 3679: break; + -: 3680: case S_DOUBLE: + #####: 3681: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3672: readTypeOnly; - -: 3673: } - -: 3674: else { - -: 3675: // high nibble - #####: 3676: readTypeInHighNbl; + #####: 3682: readTypeOnly; + -: 3683: } + -: 3684: else { + -: 3685: // high nibble + #####: 3686: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3677: } - #####: 3678: D = (double *)(*data); - #####: 3679: *data += sizeof(double); - #####: 3680: Do = allocSDouble(*D); + -: 3687: } + #####: 3688: D = (double *)(*data); + #####: 3689: *data += sizeof(double); + #####: 3690: Do = allocSDouble(*D); call 0 never executed - #####: 3681: sDictPushTiny(dict, key, (smallt *) Do); + #####: 3691: sDictPushTiny(dict, key, (smallt *) Do); call 0 never executed - #####: 3682: break; - -: 3683: case S_INT: { - -: 3684: u64 v; - #####: 3685: if (ctx->nibble == lowNbl) { + #####: 3692: break; + -: 3693: case S_INT: { + -: 3694: u64 v; + #####: 3695: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3686: v = netTypeVarintToUint((u8**)data); + #####: 3696: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3687: } - -: 3688: else { - -: 3689: // high nibble - #####: 3690: readTypeInHighNbl; + -: 3697: } + -: 3698: else { + -: 3699: // high nibble + #####: 3700: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3691: v = varintToUint(data); + #####: 3701: v = varintToUint(data); call 0 never executed - -: 3692: } - #####: 3693: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 3694: io = allocSInt(v); + -: 3702: } + #####: 3703: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3704: io = allocSInt(v); call 0 never executed - #####: 3695: sDictPushTiny(dict, key, (smallt *) io); + #####: 3705: sDictPushTiny(dict, key, (smallt *) io); call 0 never executed - -: 3696: } - #####: 3697: break; - -: 3698: case S_STRING: - #####: 3699: if (ctx->nibble == lowNbl) { + -: 3706: } + #####: 3707: break; + -: 3708: case S_STRING: + #####: 3709: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3700: readTypeOnly; - -: 3701: } - -: 3702: else { - -: 3703: // high nibble - #####: 3704: readTypeInHighNbl; + #####: 3710: readTypeOnly; + -: 3711: } + -: 3712: else { + -: 3713: // high nibble + #####: 3714: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3705: } - #####: 3706: s = (char *)(*data); - #####: 3707: *data += strlen(s)+1; - #####: 3708: so = allocSStringTiny(s); + -: 3715: } + #####: 3716: s = (char *)(*data); + #####: 3717: *data += strlen(s)+1; + #####: 3718: so = allocSStringTiny(s); call 0 never executed - #####: 3709: sDictPushTiny(dict, key, (smallt *) so); + #####: 3719: sDictPushTiny(dict, key, (smallt *) so); call 0 never executed - #####: 3710: break; - -: 3711: case S_ARRAY: - #####: 3712: a = NULL; - #####: 3713: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 3720: break; + -: 3721: case S_ARRAY: + #####: 3722: a = NULL; + #####: 3723: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 3714: sDictPushTiny(dict, key, (smallt *) a); + #####: 3724: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - #####: 3715: break; - -: 3716: case S_BYTES: - #####: 3717: B = allocSBytes(); + #####: 3725: break; + -: 3726: case S_BYTES: + #####: 3727: B = allocSBytes(); call 0 never executed - #####: 3718: if (ctx->nibble == lowNbl) { + #####: 3728: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3719: count = netTypeVarintToUint((u8**)data); + #####: 3729: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 3720: } - -: 3721: else { - -: 3722: // high nibble - #####: 3723: readTypeInHighNbl; + -: 3730: } + -: 3731: else { + -: 3732: // high nibble + #####: 3733: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3724: count = varintToUint((u8**)data); -call 0 never executed - -: 3725: } - #####: 3726: sBytesPushBuffer(&B, *data, count); -call 0 never executed - #####: 3727: *data += count; - #####: 3728: sDictPushTiny(dict, key, (smallt *) B); + #####: 3734: count = varintToUint((u8**)data); call 0 never executed - #####: 3729: break; - -: 3730: case UNIFORM_DICT: - #####: 3731: d = NULL; - #####: 3732: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + -: 3735: } + #####: 3736: sBytesPushBuffer(&B, *data, count); call 0 never executed - #####: 3733: sDictPushTiny(dict, key, (smallt *) d); -call 0 never executed - #####: 3734: break; - -: 3735: case UNIFORM_ARRAY: - #####: 3736: a = NULL; - #####: 3737: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); -call 0 never executed - #####: 3738: sDictPushTiny(dict, key, (smallt *) a); + #####: 3737: *data += count; + #####: 3738: sDictPushTiny(dict, key, (smallt *) B); call 0 never executed #####: 3739: break; - -: 3740: } - -: 3741: } - -: 3742:} - -: 3743: - -: 3744:/** - -: 3745: * deserialize dictionary from data - -: 3746: * - -: 3747: * a new dictionary is allocated - -: 3748: * - -: 3749: * \param - -: 3750: * dict dictionary holding the elements - -: 3751: * data serialized dictionary - -: 3752: */ + -: 3740: case UNIFORM_DICT: + #####: 3741: d = NULL; + #####: 3742: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); +call 0 never executed + #####: 3743: sDictPushTiny(dict, key, (smallt *) d); +call 0 never executed + #####: 3744: break; + -: 3745: case UNIFORM_ARRAY: + #####: 3746: a = NULL; + #####: 3747: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); +call 0 never executed + #####: 3748: sDictPushTiny(dict, key, (smallt *) a); +call 0 never executed + #####: 3749: break; + -: 3750: } + -: 3751: } + -: 3752:} + -: 3753: + -: 3754:/** + -: 3755: * deserialize dictionary from data + -: 3756: * + -: 3757: * a new dictionary is allocated + -: 3758: * + -: 3759: * \param + -: 3760: * dict dictionary holding the elements + -: 3761: * data serialized dictionary + -: 3762: */ function uniformDictNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3753:internal void uniformDictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - #####: 3754: sUndefinedt *u = NULL; - #####: 3755: sBoolt *bo = NULL; - #####: 3756: double *D = NULL; - #####: 3757: sDoublet *Do = NULL; - #####: 3758: sDictt *d = NULL; - #####: 3759: sIntt *io = NULL; - #####: 3760: char *s = NULL; - #####: 3761: sStringt *so = NULL; - #####: 3762: sArrayt *a = NULL; - #####: 3763: sBytest *B = NULL; - -: 3764: uint32_t count; - -: 3765: uint32_t dictCount; - -: 3766: u8 type; - -: 3767: - #####: 3768: if (packed) { + #####: 3763:internal void uniformDictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, bool packed) { + #####: 3764: sUndefinedt *u = NULL; + #####: 3765: sBoolt *bo = NULL; + #####: 3766: double *D = NULL; + #####: 3767: sDoublet *Do = NULL; + #####: 3768: sDictt *d = NULL; + #####: 3769: sIntt *io = NULL; + #####: 3770: char *s = NULL; + #####: 3771: sStringt *so = NULL; + #####: 3772: sArrayt *a = NULL; + #####: 3773: sBytest *B = NULL; + -: 3774: uint32_t count; + -: 3775: uint32_t dictCount; + -: 3776: u8 type; + -: 3777: + #####: 3778: if (packed) { branch 0 never executed branch 1 never executed - #####: 3769: type = (**data) & 0xF; - #####: 3770: dictCount = netTypeVarintToUint(data); + #####: 3779: type = (**data) & 0xF; + #####: 3780: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3771: } - -: 3772: else { - #####: 3773: if (ctx->nibble == lowNbl) { + -: 3781: } + -: 3782: else { + #####: 3783: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3774: type = (**data) >> 4; - #####: 3775: (*data)++; - #####: 3776: dictCount = varintToUint(data); + #####: 3784: type = (**data) >> 4; + #####: 3785: (*data)++; + #####: 3786: dictCount = varintToUint(data); call 0 never executed - -: 3777: } - -: 3778: else { - #####: 3779: readTypeInHighNbl; + -: 3787: } + -: 3788: else { + #####: 3789: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3780: type = (**data) & 0xF; - #####: 3781: dictCount = netTypeVarintToUint(data); + #####: 3790: type = (**data) & 0xF; + #####: 3791: dictCount = netTypeVarintToUint(data); call 0 never executed - -: 3782: } - -: 3783: } - -: 3784: - #####: 3785: if (!dictCount) { + -: 3792: } + -: 3793: } + -: 3794: + #####: 3795: if (!dictCount) { branch 0 never executed branch 1 never executed - #####: 3786: *dict = allocSDict(); + #####: 3796: *dict = allocSDict(); call 0 never executed - #####: 3787: ret; - -: 3788: } - -: 3789: - -: 3790: - #####: 3791: switch(type) { + #####: 3797: ret; + -: 3798: } + -: 3799: + -: 3800: + #####: 3801: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5575,237 +5593,237 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3792: case S_UNDEFINED: - #####: 3793: loop(dictCount) { + -: 3802: case S_UNDEFINED: + #####: 3803: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3794: char *key = (char*)*data; - #####: 3795: *data += strlen(key)+1; - #####: 3796: u = allocSUndefined(); + #####: 3804: char *key = (char*)*data; + #####: 3805: *data += strlen(key)+1; + #####: 3806: u = allocSUndefined(); call 0 never executed - #####: 3797: sDictPushTiny(dict, key, (smallt *) u); + #####: 3807: sDictPushTiny(dict, key, (smallt *) u); call 0 never executed - -: 3798: } - #####: 3799: break; - -: 3800: case S_BOOL: - #####: 3801: loop(dictCount) { + -: 3808: } + #####: 3809: break; + -: 3810: case S_BOOL: + #####: 3811: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3802: char *key = (char*)*data; - #####: 3803: *data += strlen(key)+1; - #####: 3804: if (!ctx->boolAddr) { + #####: 3812: char *key = (char*)*data; + #####: 3813: *data += strlen(key)+1; + #####: 3814: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - #####: 3805: read8bPackedBool; - #####: 3806: ctx->boolShift = 0; - -: 3807: } - #####: 3808: if (ctx->boolShift == 8) { -branch 0 never executed -branch 1 never executed - #####: 3809: readTypeInHighNbl; + #####: 3815: read8bPackedBool; + #####: 3816: ctx->boolShift = 0; + -: 3817: } + #####: 3818: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3810: read8bPackedBool; - #####: 3811: bo = allocSBool((*ctx->boolAddr) & 0x1); -call 0 never executed - -: 3812: } - -: 3813: else { - -: 3814: // high nibble - #####: 3815: readTypeInHighNbl; + #####: 3819: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3816: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); -call 0 never executed - -: 3817: } - #####: 3818: sDictPushTiny(dict, key, (smallt *) bo); + #####: 3820: read8bPackedBool; + #####: 3821: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3819: } - #####: 3820: break; - -: 3821: case S_DICT: - #####: 3822: loop(dictCount) { + -: 3822: } + -: 3823: else { + -: 3824: // high nibble + #####: 3825: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3823: char *key = (char*)*data; - #####: 3824: *data += strlen(key)+1; - #####: 3825: d = NULL; - #####: 3826: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 3826: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - #####: 3827: sDictPushTiny(dict, key, (smallt *) d); + -: 3827: } + #####: 3828: sDictPushTiny(dict, key, (smallt *) bo); call 0 never executed - -: 3828: } - #####: 3829: break; - -: 3830: case S_DOUBLE: - #####: 3831: loop(dictCount) { + -: 3829: } + #####: 3830: break; + -: 3831: case S_DICT: + #####: 3832: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3832: char *key = (char*)*data; - #####: 3833: *data += strlen(key)+1; - #####: 3834: D = (double *)(*data); - #####: 3835: *data += sizeof(double); - #####: 3836: Do = allocSDouble(*D); + #####: 3833: char *key = (char*)*data; + #####: 3834: *data += strlen(key)+1; + #####: 3835: d = NULL; + #####: 3836: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 3837: sDictPushTiny(dict, key, (smallt *) Do); + #####: 3837: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed -: 3838: } #####: 3839: break; - -: 3840: case S_INT: + -: 3840: case S_DOUBLE: #####: 3841: loop(dictCount) { branch 0 never executed branch 1 never executed #####: 3842: char *key = (char*)*data; #####: 3843: *data += strlen(key)+1; - #####: 3844: u64 v = varintToUint(data); + #####: 3844: D = (double *)(*data); + #####: 3845: *data += sizeof(double); + #####: 3846: Do = allocSDouble(*D); call 0 never executed - #####: 3845: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 3846: io = allocSInt(v); -call 0 never executed - #####: 3847: sDictPushTiny(dict, key, (smallt *) io); + #####: 3847: sDictPushTiny(dict, key, (smallt *) Do); call 0 never executed -: 3848: } #####: 3849: break; - -: 3850: case S_STRING: + -: 3850: case S_INT: #####: 3851: loop(dictCount) { branch 0 never executed branch 1 never executed #####: 3852: char *key = (char*)*data; #####: 3853: *data += strlen(key)+1; - #####: 3854: s = (char *)(*data); - #####: 3855: *data += strlen(s)+1; - #####: 3856: so = allocSStringTiny(s); + #####: 3854: u64 v = varintToUint(data); +call 0 never executed + #####: 3855: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 3856: io = allocSInt(v); call 0 never executed - #####: 3857: sDictPushTiny(dict, key, (smallt *) so); + #####: 3857: sDictPushTiny(dict, key, (smallt *) io); call 0 never executed -: 3858: } #####: 3859: break; - -: 3860: case S_ARRAY: + -: 3860: case S_STRING: #####: 3861: loop(dictCount) { branch 0 never executed branch 1 never executed #####: 3862: char *key = (char*)*data; #####: 3863: *data += strlen(key)+1; - #####: 3864: a = NULL; - #####: 3865: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 3864: s = (char *)(*data); + #####: 3865: *data += strlen(s)+1; + #####: 3866: so = allocSStringTiny(s); call 0 never executed - #####: 3866: sDictPushTiny(dict, key, (smallt *) a); + #####: 3867: sDictPushTiny(dict, key, (smallt *) so); call 0 never executed - -: 3867: } - #####: 3868: break; - -: 3869: case S_BYTES: - #####: 3870: loop(dictCount) { + -: 3868: } + #####: 3869: break; + -: 3870: case S_ARRAY: + #####: 3871: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3871: char *key = (char*)*data; - #####: 3872: *data += strlen(key)+1; - #####: 3873: B = allocSBytes(); + #####: 3872: char *key = (char*)*data; + #####: 3873: *data += strlen(key)+1; + #####: 3874: a = NULL; + #####: 3875: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 3874: count = varintToUint((u8**)data); + #####: 3876: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - #####: 3875: sBytesPushBuffer(&B, *data, count); + -: 3877: } + #####: 3878: break; + -: 3879: case S_BYTES: + #####: 3880: loop(dictCount) { +branch 0 never executed +branch 1 never executed + #####: 3881: char *key = (char*)*data; + #####: 3882: *data += strlen(key)+1; + #####: 3883: B = allocSBytes(); +call 0 never executed + #####: 3884: count = varintToUint((u8**)data); call 0 never executed - #####: 3876: *data += count; - #####: 3877: sDictPushTiny(dict, key, (smallt *) B); + #####: 3885: sBytesPushBuffer(&B, *data, count); call 0 never executed - -: 3878: } - #####: 3879: break; - -: 3880: case UNIFORM_DICT: - #####: 3881: loop(dictCount) { + #####: 3886: *data += count; + #####: 3887: sDictPushTiny(dict, key, (smallt *) B); +call 0 never executed + -: 3888: } + #####: 3889: break; + -: 3890: case UNIFORM_DICT: + #####: 3891: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3882: char *key = (char*)*data; - #####: 3883: *data += strlen(key)+1; - #####: 3884: d = NULL; - #####: 3885: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 3892: char *key = (char*)*data; + #####: 3893: *data += strlen(key)+1; + #####: 3894: d = NULL; + #####: 3895: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 3886: sDictPushTiny(dict, key, (smallt *) d); + #####: 3896: sDictPushTiny(dict, key, (smallt *) d); call 0 never executed - -: 3887: } - #####: 3888: break; - -: 3889: case UNIFORM_ARRAY: - #####: 3890: loop(dictCount) { + -: 3897: } + #####: 3898: break; + -: 3899: case UNIFORM_ARRAY: + #####: 3900: loop(dictCount) { branch 0 never executed branch 1 never executed - #####: 3891: char *key = (char*)*data; - #####: 3892: *data += strlen(key)+1; - #####: 3893: a = NULL; - #####: 3894: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 3901: char *key = (char*)*data; + #####: 3902: *data += strlen(key)+1; + #####: 3903: a = NULL; + #####: 3904: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 3895: sDictPushTiny(dict, key, (smallt *) a); + #####: 3905: sDictPushTiny(dict, key, (smallt *) a); call 0 never executed - -: 3896: } - #####: 3897: break; - -: 3898: } - -: 3899:} - -: 3900: - -: 3901:/** - -: 3902: * deserialize array from data - -: 3903: * - -: 3904: * a new array is allocated - -: 3905: * - -: 3906: * \param - -: 3907: * array holding the elements - -: 3908: * data serialized dictionary - -: 3909: */ + -: 3906: } + #####: 3907: break; + -: 3908: } + -: 3909:} + -: 3910: + -: 3911:/** + -: 3912: * deserialize array from data + -: 3913: * + -: 3914: * a new array is allocated + -: 3915: * + -: 3916: * \param + -: 3917: * array holding the elements + -: 3918: * data serialized dictionary + -: 3919: */ function arrayNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 3910:internal void arrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - #####: 3911: sUndefinedt *u = NULL; - #####: 3912: sBoolt *bo = NULL; - #####: 3913: double *D = NULL; - #####: 3914: sDoublet *Do = NULL; - #####: 3915: sDictt *d = NULL; - #####: 3916: sIntt *io = NULL; - #####: 3917: char *s = NULL; - #####: 3918: sStringt *so = NULL; - #####: 3919: sArrayt *a = NULL; - #####: 3920: sBytest *B = NULL; - -: 3921: uint32_t count; - -: 3922: uint32_t arrayCount; - -: 3923: - #####: 3924: if (packed) { -branch 0 never executed -branch 1 never executed - #####: 3925: arrayCount = varintToUint(data); + #####: 3920:internal void arrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { + #####: 3921: sUndefinedt *u = NULL; + #####: 3922: sBoolt *bo = NULL; + #####: 3923: double *D = NULL; + #####: 3924: sDoublet *Do = NULL; + #####: 3925: sDictt *d = NULL; + #####: 3926: sIntt *io = NULL; + #####: 3927: char *s = NULL; + #####: 3928: sStringt *so = NULL; + #####: 3929: sArrayt *a = NULL; + #####: 3930: sBytest *B = NULL; + -: 3931: uint32_t count; + -: 3932: uint32_t arrayCount; + -: 3933: + #####: 3934: if (packed) { +branch 0 never executed +branch 1 never executed + #####: 3935: arrayCount = varintToUint(data); call 0 never executed - -: 3926: } - -: 3927: else { - #####: 3928: if (ctx->nibble == lowNbl) { + -: 3936: } + -: 3937: else { + #####: 3938: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3929: arrayCount = netTypeVarintToUint(data); + #####: 3939: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 3930: } - -: 3931: else { - -: 3932: // high nibble - #####: 3933: readTypeInHighNbl; + -: 3940: } + -: 3941: else { + -: 3942: // high nibble + #####: 3943: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3934: arrayCount = varintToUint(data); + #####: 3944: arrayCount = varintToUint(data); call 0 never executed - -: 3935: } - -: 3936: } - -: 3937: - #####: 3938: if (!arrayCount) { + -: 3945: } + -: 3946: } + -: 3947: + #####: 3948: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 3939: *array = allocSArray();; + #####: 3949: *array = allocSArray();; call 0 never executed - #####: 3940: ret; - -: 3941: } - -: 3942: - #####: 3943: loop(arrayCount) { + #####: 3950: ret; + -: 3951: } + -: 3952: + #####: 3953: loop(arrayCount) { branch 0 never executed branch 1 never executed - -: 3944: char type; - #####: 3945: if (ctx->nibble == lowNbl) { + -: 3954: char type; + #####: 3955: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3946: type = (**data) & 0xF; - -: 3947: } - -: 3948: else { - -: 3949: // high nibble - #####: 3950: type = (*ctx->nblAddr) >> 4; - -: 3951: } - -: 3952: - #####: 3953: switch(type) { + #####: 3956: type = (**data) & 0xF; + -: 3957: } + -: 3958: else { + -: 3959: // high nibble + #####: 3960: type = (*ctx->nblAddr) >> 4; + -: 3961: } + -: 3962: + #####: 3963: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -5817,251 +5835,251 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 3954: case S_UNDEFINED: - #####: 3955: if (ctx->nibble == lowNbl) { + -: 3964: case S_UNDEFINED: + #####: 3965: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3956: readTypeOnly; - -: 3957: } - -: 3958: else { - -: 3959: // high nibble - #####: 3960: readTypeInHighNbl; + #####: 3966: readTypeOnly; + -: 3967: } + -: 3968: else { + -: 3969: // high nibble + #####: 3970: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 3961: } - #####: 3962: u = allocSUndefined(); + -: 3971: } + #####: 3972: u = allocSUndefined(); call 0 never executed - #####: 3963: sArrayPushTiny(array, (smallt *) u); + #####: 3973: sArrayPushTiny(array, (smallt *) u); call 0 never executed - #####: 3964: break; - -: 3965: case S_BOOL: - #####: 3966: if (!ctx->boolAddr) { + #####: 3974: break; + -: 3975: case S_BOOL: + #####: 3976: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - -: 3967: // new packed bools - #####: 3968: if (ctx->nibble == lowNbl) { + -: 3977: // new packed bools + #####: 3978: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3969: read4bPackedBool; - #####: 3970: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3979: read4bPackedBool; + #####: 3980: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3971: } - -: 3972: else { - -: 3973: // high nibble - #####: 3974: readTypeInHighNbl; + -: 3981: } + -: 3982: else { + -: 3983: // high nibble + #####: 3984: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3975: read8bPackedBool; - #####: 3976: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 3985: read8bPackedBool; + #####: 3986: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3977: } - -: 3978: } - -: 3979: else { - -: 3980: // there was a bool before this one, read bits in nibbles - #####: 3981: if (ctx->nibble == lowNbl) { + -: 3987: } + -: 3988: } + -: 3989: else { + -: 3990: // there was a bool before this one, read bits in nibbles + #####: 3991: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 3982: if (ctx->boolShift == 8) { + #####: 3992: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3983: read4bPackedBool; - #####: 3984: bo = allocSBool((*ctx->boolAddr) & 0x10); + #####: 3993: read4bPackedBool; + #####: 3994: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 never executed - -: 3985: } - -: 3986: else { - #####: 3987: readTypeOnly; - #####: 3988: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 3995: } + -: 3996: else { + #####: 3997: readTypeOnly; + #####: 3998: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 3989: } - -: 3990: } - -: 3991: else { - -: 3992: // high nibble - #####: 3993: readTypeInHighNbl; + -: 3999: } + -: 4000: } + -: 4001: else { + -: 4002: // high nibble + #####: 4003: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 3994: if (ctx->boolShift == 8) { + #####: 4004: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 3995: read8bPackedBool; - #####: 3996: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 4005: read8bPackedBool; + #####: 4006: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 3997: } - -: 3998: else { - #####: 3999: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 4007: } + -: 4008: else { + #####: 4009: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 4000: } - -: 4001: } - -: 4002: } - #####: 4003: sArrayPushTiny(array, (smallt *) bo); + -: 4010: } + -: 4011: } + -: 4012: } + #####: 4013: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - #####: 4004: break; - -: 4005: case S_DICT: - #####: 4006: d = NULL; - #####: 4007: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 4014: break; + -: 4015: case S_DICT: + #####: 4016: d = NULL; + #####: 4017: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 4008: sArrayPushTiny(array, (smallt *) d); + #####: 4018: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 4009: break; - -: 4010: case S_DOUBLE: - #####: 4011: if (ctx->nibble == lowNbl) { + #####: 4019: break; + -: 4020: case S_DOUBLE: + #####: 4021: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4012: readTypeOnly; - -: 4013: } - -: 4014: else { - -: 4015: // high nibble - #####: 4016: readTypeInHighNbl; + #####: 4022: readTypeOnly; + -: 4023: } + -: 4024: else { + -: 4025: // high nibble + #####: 4026: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 4017: } - #####: 4018: D = (double *)(*data); - #####: 4019: *data += sizeof(double); - #####: 4020: Do = allocSDouble(*D); + -: 4027: } + #####: 4028: D = (double *)(*data); + #####: 4029: *data += sizeof(double); + #####: 4030: Do = allocSDouble(*D); call 0 never executed - #####: 4021: sArrayPushTiny(array, (smallt *) Do); + #####: 4031: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - #####: 4022: break; - -: 4023: case S_INT: { - -: 4024: u64 v; - #####: 4025: if (ctx->nibble == lowNbl) { + #####: 4032: break; + -: 4033: case S_INT: { + -: 4034: u64 v; + #####: 4035: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4026: v = netTypeVarintToUint((u8**)data); + #####: 4036: v = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4027: } - -: 4028: else { - -: 4029: // high nibble - #####: 4030: readTypeInHighNbl; + -: 4037: } + -: 4038: else { + -: 4039: // high nibble + #####: 4040: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4031: v = varintToUint(data); + #####: 4041: v = varintToUint(data); call 0 never executed - -: 4032: } - #####: 4033: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 4034: io = allocSInt(v); + -: 4042: } + #####: 4043: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 4044: io = allocSInt(v); call 0 never executed - #####: 4035: sArrayPushTiny(array, (smallt *) io); + #####: 4045: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 4036: } - #####: 4037: break; - -: 4038: case S_STRING: - #####: 4039: if (ctx->nibble == lowNbl) { + -: 4046: } + #####: 4047: break; + -: 4048: case S_STRING: + #####: 4049: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4040: readTypeOnly; - -: 4041: } - -: 4042: else { - -: 4043: // high nibble - #####: 4044: readTypeInHighNbl; + #####: 4050: readTypeOnly; + -: 4051: } + -: 4052: else { + -: 4053: // high nibble + #####: 4054: readTypeInHighNbl; branch 0 never executed branch 1 never executed - -: 4045: } - #####: 4046: s = (char *)(*data); - #####: 4047: *data += strlen(s)+1; - #####: 4048: so = allocSStringTiny(s); + -: 4055: } + #####: 4056: s = (char *)(*data); + #####: 4057: *data += strlen(s)+1; + #####: 4058: so = allocSStringTiny(s); call 0 never executed - #####: 4049: sArrayPushTiny(array, (smallt *) so); + #####: 4059: sArrayPushTiny(array, (smallt *) so); call 0 never executed - #####: 4050: break; - -: 4051: case S_ARRAY: - #####: 4052: a = NULL; - #####: 4053: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 4060: break; + -: 4061: case S_ARRAY: + #####: 4062: a = NULL; + #####: 4063: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 4054: sArrayPushTiny(array, (smallt *) a); + #####: 4064: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 4055: break; - -: 4056: case S_BYTES: - #####: 4057: B = allocSBytes(); + #####: 4065: break; + -: 4066: case S_BYTES: + #####: 4067: B = allocSBytes(); call 0 never executed - #####: 4058: if (ctx->nibble == lowNbl) { + #####: 4068: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4059: count = netTypeVarintToUint((u8**)data); + #####: 4069: count = netTypeVarintToUint((u8**)data); call 0 never executed - -: 4060: } - -: 4061: else { - -: 4062: // high nibble - #####: 4063: readTypeInHighNbl; + -: 4070: } + -: 4071: else { + -: 4072: // high nibble + #####: 4073: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4064: count = varintToUint((u8**)data); + #####: 4074: count = varintToUint((u8**)data); call 0 never executed - -: 4065: } - #####: 4066: sBytesPushBuffer(&B, *data, count); + -: 4075: } + #####: 4076: sBytesPushBuffer(&B, *data, count); call 0 never executed - #####: 4067: *data += count; - #####: 4068: sArrayPushTiny(array, (smallt *) B); + #####: 4077: *data += count; + #####: 4078: sArrayPushTiny(array, (smallt *) B); call 0 never executed - #####: 4069: break; - -: 4070: case UNIFORM_DICT: - #####: 4071: d = NULL; - #####: 4072: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); + #####: 4079: break; + -: 4080: case UNIFORM_DICT: + #####: 4081: d = NULL; + #####: 4082: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/false); call 0 never executed - #####: 4073: sArrayPushTiny(array, (smallt *) d); + #####: 4083: sArrayPushTiny(array, (smallt *) d); call 0 never executed - #####: 4074: break; - -: 4075: case UNIFORM_ARRAY: - #####: 4076: a = NULL; - #####: 4077: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); + #####: 4084: break; + -: 4085: case UNIFORM_ARRAY: + #####: 4086: a = NULL; + #####: 4087: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/false); call 0 never executed - #####: 4078: sArrayPushTiny(array, (smallt *) a); + #####: 4088: sArrayPushTiny(array, (smallt *) a); call 0 never executed - #####: 4079: break; - -: 4080: } - -: 4081: } - -: 4082:} - -: 4083: + #####: 4089: break; + -: 4090: } + -: 4091: } + -: 4092:} + -: 4093: function uniformArrayNetDeserialLevel2 called 0 returned 0% blocks executed 0% - #####: 4084:internal void uniformArrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - #####: 4085: sUndefinedt *u = NULL; - #####: 4086: sBoolt *bo = NULL; - #####: 4087: double *D = NULL; - #####: 4088: sDoublet *Do = NULL; - #####: 4089: sDictt *d = NULL; - #####: 4090: sIntt *io = NULL; - #####: 4091: char *s = NULL; - #####: 4092: sStringt *so = NULL; - #####: 4093: sArrayt *a = NULL; - #####: 4094: sBytest *B = NULL; - -: 4095: uint32_t count; - -: 4096: uint32_t arrayCount; - -: 4097: u8 type; - -: 4098: - #####: 4099: if (packed) { + #####: 4094:internal void uniformArrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx, bool packed) { + #####: 4095: sUndefinedt *u = NULL; + #####: 4096: sBoolt *bo = NULL; + #####: 4097: double *D = NULL; + #####: 4098: sDoublet *Do = NULL; + #####: 4099: sDictt *d = NULL; + #####: 4100: sIntt *io = NULL; + #####: 4101: char *s = NULL; + #####: 4102: sStringt *so = NULL; + #####: 4103: sArrayt *a = NULL; + #####: 4104: sBytest *B = NULL; + -: 4105: uint32_t count; + -: 4106: uint32_t arrayCount; + -: 4107: u8 type; + -: 4108: + #####: 4109: if (packed) { branch 0 never executed branch 1 never executed - #####: 4100: type = (**data) & 0xF; - #####: 4101: arrayCount = netTypeVarintToUint(data); + #####: 4110: type = (**data) & 0xF; + #####: 4111: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 4102: } - -: 4103: else { - #####: 4104: if (ctx->nibble == lowNbl) { + -: 4112: } + -: 4113: else { + #####: 4114: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 4105: type = (**data) >> 4; - #####: 4106: (*data)++; - #####: 4107: arrayCount = varintToUint(data); + #####: 4115: type = (**data) >> 4; + #####: 4116: (*data)++; + #####: 4117: arrayCount = varintToUint(data); call 0 never executed - -: 4108: } - -: 4109: else { - #####: 4110: readTypeInHighNbl; + -: 4118: } + -: 4119: else { + #####: 4120: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 4111: type = (**data) & 0xF; - #####: 4112: arrayCount = netTypeVarintToUint(data); + #####: 4121: type = (**data) & 0xF; + #####: 4122: arrayCount = netTypeVarintToUint(data); call 0 never executed - -: 4113: } - -: 4114: } - -: 4115: - #####: 4116: if (!arrayCount) { + -: 4123: } + -: 4124: } + -: 4125: + #####: 4126: if (!arrayCount) { branch 0 never executed branch 1 never executed - #####: 4117: *array = allocSArray();; + #####: 4127: *array = allocSArray();; call 0 never executed - #####: 4118: ret; - -: 4119: } - -: 4120: - #####: 4121: switch(type) { + #####: 4128: ret; + -: 4129: } + -: 4130: + #####: 4131: switch(type) { branch 0 never executed branch 1 never executed branch 2 never executed @@ -6073,353 +6091,353 @@ branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed - -: 4122: case S_UNDEFINED: - #####: 4123: loop(arrayCount) { + -: 4132: case S_UNDEFINED: + #####: 4133: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4124: u = allocSUndefined(); + #####: 4134: u = allocSUndefined(); call 0 never executed - #####: 4125: sArrayPushTiny(array, (smallt *) u); + #####: 4135: sArrayPushTiny(array, (smallt *) u); call 0 never executed - -: 4126: } - #####: 4127: break; - -: 4128: case S_BOOL: - #####: 4129: loop(arrayCount) { + -: 4136: } + #####: 4137: break; + -: 4138: case S_BOOL: + #####: 4139: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4130: if (!ctx->boolAddr) { + #####: 4140: if (!ctx->boolAddr) { branch 0 never executed branch 1 never executed - #####: 4131: read8bPackedBool; - #####: 4132: ctx->boolShift = 0; - -: 4133: } - #####: 4134: if (ctx->boolShift == 8) { + #####: 4141: read8bPackedBool; + #####: 4142: ctx->boolShift = 0; + -: 4143: } + #####: 4144: if (ctx->boolShift == 8) { branch 0 never executed branch 1 never executed - #####: 4135: read8bPackedBool; - #####: 4136: bo = allocSBool((*ctx->boolAddr) & 0x1); + #####: 4145: read8bPackedBool; + #####: 4146: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 never executed - -: 4137: } - -: 4138: else { - #####: 4139: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 4147: } + -: 4148: else { + #####: 4149: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 never executed - -: 4140: } - #####: 4141: sArrayPushTiny(array, (smallt *) bo); + -: 4150: } + #####: 4151: sArrayPushTiny(array, (smallt *) bo); call 0 never executed - -: 4142: } - #####: 4143: break; - -: 4144: case S_DICT: - #####: 4145: loop(arrayCount) { + -: 4152: } + #####: 4153: break; + -: 4154: case S_DICT: + #####: 4155: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4146: d = NULL; - #####: 4147: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 4156: d = NULL; + #####: 4157: dictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 4148: sArrayPushTiny(array, (smallt *) d); + #####: 4158: sArrayPushTiny(array, (smallt *) d); call 0 never executed - -: 4149: } - #####: 4150: break; - -: 4151: case S_DOUBLE: - #####: 4152: loop(arrayCount) { + -: 4159: } + #####: 4160: break; + -: 4161: case S_DOUBLE: + #####: 4162: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4153: D = (double *)(*data); - #####: 4154: *data += sizeof(double); - #####: 4155: Do = allocSDouble(*D); + #####: 4163: D = (double *)(*data); + #####: 4164: *data += sizeof(double); + #####: 4165: Do = allocSDouble(*D); call 0 never executed - #####: 4156: sArrayPushTiny(array, (smallt *) Do); + #####: 4166: sArrayPushTiny(array, (smallt *) Do); call 0 never executed - -: 4157: } - #####: 4158: break; - -: 4159: case S_INT: - #####: 4160: loop(arrayCount) { + -: 4167: } + #####: 4168: break; + -: 4169: case S_INT: + #####: 4170: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4161: u64 v = varintToUint(data); + #####: 4171: u64 v = varintToUint(data); call 0 never executed - #####: 4162: v = (v >> 1) ^ (~(v & 1) + 1); - #####: 4163: io = allocSInt(v); + #####: 4172: v = (v >> 1) ^ (~(v & 1) + 1); + #####: 4173: io = allocSInt(v); call 0 never executed - #####: 4164: sArrayPushTiny(array, (smallt *) io); + #####: 4174: sArrayPushTiny(array, (smallt *) io); call 0 never executed - -: 4165: } - #####: 4166: break; - -: 4167: case S_STRING: - #####: 4168: loop(arrayCount) { + -: 4175: } + #####: 4176: break; + -: 4177: case S_STRING: + #####: 4178: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4169: s = (char *)(*data); - #####: 4170: *data += strlen(s)+1; - #####: 4171: so = allocSStringTiny(s); + #####: 4179: s = (char *)(*data); + #####: 4180: *data += strlen(s)+1; + #####: 4181: so = allocSStringTiny(s); call 0 never executed - #####: 4172: sArrayPushTiny(array, (smallt *) so); + #####: 4182: sArrayPushTiny(array, (smallt *) so); call 0 never executed - -: 4173: } - #####: 4174: break; - -: 4175: case S_ARRAY: - #####: 4176: loop(arrayCount) { + -: 4183: } + #####: 4184: break; + -: 4185: case S_ARRAY: + #####: 4186: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4177: a = NULL; - #####: 4178: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 4187: a = NULL; + #####: 4188: arrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 4179: sArrayPushTiny(array, (smallt *) a); + #####: 4189: sArrayPushTiny(array, (smallt *) a); call 0 never executed - -: 4180: } - #####: 4181: break; - -: 4182: case S_BYTES: - #####: 4183: loop(arrayCount) { + -: 4190: } + #####: 4191: break; + -: 4192: case S_BYTES: + #####: 4193: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4184: B = allocSBytes(); + #####: 4194: B = allocSBytes(); call 0 never executed - #####: 4185: count = varintToUint((u8**)data); + #####: 4195: count = varintToUint((u8**)data); call 0 never executed - #####: 4186: sBytesPushBuffer(&B, *data, count); + #####: 4196: sBytesPushBuffer(&B, *data, count); call 0 never executed - #####: 4187: *data += count; - #####: 4188: sArrayPushTiny(array, (smallt *) B); + #####: 4197: *data += count; + #####: 4198: sArrayPushTiny(array, (smallt *) B); call 0 never executed - -: 4189: } - #####: 4190: break; - -: 4191: case UNIFORM_DICT: - #####: 4192: loop(arrayCount) { + -: 4199: } + #####: 4200: break; + -: 4201: case UNIFORM_DICT: + #####: 4202: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4193: d = NULL; - #####: 4194: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); + #####: 4203: d = NULL; + #####: 4204: uniformDictNetDeserialLevel2(&d, data, ctx, /*packed=*/true); call 0 never executed - #####: 4195: sArrayPushTiny(array, (smallt *) d); + #####: 4205: sArrayPushTiny(array, (smallt *) d); call 0 never executed - -: 4196: } - #####: 4197: break; - -: 4198: case UNIFORM_ARRAY: - #####: 4199: loop(arrayCount) { + -: 4206: } + #####: 4207: break; + -: 4208: case UNIFORM_ARRAY: + #####: 4209: loop(arrayCount) { branch 0 never executed branch 1 never executed - #####: 4200: a = NULL; - #####: 4201: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); + #####: 4210: a = NULL; + #####: 4211: uniformArrayNetDeserialLevel2(&a, data, ctx, /*packed=*/true); call 0 never executed - #####: 4202: sArrayPushTiny(array, (smallt *) a); + #####: 4212: sArrayPushTiny(array, (smallt *) a); call 0 never executed - -: 4203: } - #####: 4204: break; - -: 4205: } - -: 4206:} - -: 4207: + -: 4213: } + #####: 4214: break; + -: 4215: } + -: 4216:} + -: 4217: function deserialNetSerialLevel2 called 0 returned 0% blocks executed 0% - #####: 4208:internal smallJsont* deserialNetSerialLevel2(smallJsont *self, smallBytest *data) { - -: 4209: - #####: 4210: if (!data or !data->B or !data->B->count) { + #####: 4218:internal smallJsont* deserialNetSerialLevel2(smallJsont *self, smallBytest *data) { + -: 4219: + #####: 4220: 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 - #####: 4211: ret self; - -: 4212: } - -: 4213: - #####: 4214: smallt *o = netDeserialLevel2(data->B); + #####: 4221: ret self; + -: 4222: } + -: 4223: + #####: 4224: smallt *o = netDeserialLevel2(data->B); call 0 never executed - -: 4215: - #####: 4216: if (!o) { + -: 4225: + #####: 4226: if (!o) { branch 0 never executed branch 1 never executed - #####: 4217: ret self; - -: 4218: } - -: 4219: - #####: 4220: freeG(self); -call 0 never executed - -: 4221: - #####: 4222: setsoG(self, o); -call 0 never executed - -: 4223: - #####: 4224: ret self; - -: 4225:} - -: 4226: - -: 4227:// level 3 - -: 4228:// like level 2, elements of identical type in a row are packed + #####: 4227: ret self; + -: 4228: } -: 4229: - -: 4230:/** - -: 4231: * deserializer top function - -: 4232: */ -function netDeserial called 85 returned 100% blocks executed 85% - 85: 4233:internal smallt* netDeserial(sBytest *obj) { - 85: 4234: smallt *r = NULL; - 85: 4235: double *D = NULL; - 85: 4236: char *s = NULL; - 85: 4237: sBytest *B = NULL; - -: 4238: uint32_t count; - 85: 4239: char *data = NULL; - 85: 4240: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; - -: 4241: - 85: 4242: switch(obj->data & 0xF) { + #####: 4230: freeG(self); +call 0 never executed + -: 4231: + #####: 4232: setsoG(self, o); +call 0 never executed + -: 4233: + #####: 4234: ret self; + -: 4235:} + -: 4236: + -: 4237:// level 3 + -: 4238:// like level 2, elements of identical type in a row are packed + -: 4239: + -: 4240:/** + -: 4241: * deserializer top function + -: 4242: */ +function netDeserial called 86 returned 100% blocks executed 85% + 86: 4243:internal smallt* netDeserial(sBytest *obj) { + 86: 4244: smallt *r = NULL; + 86: 4245: double *D = NULL; + 86: 4246: char *s = NULL; + 86: 4247: sBytest *B = NULL; + -: 4248: uint32_t count; + 86: 4249: char *data = NULL; + 86: 4250: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL}; + -: 4251: + 86: 4252: switch(obj->data & 0xF) { branch 0 taken 1% branch 1 taken 1% -branch 2 taken 31% +branch 2 taken 30% branch 3 taken 1% -branch 4 taken 4% +branch 4 taken 3% branch 5 taken 1% -branch 6 taken 31% +branch 6 taken 30% branch 7 taken 0% -branch 8 taken 15% +branch 8 taken 16% branch 9 taken 15% branch 10 taken 0% - -: 4243: case S_UNDEFINED: - 1: 4244: r = (smallt *) allocSUndefined(); -call 0 returned 100% - 1: 4245: break; - -: 4246: case S_BOOL: - 1: 4247: r = (smallt *) allocSBool(obj->data & 0x10); + -: 4253: case S_UNDEFINED: + 1: 4254: r = (smallt *) allocSUndefined(); call 0 returned 100% - 1: 4248: break; - -: 4249: case S_DICT: - 26: 4250: data = (char *)&(obj->data); - -: 4251: //debug - ctx.dbuf = (u8*) data; - 26: 4252: dictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 26: 4253: break; - -: 4254: case S_DOUBLE: - 1: 4255: data = &(obj->data)+1; - 1: 4256: D = (double *)data; - 1: 4257: r = (smallt *) allocSDouble(*D); + 1: 4255: break; + -: 4256: case S_BOOL: + 1: 4257: r = (smallt *) allocSBool(obj->data & 0x10); call 0 returned 100% 1: 4258: break; - -: 4259: case S_INT: - 3: 4260: data = &(obj->data); - 3: 4261: u64 v = netTypeVarintToUint((u8**)&data); -call 0 returned 100% - 3: 4262: v = (v >> 1) ^ (~(v & 1) + 1); - 3: 4263: r = (smallt *) allocSInt(v); + -: 4259: case S_DICT: + 26: 4260: data = (char *)&(obj->data); + -: 4261: //debug - ctx.dbuf = (u8*) data; + 26: 4262: dictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); call 0 returned 100% - 3: 4264: break; - -: 4265: case S_STRING: - 1: 4266: s = (char *)&(obj->data)+1; - 1: 4267: r = (smallt *) allocSStringTiny(s); + 26: 4263: break; + -: 4264: case S_DOUBLE: + 1: 4265: data = &(obj->data)+1; + 1: 4266: D = (double *)data; + 1: 4267: r = (smallt *) allocSDouble(*D); call 0 returned 100% 1: 4268: break; - -: 4269: case S_ARRAY: - 26: 4270: data = (char *)&(obj->data); - -: 4271: //debug - ctx.dbuf = (u8*) data; - 26: 4272: arrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 26: 4273: break; - -: 4274: case S_BYTES: - #####: 4275: B = allocSBytes(); -call 0 never executed - #####: 4276: data = &(obj->data); - #####: 4277: count = netTypeVarintToUint((u8**)&data); -call 0 never executed - #####: 4278: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 4279: r = (smallt *)B; - #####: 4280: break; - -: 4281: case UNIFORM_DICT: - 13: 4282: data = (char *)&(obj->data); - -: 4283: //debug - ctx.dbuf = (u8*) data; - 13: 4284: uniformDictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 13: 4285: break; - -: 4286: case UNIFORM_ARRAY: - 13: 4287: data = (char *)&(obj->data); - -: 4288: //debug - ctx.dbuf = (u8*) data; - 13: 4289: uniformArrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); -call 0 returned 100% - 13: 4290: break; - -: 4291: } - -: 4292: - 85: 4293: ret r; - -: 4294:} - -: 4295: - -: 4296:/** - -: 4297: * deserialize dictionary from data - -: 4298: * - -: 4299: * a new dictionary is allocated - -: 4300: * - -: 4301: * \param - -: 4302: * dict dictionary holding the elements - -: 4303: * data serialized dictionary - -: 4304: */ + -: 4269: case S_INT: + 3: 4270: data = &(obj->data); + 3: 4271: u64 v = netTypeVarintToUint((u8**)&data); +call 0 returned 100% + 3: 4272: v = (v >> 1) ^ (~(v & 1) + 1); + 3: 4273: r = (smallt *) allocSInt(v); +call 0 returned 100% + 3: 4274: break; + -: 4275: case S_STRING: + 1: 4276: s = (char *)&(obj->data)+1; + 1: 4277: r = (smallt *) allocSStringTiny(s); +call 0 returned 100% + 1: 4278: break; + -: 4279: case S_ARRAY: + 26: 4280: data = (char *)&(obj->data); + -: 4281: //debug - ctx.dbuf = (u8*) data; + 26: 4282: arrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 returned 100% + 26: 4283: break; + -: 4284: case S_BYTES: + #####: 4285: B = allocSBytes(); +call 0 never executed + #####: 4286: data = &(obj->data); + #####: 4287: count = netTypeVarintToUint((u8**)&data); +call 0 never executed + #####: 4288: sBytesPushBuffer(&B, data, count); +call 0 never executed + #####: 4289: r = (smallt *)B; + #####: 4290: break; + -: 4291: case UNIFORM_DICT: + 14: 4292: data = (char *)&(obj->data); + -: 4293: //debug - ctx.dbuf = (u8*) data; + 14: 4294: uniformDictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 returned 100% + 14: 4295: break; + -: 4296: case UNIFORM_ARRAY: + 13: 4297: data = (char *)&(obj->data); + -: 4298: //debug - ctx.dbuf = (u8*) data; + 13: 4299: uniformArrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false); +call 0 returned 100% + 13: 4300: break; + -: 4301: } + -: 4302: + 86: 4303: ret r; + -: 4304:} + -: 4305: + -: 4306:/** + -: 4307: * deserialize dictionary from data + -: 4308: * + -: 4309: * a new dictionary is allocated + -: 4310: * + -: 4311: * \param + -: 4312: * dict dictionary holding the elements + -: 4313: * data serialized dictionary + -: 4314: */ function dictNetDeserial called 56 returned 100% blocks executed 84% - 56: 4305:internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - 56: 4306: sUndefinedt *u = NULL; - 56: 4307: sBoolt *bo = NULL; - 56: 4308: double *D = NULL; - 56: 4309: sDoublet *Do = NULL; - 56: 4310: sDictt *d = NULL; - 56: 4311: sIntt *io = NULL; - 56: 4312: char *s = NULL; - 56: 4313: sStringt *so = NULL; - 56: 4314: sArrayt *a = NULL; - 56: 4315: sBytest *B = NULL; - -: 4316: uint32_t count; - -: 4317: uint32_t dictCount; - -: 4318: - 56: 4319: if (packed) { + 56: 4315:internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { + 56: 4316: sUndefinedt *u = NULL; + 56: 4317: sBoolt *bo = NULL; + 56: 4318: double *D = NULL; + 56: 4319: sDoublet *Do = NULL; + 56: 4320: sDictt *d = NULL; + 56: 4321: sIntt *io = NULL; + 56: 4322: char *s = NULL; + 56: 4323: sStringt *so = NULL; + 56: 4324: sArrayt *a = NULL; + 56: 4325: sBytest *B = NULL; + -: 4326: uint32_t count; + -: 4327: uint32_t dictCount; + -: 4328: + 56: 4329: if (packed) { branch 0 taken 48% (fallthrough) branch 1 taken 52% - 27: 4320: dictCount = varintToUint(data); + 27: 4330: dictCount = varintToUint(data); call 0 returned 100% - -: 4321: } - -: 4322: else { - 29: 4323: if (ctx->nibble == lowNbl) { + -: 4331: } + -: 4332: else { + 29: 4333: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 27: 4324: dictCount = netTypeVarintToUint(data); -call 0 returned 100% - -: 4325: } - -: 4326: else { - -: 4327: // high nibble - -: 4328: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; - -: 4329: #define readTypeInHighNbl\ - -: 4330: ctx->nibble = lowNbl;\ - -: 4331: if (ctx->nblAddr == *data)\ - -: 4332: /* data points to the type, next byte is count */\ - -: 4333: (*data)++ - 2: 4334: readTypeInHighNbl; + 27: 4334: dictCount = netTypeVarintToUint(data); +call 0 returned 100% + -: 4335: } + -: 4336: else { + -: 4337: // high nibble + -: 4338: // type = *(ctx->dbuf + ctx->nblOffset) >> 4; + -: 4339: #define readTypeInHighNbl\ + -: 4340: ctx->nibble = lowNbl;\ + -: 4341: if (ctx->nblAddr == *data)\ + -: 4342: /* data points to the type, next byte is count */\ + -: 4343: (*data)++ + 2: 4344: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 2: 4335: dictCount = varintToUint(data); + 2: 4345: dictCount = varintToUint(data); call 0 returned 100% - -: 4336: } - -: 4337: } - -: 4338: - 56: 4339: if (!dictCount) { + -: 4346: } + -: 4347: } + -: 4348: + 56: 4349: if (!dictCount) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - 10: 4340: *dict = allocSDict(); -call 0 returned 100% - 10: 4341: ret; - -: 4342: } - -: 4343: - 46: 4344: bool inPack = false; - -: 4345: u8 packedType; - -: 4346: size_t packCount; - 209: 4347: loop(dictCount) { + 10: 4350: *dict = allocSDict(); +call 0 returned 100% + 66: 4351: ret; + -: 4352: } + -: 4353: + 46: 4354: bool inPack = false; + -: 4355: u8 packedType; + -: 4356: size_t packCount; + 209: 4357: loop(dictCount) { branch 0 taken 78% branch 1 taken 22% (fallthrough) - 163: 4348: char *key = (char*)*data; - 163: 4349: *data += strlen(key)+1; - -: 4350: char type; - 163: 4351: if (inPack) { + 163: 4358: char *key = (char*)*data; + 163: 4359: *data += strlen(key)+1; + -: 4360: char type; + 163: 4361: if (inPack) { branch 0 taken 23% (fallthrough) branch 1 taken 77% - 38: 4352: type = packedType; - -: 4353: } - -: 4354: else { - 125: 4355: if (ctx->nibble == lowNbl) { + 38: 4362: type = packedType; + -: 4363: } + -: 4364: else { + 125: 4365: if (ctx->nibble == lowNbl) { branch 0 taken 66% (fallthrough) branch 1 taken 34% - 83: 4356: type = (**data) & 0xF; - -: 4357: } - -: 4358: else { - -: 4359: // high nibble - 42: 4360: type = (*ctx->nblAddr) >> 4; - -: 4361: } - -: 4362: } - -: 4363: - 163: 4364: switch(type) { + 83: 4366: type = (**data) & 0xF; + -: 4367: } + -: 4368: else { + -: 4369: // high nibble + 42: 4370: type = (*ctx->nblAddr) >> 4; + -: 4371: } + -: 4372: } + -: 4373: + 163: 4374: switch(type) { branch 0 taken 18% branch 1 taken 19% branch 2 taken 1% @@ -6437,483 +6455,483 @@ branch 13 taken 0% branch 14 taken 2% branch 15 taken 2% branch 16 taken 0% - -: 4365: case S_UNDEFINED: - 29: 4366: if (ctx->nibble == lowNbl) { + -: 4375: case S_UNDEFINED: + 29: 4376: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - -: 4367: #define readTypeOnly\ - -: 4368: ctx->nibble = highNbl;\ - -: 4369: ctx->nblAddr = *data;\ - -: 4370: (*data)++ - 27: 4371: readTypeOnly; - -: 4372: } - -: 4373: else { - -: 4374: // high nibble - 2: 4375: readTypeInHighNbl; + -: 4377: #define readTypeOnly\ + -: 4378: ctx->nibble = highNbl;\ + -: 4379: ctx->nblAddr = *data;\ + -: 4380: (*data)++ + 27: 4381: readTypeOnly; + -: 4382: } + -: 4383: else { + -: 4384: // high nibble + 2: 4385: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4376: } - 29: 4377: u = allocSUndefined(); + -: 4386: } + 29: 4387: u = allocSUndefined(); call 0 returned 100% - 29: 4378: sDictPushTiny(dict, key, (smallt *) u); + 29: 4388: sDictPushTiny(dict, key, (smallt *) u); call 0 returned 100% - 29: 4379: break; - -: 4380: case S_BOOL: - 31: 4381: if (!ctx->boolAddr) { + 29: 4389: break; + -: 4390: case S_BOOL: + 31: 4391: if (!ctx->boolAddr) { branch 0 taken 16% (fallthrough) branch 1 taken 84% - -: 4382: // new packed bools - 5: 4383: if (ctx->nibble == lowNbl) { + -: 4392: // new packed bools + 5: 4393: if (ctx->nibble == lowNbl) { branch 0 taken 60% (fallthrough) branch 1 taken 40% - -: 4384: #define read4bPackedBool\ - -: 4385: ctx->boolShift = 5;\ - -: 4386: ctx->boolAddr = *data;\ - -: 4387: (*data)++ - 3: 4388: read4bPackedBool; - 3: 4389: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 returned 100% - -: 4390: } - -: 4391: else { - -: 4392: // high nibble - 2: 4393: readTypeInHighNbl; -branch 0 taken 0% (fallthrough) -branch 1 taken 100% - -: 4394: #define read8bPackedBool\ - -: 4395: ctx->boolShift = 1;\ + -: 4394: #define read4bPackedBool\ + -: 4395: ctx->boolShift = 5;\ -: 4396: ctx->boolAddr = *data;\ -: 4397: (*data)++ - 2: 4398: read8bPackedBool; - 2: 4399: bo = allocSBool((*ctx->boolAddr) & 0x1); + 3: 4398: read4bPackedBool; + 3: 4399: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 returned 100% -: 4400: } - -: 4401: } - -: 4402: else { - -: 4403: // there was a bool before this one, read bits in nibbles - 26: 4404: if (ctx->nibble == lowNbl) { + -: 4401: else { + -: 4402: // high nibble + 2: 4403: readTypeInHighNbl; +branch 0 taken 0% (fallthrough) +branch 1 taken 100% + -: 4404: #define read8bPackedBool\ + -: 4405: ctx->boolShift = 1;\ + -: 4406: ctx->boolAddr = *data;\ + -: 4407: (*data)++ + 2: 4408: read8bPackedBool; + 2: 4409: bo = allocSBool((*ctx->boolAddr) & 0x1); +call 0 returned 100% + -: 4410: } + -: 4411: } + -: 4412: else { + -: 4413: // there was a bool before this one, read bits in nibbles + 26: 4414: if (ctx->nibble == lowNbl) { branch 0 taken 58% (fallthrough) branch 1 taken 42% - 15: 4405: if (ctx->boolShift == 8) { + 15: 4415: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - 1: 4406: read4bPackedBool; - 1: 4407: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 returned 100% - -: 4408: } - -: 4409: else { - 14: 4410: readTypeOnly; - 14: 4411: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); -call 0 returned 100% - -: 4412: } - -: 4413: } - -: 4414: else { - -: 4415: // high nibble - 11: 4416: readTypeInHighNbl; + 1: 4416: read4bPackedBool; + 1: 4417: bo = allocSBool((*ctx->boolAddr) & 0x10); +call 0 returned 100% + -: 4418: } + -: 4419: else { + 14: 4420: readTypeOnly; + 14: 4421: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); +call 0 returned 100% + -: 4422: } + -: 4423: } + -: 4424: else { + -: 4425: // high nibble + 11: 4426: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 11: 4417: if (ctx->boolShift == 8) { + 11: 4427: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - 2: 4418: read8bPackedBool; - 2: 4419: bo = allocSBool((*ctx->boolAddr) & 0x1); + 2: 4428: read8bPackedBool; + 2: 4429: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 4420: } - -: 4421: else { - -: 4422: // high nibble - 9: 4423: readTypeInHighNbl; + -: 4430: } + -: 4431: else { + -: 4432: // high nibble + 9: 4433: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 9: 4424: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + 9: 4434: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 4425: } - -: 4426: } - -: 4427: } - 31: 4428: sDictPushTiny(dict, key, (smallt *) bo); + -: 4435: } + -: 4436: } + -: 4437: } + 31: 4438: sDictPushTiny(dict, key, (smallt *) bo); call 0 returned 100% - 31: 4429: break; - -: 4430: case S_DICT: - 1: 4431: d = NULL; - 1: 4432: dictNetDeserial(&d, data, ctx, /*packed=*/false); + 31: 4439: break; + -: 4440: case S_DICT: + 1: 4441: d = NULL; + 1: 4442: dictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 1: 4433: sDictPushTiny(dict, key, (smallt *) d); + 1: 4443: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - 1: 4434: break; - -: 4435: case S_DOUBLE: - 2: 4436: if (ctx->nibble == lowNbl) { + 1: 4444: break; + -: 4445: case S_DOUBLE: + 2: 4446: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4437: readTypeOnly; - -: 4438: } - -: 4439: else { - -: 4440: // high nibble - 1: 4441: readTypeInHighNbl; + 1: 4447: readTypeOnly; + -: 4448: } + -: 4449: else { + -: 4450: // high nibble + 1: 4451: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4442: } - 2: 4443: D = (double *)(*data); - 2: 4444: *data += sizeof(double); - 2: 4445: Do = allocSDouble(*D); + -: 4452: } + 2: 4453: D = (double *)(*data); + 2: 4454: *data += sizeof(double); + 2: 4455: Do = allocSDouble(*D); call 0 returned 100% - 2: 4446: sDictPushTiny(dict, key, (smallt *) Do); + 2: 4456: sDictPushTiny(dict, key, (smallt *) Do); call 0 returned 100% - 2: 4447: break; - -: 4448: case S_INT: { - -: 4449: u64 v; - 24: 4450: if (ctx->nibble == lowNbl) { + 2: 4457: break; + -: 4458: case S_INT: { + -: 4459: u64 v; + 24: 4460: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 12: 4451: v = netTypeVarintToUint((u8**)data); + 12: 4461: v = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4452: } - -: 4453: else { - -: 4454: // high nibble - 12: 4455: readTypeInHighNbl; + -: 4462: } + -: 4463: else { + -: 4464: // high nibble + 12: 4465: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 12: 4456: v = varintToUint(data); + 12: 4466: v = varintToUint(data); call 0 returned 100% - -: 4457: } - 24: 4458: v = (v >> 1) ^ (~(v & 1) + 1); - 24: 4459: io = allocSInt(v); + -: 4467: } + 24: 4468: v = (v >> 1) ^ (~(v & 1) + 1); + 24: 4469: io = allocSInt(v); call 0 returned 100% - 24: 4460: sDictPushTiny(dict, key, (smallt *) io); + 24: 4470: sDictPushTiny(dict, key, (smallt *) io); call 0 returned 100% - -: 4461: } - 24: 4462: break; - -: 4463: case S_STRING: - 14: 4464: if (ctx->nibble == lowNbl) { + -: 4471: } + 24: 4472: break; + -: 4473: case S_STRING: + 14: 4474: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 13: 4465: readTypeOnly; - -: 4466: } - -: 4467: else { - -: 4468: // high nibble - 1: 4469: readTypeInHighNbl; + 13: 4475: readTypeOnly; + -: 4476: } + -: 4477: else { + -: 4478: // high nibble + 1: 4479: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4470: } - 14: 4471: s = (char *)(*data); - 14: 4472: *data += strlen(s)+1; - 14: 4473: so = allocSStringTiny(s); + -: 4480: } + 14: 4481: s = (char *)(*data); + 14: 4482: *data += strlen(s)+1; + 14: 4483: so = allocSStringTiny(s); call 0 returned 100% - 14: 4474: sDictPushTiny(dict, key, (smallt *) so); + 14: 4484: sDictPushTiny(dict, key, (smallt *) so); call 0 returned 100% - 14: 4475: break; - -: 4476: case S_ARRAY: - 3: 4477: a = NULL; - 3: 4478: arrayNetDeserial(&a, data, ctx, /*packed=*/false); + 14: 4485: break; + -: 4486: case S_ARRAY: + 3: 4487: a = NULL; + 3: 4488: arrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 3: 4479: sDictPushTiny(dict, key, (smallt *) a); + 3: 4489: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - 3: 4480: break; - -: 4481: case S_BYTES: - 2: 4482: B = allocSBytes(); + 3: 4490: break; + -: 4491: case S_BYTES: + 2: 4492: B = allocSBytes(); call 0 returned 100% - 2: 4483: if (ctx->nibble == lowNbl) { + 2: 4493: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4484: count = netTypeVarintToUint((u8**)data); + 1: 4494: count = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4485: } - -: 4486: else { - -: 4487: // high nibble - 1: 4488: readTypeInHighNbl; + -: 4495: } + -: 4496: else { + -: 4497: // high nibble + 1: 4498: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4489: count = varintToUint((u8**)data); + 1: 4499: count = varintToUint((u8**)data); call 0 returned 100% - -: 4490: } - 2: 4491: sBytesPushBuffer(&B, *data, count); + -: 4500: } + 2: 4501: sBytesPushBuffer(&B, *data, count); call 0 returned 100% - 2: 4492: *data += count; - 2: 4493: sDictPushTiny(dict, key, (smallt *) B); + 2: 4502: *data += count; + 2: 4503: sDictPushTiny(dict, key, (smallt *) B); call 0 returned 100% - 2: 4494: break; - -: 4495: case PK_DICT: - 15: 4496: if (!inPack) { + 2: 4504: break; + -: 4505: case PK_DICT: + 15: 4506: if (!inPack) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - 3: 4497: inPack = true; - 3: 4498: if (ctx->nibble == lowNbl) { + 3: 4507: inPack = true; + 3: 4508: if (ctx->nibble == lowNbl) { branch 0 taken 67% (fallthrough) branch 1 taken 33% - 2: 4499: packCount = netTypeVarintToUint((u8**)data); + 2: 4509: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4500: } - -: 4501: else { - -: 4502: // high nibble - 1: 4503: readTypeInHighNbl; + -: 4510: } + -: 4511: else { + -: 4512: // high nibble + 1: 4513: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4504: packCount = varintToUint((u8**)data); + 1: 4514: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4505: } - 3: 4506: packedType = PK_DICT; - -: 4507: } - -: 4508: - 15: 4509: d = NULL; - 15: 4510: dictNetDeserial(&d, data, ctx, /*packed=*/true); + -: 4515: } + 3: 4516: packedType = PK_DICT; + -: 4517: } + -: 4518: + 15: 4519: d = NULL; + 15: 4520: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 15: 4511: sDictPushTiny(dict, key, (smallt *) d); + 15: 4521: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - -: 4512: // stop unpacking when packCount == 0 - 15: 4513: packCount--; - 15: 4514: if (!packCount) inPack = false; + -: 4522: // stop unpacking when packCount == 0 + 15: 4523: packCount--; + 15: 4524: if (!packCount) inPack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - 15: 4515: break; - -: 4516: case PK_DOUBLE: - 10: 4517: if (!inPack) { + 15: 4525: break; + -: 4526: case PK_DOUBLE: + 10: 4527: if (!inPack) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - 2: 4518: inPack = true; - 2: 4519: if (ctx->nibble == lowNbl) { + 2: 4528: inPack = true; + 2: 4529: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4520: packCount = netTypeVarintToUint((u8**)data); + 1: 4530: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4521: } - -: 4522: else { - -: 4523: // high nibble - 1: 4524: readTypeInHighNbl; + -: 4531: } + -: 4532: else { + -: 4533: // high nibble + 1: 4534: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4525: packCount = varintToUint((u8**)data); + 1: 4535: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4526: } - 2: 4527: packedType = PK_DOUBLE; - -: 4528: } - -: 4529: - 10: 4530: D = (double *)(*data); - 10: 4531: *data += sizeof(double); - 10: 4532: Do = allocSDouble(*D); + -: 4536: } + 2: 4537: packedType = PK_DOUBLE; + -: 4538: } + -: 4539: + 10: 4540: D = (double *)(*data); + 10: 4541: *data += sizeof(double); + 10: 4542: Do = allocSDouble(*D); call 0 returned 100% - 10: 4533: sDictPushTiny(dict, key, (smallt *) Do); + 10: 4543: sDictPushTiny(dict, key, (smallt *) Do); call 0 returned 100% - -: 4534: // stop unpacking when packCount == 0 - 10: 4535: packCount--; - 10: 4536: if (!packCount) inPack = false; + -: 4544: // stop unpacking when packCount == 0 + 10: 4545: packCount--; + 10: 4546: if (!packCount) inPack = false; branch 0 taken 20% (fallthrough) branch 1 taken 80% - 10: 4537: break; - -: 4538: case PK_INT: - 8: 4539: if (!inPack) { + 10: 4547: break; + -: 4548: case PK_INT: + 8: 4549: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4540: inPack = true; - 2: 4541: if (ctx->nibble == lowNbl) { + 2: 4550: inPack = true; + 2: 4551: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4542: packCount = netTypeVarintToUint((u8**)data); + 1: 4552: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4543: } - -: 4544: else { - -: 4545: // high nibble - 1: 4546: readTypeInHighNbl; + -: 4553: } + -: 4554: else { + -: 4555: // high nibble + 1: 4556: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4547: packCount = varintToUint((u8**)data); + 1: 4557: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4548: } - 2: 4549: packedType = PK_INT; - -: 4550: } - -: 4551: - 8: 4552: u64 v = varintToUint(data); + -: 4558: } + 2: 4559: packedType = PK_INT; + -: 4560: } + -: 4561: + 8: 4562: u64 v = varintToUint(data); call 0 returned 100% - 8: 4553: v = (v >> 1) ^ (~(v & 1) + 1); - 8: 4554: io = allocSInt(v); + 8: 4563: v = (v >> 1) ^ (~(v & 1) + 1); + 8: 4564: io = allocSInt(v); call 0 returned 100% - 8: 4555: sDictPushTiny(dict, key, (smallt *) io); + 8: 4565: sDictPushTiny(dict, key, (smallt *) io); call 0 returned 100% - -: 4556: // stop unpacking when packCount == 0 - 8: 4557: packCount--; - 8: 4558: if (!packCount) inPack = false; + -: 4566: // stop unpacking when packCount == 0 + 8: 4567: packCount--; + 8: 4568: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4559: break; - -: 4560: case PK_STRING: - 8: 4561: if (!inPack) { + 8: 4569: break; + -: 4570: case PK_STRING: + 8: 4571: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4562: inPack = true; - 2: 4563: if (ctx->nibble == lowNbl) { + 2: 4572: inPack = true; + 2: 4573: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4564: packCount = netTypeVarintToUint((u8**)data); + 1: 4574: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4565: } - -: 4566: else { - -: 4567: // high nibble - 1: 4568: readTypeInHighNbl; + -: 4575: } + -: 4576: else { + -: 4577: // high nibble + 1: 4578: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4569: packCount = varintToUint((u8**)data); + 1: 4579: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4570: } - 2: 4571: packedType = PK_STRING; - -: 4572: } - -: 4573: - 8: 4574: s = (char *)(*data); - 8: 4575: *data += strlen(s)+1; - 8: 4576: so = allocSStringTiny(s); + -: 4580: } + 2: 4581: packedType = PK_STRING; + -: 4582: } + -: 4583: + 8: 4584: s = (char *)(*data); + 8: 4585: *data += strlen(s)+1; + 8: 4586: so = allocSStringTiny(s); call 0 returned 100% - 8: 4577: sDictPushTiny(dict, key, (smallt *) so); + 8: 4587: sDictPushTiny(dict, key, (smallt *) so); call 0 returned 100% - -: 4578: // stop unpacking when packCount == 0 - 8: 4579: packCount--; - 8: 4580: if (!packCount) inPack = false; + -: 4588: // stop unpacking when packCount == 0 + 8: 4589: packCount--; + 8: 4590: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4581: break; - -: 4582: case PK_ARRAY: - 8: 4583: if (!inPack) { + 8: 4591: break; + -: 4592: case PK_ARRAY: + 8: 4593: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4584: inPack = true; - 2: 4585: if (ctx->nibble == lowNbl) { + 2: 4594: inPack = true; + 2: 4595: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4586: packCount = netTypeVarintToUint((u8**)data); + 1: 4596: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4587: } - -: 4588: else { - -: 4589: // high nibble - 1: 4590: readTypeInHighNbl; + -: 4597: } + -: 4598: else { + -: 4599: // high nibble + 1: 4600: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4591: packCount = varintToUint((u8**)data); + 1: 4601: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4592: } - 2: 4593: packedType = PK_ARRAY; - -: 4594: } - -: 4595: - 8: 4596: a = NULL; - 8: 4597: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + -: 4602: } + 2: 4603: packedType = PK_ARRAY; + -: 4604: } + -: 4605: + 8: 4606: a = NULL; + 8: 4607: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 8: 4598: sDictPushTiny(dict, key, (smallt *) a); + 8: 4608: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - -: 4599: // stop unpacking when packCount == 0 - 8: 4600: packCount--; - 8: 4601: if (!packCount) inPack = false; + -: 4609: // stop unpacking when packCount == 0 + 8: 4610: packCount--; + 8: 4611: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4602: break; - -: 4603: case PK_BYTES: - #####: 4604: if (!inPack) { -branch 0 never executed -branch 1 never executed - #####: 4605: inPack = true; - #####: 4606: if (ctx->nibble == lowNbl) { -branch 0 never executed -branch 1 never executed - #####: 4607: packCount = netTypeVarintToUint((u8**)data); -call 0 never executed - -: 4608: } - -: 4609: else { - -: 4610: // high nibble - #####: 4611: readTypeInHighNbl; -branch 0 never executed -branch 1 never executed - #####: 4612: packCount = varintToUint((u8**)data); -call 0 never executed - -: 4613: } - #####: 4614: packedType = PK_BYTES; - -: 4615: } - -: 4616: - #####: 4617: B = allocSBytes(); -call 0 never executed - #####: 4618: count = varintToUint((u8**)data); -call 0 never executed - #####: 4619: sBytesPushBuffer(&B, data, count); -call 0 never executed - #####: 4620: *data += count; - #####: 4621: sDictPushTiny(dict, key, (smallt *) B); -call 0 never executed - -: 4622: // stop unpacking when packCount == 0 - #####: 4623: packCount--; - #####: 4624: if (!packCount) inPack = false; -branch 0 never executed -branch 1 never executed - #####: 4625: break; - -: 4626: case UNIFORM_DICT: - 4: 4627: d = NULL; - 4: 4628: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); -call 0 returned 100% - 4: 4629: sDictPushTiny(dict, key, (smallt *) d); -call 0 returned 100% - 4: 4630: break; - -: 4631: case UNIFORM_ARRAY: - 4: 4632: a = NULL; - 4: 4633: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); -call 0 returned 100% - 4: 4634: sDictPushTiny(dict, key, (smallt *) a); -call 0 returned 100% - 4: 4635: break; - -: 4636: } - -: 4637: } - -: 4638:} - -: 4639: - -: 4640:/** - -: 4641: * deserialize dictionary from data - -: 4642: * - -: 4643: * a new dictionary is allocated - -: 4644: * - -: 4645: * \param - -: 4646: * dict dictionary holding the elements - -: 4647: * data serialized dictionary - -: 4648: */ -function uniformDictNetDeserial called 26 returned 100% blocks executed 97% - 26: 4649:internal void uniformDictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { - 26: 4650: sUndefinedt *u = NULL; - 26: 4651: sBoolt *bo = NULL; - 26: 4652: double *D = NULL; - 26: 4653: sDoublet *Do = NULL; - 26: 4654: sDictt *d = NULL; - 26: 4655: sIntt *io = NULL; - 26: 4656: char *s = NULL; - 26: 4657: sStringt *so = NULL; - 26: 4658: sArrayt *a = NULL; - 26: 4659: sBytest *B = NULL; - -: 4660: uint32_t count; - -: 4661: uint32_t dictCount; - -: 4662: u8 type; - -: 4663: - 26: 4664: if (packed) { + 8: 4612: break; + -: 4613: case PK_BYTES: + #####: 4614: if (!inPack) { +branch 0 never executed +branch 1 never executed + #####: 4615: inPack = true; + #####: 4616: if (ctx->nibble == lowNbl) { +branch 0 never executed +branch 1 never executed + #####: 4617: packCount = netTypeVarintToUint((u8**)data); +call 0 never executed + -: 4618: } + -: 4619: else { + -: 4620: // high nibble + #####: 4621: readTypeInHighNbl; +branch 0 never executed +branch 1 never executed + #####: 4622: packCount = varintToUint((u8**)data); +call 0 never executed + -: 4623: } + #####: 4624: packedType = PK_BYTES; + -: 4625: } + -: 4626: + #####: 4627: B = allocSBytes(); +call 0 never executed + #####: 4628: count = varintToUint((u8**)data); +call 0 never executed + #####: 4629: sBytesPushBuffer(&B, *data, count); +call 0 never executed + #####: 4630: *data += count; + #####: 4631: sDictPushTiny(dict, key, (smallt *) B); +call 0 never executed + -: 4632: // stop unpacking when packCount == 0 + #####: 4633: packCount--; + #####: 4634: if (!packCount) inPack = false; +branch 0 never executed +branch 1 never executed + #####: 4635: break; + -: 4636: case UNIFORM_DICT: + 4: 4637: d = NULL; + 4: 4638: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); +call 0 returned 100% + 4: 4639: sDictPushTiny(dict, key, (smallt *) d); +call 0 returned 100% + 4: 4640: break; + -: 4641: case UNIFORM_ARRAY: + 4: 4642: a = NULL; + 4: 4643: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); +call 0 returned 100% + 4: 4644: sDictPushTiny(dict, key, (smallt *) a); +call 0 returned 100% + 4: 4645: break; + -: 4646: } + -: 4647: } + -: 4648:} + -: 4649: + -: 4650:/** + -: 4651: * deserialize dictionary from data + -: 4652: * + -: 4653: * a new dictionary is allocated + -: 4654: * + -: 4655: * \param + -: 4656: * dict dictionary holding the elements + -: 4657: * data serialized dictionary + -: 4658: */ +function uniformDictNetDeserial called 27 returned 100% blocks executed 97% + 27: 4659:internal void uniformDictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) { + 27: 4660: sUndefinedt *u = NULL; + 27: 4661: sBoolt *bo = NULL; + 27: 4662: double *D = NULL; + 27: 4663: sDoublet *Do = NULL; + 27: 4664: sDictt *d = NULL; + 27: 4665: sIntt *io = NULL; + 27: 4666: char *s = NULL; + 27: 4667: sStringt *so = NULL; + 27: 4668: sArrayt *a = NULL; + 27: 4669: sBytest *B = NULL; + -: 4670: uint32_t count; + -: 4671: uint32_t dictCount; + -: 4672: u8 type; + -: 4673: + 27: 4674: if (packed) { branch 0 taken 15% (fallthrough) branch 1 taken 85% - 4: 4665: type = (**data) & 0xF; - 4: 4666: dictCount = netTypeVarintToUint(data); + 4: 4675: type = (**data) & 0xF; + 4: 4676: dictCount = netTypeVarintToUint(data); call 0 returned 100% - -: 4667: } - -: 4668: else { - 22: 4669: if (ctx->nibble == lowNbl) { + -: 4677: } + -: 4678: else { + 23: 4679: if (ctx->nibble == lowNbl) { branch 0 taken 91% (fallthrough) branch 1 taken 9% - 20: 4670: type = (**data) >> 4; - 20: 4671: (*data)++; - 20: 4672: dictCount = varintToUint(data); + 21: 4680: type = (**data) >> 4; + 21: 4681: (*data)++; + 21: 4682: dictCount = varintToUint(data); call 0 returned 100% - -: 4673: } - -: 4674: else { - 2: 4675: readTypeInHighNbl; + -: 4683: } + -: 4684: else { + 2: 4685: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 2: 4676: type = (**data) & 0xF; - 2: 4677: dictCount = netTypeVarintToUint(data); + 2: 4686: type = (**data) & 0xF; + 2: 4687: dictCount = netTypeVarintToUint(data); call 0 returned 100% - -: 4678: } - -: 4679: } - -: 4680: - 26: 4681: if (!dictCount) { -branch 0 taken 4% (fallthrough) -branch 1 taken 96% - 1: 4682: *dict = allocSDict(); + -: 4688: } + -: 4689: } + -: 4690: + 27: 4691: if (!dictCount) { +branch 0 taken 7% (fallthrough) +branch 1 taken 93% + 2: 4692: *dict = allocSDict(); call 0 returned 100% - 1: 4683: ret; - -: 4684: } - -: 4685: - -: 4686: - 25: 4687: switch(type) { + 29: 4693: ret; + -: 4694: } + -: 4695: + -: 4696: + 25: 4697: switch(type) { branch 0 taken 4% branch 1 taken 16% branch 2 taken 4% @@ -6925,247 +6943,247 @@ branch 7 taken 4% branch 8 taken 4% branch 9 taken 4% branch 10 taken 0% - -: 4688: case S_UNDEFINED: - 7: 4689: loop(dictCount) { + -: 4698: case S_UNDEFINED: + 7: 4699: loop(dictCount) { branch 0 taken 86% branch 1 taken 14% (fallthrough) - 6: 4690: char *key = (char*)*data; - 6: 4691: *data += strlen(key)+1; - 6: 4692: u = allocSUndefined(); + 6: 4700: char *key = (char*)*data; + 6: 4701: *data += strlen(key)+1; + 6: 4702: u = allocSUndefined(); call 0 returned 100% - 6: 4693: sDictPushTiny(dict, key, (smallt *) u); + 6: 4703: sDictPushTiny(dict, key, (smallt *) u); call 0 returned 100% - -: 4694: } - 1: 4695: break; - -: 4696: case S_BOOL: - 19: 4697: loop(dictCount) { + -: 4704: } + 1: 4705: break; + -: 4706: case S_BOOL: + 19: 4707: loop(dictCount) { branch 0 taken 79% branch 1 taken 21% (fallthrough) - 15: 4698: char *key = (char*)*data; - 15: 4699: *data += strlen(key)+1; - 15: 4700: if (!ctx->boolAddr) { + 15: 4708: char *key = (char*)*data; + 15: 4709: *data += strlen(key)+1; + 15: 4710: if (!ctx->boolAddr) { branch 0 taken 20% (fallthrough) branch 1 taken 80% - 3: 4701: read8bPackedBool; - 3: 4702: ctx->boolShift = 0; - -: 4703: } - 15: 4704: if (ctx->boolShift == 8) { + 3: 4711: read8bPackedBool; + 3: 4712: ctx->boolShift = 0; + -: 4713: } + 15: 4714: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - 1: 4705: readTypeInHighNbl; + 1: 4715: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4706: read8bPackedBool; - 1: 4707: bo = allocSBool((*ctx->boolAddr) & 0x1); + 1: 4716: read8bPackedBool; + 1: 4717: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 4708: } - -: 4709: else { - -: 4710: // high nibble - 14: 4711: readTypeInHighNbl; + -: 4718: } + -: 4719: else { + -: 4720: // high nibble + 14: 4721: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 14: 4712: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + 14: 4722: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 4713: } - 15: 4714: sDictPushTiny(dict, key, (smallt *) bo); + -: 4723: } + 15: 4724: sDictPushTiny(dict, key, (smallt *) bo); call 0 returned 100% - -: 4715: } - 4: 4716: break; - -: 4717: case S_DICT: - 3: 4718: loop(dictCount) { + -: 4725: } + 4: 4726: break; + -: 4727: case S_DICT: + 3: 4728: loop(dictCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 4719: char *key = (char*)*data; - 2: 4720: *data += strlen(key)+1; - 2: 4721: d = NULL; - 2: 4722: dictNetDeserial(&d, data, ctx, /*packed=*/true); + 2: 4729: char *key = (char*)*data; + 2: 4730: *data += strlen(key)+1; + 2: 4731: d = NULL; + 2: 4732: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 2: 4723: sDictPushTiny(dict, key, (smallt *) d); + 2: 4733: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - -: 4724: } - 1: 4725: break; - -: 4726: case S_DOUBLE: - 4: 4727: loop(dictCount) { + -: 4734: } + 1: 4735: break; + -: 4736: case S_DOUBLE: + 4: 4737: loop(dictCount) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 4728: char *key = (char*)*data; - 3: 4729: *data += strlen(key)+1; - 3: 4730: D = (double *)(*data); - 3: 4731: *data += sizeof(double); - 3: 4732: Do = allocSDouble(*D); + 3: 4738: char *key = (char*)*data; + 3: 4739: *data += strlen(key)+1; + 3: 4740: D = (double *)(*data); + 3: 4741: *data += sizeof(double); + 3: 4742: Do = allocSDouble(*D); call 0 returned 100% - 3: 4733: sDictPushTiny(dict, key, (smallt *) Do); + 3: 4743: sDictPushTiny(dict, key, (smallt *) Do); call 0 returned 100% - -: 4734: } - 1: 4735: break; - -: 4736: case S_INT: - 21: 4737: loop(dictCount) { + -: 4744: } + 1: 4745: break; + -: 4746: case S_INT: + 21: 4747: loop(dictCount) { branch 0 taken 57% branch 1 taken 43% (fallthrough) - 12: 4738: char *key = (char*)*data; - 12: 4739: *data += strlen(key)+1; - 12: 4740: u64 v = varintToUint(data); + 12: 4748: char *key = (char*)*data; + 12: 4749: *data += strlen(key)+1; + 12: 4750: u64 v = varintToUint(data); call 0 returned 100% - 12: 4741: v = (v >> 1) ^ (~(v & 1) + 1); - 12: 4742: io = allocSInt(v); + 12: 4751: v = (v >> 1) ^ (~(v & 1) + 1); + 12: 4752: io = allocSInt(v); call 0 returned 100% - 12: 4743: sDictPushTiny(dict, key, (smallt *) io); + 12: 4753: sDictPushTiny(dict, key, (smallt *) io); call 0 returned 100% - -: 4744: } - 9: 4745: break; - -: 4746: case S_STRING: - 16: 4747: loop(dictCount) { + -: 4754: } + 9: 4755: break; + -: 4756: case S_STRING: + 16: 4757: loop(dictCount) { branch 0 taken 69% branch 1 taken 31% (fallthrough) - 11: 4748: char *key = (char*)*data; - 11: 4749: *data += strlen(key)+1; - 11: 4750: s = (char *)(*data); - 11: 4751: *data += strlen(s)+1; - 11: 4752: so = allocSStringTiny(s); -call 0 returned 100% - 11: 4753: sDictPushTiny(dict, key, (smallt *) so); -call 0 returned 100% - -: 4754: } - 5: 4755: break; - -: 4756: case S_ARRAY: - 2: 4757: loop(dictCount) { + 11: 4758: char *key = (char*)*data; + 11: 4759: *data += strlen(key)+1; + 11: 4760: s = (char *)(*data); + 11: 4761: *data += strlen(s)+1; + 11: 4762: so = allocSStringTiny(s); +call 0 returned 100% + 11: 4763: sDictPushTiny(dict, key, (smallt *) so); +call 0 returned 100% + -: 4764: } + 5: 4765: break; + -: 4766: case S_ARRAY: + 2: 4767: loop(dictCount) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 1: 4758: char *key = (char*)*data; - 1: 4759: *data += strlen(key)+1; - 1: 4760: a = NULL; - 1: 4761: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + 1: 4768: char *key = (char*)*data; + 1: 4769: *data += strlen(key)+1; + 1: 4770: a = NULL; + 1: 4771: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 1: 4762: sDictPushTiny(dict, key, (smallt *) a); + 1: 4772: sDictPushTiny(dict, key, (smallt *) a); call 0 returned 100% - -: 4763: } - 1: 4764: break; - -: 4765: case S_BYTES: - 3: 4766: loop(dictCount) { + -: 4773: } + 1: 4774: break; + -: 4775: case S_BYTES: + 3: 4776: loop(dictCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 4767: char *key = (char*)*data; - 2: 4768: *data += strlen(key)+1; - 2: 4769: B = allocSBytes(); + 2: 4777: char *key = (char*)*data; + 2: 4778: *data += strlen(key)+1; + 2: 4779: B = allocSBytes(); call 0 returned 100% - 2: 4770: count = varintToUint((u8**)data); + 2: 4780: count = varintToUint((u8**)data); call 0 returned 100% - 2: 4771: sBytesPushBuffer(&B, *data, count); + 2: 4781: sBytesPushBuffer(&B, *data, count); call 0 returned 100% - 2: 4772: *data += count; - 2: 4773: sDictPushTiny(dict, key, (smallt *) B); + 2: 4782: *data += count; + 2: 4783: sDictPushTiny(dict, key, (smallt *) B); call 0 returned 100% - -: 4774: } - 1: 4775: break; - -: 4776: case UNIFORM_DICT: - 3: 4777: loop(dictCount) { + -: 4784: } + 1: 4785: break; + -: 4786: case UNIFORM_DICT: + 3: 4787: loop(dictCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 4778: char *key = (char*)*data; - 2: 4779: *data += strlen(key)+1; - 2: 4780: d = NULL; - 2: 4781: uniformDictNetDeserial(&d, data, ctx, /*packed=*/true); + 2: 4788: char *key = (char*)*data; + 2: 4789: *data += strlen(key)+1; + 2: 4790: d = NULL; + 2: 4791: uniformDictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 2: 4782: sDictPushTiny(dict, key, (smallt *) d); + 2: 4792: sDictPushTiny(dict, key, (smallt *) d); call 0 returned 100% - -: 4783: } - 1: 4784: break; - -: 4785: case UNIFORM_ARRAY: - 2: 4786: loop(dictCount) { + -: 4793: } + 1: 4794: break; + -: 4795: case UNIFORM_ARRAY: + 2: 4796: loop(dictCount) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 1: 4787: char *key = (char*)*data; - 1: 4788: *data += strlen(key)+1; - 1: 4789: a = NULL; - 1: 4790: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/true); -call 0 returned 100% - 1: 4791: sDictPushTiny(dict, key, (smallt *) a); -call 0 returned 100% - -: 4792: } - 1: 4793: break; - -: 4794: } - -: 4795:} - -: 4796: - -: 4797:/** - -: 4798: * deserialize array from data - -: 4799: * - -: 4800: * a new array is allocated - -: 4801: * - -: 4802: * \param - -: 4803: * array holding the elements - -: 4804: * data serialized dictionary - -: 4805: */ + 1: 4797: char *key = (char*)*data; + 1: 4798: *data += strlen(key)+1; + 1: 4799: a = NULL; + 1: 4800: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/true); +call 0 returned 100% + 1: 4801: sDictPushTiny(dict, key, (smallt *) a); +call 0 returned 100% + -: 4802: } + 1: 4803: break; + -: 4804: } + -: 4805:} + -: 4806: + -: 4807:/** + -: 4808: * deserialize array from data + -: 4809: * + -: 4810: * a new array is allocated + -: 4811: * + -: 4812: * \param + -: 4813: * array holding the elements + -: 4814: * data serialized dictionary + -: 4815: */ function arrayNetDeserial called 53 returned 100% blocks executed 84% - 53: 4806:internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - 53: 4807: sUndefinedt *u = NULL; - 53: 4808: sBoolt *bo = NULL; - 53: 4809: double *D = NULL; - 53: 4810: sDoublet *Do = NULL; - 53: 4811: sDictt *d = NULL; - 53: 4812: sIntt *io = NULL; - 53: 4813: char *s = NULL; - 53: 4814: sStringt *so = NULL; - 53: 4815: sArrayt *a = NULL; - 53: 4816: sBytest *B = NULL; - -: 4817: uint32_t count; - -: 4818: uint32_t arrayCount; - -: 4819: - 53: 4820: if (packed) { + 53: 4816:internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { + 53: 4817: sUndefinedt *u = NULL; + 53: 4818: sBoolt *bo = NULL; + 53: 4819: double *D = NULL; + 53: 4820: sDoublet *Do = NULL; + 53: 4821: sDictt *d = NULL; + 53: 4822: sIntt *io = NULL; + 53: 4823: char *s = NULL; + 53: 4824: sStringt *so = NULL; + 53: 4825: sArrayt *a = NULL; + 53: 4826: sBytest *B = NULL; + -: 4827: uint32_t count; + -: 4828: uint32_t arrayCount; + -: 4829: + 53: 4830: if (packed) { branch 0 taken 42% (fallthrough) branch 1 taken 58% - 22: 4821: arrayCount = varintToUint(data); + 22: 4831: arrayCount = varintToUint(data); call 0 returned 100% - -: 4822: } - -: 4823: else { - 31: 4824: if (ctx->nibble == lowNbl) { + -: 4832: } + -: 4833: else { + 31: 4834: if (ctx->nibble == lowNbl) { branch 0 taken 90% (fallthrough) branch 1 taken 10% - 28: 4825: arrayCount = netTypeVarintToUint(data); + 28: 4835: arrayCount = netTypeVarintToUint(data); call 0 returned 100% - -: 4826: } - -: 4827: else { - -: 4828: // high nibble - 3: 4829: readTypeInHighNbl; + -: 4836: } + -: 4837: else { + -: 4838: // high nibble + 3: 4839: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 3: 4830: arrayCount = varintToUint(data); + 3: 4840: arrayCount = varintToUint(data); call 0 returned 100% - -: 4831: } - -: 4832: } - -: 4833: - 53: 4834: if (!arrayCount) { + -: 4841: } + -: 4842: } + -: 4843: + 53: 4844: if (!arrayCount) { branch 0 taken 4% (fallthrough) branch 1 taken 96% - 2: 4835: *array = allocSArray();; -call 0 returned 100% - 2: 4836: ret; - -: 4837: } - -: 4838: - 51: 4839: bool inPack = false; - -: 4840: u8 packedType; - -: 4841: size_t packCount; - 216: 4842: loop(arrayCount) { + 2: 4845: *array = allocSArray();; +call 0 returned 100% + 55: 4846: ret; + -: 4847: } + -: 4848: + 51: 4849: bool inPack = false; + -: 4850: u8 packedType; + -: 4851: size_t packCount; + 216: 4852: loop(arrayCount) { branch 0 taken 76% branch 1 taken 24% (fallthrough) - -: 4843: char type; - 165: 4844: if (inPack) { + -: 4853: char type; + 165: 4854: if (inPack) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - 30: 4845: type = packedType; - -: 4846: } - -: 4847: else { - 135: 4848: if (ctx->nibble == lowNbl) { + 30: 4855: type = packedType; + -: 4856: } + -: 4857: else { + 135: 4858: if (ctx->nibble == lowNbl) { branch 0 taken 73% (fallthrough) branch 1 taken 27% - 99: 4849: type = (**data) & 0xF; - -: 4850: } - -: 4851: else { - -: 4852: // high nibble - 36: 4853: type = (*ctx->nblAddr) >> 4; - -: 4854: } - -: 4855: } - -: 4856: - 165: 4857: switch(type) { + 99: 4859: type = (**data) & 0xF; + -: 4860: } + -: 4861: else { + -: 4862: // high nibble + 36: 4863: type = (*ctx->nblAddr) >> 4; + -: 4864: } + -: 4865: } + -: 4866: + 165: 4867: switch(type) { branch 0 taken 18% branch 1 taken 22% branch 2 taken 1% @@ -7183,457 +7201,457 @@ branch 13 taken 0% branch 14 taken 3% branch 15 taken 4% branch 16 taken 0% - -: 4858: case S_UNDEFINED: - 29: 4859: if (ctx->nibble == lowNbl) { + -: 4868: case S_UNDEFINED: + 29: 4869: if (ctx->nibble == lowNbl) { branch 0 taken 93% (fallthrough) branch 1 taken 7% - 27: 4860: readTypeOnly; - -: 4861: } - -: 4862: else { - -: 4863: // high nibble - 2: 4864: readTypeInHighNbl; + 27: 4870: readTypeOnly; + -: 4871: } + -: 4872: else { + -: 4873: // high nibble + 2: 4874: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4865: } - 29: 4866: u = allocSUndefined(); + -: 4875: } + 29: 4876: u = allocSUndefined(); call 0 returned 100% - 29: 4867: sArrayPushTiny(array, (smallt *) u); + 29: 4877: sArrayPushTiny(array, (smallt *) u); call 0 returned 100% - 29: 4868: break; - -: 4869: case S_BOOL: - 36: 4870: if (!ctx->boolAddr) { + 29: 4878: break; + -: 4879: case S_BOOL: + 36: 4880: if (!ctx->boolAddr) { branch 0 taken 22% (fallthrough) branch 1 taken 78% - -: 4871: // new packed bools - 8: 4872: if (ctx->nibble == lowNbl) { + -: 4881: // new packed bools + 8: 4882: if (ctx->nibble == lowNbl) { branch 0 taken 63% (fallthrough) branch 1 taken 38% - 5: 4873: read4bPackedBool; - 5: 4874: bo = allocSBool((*ctx->boolAddr) & 0x10); + 5: 4883: read4bPackedBool; + 5: 4884: bo = allocSBool((*ctx->boolAddr) & 0x10); call 0 returned 100% - -: 4875: } - -: 4876: else { - -: 4877: // high nibble - 3: 4878: readTypeInHighNbl; + -: 4885: } + -: 4886: else { + -: 4887: // high nibble + 3: 4888: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 3: 4879: read8bPackedBool; - 3: 4880: bo = allocSBool((*ctx->boolAddr) & 0x1); -call 0 returned 100% - -: 4881: } - -: 4882: } - -: 4883: else { - -: 4884: // there was a bool before this one, read bits in nibbles - 28: 4885: if (ctx->nibble == lowNbl) { + 3: 4889: read8bPackedBool; + 3: 4890: bo = allocSBool((*ctx->boolAddr) & 0x1); +call 0 returned 100% + -: 4891: } + -: 4892: } + -: 4893: else { + -: 4894: // there was a bool before this one, read bits in nibbles + 28: 4895: if (ctx->nibble == lowNbl) { branch 0 taken 61% (fallthrough) branch 1 taken 39% - 17: 4886: if (ctx->boolShift == 8) { + 17: 4896: if (ctx->boolShift == 8) { branch 0 taken 12% (fallthrough) branch 1 taken 88% - 2: 4887: read4bPackedBool; - 2: 4888: bo = allocSBool((*ctx->boolAddr) & 0x10); -call 0 returned 100% - -: 4889: } - -: 4890: else { - 15: 4891: readTypeOnly; - 15: 4892: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); -call 0 returned 100% - -: 4893: } - -: 4894: } - -: 4895: else { - -: 4896: // high nibble - 11: 4897: readTypeInHighNbl; + 2: 4897: read4bPackedBool; + 2: 4898: bo = allocSBool((*ctx->boolAddr) & 0x10); +call 0 returned 100% + -: 4899: } + -: 4900: else { + 15: 4901: readTypeOnly; + 15: 4902: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); +call 0 returned 100% + -: 4903: } + -: 4904: } + -: 4905: else { + -: 4906: // high nibble + 11: 4907: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 11: 4898: if (ctx->boolShift == 8) { + 11: 4908: if (ctx->boolShift == 8) { branch 0 taken 18% (fallthrough) branch 1 taken 82% - 2: 4899: read8bPackedBool; - 2: 4900: bo = allocSBool((*ctx->boolAddr) & 0x1); + 2: 4909: read8bPackedBool; + 2: 4910: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 4901: } - -: 4902: else { - 9: 4903: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 4911: } + -: 4912: else { + 9: 4913: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 4904: } - -: 4905: } - -: 4906: } - 36: 4907: sArrayPushTiny(array, (smallt *) bo); + -: 4914: } + -: 4915: } + -: 4916: } + 36: 4917: sArrayPushTiny(array, (smallt *) bo); call 0 returned 100% - 36: 4908: break; - -: 4909: case S_DICT: - 2: 4910: d = NULL; - 2: 4911: dictNetDeserial(&d, data, ctx, /*packed=*/false); + 36: 4918: break; + -: 4919: case S_DICT: + 2: 4920: d = NULL; + 2: 4921: dictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 2: 4912: sArrayPushTiny(array, (smallt *) d); + 2: 4922: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - 2: 4913: break; - -: 4914: case S_DOUBLE: - 2: 4915: if (ctx->nibble == lowNbl) { + 2: 4923: break; + -: 4924: case S_DOUBLE: + 2: 4925: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4916: readTypeOnly; - -: 4917: } - -: 4918: else { - -: 4919: // high nibble - 1: 4920: readTypeInHighNbl; + 1: 4926: readTypeOnly; + -: 4927: } + -: 4928: else { + -: 4929: // high nibble + 1: 4930: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4921: } - 2: 4922: D = (double *)(*data); - 2: 4923: *data += sizeof(double); - 2: 4924: Do = allocSDouble(*D); + -: 4931: } + 2: 4932: D = (double *)(*data); + 2: 4933: *data += sizeof(double); + 2: 4934: Do = allocSDouble(*D); call 0 returned 100% - 2: 4925: sArrayPushTiny(array, (smallt *) Do); + 2: 4935: sArrayPushTiny(array, (smallt *) Do); call 0 returned 100% - 2: 4926: break; - -: 4927: case S_INT: { - -: 4928: u64 v; - 28: 4929: if (ctx->nibble == lowNbl) { + 2: 4936: break; + -: 4937: case S_INT: { + -: 4938: u64 v; + 28: 4939: if (ctx->nibble == lowNbl) { branch 0 taken 86% (fallthrough) branch 1 taken 14% - 24: 4930: v = netTypeVarintToUint((u8**)data); + 24: 4940: v = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4931: } - -: 4932: else { - -: 4933: // high nibble - 4: 4934: readTypeInHighNbl; + -: 4941: } + -: 4942: else { + -: 4943: // high nibble + 4: 4944: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 4: 4935: v = varintToUint(data); + 4: 4945: v = varintToUint(data); call 0 returned 100% - -: 4936: } - 28: 4937: v = (v >> 1) ^ (~(v & 1) + 1); - 28: 4938: io = allocSInt(v); + -: 4946: } + 28: 4947: v = (v >> 1) ^ (~(v & 1) + 1); + 28: 4948: io = allocSInt(v); call 0 returned 100% - 28: 4939: sArrayPushTiny(array, (smallt *) io); + 28: 4949: sArrayPushTiny(array, (smallt *) io); call 0 returned 100% - -: 4940: } - 28: 4941: break; - -: 4942: case S_STRING: - 13: 4943: if (ctx->nibble == lowNbl) { + -: 4950: } + 28: 4951: break; + -: 4952: case S_STRING: + 13: 4953: if (ctx->nibble == lowNbl) { branch 0 taken 69% (fallthrough) branch 1 taken 31% - 9: 4944: readTypeOnly; - -: 4945: } - -: 4946: else { - -: 4947: // high nibble - 4: 4948: readTypeInHighNbl; + 9: 4954: readTypeOnly; + -: 4955: } + -: 4956: else { + -: 4957: // high nibble + 4: 4958: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - -: 4949: } - 13: 4950: s = (char *)(*data); - 13: 4951: *data += strlen(s)+1; - 13: 4952: so = allocSStringTiny(s); + -: 4959: } + 13: 4960: s = (char *)(*data); + 13: 4961: *data += strlen(s)+1; + 13: 4962: so = allocSStringTiny(s); call 0 returned 100% - 13: 4953: sArrayPushTiny(array, (smallt *) so); + 13: 4963: sArrayPushTiny(array, (smallt *) so); call 0 returned 100% - 13: 4954: break; - -: 4955: case S_ARRAY: - 2: 4956: a = NULL; - 2: 4957: arrayNetDeserial(&a, data, ctx, /*packed=*/false); + 13: 4964: break; + -: 4965: case S_ARRAY: + 2: 4966: a = NULL; + 2: 4967: arrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 2: 4958: sArrayPushTiny(array, (smallt *) a); + 2: 4968: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - 2: 4959: break; - -: 4960: case S_BYTES: - 2: 4961: B = allocSBytes(); + 2: 4969: break; + -: 4970: case S_BYTES: + 2: 4971: B = allocSBytes(); call 0 returned 100% - 2: 4962: if (ctx->nibble == lowNbl) { + 2: 4972: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4963: count = netTypeVarintToUint((u8**)data); + 1: 4973: count = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4964: } - -: 4965: else { - -: 4966: // high nibble - 1: 4967: readTypeInHighNbl; + -: 4974: } + -: 4975: else { + -: 4976: // high nibble + 1: 4977: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4968: count = varintToUint((u8**)data); + 1: 4978: count = varintToUint((u8**)data); call 0 returned 100% - -: 4969: } - 2: 4970: sBytesPushBuffer(&B, *data, count); + -: 4979: } + 2: 4980: sBytesPushBuffer(&B, *data, count); call 0 returned 100% - 2: 4971: *data += count; - 2: 4972: sArrayPushTiny(array, (smallt *) B); + 2: 4981: *data += count; + 2: 4982: sArrayPushTiny(array, (smallt *) B); call 0 returned 100% - 2: 4973: break; - -: 4974: case PK_DICT: - 8: 4975: if (!inPack) { + 2: 4983: break; + -: 4984: case PK_DICT: + 8: 4985: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4976: inPack = true; - 2: 4977: if (ctx->nibble == lowNbl) { + 2: 4986: inPack = true; + 2: 4987: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4978: packCount = netTypeVarintToUint((u8**)data); + 1: 4988: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 4979: } - -: 4980: else { - -: 4981: // high nibble - 1: 4982: readTypeInHighNbl; + -: 4989: } + -: 4990: else { + -: 4991: // high nibble + 1: 4992: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 4983: packCount = varintToUint((u8**)data); + 1: 4993: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 4984: } - 2: 4985: packedType = PK_DICT; - -: 4986: } - -: 4987: - 8: 4988: d = NULL; - 8: 4989: dictNetDeserial(&d, data, ctx, /*packed=*/true); + -: 4994: } + 2: 4995: packedType = PK_DICT; + -: 4996: } + -: 4997: + 8: 4998: d = NULL; + 8: 4999: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 8: 4990: sArrayPushTiny(array, (smallt *) d); + 8: 5000: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - -: 4991: // stop unpacking when packCount == 0 - 8: 4992: packCount--; - 8: 4993: if (!packCount) inPack = false; + -: 5001: // stop unpacking when packCount == 0 + 8: 5002: packCount--; + 8: 5003: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 4994: break; - -: 4995: case PK_DOUBLE: - 8: 4996: if (!inPack) { + 8: 5004: break; + -: 5005: case PK_DOUBLE: + 8: 5006: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 4997: inPack = true; - 2: 4998: if (ctx->nibble == lowNbl) { + 2: 5007: inPack = true; + 2: 5008: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 4999: packCount = netTypeVarintToUint((u8**)data); + 1: 5009: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5000: } - -: 5001: else { - -: 5002: // high nibble - 1: 5003: readTypeInHighNbl; + -: 5010: } + -: 5011: else { + -: 5012: // high nibble + 1: 5013: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5004: packCount = varintToUint((u8**)data); + 1: 5014: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5005: } - 2: 5006: packedType = PK_DOUBLE; - -: 5007: } - -: 5008: - 8: 5009: D = (double *)(*data); - 8: 5010: *data += sizeof(double); - 8: 5011: Do = allocSDouble(*D); + -: 5015: } + 2: 5016: packedType = PK_DOUBLE; + -: 5017: } + -: 5018: + 8: 5019: D = (double *)(*data); + 8: 5020: *data += sizeof(double); + 8: 5021: Do = allocSDouble(*D); call 0 returned 100% - 8: 5012: sArrayPushTiny(array, (smallt *) Do); + 8: 5022: sArrayPushTiny(array, (smallt *) Do); call 0 returned 100% - -: 5013: // stop unpacking when packCount == 0 - 8: 5014: packCount--; - 8: 5015: if (!packCount) inPack = false; + -: 5023: // stop unpacking when packCount == 0 + 8: 5024: packCount--; + 8: 5025: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5016: break; - -: 5017: case PK_INT: - 8: 5018: if (!inPack) { + 8: 5026: break; + -: 5027: case PK_INT: + 8: 5028: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 5019: inPack = true; - 2: 5020: if (ctx->nibble == lowNbl) { + 2: 5029: inPack = true; + 2: 5030: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 5021: packCount = netTypeVarintToUint((u8**)data); + 1: 5031: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5022: } - -: 5023: else { - -: 5024: // high nibble - 1: 5025: readTypeInHighNbl; + -: 5032: } + -: 5033: else { + -: 5034: // high nibble + 1: 5035: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5026: packCount = varintToUint((u8**)data); + 1: 5036: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5027: } - 2: 5028: packedType = PK_INT; - -: 5029: } - -: 5030: - 8: 5031: u64 v = varintToUint(data); + -: 5037: } + 2: 5038: packedType = PK_INT; + -: 5039: } + -: 5040: + 8: 5041: u64 v = varintToUint(data); call 0 returned 100% - 8: 5032: v = (v >> 1) ^ (~(v & 1) + 1); - 8: 5033: io = allocSInt(v); + 8: 5042: v = (v >> 1) ^ (~(v & 1) + 1); + 8: 5043: io = allocSInt(v); call 0 returned 100% - 8: 5034: sArrayPushTiny(array, (smallt *) io); + 8: 5044: sArrayPushTiny(array, (smallt *) io); call 0 returned 100% - -: 5035: // stop unpacking when packCount == 0 - 8: 5036: packCount--; - 8: 5037: if (!packCount) inPack = false; + -: 5045: // stop unpacking when packCount == 0 + 8: 5046: packCount--; + 8: 5047: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5038: break; - -: 5039: case PK_STRING: - 8: 5040: if (!inPack) { + 8: 5048: break; + -: 5049: case PK_STRING: + 8: 5050: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 5041: inPack = true; - 2: 5042: if (ctx->nibble == lowNbl) { + 2: 5051: inPack = true; + 2: 5052: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 5043: packCount = netTypeVarintToUint((u8**)data); + 1: 5053: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5044: } - -: 5045: else { - -: 5046: // high nibble - 1: 5047: readTypeInHighNbl; + -: 5054: } + -: 5055: else { + -: 5056: // high nibble + 1: 5057: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5048: packCount = varintToUint((u8**)data); + 1: 5058: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5049: } - 2: 5050: packedType = PK_STRING; - -: 5051: } - -: 5052: - 8: 5053: s = (char *)(*data); - 8: 5054: *data += strlen(s)+1; - 8: 5055: so = allocSStringTiny(s); + -: 5059: } + 2: 5060: packedType = PK_STRING; + -: 5061: } + -: 5062: + 8: 5063: s = (char *)(*data); + 8: 5064: *data += strlen(s)+1; + 8: 5065: so = allocSStringTiny(s); call 0 returned 100% - 8: 5056: sArrayPushTiny(array, (smallt *) so); + 8: 5066: sArrayPushTiny(array, (smallt *) so); call 0 returned 100% - -: 5057: // stop unpacking when packCount == 0 - 8: 5058: packCount--; - 8: 5059: if (!packCount) inPack = false; + -: 5067: // stop unpacking when packCount == 0 + 8: 5068: packCount--; + 8: 5069: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5060: break; - -: 5061: case PK_ARRAY: - 8: 5062: if (!inPack) { + 8: 5070: break; + -: 5071: case PK_ARRAY: + 8: 5072: if (!inPack) { branch 0 taken 25% (fallthrough) branch 1 taken 75% - 2: 5063: inPack = true; - 2: 5064: if (ctx->nibble == lowNbl) { + 2: 5073: inPack = true; + 2: 5074: if (ctx->nibble == lowNbl) { branch 0 taken 50% (fallthrough) branch 1 taken 50% - 1: 5065: packCount = netTypeVarintToUint((u8**)data); + 1: 5075: packCount = netTypeVarintToUint((u8**)data); call 0 returned 100% - -: 5066: } - -: 5067: else { - -: 5068: // high nibble - 1: 5069: readTypeInHighNbl; + -: 5076: } + -: 5077: else { + -: 5078: // high nibble + 1: 5079: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 1: 5070: packCount = varintToUint((u8**)data); + 1: 5080: packCount = varintToUint((u8**)data); call 0 returned 100% - -: 5071: } - 2: 5072: packedType = PK_ARRAY; - -: 5073: } - -: 5074: - 8: 5075: a = NULL; - 8: 5076: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + -: 5081: } + 2: 5082: packedType = PK_ARRAY; + -: 5083: } + -: 5084: + 8: 5085: a = NULL; + 8: 5086: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 8: 5077: sArrayPushTiny(array, (smallt *) a); + 8: 5087: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - -: 5078: // stop unpacking when packCount == 0 - 8: 5079: packCount--; - 8: 5080: if (!packCount) inPack = false; + -: 5088: // stop unpacking when packCount == 0 + 8: 5089: packCount--; + 8: 5090: if (!packCount) inPack = false; branch 0 taken 25% (fallthrough) branch 1 taken 75% - 8: 5081: break; - -: 5082: case PK_BYTES: - #####: 5083: if (!inPack) { + 8: 5091: break; + -: 5092: case PK_BYTES: + #####: 5093: if (!inPack) { branch 0 never executed branch 1 never executed - #####: 5084: inPack = true; - #####: 5085: if (ctx->nibble == lowNbl) { + #####: 5094: inPack = true; + #####: 5095: if (ctx->nibble == lowNbl) { branch 0 never executed branch 1 never executed - #####: 5086: packCount = netTypeVarintToUint((u8**)data); + #####: 5096: packCount = netTypeVarintToUint((u8**)data); call 0 never executed - -: 5087: } - -: 5088: else { - -: 5089: // high nibble - #####: 5090: readTypeInHighNbl; + -: 5097: } + -: 5098: else { + -: 5099: // high nibble + #####: 5100: readTypeInHighNbl; branch 0 never executed branch 1 never executed - #####: 5091: packCount = varintToUint((u8**)data); + #####: 5101: packCount = varintToUint((u8**)data); call 0 never executed - -: 5092: } - #####: 5093: packedType = PK_BYTES; - -: 5094: } - -: 5095: - #####: 5096: B = allocSBytes(); + -: 5102: } + #####: 5103: packedType = PK_BYTES; + -: 5104: } + -: 5105: + #####: 5106: B = allocSBytes(); call 0 never executed - #####: 5097: count = varintToUint((u8**)data); + #####: 5107: count = varintToUint((u8**)data); call 0 never executed - #####: 5098: sBytesPushBuffer(&B, data, count); + #####: 5108: sBytesPushBuffer(&B, *data, count); call 0 never executed - #####: 5099: *data += count; - #####: 5100: sArrayPushTiny(array, (smallt *) B); + #####: 5109: *data += count; + #####: 5110: sArrayPushTiny(array, (smallt *) B); call 0 never executed - -: 5101: // stop unpacking when packCount == 0 - #####: 5102: packCount--; - #####: 5103: if (!packCount) inPack = false; + -: 5111: // stop unpacking when packCount == 0 + #####: 5112: packCount--; + #####: 5113: if (!packCount) inPack = false; branch 0 never executed branch 1 never executed - #####: 5104: break; - -: 5105: case UNIFORM_DICT: - 5: 5106: d = NULL; - 5: 5107: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); + #####: 5114: break; + -: 5115: case UNIFORM_DICT: + 5: 5116: d = NULL; + 5: 5117: uniformDictNetDeserial(&d, data, ctx, /*packed=*/false); call 0 returned 100% - 5: 5108: sArrayPushTiny(array, (smallt *) d); + 5: 5118: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - 5: 5109: break; - -: 5110: case UNIFORM_ARRAY: - 6: 5111: a = NULL; - 6: 5112: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); + 5: 5119: break; + -: 5120: case UNIFORM_ARRAY: + 6: 5121: a = NULL; + 6: 5122: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/false); call 0 returned 100% - 6: 5113: sArrayPushTiny(array, (smallt *) a); + 6: 5123: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - 6: 5114: break; - -: 5115: } - -: 5116: } - -: 5117:} - -: 5118: + 6: 5124: break; + -: 5125: } + -: 5126: } + -: 5127:} + -: 5128: function uniformArrayNetDeserial called 25 returned 100% blocks executed 99% - 25: 5119:internal void uniformArrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { - 25: 5120: sUndefinedt *u = NULL; - 25: 5121: sBoolt *bo = NULL; - 25: 5122: double *D = NULL; - 25: 5123: sDoublet *Do = NULL; - 25: 5124: sDictt *d = NULL; - 25: 5125: sIntt *io = NULL; - 25: 5126: char *s = NULL; - 25: 5127: sStringt *so = NULL; - 25: 5128: sArrayt *a = NULL; - 25: 5129: sBytest *B = NULL; - -: 5130: uint32_t count; - -: 5131: uint32_t arrayCount; - -: 5132: u8 type; - -: 5133: - 25: 5134: if (packed) { + 25: 5129:internal void uniformArrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) { + 25: 5130: sUndefinedt *u = NULL; + 25: 5131: sBoolt *bo = NULL; + 25: 5132: double *D = NULL; + 25: 5133: sDoublet *Do = NULL; + 25: 5134: sDictt *d = NULL; + 25: 5135: sIntt *io = NULL; + 25: 5136: char *s = NULL; + 25: 5137: sStringt *so = NULL; + 25: 5138: sArrayt *a = NULL; + 25: 5139: sBytest *B = NULL; + -: 5140: uint32_t count; + -: 5141: uint32_t arrayCount; + -: 5142: u8 type; + -: 5143: + 25: 5144: if (packed) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - 2: 5135: type = (**data) & 0xF; - 2: 5136: arrayCount = netTypeVarintToUint(data); + 2: 5145: type = (**data) & 0xF; + 2: 5146: arrayCount = netTypeVarintToUint(data); call 0 returned 100% - -: 5137: } - -: 5138: else { - 23: 5139: if (ctx->nibble == lowNbl) { + -: 5147: } + -: 5148: else { + 23: 5149: if (ctx->nibble == lowNbl) { branch 0 taken 78% (fallthrough) branch 1 taken 22% - 18: 5140: type = (**data) >> 4; - 18: 5141: (*data)++; - 18: 5142: arrayCount = varintToUint(data); + 18: 5150: type = (**data) >> 4; + 18: 5151: (*data)++; + 18: 5152: arrayCount = varintToUint(data); call 0 returned 100% - -: 5143: } - -: 5144: else { - 5: 5145: readTypeInHighNbl; + -: 5153: } + -: 5154: else { + 5: 5155: readTypeInHighNbl; branch 0 taken 0% (fallthrough) branch 1 taken 100% - 5: 5146: type = (**data) & 0xF; - 5: 5147: arrayCount = netTypeVarintToUint(data); + 5: 5156: type = (**data) & 0xF; + 5: 5157: arrayCount = netTypeVarintToUint(data); call 0 returned 100% - -: 5148: } - -: 5149: } - -: 5150: - 25: 5151: if (!arrayCount) { + -: 5158: } + -: 5159: } + -: 5160: + 25: 5161: if (!arrayCount) { branch 0 taken 8% (fallthrough) branch 1 taken 92% - 2: 5152: *array = allocSArray();; + 2: 5162: *array = allocSArray();; call 0 returned 100% - 2: 5153: ret; - -: 5154: } - -: 5155: - 23: 5156: switch(type) { + 27: 5163: ret; + -: 5164: } + -: 5165: + 23: 5166: switch(type) { branch 0 taken 4% branch 1 taken 9% branch 2 taken 4% @@ -7645,176 +7663,176 @@ branch 7 taken 4% branch 8 taken 4% branch 9 taken 4% branch 10 taken 0% - -: 5157: case S_UNDEFINED: - 7: 5158: loop(arrayCount) { + -: 5167: case S_UNDEFINED: + 7: 5168: loop(arrayCount) { branch 0 taken 86% branch 1 taken 14% (fallthrough) - 6: 5159: u = allocSUndefined(); + 6: 5169: u = allocSUndefined(); call 0 returned 100% - 6: 5160: sArrayPushTiny(array, (smallt *) u); + 6: 5170: sArrayPushTiny(array, (smallt *) u); call 0 returned 100% - -: 5161: } - 1: 5162: break; - -: 5163: case S_BOOL: - 16: 5164: loop(arrayCount) { + -: 5171: } + 1: 5172: break; + -: 5173: case S_BOOL: + 16: 5174: loop(arrayCount) { branch 0 taken 88% branch 1 taken 13% (fallthrough) - 14: 5165: if (!ctx->boolAddr) { + 14: 5175: if (!ctx->boolAddr) { branch 0 taken 14% (fallthrough) branch 1 taken 86% - 2: 5166: read8bPackedBool; - 2: 5167: ctx->boolShift = 0; - -: 5168: } - 14: 5169: if (ctx->boolShift == 8) { + 2: 5176: read8bPackedBool; + 2: 5177: ctx->boolShift = 0; + -: 5178: } + 14: 5179: if (ctx->boolShift == 8) { branch 0 taken 7% (fallthrough) branch 1 taken 93% - 1: 5170: read8bPackedBool; - 1: 5171: bo = allocSBool((*ctx->boolAddr) & 0x1); + 1: 5180: read8bPackedBool; + 1: 5181: bo = allocSBool((*ctx->boolAddr) & 0x1); call 0 returned 100% - -: 5172: } - -: 5173: else { - 13: 5174: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); + -: 5182: } + -: 5183: else { + 13: 5184: bo = allocSBool((*ctx->boolAddr) & (0x1 << (ctx->boolShift++))); call 0 returned 100% - -: 5175: } - 14: 5176: sArrayPushTiny(array, (smallt *) bo); + -: 5185: } + 14: 5186: sArrayPushTiny(array, (smallt *) bo); call 0 returned 100% - -: 5177: } - 2: 5178: break; - -: 5179: case S_DICT: - 3: 5180: loop(arrayCount) { + -: 5187: } + 2: 5188: break; + -: 5189: case S_DICT: + 3: 5190: loop(arrayCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 5181: d = NULL; - 2: 5182: dictNetDeserial(&d, data, ctx, /*packed=*/true); + 2: 5191: d = NULL; + 2: 5192: dictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 2: 5183: sArrayPushTiny(array, (smallt *) d); + 2: 5193: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - -: 5184: } - 1: 5185: break; - -: 5186: case S_DOUBLE: - 4: 5187: loop(arrayCount) { + -: 5194: } + 1: 5195: break; + -: 5196: case S_DOUBLE: + 4: 5197: loop(arrayCount) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 5188: D = (double *)(*data); - 3: 5189: *data += sizeof(double); - 3: 5190: Do = allocSDouble(*D); + 3: 5198: D = (double *)(*data); + 3: 5199: *data += sizeof(double); + 3: 5200: Do = allocSDouble(*D); call 0 returned 100% - 3: 5191: sArrayPushTiny(array, (smallt *) Do); + 3: 5201: sArrayPushTiny(array, (smallt *) Do); call 0 returned 100% - -: 5192: } - 1: 5193: break; - -: 5194: case S_INT: - 49: 5195: loop(arrayCount) { + -: 5202: } + 1: 5203: break; + -: 5204: case S_INT: + 49: 5205: loop(arrayCount) { branch 0 taken 78% branch 1 taken 22% (fallthrough) - 38: 5196: u64 v = varintToUint(data); + 38: 5206: u64 v = varintToUint(data); call 0 returned 100% - 38: 5197: v = (v >> 1) ^ (~(v & 1) + 1); - 38: 5198: io = allocSInt(v); + 38: 5207: v = (v >> 1) ^ (~(v & 1) + 1); + 38: 5208: io = allocSInt(v); call 0 returned 100% - 38: 5199: sArrayPushTiny(array, (smallt *) io); + 38: 5209: sArrayPushTiny(array, (smallt *) io); call 0 returned 100% - -: 5200: } - 11: 5201: break; - -: 5202: case S_STRING: - 4: 5203: loop(arrayCount) { + -: 5210: } + 11: 5211: break; + -: 5212: case S_STRING: + 4: 5213: loop(arrayCount) { branch 0 taken 75% branch 1 taken 25% (fallthrough) - 3: 5204: s = (char *)(*data); - 3: 5205: *data += strlen(s)+1; - 3: 5206: so = allocSStringTiny(s); + 3: 5214: s = (char *)(*data); + 3: 5215: *data += strlen(s)+1; + 3: 5216: so = allocSStringTiny(s); call 0 returned 100% - 3: 5207: sArrayPushTiny(array, (smallt *) so); + 3: 5217: sArrayPushTiny(array, (smallt *) so); call 0 returned 100% - -: 5208: } - 1: 5209: break; - -: 5210: case S_ARRAY: - 8: 5211: loop(arrayCount) { + -: 5218: } + 1: 5219: break; + -: 5220: case S_ARRAY: + 8: 5221: loop(arrayCount) { branch 0 taken 63% branch 1 taken 38% (fallthrough) - 5: 5212: a = NULL; - 5: 5213: arrayNetDeserial(&a, data, ctx, /*packed=*/true); + 5: 5222: a = NULL; + 5: 5223: arrayNetDeserial(&a, data, ctx, /*packed=*/true); call 0 returned 100% - 5: 5214: sArrayPushTiny(array, (smallt *) a); + 5: 5224: sArrayPushTiny(array, (smallt *) a); call 0 returned 100% - -: 5215: } - 3: 5216: break; - -: 5217: case S_BYTES: - 3: 5218: loop(arrayCount) { + -: 5225: } + 3: 5226: break; + -: 5227: case S_BYTES: + 3: 5228: loop(arrayCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 5219: B = allocSBytes(); + 2: 5229: B = allocSBytes(); call 0 returned 100% - 2: 5220: count = varintToUint((u8**)data); + 2: 5230: count = varintToUint((u8**)data); call 0 returned 100% - 2: 5221: sBytesPushBuffer(&B, *data, count); + 2: 5231: sBytesPushBuffer(&B, *data, count); call 0 returned 100% - 2: 5222: *data += count; - 2: 5223: sArrayPushTiny(array, (smallt *) B); + 2: 5232: *data += count; + 2: 5233: sArrayPushTiny(array, (smallt *) B); call 0 returned 100% - -: 5224: } - 1: 5225: break; - -: 5226: case UNIFORM_DICT: - 3: 5227: loop(arrayCount) { + -: 5234: } + 1: 5235: break; + -: 5236: case UNIFORM_DICT: + 3: 5237: loop(arrayCount) { branch 0 taken 67% branch 1 taken 33% (fallthrough) - 2: 5228: d = NULL; - 2: 5229: uniformDictNetDeserial(&d, data, ctx, /*packed=*/true); + 2: 5238: d = NULL; + 2: 5239: uniformDictNetDeserial(&d, data, ctx, /*packed=*/true); call 0 returned 100% - 2: 5230: sArrayPushTiny(array, (smallt *) d); + 2: 5240: sArrayPushTiny(array, (smallt *) d); call 0 returned 100% - -: 5231: } - 1: 5232: break; - -: 5233: case UNIFORM_ARRAY: - 2: 5234: loop(arrayCount) { + -: 5241: } + 1: 5242: break; + -: 5243: case UNIFORM_ARRAY: + 2: 5244: loop(arrayCount) { branch 0 taken 50% branch 1 taken 50% (fallthrough) - 1: 5235: a = NULL; - 1: 5236: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/true); -call 0 returned 100% - 1: 5237: sArrayPushTiny(array, (smallt *) a); -call 0 returned 100% - -: 5238: } - 1: 5239: break; - -: 5240: } - -: 5241:} - -: 5242: -function deserialNetSerial called 86 returned 100% blocks executed 91% - 86: 5243:internal smallJsont* deserialNetSerial(smallJsont *self, smallBytest *data) { - -: 5244: - 86: 5245: if (!data or !data->B or !data->B->count) { + 1: 5245: a = NULL; + 1: 5246: uniformArrayNetDeserial(&a, data, ctx, /*packed=*/true); +call 0 returned 100% + 1: 5247: sArrayPushTiny(array, (smallt *) a); +call 0 returned 100% + -: 5248: } + 1: 5249: break; + -: 5250: } + -: 5251:} + -: 5252: +function deserialNetSerial called 87 returned 100% blocks executed 91% + 87: 5253:internal smallJsont* deserialNetSerial(smallJsont *self, smallBytest *data) { + -: 5254: + 87: 5255: if (!data or !data->B or !data->B->count) { branch 0 taken 100% (fallthrough) branch 1 taken 0% branch 2 taken 100% (fallthrough) branch 3 taken 0% branch 4 taken 1% (fallthrough) branch 5 taken 99% - 1: 5246: ret self; - -: 5247: } - -: 5248: - 85: 5249: smallt *o = netDeserial(data->B); + 1: 5256: ret self; + -: 5257: } + -: 5258: + 86: 5259: smallt *o = netDeserial(data->B); call 0 returned 100% - -: 5250: - 85: 5251: if (!o) { + -: 5260: + 86: 5261: if (!o) { branch 0 taken 0% (fallthrough) branch 1 taken 100% - #####: 5252: ret self; - -: 5253: } - -: 5254: - 85: 5255: freeG(self); -call 0 returned 100% - -: 5256: - 85: 5257: setsoG(self, o); -call 0 returned 100% - -: 5258: - 85: 5259: ret self; - -: 5260:} - -: 5261: - -: 5262:// vim: set expandtab ts=2 sw=2: - -: 5263: + #####: 5262: ret self; + -: 5263: } + -: 5264: + 86: 5265: freeG(self); +call 0 returned 100% + -: 5266: + 86: 5267: setsoG(self, o); +call 0 returned 100% + -: 5268: + 86: 5269: ret self; + -: 5270:} + -: 5271: + -: 5272:// vim: set expandtab ts=2 sw=2: + -: 5273: function checkLibsheepyVersionNetSerial called 0 returned 0% blocks executed 0% - #####: 5264:bool checkLibsheepyVersionNetSerial(const char *currentLibsheepyVersion) { - #####: 5265: return eqG(currentLibsheepyVersion, LIBSHEEPY_VERSION); + #####: 5274:bool checkLibsheepyVersionNetSerial(const char *currentLibsheepyVersion) { + #####: 5275: return eqG(currentLibsheepyVersion, LIBSHEEPY_VERSION); call 0 never executed - -: 5266:} - -: 5267: + -: 5276:} + -: 5277: diff --git a/package.yml b/package.yml @@ -1,6 +1,6 @@ --- name: netSerial - version: 0.0.12 + version: 0.0.13 description: network serializer with binary format more compact than the default serializer in smallJson bin: ./netSerial.c repository: diff --git a/test.c b/test.c @@ -100,6 +100,10 @@ int main(int ARGC, char** ARGV) { pushG(&b,'C'); createSmallArray(a); pushG(&a, &b); + delElemG(&a, 0); + /* createSmallDict(a); */ + /* setG(&a, "a", &b); */ + /* delElemG(&a, "a"); */ setTopG(&n, &a); show(); } diff --git a/testNetSerial.c b/testNetSerial.c @@ -758,6 +758,25 @@ START_TEST(dictT) createSmallDict(dd); createSmallArray(a); + // dict with a deleted element (empty with dict->count == 1) + initiateG(&d); + setG(&d, "0", NULL); + delElemG(&d, "0"); + setTopG(&n, &d); + logVarG(&n); + B = serialG(&n); + logI("len %u", lenG(B)); + logSI("%s",toHexSepS(getValG(B), lenG(B), " ")); + s = sToString((smallt *) B->B); + ck_assert_str_eq(s, "[0x0e,0x00]"); + free(s); + deserialG(&ds, B); + s = toStringG(&ds); + ck_assert_str_eq(s, "{}"); + free(s); + terminateG(B); + freeManyG(&n, &ds); + // null and uniform dict initiateG(&d); setG(&d, "0", NULL);