Branch Coverage

c/pgtypes.c
Criterion Covered Total %
branch 0 422 0.0


line true false branch
80 0 0 RLEN(1);
81 0 0 return *buf ? newSV_true() : newSV_false();
86 0 0 if (r < 0) {
89 0 0 if (l == 0 || (l == 1 && (*x == '0' || *x == 'f'))) r = 0;
0 0 if (l == 0 || (l == 1 && (*x == '0' || *x == 'f'))) r = 0;
0 0 if (l == 0 || (l == 1 && (*x == '0' || *x == 'f'))) r = 0;
0 0 if (l == 0 || (l == 1 && (*x == '0' || *x == 'f'))) r = 0;
90 0 0 else if (l == 1 && (*x == '1' || *x == 't')) r = 1;
0 0 else if (l == 1 && (*x == '1' || *x == 't')) r = 1;
0 0 else if (l == 1 && (*x == '1' || *x == 't')) r = 1;
97 0 0 RLEN(0);
107 0 0 RLEN(2);
112 0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
0 0 SIV(-32768, 32767);
117 0 0 RLEN(4);
122 0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
0 0 SIV(-2147483648, 2147483647);
127 0 0 RLEN(8);
132 0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
0 0 SIV(IV_MIN, IV_MAX);
137 0 0 RLEN(4);
142 0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
0 0 SIV(0, UINT32_MAX);
147 0 0 RLEN(8);
167 0 0 SV *r = newSV(len ? len * 2 : 1);
172 0 0 for (i=0; i
185 0 0 if (len % 2) SERR("Invalid hex string");
186 0 0 while (in < end) {
188 0 0 if (v > 0xff) SERR("Invalid hex string");
195 0 0 RLEN(1);
202 0 0 if (len != 1) SERR("expected 1-byte string");
208 0 0 if (!is_c9strict_utf8_string((const U8*)buf, len)) RERR("invalid UTF-8");
219 0 0 RLEN(4);
224 0 0 if (!looks_like_number(val)) SERR("expected a number");
229 0 0 RLEN(8);
234 0 0 if (!looks_like_number(val)) SERR("expected a number");
245 0 0 if (sv == NULL) RERR("invalid JSON");
246 0 0 if (json.buf != json.end) RERR("trailing garbage");
256 0 0 if (len <= 1 || *buf != 1) RERR("invalid JSONB");
0 0 if (len <= 1 || *buf != 1) RERR("invalid JSONB");
266 0 0 if (len <= 1 || *buf != 1) RERR("invalid jsonpath");
0 0 if (len <= 1 || *buf != 1) RERR("invalid jsonpath");
280 0 0 if (dim == ndim) {
281 0 0 if (end - *buf < 4) fu_confess("Invalid array format");
285 0 0 if (end - *buf < len) fu_confess("Invalid array format");
286 0 0 if (len >= 0) {
298 0 0 for (i=0; i
306 0 0 if (len < 12) RERR("input data too short");
310 0 0 if (elemtype != ctx->arrayelem->oid) RERR("invalid element type, expected %u but got %u", ctx->arrayelem->oid, elemtype);
312 0 0 if (ndim == 0) return newRV_noinc((SV *)newAV());
313 0 0 if (ndim > ARRAY_MAXDIM) RERR("too many dimensions");
314 0 0 if ((U32)len < 12 + ndim*8) RERR("input data too short");
323 0 0 if (dim == ndim) {
324 0 0 if (!SvOK(v)) {
329 0 0 size_t lenoff = fustr_len(out);
332 0 0 fu_tobeU(32, fustr_start(out) + lenoff, fustr_len(out) - lenoff - 4);
0 0 fu_tobeU(32, fustr_start(out) + lenoff, fustr_len(out) - lenoff - 4);
336 0 0 if (!SvROK(v)) fu_confess("Invalid array structure in bind parameter");
339 0 0 if (SvTYPE(v) != SVt_PVAV) fu_confess("Invalid array structure in bind parameter");
341 0 0 if (av_count(av) != dims[dim]) fu_confess("Invalid array structure in bind parameter");
343 0 0 for (i=0; i
345 0 0 if (!sv || !*sv) fu_confess("Invalid array structure in bind parameter");
0 0 if (!sv || !*sv) fu_confess("Invalid array structure in bind parameter");
362 0 0 if (!SvROK(v)) break;
365 0 0 if (SvTYPE(v) != SVt_PVAV) break;
366 0 0 if (ndim >= ARRAY_MAXDIM) SERR("too many dimensions");
368 0 0 if (ndim > 0 && dims[ndim] == 0) SERR("nested arrays may not be empty");
0 0 if (ndim > 0 && dims[ndim] == 0) SERR("nested arrays may not be empty");
371 0 0 if (!sv || !*sv) break;
0 0 if (!sv || !*sv) break;
374 0 0 if (ndim == 0) SERR("expected an array");
375 0 0 if (dims[0] == 0) ndim = 0;
380 0 0 size_t hasnull_off = fustr_len(out) - 1;
383 0 0 for (i=0; i
387 0 0 if (ctx->oid == 22 || ctx->oid == 30) fustr_write(out, "\0\0\0\0", 4);
0 0 if (ctx->oid == 22 || ctx->oid == 30) fustr_write(out, "\0\0\0\0", 4);
390 0 0 if (ndim == 0) return;
395 0 0 if (hasnull) fustr_start(out)[hasnull_off] = 1;
0 0 if (hasnull) fustr_start(out)[hasnull_off] = 1;
402 0 0 if (len < 4) RERR("input data too short");
404 0 0 if (nfields != ctx->record.info->nattrs) RERR("expected %d fields but got %d", ctx->record.info->nattrs, nfields);
409 0 0 for (i=0; i
410 0 0 if (len < 8) RERR("input data too short");
412 0 0 if (oid != ctx->record.info->attrs[i].oid)
417 0 0 if (vlen > len) RERR("input data too short");
418 0 0 if (vlen >= 0) {
430 0 0 if (!SvROK(val)) SERR("expected a hashref");
433 0 0 if (SvTYPE(sv) != SVt_PVHV) SERR("expected a hashref");
438 0 0 for (i=0; irecord.info->nattrs; i++) {
441 0 0 if (!rsv || !*rsv) {
0 0 if (!rsv || !*rsv) {
447 0 0 if (!SvOK(sv)) {
451 0 0 size_t lenoff = fustr_len(out);
454 0 0 fu_tobeU(32, fustr_start(out) + lenoff, fustr_len(out) - lenoff - 4);
0 0 fu_tobeU(32, fustr_start(out) + lenoff, fustr_len(out) - lenoff - 4);
465 0 0 PUSHMARK(SP);
466 0 0 mXPUSHs(newSVpvn(buf, len));
475 0 0 FREETMPS;
486 0 0 PUSHMARK(SP);
487 0 0 XPUSHs(val);
500 0 0 FREETMPS;
507 0 0 if (len < 8) RERR("input data too short");
510 0 0 if (buf[0] == 2) { /* INET */
511 0 0 RLEN(8);
512 0 0 if (!inet_ntop(AF_INET, buf+4, tmp, sizeof(tmp)-1)) RERR("%s", strerror(errno));
513 0 0 } else if (buf[0] == 3) { /* INET6 */
514 0 0 RLEN(20);
515 0 0 if (!inet_ntop(AF_INET6, buf+4, tmp, sizeof(tmp)-1)) RERR("%s", strerror(errno));
518 0 0 if (buf[2] || buf[1] != (buf[0] == 2 ? 32 : (char)128))
0 0 if (buf[2] || buf[1] != (buf[0] == 2 ? 32 : (char)128))
0 0 if (buf[2] || buf[1] != (buf[0] == 2 ? 32 : (char)128))
527 0 0 if (len >= sizeof(tmp)) SERR("input too long");
528 0 0 char family = strchr(in, ':') ? 3 : 2;
529 0 0 char *wr = fustr_write_buf(out, family == 2 ? 8 : 20);
532 0 0 *mask = family == 2 ? 32 : 128;
534 0 0 wr[3] = family == 2 ? 4 : 16;
537 0 0 if (slash && slash - in < 100) {
0 0 if (slash && slash - in < 100) {
542 0 0 if (inet_pton(family == 2 ? AF_INET : AF_INET6, in, wr+4) != 1)
0 0 if (inet_pton(family == 2 ? AF_INET : AF_INET6, in, wr+4) != 1)
545 0 0 if (slash) {
547 0 0 if (!grok_atoUV(slash+1, &uv, NULL) || uv > *mask)
0 0 if (!grok_atoUV(slash+1, &uv, NULL) || uv > *mask)
554 0 0 RLEN(16);
559 0 0 for (i=0; i<16; i++) {
560 0 0 if (i == 4 || i == 6 || i == 8 || i == 10) *out++ = '-';
0 0 if (i == 4 || i == 6 || i == 8 || i == 10) *out++ = '-';
0 0 if (i == 4 || i == 6 || i == 8 || i == 10) *out++ = '-';
0 0 if (i == 4 || i == 6 || i == 8 || i == 10) *out++ = '-';
572 0 0 if (*in == '{') in++;
573 0 0 for (; *in; in++) {
574 0 0 if (*in == '}') break;
575 0 0 if (dig == 0x10 && *in == '-') continue;
0 0 if (dig == 0x10 && *in == '-') continue;
577 0 0 if (x > 0x10) SERR("invalid UUID");
578 0 0 if (bytes >= 16) SERR("invalid UUID");
579 0 0 if (dig == 0x10) dig = x;
586 0 0 if (dig != 0x10 || bytes != 16) SERR("invalid UUID");
0 0 if (dig != 0x10 || bytes != 16) SERR("invalid UUID");
593 0 0 RLEN(8);
598 0 0 if (!looks_like_number(val)) SERR("expected a number");
604 0 0 RLEN(4);
609 0 0 if (!looks_like_number(val)) SERR("expected a number");
614 0 0 RLEN(4);
623 0 0 if (sscanf(SvPV_nolen(val), "%4d-%2d-%2d", &year, &month, &day) != 3) SERR("invalid date format");
626 0 0 if (month > 2) {
644 0 0 RLEN(8);
649 0 0 if (!looks_like_number(val)) SERR("expected a number");
661 0 0 if (**str >= 'a' && **str <= 'z') {
0 0 if (**str >= 'a' && **str <= 'z') {
664 0 0 if (**str >= 'a' && **str <= 'z') {
0 0 if (**str >= 'a' && **str <= 'z') {
667 0 0 if (**str >= 'a' && **str <= 'z') {
0 0 if (**str >= 'a' && **str <= 'z') {
684 0 0 RLEN(2);
695 0 0 if (*t) SERR("Invalid vndbtag: '%s'", SvPV_nolen(val));
703 0 0 RLEN(8);
714 0 0 if (!grok_atoUV(str, &num, NULL) || num > VNDBID2_MAXNUM) SERR("invalid vndbid '%s'", ostr);
0 0 if (!grok_atoUV(str, &num, NULL) || num > VNDBID2_MAXNUM) SERR("invalid vndbid '%s'", ostr);
936 0 0 while (b <= e) {
938 0 0 if (list[i].oid == oid) return list+i;
939 0 0 if (list[i].oid < oid) b = i+1;
951 0 0 for (i=0; i
952 0 0 if (strcmp(fupg_dynoid[i].name.n, name) == 0)
960 0 0 if (r) return r;
964 0 0 for (i=0; i
965 0 0 if (strcmp(fupg_specials[i].name.n, name) == 0)
968 0 0 for (i=0; i
969 0 0 if (strcmp(fupg_builtin[i].name.n, name) == 0)