Branch Coverage

src/buffer.c
Criterion Covered Total %
branch 97 162 59.8


line true false branch
31 30 625 if (!len) len = BUFFER_ALLOCSZ;
51 39 201 if (!buffer->alloc) {
64 655 2 if (buffer->alloc > 0) {
105 103 316 if (buffer->offset * 1.0 / buffer->alloc >= BUFFER_COMPACT_PERCENT ) {
130 0 82055 if (len > BUFFER_MAX_CHUNK)
134 2957 79098 if (buffer->offset == buffer->end) {
141 82055 419 if (buffer->end + len <= buffer->alloc) {
148 103 316 if (buffer_compact(buffer))
152 129 187 if (buffer->alloc + len < 4096)
157 0 316 if (newlen > BUFFER_MAX_LEN)
176 0 0 if (buffer->offset == buffer->end) {
181 0 0 if (buffer->end + len < buffer->alloc)
183 0 0 if (buffer_compact(buffer))
185 0 0 if (roundup(buffer->alloc + len, BUFFER_ALLOCSZ) <= BUFFER_MAX_LEN)
203 0 80685 if (len > buffer->end - buffer->offset) {
216 0 1967 if (buffer_get_ret(buffer, buf, len) == -1)
225 0 56358 if (bytes > buffer->end - buffer->offset) {
237 0 56358 if (buffer_consume_ret(buffer, bytes) == -1)
246 0 0 if (bytes > buffer->end - buffer->offset)
256 0 0 if (buffer_consume_end_ret(buffer, bytes) == -1)
324 0 4051 if (buffer_get_ret(buffer, ret, 1) == -1) {
337 0 4051 if (buffer_get_char_ret(&ch, buffer) == -1)
361 0 2091 if (buffer_get_ret(buffer, (char *) buf, 4) == -1)
372 0 2091 if (buffer_get_int_le_ret(&ret, buffer) == -1)
397 0 57219 if (buffer_get_ret(buffer, (char *) buf, 4) == -1)
408 0 57219 if (buffer_get_int_ret(&ret, buffer) == -1)
432 0 114 if (buffer_get_ret(buffer, (char *) buf, 3) == -1)
443 0 114 if (buffer_get_int24_ret(&ret, buffer) == -1)
467 0 8 if (buffer_get_ret(buffer, (char *) buf, 3) == -1)
478 0 8 if (buffer_get_int24_le_ret(&ret, buffer) == -1)
507 0 643 if (buffer_get_ret(buffer, (char *) buf, 8) == -1)
518 0 643 if (buffer_get_int64_le_ret(&ret, buffer) == -1)
547 0 132 if (buffer_get_ret(buffer, (char *) buf, 8) == -1)
558 0 132 if (buffer_get_int64_ret(&ret, buffer) == -1)
581 0 13174 if (buffer_get_ret(buffer, (char *) buf, 2) == -1)
592 0 13174 if (buffer_get_short_le_ret(&ret, buffer) == -1)
615 0 1277 if (buffer_get_ret(buffer, (char *) buf, 2) == -1)
626 0 1277 if (buffer_get_short_ret(&ret, buffer) == -1)
651 0 320 if (!len_hint) return 0;
653 7407 173 for (i = 0; i < len_hint; i++) {
658 147 7260 if (c == 0) {
668 173 147 if ( (utf8->buf + utf8->end - 1)[0] != 0 ) {
691 0 797 if (!len_hint) return 0;
697 48663 313 for (i = 0; i < len_hint; i++) {
700 36690 11973 if (is_utf8) {
705 6642 5331 if (c < 0x80) {
708 5 5326 else if (c < 0xc0) {
718 484 48179 if (c == 0) {
728 313 484 if ( (utf8->buf + utf8->end - 1)[0] != 0 ) {
749 4 705 if (!len) return 0;
751 10879 83 for (i = 0; i < len; i += 2) {
753 10878 1 if (len - i >= 2) {
754 10745 133 wc = (byteorder == UTF16_BYTEORDER_LE)
764 10807 72 if (wc < 0x80) {
767 70 2 else if (wc < 0x800) {
777 622 10257 if (wc == 0) {
784 83 622 if ( (utf8->buf + utf8->end - 1)[0] != 0 ) {
813 0 6 if (buffer_get_ret(buffer, (char *) buf, 4) == -1)
824 0 6 if (buffer_get_float32_le_ret(&ret, buffer) == -1)
842 0 6 if ( !(exponent || mantissa) ) {
0 0 if ( !(exponent || mantissa) ) {
847 6 0 exponent = exponent ? exponent - 127 : 0;
849 6 0 v = mantissa ? ((float)mantissa) / ((float)0x800000) : 0.0;
851 0 6 if (negative) {
855 0 6 if (exponent > 0) {
858 6 0 else if (exponent < 0) {
870 0 3 if (buffer_get_ret(buffer, (char *) buf, 4) == -1)
881 0 3 if (buffer_get_float32_ret(&ret, buffer) == -1)
899 0 3 if ( !(exponent || mantissa) ) {
0 0 if ( !(exponent || mantissa) ) {
904 3 0 exponent = exponent ? exponent - 127 : 0;
906 3 0 v = mantissa ? ((float)mantissa) / ((float)0x800000) : 0.0;
908 0 3 if (negative) {
912 0 3 if (exponent > 0) {
915 3 0 else if (exponent < 0) {
943 0 3 if (expon == 0 && hiMant == 0 && loMant == 0) {
0 0 if (expon == 0 && hiMant == 0 && loMant == 0) {
0 0 if (expon == 0 && hiMant == 0 && loMant == 0) {
947 0 3 if (expon == 0x7FFF) { /* Infinity or NaN */
959 0 3 if (bptr[0] & 0x80)
1004 56 93 while (buffer->ncached < bits) {