| line |
true |
false |
branch |
|
46
|
20 |
382 |
if (ofs < 0) { |
|
48
|
0 |
20 |
if (ofs < 0) |
|
51
|
10 |
372 |
else if (ofs > len) |
|
59
|
1150 |
0 |
SvUPGRADE(name, SVt_PVNV); |
|
106
|
125 |
0 |
return (pagesize < 0)? 4096 : pagesize; |
|
217
|
11224 |
0 |
if ((!obj || !SvOK(obj)) && (flags & SECRET_BUFFER_MAGIC_UNDEF_OK)) |
|
|
0 |
11224 |
if ((!obj || !SvOK(obj)) && (flags & SECRET_BUFFER_MAGIC_UNDEF_OK)) |
|
|
0 |
0 |
if ((!obj || !SvOK(obj)) && (flags & SECRET_BUFFER_MAGIC_UNDEF_OK)) |
|
220
|
1510 |
9714 |
if (!sv_isobject(obj)) { |
|
221
|
0 |
1510 |
if (flags & SECRET_BUFFER_MAGIC_OR_DIE) |
|
226
|
8351 |
1363 |
if (SvMAGICAL(sv) && (magic = mg_findext(sv, PERL_MAGIC_ext, mg_vtbl))) |
|
|
7836 |
515 |
if (SvMAGICAL(sv) && (magic = mg_findext(sv, PERL_MAGIC_ext, mg_vtbl))) |
|
229
|
1363 |
515 |
if (flags & SECRET_BUFFER_MAGIC_AUTOCREATE && auto_ctor) { |
|
|
1363 |
0 |
if (flags & SECRET_BUFFER_MAGIC_AUTOCREATE && auto_ctor) { |
|
237
|
0 |
515 |
if (flags & SECRET_BUFFER_MAGIC_OR_DIE) |
|
261
|
566 |
0 |
if (buf) { |
|
263
|
31 |
535 |
if (buf->stringify_sv) |
|
297
|
64 |
1 |
if (buf->data) { |
|
299
|
0 |
64 |
if (buf->capacity <= buf->len) { |
|
335
|
31 |
23 |
if (!sv) { |
|
355
|
1 |
0 |
if (!sv || !SvOK(sv)) |
|
|
0 |
1 |
if (!sv || !SvOK(sv)) |
|
357
|
1 |
0 |
if (SvIOK(sv)) |
|
359
|
0 |
0 |
if (SvPOK(sv)) { |
|
361
|
0 |
0 |
if (!str[0]) return 0; |
|
362
|
0 |
0 |
if (strcmp(str, "NONBLOCK") == 0) return SECRET_BUFFER_NONBLOCK; |
|
368
|
2 |
0 |
if (!sv || !SvOK(sv)) |
|
|
0 |
2 |
if (!sv || !SvOK(sv)) |
|
370
|
0 |
2 |
if (SvIOK(sv)) |
|
372
|
2 |
0 |
if (SvPOK(sv)) { |
|
374
|
0 |
2 |
if (!str[0]) return 0; |
|
375
|
2 |
0 |
if (strcmp(str, "AT_LEAST") == 0) return SECRET_BUFFER_AT_LEAST; |
|
386
|
0 |
0 |
if (sv && SvIOK(sv)) { |
|
|
0 |
0 |
if (sv && SvIOK(sv)) { |
|
388
|
0 |
0 |
if (val < 1 || val > 3) |
|
|
0 |
0 |
if (val < 1 || val > 3) |
|
391
|
0 |
0 |
} else if (sv && SvOK(sv)) { |
|
|
0 |
0 |
} else if (sv && SvOK(sv)) { |
|
394
|
0 |
0 |
if (strcmp(str, "BASE128LE") == 0) return BASE128LE; |
|
395
|
0 |
0 |
if (strcmp(str, "BASE128BE") == 0) return BASE128BE; |
|
396
|
0 |
0 |
if (strcmp(str, "ASN1_DER_LENGTH") == 0) return ASN1_DER_LENGTH; |
|
442
|
124 |
125 |
while (p < lim) { |
|
444
|
124 |
0 |
while (p < lim && !is_page_accessible(p)) { |
|
|
0 |
124 |
while (p < lim && !is_page_accessible(p)) { |
|
449
|
28639 |
124 |
while (p < lim && is_page_accessible(p)) { |
|
|
28639 |
0 |
while (p < lim && is_page_accessible(p)) { |
|
454
|
131 |
0 |
while (run_start < run_lim && (at= memmem((void*)run_start, run_lim - run_start, needle, needle_len))) { |
|
|
7 |
124 |
while (run_start < run_lim && (at= memmem((void*)run_start, run_lim - run_start, needle, needle_len))) { |
|
483
|
110 |
423 |
if (items - next_arg == 1) { |
|
487
|
0 |
423 |
if ((items - next_arg) & 1) |
|
489
|
5 |
423 |
for (i= next_arg; i < items-1; i += 2) { |
|
495
|
0 |
5 |
PUSHMARK(SP); |
|
496
|
0 |
5 |
EXTEND(SP, 2); |
|
501
|
5 |
0 |
FREETMPS; |
|
515
|
1 |
29 |
secret_buffer_splice_sv(buf, ix? 0 : buf->len, ix? buf->len : 0, source); |
|
|
29 |
1 |
secret_buffer_splice_sv(buf, ix? 0 : buf->len, ix? buf->len : 0, source); |
|
523
|
4 |
67 |
if (val) { /* writing */ |
|
525
|
0 |
4 |
if (ival < 0) ival= 0; |
|
539
|
4 |
4 |
if (val) { /* wiritng */ |
|
541
|
0 |
4 |
if (ival < 0) ival= 0; |
|
542
|
2 |
2 |
if (flags & SECRET_BUFFER_AT_LEAST) |
|
570
|
20 |
9 |
if (ix == 0) { // index (forward) |
|
571
|
7 |
13 |
pos= normalize_offset(SvOK(ofs_sv)? SvIV(ofs_sv) : 0, buf->len); |
|
574
|
4 |
5 |
IV max= normalize_offset(SvOK(ofs_sv)? SvIV(ofs_sv) : -1, buf->len); |
|
579
|
2 |
7 |
if (SvRX(pattern)) |
|
587
|
2 |
7 |
if (lim > buf->len) lim= buf->len; |
|
589
|
0 |
29 |
if (!secret_buffer_parse_init(&parse, buf, pos, lim, 0)) |
|
592
|
24 |
5 |
if (secret_buffer_match(&parse, pattern, flags)) |
|
595
|
0 |
5 |
if (parse.error) |
|
613
|
106 |
0 |
IV len= !SvOK(len_sv)? buf->len : SvIV(len_sv); |
|
615
|
0 |
106 |
if (!secret_buffer_parse_init(&parse, buf, |
|
621
|
82 |
24 |
if (secret_buffer_match(&parse, pattern, flags)) { |
|
625
|
0 |
24 |
else if (parse.error) |
|
652
|
14 |
4 |
IV count= count_sv? SvIV(count_sv) : buf->len; |
|
660
|
11 |
7 |
if (GIMME_V != G_VOID) { |
|
663
|
8 |
3 |
if (count) { |
|
669
|
1 |
10 |
if (el && *el) |
|
|
1 |
0 |
if (el && *el) |
|
674
|
7 |
11 |
if (replacement) |
|
677
|
7 |
11 |
if (!sub_ref) |
|
713
|
3 |
1 |
for (i= 1; i < items; i++) { |
|
721
|
3 |
1 |
for (i= 1; i < items; i++) { |
|
749
|
1252 |
163 |
for (i = 0; i < common_len; i++) |
|
750
|
8 |
1244 |
if (lhs_buf[i] != rhs_buf[i] && !ret) |
|
|
8 |
0 |
if (lhs_buf[i] != rhs_buf[i] && !ret) |
|
751
|
4 |
4 |
ret= lhs_buf[i] < rhs_buf[i]? -1 : 1; |
|
752
|
155 |
8 |
if (ret == 0 && lhs_len != rhs_len) |
|
|
6 |
149 |
if (ret == 0 && lhs_len != rhs_len) |
|
753
|
3 |
3 |
ret= lhs_len < rhs_len? -1 : 1; |
|
756
|
4 |
159 |
if (reverse) |
|
767
|
0 |
2 |
RETVAL= secret_buffer_append_random(buf, count, flags); |
|
780
|
6 |
0 |
ST(0)= (got < 0)? &PL_sv_undef : sv_2mortal(newSViv(got)); |
|
792
|
3 |
1 |
ST(0)= (got < 0)? &PL_sv_undef : sv_2mortal(newSViv(got)); |
|
804
|
5 |
17 |
: got == SECRET_BUFFER_EOF? &PL_sv_no |
|
805
|
3 |
2 |
: &PL_sv_undef; |
|
818
|
4 |
0 |
ST(0)= (wrote < 0)? &PL_sv_undef : sv_2mortal(newSViv(wrote)); |
|
831
|
1 |
2 |
wrote= secret_buffer_write_async(buf, io, ofs, count, GIMME_V == G_VOID? NULL : &ref_out); |
|
834
|
3 |
0 |
ST(0)= wrote? sv_2mortal(newSViv(wrote)) : ref_out? ref_out : &PL_sv_undef; |
|
|
0 |
0 |
ST(0)= wrote? sv_2mortal(newSViv(wrote)) : ref_out? ref_out : &PL_sv_undef; |
|
843
|
43 |
12 |
if (!field || !*field) { |
|
|
0 |
43 |
if (!field || !*field) { |
|
845
|
3 |
40 |
} else if (SvOK(*field)) { |
|
859
|
0 |
7 |
PUSHMARK(SP); |
|
860
|
0 |
7 |
EXTEND(SP, 1); |
|
870
|
0 |
0 |
RETVAL= false; |
|
880
|
0 |
125 |
if (!buf->len) |
|
883
|
0 |
125 |
if (RETVAL < 0) |
|
897
|
0 |
7 |
PUSHMARK(SP); |
|
898
|
7 |
0 |
EXTEND(SP, items); |
|
|
0 |
7 |
EXTEND(SP, items); |
|
899
|
11 |
7 |
for (i= 1; i < items; i++) { |
|
900
|
11 |
0 |
if (SvOK(ST(i)) && SvROK(ST(i)) && (buf= secret_buffer_from_magic(ST(i), 0))) |
|
|
7 |
4 |
if (SvOK(ST(i)) && SvROK(ST(i)) && (buf= secret_buffer_from_magic(ST(i), 0))) |
|
|
7 |
0 |
if (SvOK(ST(i)) && SvROK(ST(i)) && (buf= secret_buffer_from_magic(ST(i), 0))) |
|
929
|
0 |
0 |
if (secret_buffer_async_result_recv(result, (IV)(timeout*1000), &bytes_written, &os_err)) { |
|
930
|
0 |
0 |
EXTEND(sp, 2); |
|
953
|
0 |
22 |
if (items == 2) { |
|
955
|
0 |
0 |
handle= io? IoIFP(io) : NULL; |
|
956
|
22 |
0 |
} else if (items > 2) { |
|
958
|
0 |
22 |
if ((items - 1) & 1) |
|
960
|
66 |
22 |
for (; i < items; i+= 2) { |
|
963
|
22 |
44 |
if (len == 4 && memcmp(name, "echo", 4) == 0) { |
|
|
22 |
0 |
if (len == 4 && memcmp(name, "echo", 4) == 0) { |
|
966
|
22 |
22 |
else if (len == 6 && memcmp(name, "handle", 6) == 0) { |
|
|
22 |
0 |
else if (len == 6 && memcmp(name, "handle", 6) == 0) { |
|
968
|
22 |
0 |
handle= io? IoIFP(io) : NULL; |
|
970
|
0 |
22 |
else if (len == 10 && memcmp(name, "line_input", 10) == 0) { |
|
|
0 |
0 |
else if (len == 10 && memcmp(name, "line_input", 10) == 0) { |
|
973
|
22 |
0 |
else if (len == 12 && memcmp(name, "auto_restore", 12) == 0) { |
|
|
22 |
0 |
else if (len == 12 && memcmp(name, "auto_restore", 12) == 0) { |
|
981
|
0 |
22 |
if (!handle) |
|
986
|
22 |
0 |
if (!sb_console_state_init(aTHX_ &cstate, handle)) { |
|
987
|
0 |
22 |
if (ix == 0) |
|
991
|
0 |
0 |
if (auto_restore) |
|
993
|
0 |
0 |
if (set_echo && SvOK(set_echo)) { |
|
|
0 |
0 |
if (set_echo && SvOK(set_echo)) { |
|
995
|
0 |
0 |
if (sb_console_state_get_echo(&cstate) != enable) { |
|
997
|
0 |
0 |
if (!sb_console_state_set_echo(&cstate, enable)) |
|
1001
|
0 |
0 |
if (set_line_input && SvOK(set_line_input)) { |
|
|
0 |
0 |
if (set_line_input && SvOK(set_line_input)) { |
|
1003
|
0 |
0 |
if (sb_console_state_get_line_input(&cstate) != enable) { |
|
1005
|
0 |
0 |
if (!sb_console_state_set_line_input(&cstate, enable)) |
|
1011
|
0 |
0 |
if (ix == 1 && already_set) |
|
|
0 |
0 |
if (ix == 1 && already_set) |
|
1028
|
0 |
0 |
if (enable != NULL) |
|
1039
|
0 |
0 |
if (enable != NULL) |
|
1050
|
0 |
0 |
if (enable != NULL) |
|
1052
|
0 |
0 |
RETVAL= cstate->auto_restore; |
|
1061
|
0 |
0 |
cstate->auto_restore= false; /* no longer run restore on destructor */ |
|
1077
|
56 |
0 |
SV **buf_field= span && SvTYPE(SvRV(class_or_obj)) == SVt_PVHV |
|
1079
|
56 |
498 |
: NULL; |
|
1080
|
56 |
498 |
secret_buffer *buf= secret_buffer_from_magic( |
|
1083
|
56 |
498 |
bool subspan= span && ix >= 2; |
|
|
8 |
48 |
bool subspan= span && ix >= 2; |
|
1084
|
8 |
546 |
IV base_pos= subspan? span->pos : 0; |
|
1086
|
56 |
498 |
int encoding= span? span->encoding : 0, i; |
|
1092
|
550 |
4 |
if (buf && items >= 2 && looks_like_number(ST(1))) { |
|
|
86 |
464 |
if (buf && items >= 2 && looks_like_number(ST(1))) { |
|
|
29 |
57 |
if (buf && items >= 2 && looks_like_number(ST(1))) { |
|
1095
|
26 |
3 |
if (items >= 3 && SvOK(ST(2))) { |
|
|
26 |
0 |
if (items >= 3 && SvOK(ST(2))) { |
|
1098
|
2 |
24 |
if (items >= 4) { |
|
1100
|
0 |
2 |
if (items > 4) |
|
1105
|
0 |
525 |
if ((items - 1) & 1) |
|
1107
|
84 |
525 |
for (i= 1; i < items-1; i += 2) { |
|
1108
|
22 |
62 |
if (0 == strcmp("pos", SvPV_nolen(ST(i)))) { |
|
1112
|
30 |
32 |
else if (0 == strcmp("lim", SvPV_nolen(ST(i)))) { |
|
1116
|
4 |
28 |
else if (0 == strcmp("len", SvPV_nolen(ST(i)))) { |
|
1120
|
26 |
2 |
else if (0 == strcmp("encoding", SvPV_nolen(ST(i)))) { |
|
1123
|
2 |
0 |
else if (0 == strcmp("buf", SvPV_nolen(ST(i)))) { |
|
1128
|
30 |
524 |
if (have_len && have_lim && (lim != pos + len)) |
|
|
0 |
30 |
if (have_len && have_lim && (lim != pos + len)) |
|
|
0 |
0 |
if (have_len && have_lim && (lim != pos + len)) |
|
1131
|
2 |
552 |
if (!buf) { |
|
1133
|
0 |
2 |
if (ix != 4) |
|
1138
|
8 |
546 |
base_lim= subspan? span->lim : buf->len; |
|
1141
|
51 |
503 |
: span ? span->pos |
|
|
42 |
461 |
: span ? span->pos |
|
1145
|
30 |
524 |
: have_len? normalize_offset(len, base_lim-pos)+pos |
|
|
30 |
494 |
: have_len? normalize_offset(len, base_lim-pos)+pos |
|
|
32 |
462 |
: have_len? normalize_offset(len, base_lim-pos)+pos |
|
1148
|
0 |
554 |
if (pos > lim) |
|
1152
|
28 |
526 |
if (encoding_sv) { |
|
1153
|
0 |
28 |
if (!parse_encoding(aTHX_ encoding_sv, &encoding)) |
|
1167
|
74 |
368 |
if (newval_sv) { |
|
1169
|
0 |
74 |
if (newval < 0) |
|
1173
|
0 |
10 |
case 1: if (newval < span->pos) croak("lim must be >= pos"); |
|
1179
|
319 |
123 |
RETVAL= ix == 0? span->pos |
|
1180
|
181 |
261 |
: ix == 1? span->lim |
|
1181
|
76 |
185 |
: ix == 2? span->lim - span->pos |
|
1182
|
185 |
0 |
: -1; |
|
1193
|
0 |
26 |
if (!encodings) croak("BUG"); |
|
1195
|
15 |
11 |
if (newval_sv) |
|
1196
|
0 |
15 |
if (!parse_encoding(aTHX_ newval_sv, &span->encoding)) |
|
1199
|
26 |
0 |
if (!enc_const || !SvOK(enc_const)) |
|
|
0 |
26 |
if (!enc_const || !SvOK(enc_const)) |
|
1219
|
0 |
3 |
if (!secret_buffer_parse_init_from_sv(&p, self)) |
|
1223
|
3 |
0 |
if (p.lim - p.pos >= 3 && p.pos[0] == 0xEF && p.pos[1] == 0xBB && p.pos[2] == 0xBF) { |
|
|
1 |
2 |
if (p.lim - p.pos >= 3 && p.pos[0] == 0xEF && p.pos[1] == 0xBB && p.pos[2] == 0xBF) { |
|
|
1 |
0 |
if (p.lim - p.pos >= 3 && p.pos[0] == 0xEF && p.pos[1] == 0xBB && p.pos[2] == 0xBF) { |
|
|
1 |
0 |
if (p.lim - p.pos >= 3 && p.pos[0] == 0xEF && p.pos[1] == 0xBB && p.pos[2] == 0xBF) { |
|
1227
|
2 |
0 |
else if (p.lim - p.pos >= 2 && p.pos[0] == 0xFF && p.pos[1] == 0xFE) { |
|
|
1 |
1 |
else if (p.lim - p.pos >= 2 && p.pos[0] == 0xFF && p.pos[1] == 0xFE) { |
|
|
1 |
0 |
else if (p.lim - p.pos >= 2 && p.pos[0] == 0xFF && p.pos[1] == 0xFE) { |
|
1231
|
1 |
0 |
else if (p.lim - p.pos >= 2 && p.pos[0] == 0xFE && p.pos[1] == 0xFF) { |
|
|
1 |
0 |
else if (p.lim - p.pos >= 2 && p.pos[0] == 0xFE && p.pos[1] == 0xFF) { |
|
|
1 |
0 |
else if (p.lim - p.pos >= 2 && p.pos[0] == 0xFE && p.pos[1] == 0xFF) { |
|
1255
|
0 |
572 |
if (!secret_buffer_parse_init(&parse, buf, span->pos, span->lim, span->encoding)) |
|
1258
|
68 |
504 |
if (ix & 1) |
|
1261
|
526 |
46 |
if (ix & 2) |
|
1268
|
470 |
102 |
if (ret_type != 1 && parse.encoding == SECRET_BUFFER_ENCODING_BASE64) |
|
|
0 |
470 |
if (ret_type != 1 && parse.encoding == SECRET_BUFFER_ENCODING_BASE64) |
|
1272
|
14 |
558 |
if (!pattern) { |
|
1273
|
2 |
12 |
if (op == 3 || op == 4 || op == 5) |
|
|
1 |
1 |
if (op == 3 || op == 4 || op == 5) |
|
|
1 |
0 |
if (op == 3 || op == 4 || op == 5) |
|
1275
|
0 |
14 |
if (!pattern) |
|
1280
|
1 |
571 |
if (parse.error) |
|
1284
|
197 |
67 |
if (matched) span->pos= parse.lim - (U8*) buf->data; |
|
1287
|
1 |
0 |
if (matched) span->lim= parse.pos - (U8*) buf->data; |
|
1291
|
39 |
79 |
if (matched) span->pos= parse.lim - (U8*) buf->data; |
|
1292
|
40 |
78 |
if (op == 4) break; |
|
1299
|
19 |
100 |
if (matched) span->lim= parse.pos - (U8*) buf->data; |
|
1304
|
311 |
260 |
if (ret_type == 0) { |
|
1305
|
77 |
234 |
if (!matched) |
|
1307
|
234 |
0 |
if (parse.pos > parse.lim || parse.lim > (U8*) buf->data + buf->len) |
|
|
0 |
234 |
if (parse.pos > parse.lim || parse.lim > (U8*) buf->data + buf->len) |
|
1311
|
101 |
159 |
} else if (ret_type == 1) { |
|
1312
|
63 |
38 |
if (matched) |
|
1331
|
0 |
5 |
if (!secret_buffer_parse_init_from_sv(&p, self)) |
|
1334
|
12 |
2 |
while (count && p.pos < p.lim) { |
|
|
11 |
1 |
while (count && p.pos < p.lim) { |
|
1335
|
0 |
11 |
if (!secret_buffer_parse_uv_base128be(&p, &len)) { |
|
1339
|
2 |
9 |
if (len > p.lim - p.pos) { |
|
1344
|
0 |
9 |
XPUSHs(secret_buffer_span_new_obj(p.sbuf, ofs, ofs + len, 0)); |
|
1346
|
4 |
5 |
if (count > 0) --count; |
|
1363
|
0 |
1152 |
if (!secret_buffer_parse_init_from_sv(&p, self)) |
|
1372
|
1152 |
0 |
if (success) { |
|
1394
|
1 |
101 |
if (!secret_buffer_parse_init_from_sv(&src, self)) |
|
1397
|
89 |
12 |
if (ix > 0) { /* called as 'copy_to' or 'append_to' */ |
|
1398
|
0 |
89 |
if (items < 2) |
|
1409
|
0 |
101 |
if ((items - next_arg) & 1) |
|
1411
|
23 |
101 |
for (; next_arg < items; next_arg+= 2) { |
|
1412
|
23 |
0 |
if (0 == strcmp(SvPV_nolen(ST(next_arg)), "encoding")) { |
|
1413
|
0 |
23 |
if (!parse_encoding(aTHX_ ST(next_arg+1), &dst_encoding)) |
|
1417
|
0 |
101 |
if (!secret_buffer_copy_to(&src, dst_sv, dst_encoding, ix == 2)) |
|
1420
|
12 |
89 |
if (ix == 0) |
|
1430
|
0 |
18 |
if (!secret_buffer_parse_init_from_sv(&lhs_parse, lhs)) |
|
1432
|
0 |
18 |
if (!secret_buffer_parse_init_from_sv(&rhs_parse, rhs)) |
|
1436
|
0 |
18 |
if (reverse) |
|
1472
|
184 |
23 |
for (i= 0; i <= SECRET_BUFFER_ENCODING_MAX; i++) |
|
1473
|
161 |
23 |
if (enc[i] && av_store(encodings, i, enc[i])) |
|
|
161 |
0 |
if (enc[i] && av_store(encodings, i, enc[i])) |