| line |
true |
false |
branch |
|
47
|
20 |
469 |
if (ofs < 0) { |
|
49
|
0 |
20 |
if (ofs < 0) |
|
52
|
10 |
459 |
else if (ofs > len) |
|
60
|
1326 |
0 |
SvUPGRADE(name, SVt_PVNV); |
|
109
|
125 |
0 |
return (pagesize < 0)? 4096 : pagesize; |
|
223
|
12428 |
0 |
if ((!obj || !SvOK(obj)) && (flags & SECRET_BUFFER_MAGIC_UNDEF_OK)) |
|
|
0 |
12428 |
if ((!obj || !SvOK(obj)) && (flags & SECRET_BUFFER_MAGIC_UNDEF_OK)) |
|
|
0 |
0 |
if ((!obj || !SvOK(obj)) && (flags & SECRET_BUFFER_MAGIC_UNDEF_OK)) |
|
226
|
1514 |
10914 |
if (!sv_isobject(obj)) { |
|
227
|
0 |
1514 |
if (flags & SECRET_BUFFER_MAGIC_OR_DIE) |
|
232
|
9317 |
1597 |
if (SvMAGICAL(sv) && (magic = mg_findext(sv, PERL_MAGIC_ext, mg_vtbl))) |
|
|
8772 |
545 |
if (SvMAGICAL(sv) && (magic = mg_findext(sv, PERL_MAGIC_ext, mg_vtbl))) |
|
235
|
1597 |
545 |
if (flags & SECRET_BUFFER_MAGIC_AUTOCREATE && auto_ctor) { |
|
|
1597 |
0 |
if (flags & SECRET_BUFFER_MAGIC_AUTOCREATE && auto_ctor) { |
|
243
|
0 |
545 |
if (flags & SECRET_BUFFER_MAGIC_OR_DIE) |
|
267
|
582 |
0 |
if (buf) { |
|
269
|
44 |
538 |
if (buf->stringify_sv) |
|
303
|
86 |
1 |
if (buf->data) { |
|
305
|
0 |
86 |
if (buf->capacity <= buf->len) { |
|
341
|
44 |
30 |
if (!sv) { |
|
361
|
1 |
0 |
if (!sv || !SvOK(sv)) |
|
|
0 |
1 |
if (!sv || !SvOK(sv)) |
|
363
|
1 |
0 |
if (SvIOK(sv)) |
|
365
|
0 |
0 |
if (SvPOK(sv)) { |
|
367
|
0 |
0 |
if (!str[0]) return 0; |
|
368
|
0 |
0 |
if (strcmp(str, "NONBLOCK") == 0) return SECRET_BUFFER_NONBLOCK; |
|
374
|
2 |
0 |
if (!sv || !SvOK(sv)) |
|
|
0 |
2 |
if (!sv || !SvOK(sv)) |
|
376
|
0 |
2 |
if (SvIOK(sv)) |
|
378
|
2 |
0 |
if (SvPOK(sv)) { |
|
380
|
0 |
2 |
if (!str[0]) return 0; |
|
381
|
2 |
0 |
if (strcmp(str, "AT_LEAST") == 0) return SECRET_BUFFER_AT_LEAST; |
|
392
|
0 |
0 |
if (sv && SvIOK(sv)) { |
|
|
0 |
0 |
if (sv && SvIOK(sv)) { |
|
394
|
0 |
0 |
if (val < 1 || val > 3) |
|
|
0 |
0 |
if (val < 1 || val > 3) |
|
397
|
0 |
0 |
} else if (sv && SvOK(sv)) { |
|
|
0 |
0 |
} else if (sv && SvOK(sv)) { |
|
400
|
0 |
0 |
if (strcmp(str, "BASE128LE") == 0) return BASE128LE; |
|
401
|
0 |
0 |
if (strcmp(str, "BASE128BE") == 0) return BASE128BE; |
|
402
|
0 |
0 |
if (strcmp(str, "ASN1_DER_LENGTH") == 0) return ASN1_DER_LENGTH; |
|
448
|
124 |
125 |
while (p < lim) { |
|
450
|
124 |
0 |
while (p < lim && !is_page_accessible(p)) { |
|
|
0 |
124 |
while (p < lim && !is_page_accessible(p)) { |
|
455
|
28757 |
124 |
while (p < lim && is_page_accessible(p)) { |
|
|
28757 |
0 |
while (p < lim && is_page_accessible(p)) { |
|
460
|
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))) { |
|
489
|
110 |
439 |
if (items - next_arg == 1) { |
|
493
|
0 |
439 |
if ((items - next_arg) & 1) |
|
495
|
5 |
439 |
for (i= next_arg; i < items-1; i += 2) { |
|
501
|
0 |
5 |
PUSHMARK(SP); |
|
502
|
0 |
5 |
EXTEND(SP, 2); |
|
507
|
5 |
0 |
FREETMPS; |
|
521
|
29 |
1 |
size_t from_ofs= (ix? 0 : buf->len), len_sum= 0; |
|
524
|
0 |
30 |
if ((items-1) > 16) { |
|
529
|
30 |
30 |
for (i= 0; i < items-1; i++) { |
|
535
|
30 |
30 |
for (i= 0; i < items-1; i++) { |
|
548
|
8 |
168 |
if (val) { /* writing */ |
|
550
|
0 |
8 |
if (ival < 0) ival= 0; |
|
564
|
4 |
4 |
if (val) { /* wiritng */ |
|
566
|
0 |
4 |
if (ival < 0) ival= 0; |
|
567
|
2 |
2 |
if (flags & SECRET_BUFFER_AT_LEAST) |
|
595
|
79 |
9 |
if (ix == 0) { // index (forward) |
|
596
|
66 |
13 |
pos= normalize_offset(SvOK(ofs_sv)? SvIV(ofs_sv) : 0, buf->len); |
|
599
|
4 |
5 |
IV max= normalize_offset(SvOK(ofs_sv)? SvIV(ofs_sv) : -1, buf->len); |
|
604
|
2 |
7 |
if (SvRX(pattern)) |
|
612
|
2 |
7 |
if (lim > buf->len) lim= buf->len; |
|
614
|
0 |
88 |
if (!secret_buffer_parse_init(&parse, buf, pos, lim, 0)) |
|
617
|
30 |
58 |
if (secret_buffer_match(&parse, pattern, flags)) |
|
620
|
0 |
58 |
if (parse.error) |
|
638
|
106 |
0 |
IV len= !SvOK(len_sv)? buf->len : SvIV(len_sv); |
|
640
|
0 |
106 |
if (!secret_buffer_parse_init(&parse, buf, |
|
646
|
82 |
24 |
if (secret_buffer_match(&parse, pattern, flags)) { |
|
650
|
0 |
24 |
else if (parse.error) |
|
677
|
14 |
4 |
IV count= count_sv? SvIV(count_sv) : buf->len; |
|
685
|
11 |
7 |
if (GIMME_V != G_VOID) { |
|
688
|
8 |
3 |
if (count) { |
|
694
|
1 |
10 |
if (el && *el) |
|
|
1 |
0 |
if (el && *el) |
|
699
|
7 |
11 |
if (replacement) |
|
702
|
7 |
11 |
if (!sub_ref) |
|
738
|
3 |
1 |
for (i= 1; i < items; i++) { |
|
746
|
3 |
1 |
for (i= 1; i < items; i++) { |
|
774
|
1252 |
163 |
for (i = 0; i < common_len; i++) |
|
775
|
8 |
1244 |
if (lhs_buf[i] != rhs_buf[i] && !ret) |
|
|
8 |
0 |
if (lhs_buf[i] != rhs_buf[i] && !ret) |
|
776
|
4 |
4 |
ret= lhs_buf[i] < rhs_buf[i]? -1 : 1; |
|
777
|
155 |
8 |
if (ret == 0 && lhs_len != rhs_len) |
|
|
6 |
149 |
if (ret == 0 && lhs_len != rhs_len) |
|
778
|
3 |
3 |
ret= lhs_len < rhs_len? -1 : 1; |
|
781
|
4 |
159 |
if (reverse) |
|
792
|
0 |
2 |
RETVAL= secret_buffer_append_random(buf, count, flags); |
|
805
|
0 |
12 |
if (got < 0) |
|
819
|
1 |
59 |
if (got < 0) |
|
833
|
9 |
31 |
: got == SECRET_BUFFER_EOF? &PL_sv_no |
|
834
|
5 |
4 |
: &PL_sv_undef; |
|
847
|
4 |
0 |
ST(0)= (wrote < 0)? &PL_sv_undef : sv_2mortal(newSViv(wrote)); |
|
860
|
1 |
2 |
wrote= secret_buffer_write_async(buf, io, ofs, count, GIMME_V == G_VOID? NULL : &ref_out); |
|
863
|
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; |
|
872
|
61 |
12 |
if (!field || !*field) { |
|
|
0 |
61 |
if (!field || !*field) { |
|
874
|
3 |
58 |
} else if (SvOK(*field)) { |
|
888
|
0 |
9 |
PUSHMARK(SP); |
|
889
|
0 |
9 |
EXTEND(SP, 1); |
|
899
|
0 |
0 |
RETVAL= false; |
|
909
|
0 |
125 |
if (!buf->len) |
|
912
|
0 |
125 |
if (RETVAL < 0) |
|
926
|
0 |
7 |
PUSHMARK(SP); |
|
927
|
7 |
0 |
EXTEND(SP, items); |
|
|
0 |
7 |
EXTEND(SP, items); |
|
928
|
11 |
7 |
for (i= 1; i < items; i++) { |
|
929
|
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))) |
|
967
|
0 |
0 |
if (secret_buffer_async_result_recv(result, (IV)(timeout*1000), &bytes_written, &os_err)) { |
|
968
|
0 |
0 |
EXTEND(sp, 2); |
|
991
|
0 |
47 |
if (items == 2) { |
|
993
|
0 |
0 |
handle= io? IoIFP(io) : NULL; |
|
994
|
47 |
0 |
} else if (items > 2) { |
|
996
|
0 |
47 |
if ((items - 1) & 1) |
|
998
|
47 |
47 |
for (; i < items; i+= 2) { |
|
1002
|
0 |
47 |
if (len == 4 && memcmp(name, "echo", 4) == 0) { |
|
|
0 |
0 |
if (len == 4 && memcmp(name, "echo", 4) == 0) { |
|
1003
|
0 |
0 |
if (SvOK(val)) set_echo= val; |
|
1005
|
47 |
0 |
else if (len == 6 && memcmp(name, "handle", 6) == 0) { |
|
|
47 |
0 |
else if (len == 6 && memcmp(name, "handle", 6) == 0) { |
|
1007
|
47 |
0 |
handle= io? IoIFP(io) : NULL; |
|
1009
|
0 |
0 |
else if (len == 10 && memcmp(name, "line_input", 10) == 0) { |
|
|
0 |
0 |
else if (len == 10 && memcmp(name, "line_input", 10) == 0) { |
|
1010
|
0 |
0 |
if (SvOK(val)) set_line_input= val; |
|
1012
|
0 |
0 |
else if (len == 12 && memcmp(name, "auto_restore", 12) == 0) { |
|
|
0 |
0 |
else if (len == 12 && memcmp(name, "auto_restore", 12) == 0) { |
|
1013
|
0 |
0 |
if (SvOK(val)) auto_restore= val; |
|
1020
|
0 |
47 |
if (!handle) |
|
1025
|
47 |
0 |
if (!sb_console_state_init(aTHX_ &cstate, handle)) { |
|
1026
|
0 |
47 |
if (ix == 0) |
|
1030
|
0 |
0 |
if (auto_restore) |
|
1032
|
0 |
0 |
if (set_echo) { |
|
1034
|
0 |
0 |
if (sb_console_state_get_echo(&cstate) != enable) { |
|
1036
|
0 |
0 |
if (!sb_console_state_set_echo(&cstate, enable)) |
|
1040
|
0 |
0 |
if (set_line_input) { |
|
1042
|
0 |
0 |
if (sb_console_state_get_line_input(&cstate) != enable) { |
|
1044
|
0 |
0 |
if (!sb_console_state_set_line_input(&cstate, enable)) |
|
1050
|
0 |
0 |
if (ix == 1 && (set_echo || set_line_input) && already_set) |
|
|
0 |
0 |
if (ix == 1 && (set_echo || set_line_input) && already_set) |
|
|
0 |
0 |
if (ix == 1 && (set_echo || set_line_input) && already_set) |
|
|
0 |
0 |
if (ix == 1 && (set_echo || set_line_input) && already_set) |
|
1067
|
0 |
0 |
if (enable != NULL) |
|
1078
|
0 |
0 |
if (enable != NULL) |
|
1089
|
0 |
0 |
if (enable != NULL) |
|
1091
|
0 |
0 |
RETVAL= cstate->auto_restore; |
|
1100
|
0 |
0 |
cstate->auto_restore= false; /* no longer run restore on destructor */ |
|
1121
|
0 |
0 |
RETVAL= false; |
|
1138
|
56 |
0 |
SV **buf_field= span && SvTYPE(SvRV(class_or_obj)) == SVt_PVHV |
|
1140
|
56 |
528 |
: NULL; |
|
1141
|
56 |
528 |
secret_buffer *buf= secret_buffer_from_magic( |
|
1144
|
56 |
528 |
bool subspan= span && ix >= 2; |
|
|
8 |
48 |
bool subspan= span && ix >= 2; |
|
1145
|
8 |
576 |
IV base_pos= subspan? span->pos : 0; |
|
1147
|
56 |
528 |
int encoding= span? span->encoding : 0, i; |
|
1153
|
580 |
4 |
if (buf && items >= 2 && looks_like_number(ST(1))) { |
|
|
116 |
464 |
if (buf && items >= 2 && looks_like_number(ST(1))) { |
|
|
29 |
87 |
if (buf && items >= 2 && looks_like_number(ST(1))) { |
|
1156
|
26 |
3 |
if (items >= 3 && SvOK(ST(2))) { |
|
|
26 |
0 |
if (items >= 3 && SvOK(ST(2))) { |
|
1159
|
2 |
24 |
if (items >= 4) { |
|
1161
|
0 |
2 |
if (items > 4) |
|
1166
|
0 |
555 |
if ((items - 1) & 1) |
|
1168
|
142 |
555 |
for (i= 1; i < items-1; i += 2) { |
|
1169
|
50 |
92 |
if (0 == strcmp("pos", SvPV_nolen(ST(i)))) { |
|
1173
|
30 |
62 |
else if (0 == strcmp("lim", SvPV_nolen(ST(i)))) { |
|
1177
|
4 |
58 |
else if (0 == strcmp("len", SvPV_nolen(ST(i)))) { |
|
1181
|
56 |
2 |
else if (0 == strcmp("encoding", SvPV_nolen(ST(i)))) { |
|
1184
|
2 |
0 |
else if (0 == strcmp("buf", SvPV_nolen(ST(i)))) { |
|
1189
|
30 |
554 |
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)) |
|
1192
|
2 |
582 |
if (!buf) { |
|
1194
|
0 |
2 |
if (ix != 4) |
|
1199
|
8 |
576 |
base_lim= subspan? span->lim : buf->len; |
|
1202
|
79 |
505 |
: span ? span->pos |
|
|
42 |
463 |
: span ? span->pos |
|
1206
|
30 |
554 |
: have_len? normalize_offset(len, base_lim-pos)+pos |
|
|
30 |
524 |
: have_len? normalize_offset(len, base_lim-pos)+pos |
|
|
32 |
492 |
: have_len? normalize_offset(len, base_lim-pos)+pos |
|
1209
|
0 |
584 |
if (pos > lim) |
|
1213
|
58 |
526 |
if (encoding_sv) { |
|
1214
|
0 |
58 |
if (!parse_encoding(aTHX_ encoding_sv, &encoding)) |
|
1228
|
74 |
590 |
if (newval_sv) { |
|
1230
|
0 |
74 |
if (newval < 0) |
|
1234
|
0 |
10 |
case 1: if (newval < span->pos) croak("lim must be >= pos"); |
|
1240
|
537 |
127 |
RETVAL= ix == 0? span->pos |
|
1241
|
181 |
483 |
: ix == 1? span->lim |
|
1242
|
76 |
407 |
: ix == 2? span->lim - span->pos |
|
1243
|
407 |
0 |
: -1; |
|
1254
|
0 |
32 |
if (!encodings) croak("BUG"); |
|
1256
|
21 |
11 |
if (newval_sv) |
|
1257
|
0 |
21 |
if (!parse_encoding(aTHX_ newval_sv, &span->encoding)) |
|
1260
|
32 |
0 |
if (!enc_const || !SvOK(enc_const)) |
|
|
0 |
32 |
if (!enc_const || !SvOK(enc_const)) |
|
1280
|
0 |
3 |
if (!secret_buffer_parse_init_from_sv(&p, self)) |
|
1284
|
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) { |
|
1288
|
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) { |
|
1292
|
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) { |
|
1316
|
0 |
776 |
if (!secret_buffer_parse_init(&parse, buf, span->pos, span->lim, span->encoding)) |
|
1319
|
68 |
708 |
if (ix & 1) |
|
1322
|
730 |
46 |
if (ix & 2) |
|
1329
|
664 |
112 |
if (ret_type != 1 && parse.encoding == SECRET_BUFFER_ENCODING_BASE64) |
|
|
0 |
664 |
if (ret_type != 1 && parse.encoding == SECRET_BUFFER_ENCODING_BASE64) |
|
1333
|
14 |
762 |
if (!pattern) { |
|
1334
|
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) |
|
1336
|
0 |
14 |
if (!pattern) |
|
1341
|
7 |
769 |
if (parse.error) |
|
1345
|
385 |
67 |
if (matched) span->pos= parse.lim - (U8*) buf->data; |
|
1348
|
1 |
0 |
if (matched) span->lim= parse.pos - (U8*) buf->data; |
|
1352
|
39 |
79 |
if (matched) span->pos= parse.lim - (U8*) buf->data; |
|
1353
|
40 |
78 |
if (op == 4) break; |
|
1360
|
19 |
100 |
if (matched) span->lim= parse.pos - (U8*) buf->data; |
|
1365
|
499 |
270 |
if (ret_type == 0) { |
|
1366
|
77 |
422 |
if (!matched) |
|
1368
|
422 |
0 |
if (parse.pos > parse.lim || parse.lim > (U8*) buf->data + buf->len) |
|
|
0 |
422 |
if (parse.pos > parse.lim || parse.lim > (U8*) buf->data + buf->len) |
|
1372
|
111 |
159 |
} else if (ret_type == 1) { |
|
1373
|
69 |
42 |
if (matched) |
|
1392
|
0 |
5 |
if (!secret_buffer_parse_init_from_sv(&p, self)) |
|
1395
|
12 |
2 |
while (count && p.pos < p.lim) { |
|
|
11 |
1 |
while (count && p.pos < p.lim) { |
|
1396
|
0 |
11 |
if (!secret_buffer_parse_uv_base128be(&p, &len)) { |
|
1400
|
2 |
9 |
if (len > p.lim - p.pos) { |
|
1405
|
0 |
9 |
XPUSHs(secret_buffer_span_new_obj(p.sbuf, ofs, ofs + len, 0)); |
|
1407
|
4 |
5 |
if (count > 0) --count; |
|
1424
|
0 |
1152 |
if (!secret_buffer_parse_init_from_sv(&p, self)) |
|
1433
|
1152 |
0 |
if (success) { |
|
1455
|
1 |
101 |
if (!secret_buffer_parse_init_from_sv(&src, self)) |
|
1458
|
89 |
12 |
if (ix > 0) { /* called as 'copy_to' or 'append_to' */ |
|
1459
|
0 |
89 |
if (items < 2) |
|
1470
|
0 |
101 |
if ((items - next_arg) & 1) |
|
1472
|
23 |
101 |
for (; next_arg < items; next_arg+= 2) { |
|
1473
|
23 |
0 |
if (0 == strcmp(SvPV_nolen(ST(next_arg)), "encoding")) { |
|
1474
|
0 |
23 |
if (!parse_encoding(aTHX_ ST(next_arg+1), &dst_encoding)) |
|
1478
|
0 |
101 |
if (!secret_buffer_copy_to(&src, dst_sv, dst_encoding, ix == 2)) |
|
1481
|
12 |
89 |
if (ix == 0) |
|
1491
|
0 |
20 |
if (!secret_buffer_parse_init_from_sv(&lhs_parse, lhs)) |
|
1493
|
0 |
20 |
if (!secret_buffer_parse_init_from_sv(&rhs_parse, rhs)) |
|
1497
|
0 |
20 |
if (reverse) |
|
1533
|
208 |
26 |
for (i= 0; i <= SECRET_BUFFER_ENCODING_MAX; i++) |
|
1534
|
182 |
26 |
if (enc[i] && av_store(encodings, i, enc[i])) |
|
|
182 |
0 |
if (enc[i] && av_store(encodings, i, enc[i])) |