… | |
… | |
194 | INLINE void |
194 | INLINE void |
195 | need (enc_t *enc, STRLEN len) |
195 | need (enc_t *enc, STRLEN len) |
196 | { |
196 | { |
197 | if (expect_false (enc->cur + len >= enc->end)) |
197 | if (expect_false (enc->cur + len >= enc->end)) |
198 | { |
198 | { |
199 | STRLEN cur = enc->cur - SvPVX (enc->sv); |
199 | STRLEN cur = enc->cur - (char *)SvPVX (enc->sv); |
200 | SvGROW (enc->sv, cur + len + 1); |
200 | SvGROW (enc->sv, cur + len + 1); |
201 | enc->cur = SvPVX (enc->sv) + cur; |
201 | enc->cur = SvPVX (enc->sv) + cur; |
202 | enc->end = SvPVX (enc->sv) + SvLEN (enc->sv) - 1; |
202 | enc->end = SvPVX (enc->sv) + SvLEN (enc->sv) - 1; |
203 | } |
203 | } |
204 | } |
204 | } |
… | |
… | |
460 | |
460 | |
461 | encode_ch (enc, '{'); |
461 | encode_ch (enc, '{'); |
462 | |
462 | |
463 | // for canonical output we have to sort by keys first |
463 | // for canonical output we have to sort by keys first |
464 | // actually, this is mostly due to the stupid so-called |
464 | // actually, this is mostly due to the stupid so-called |
465 | // security workaround added somewhere in 5.8.x. |
465 | // security workaround added somewhere in 5.8.x |
466 | // that randomises hash orderings |
466 | // that randomises hash orderings |
467 | if (enc->json.flags & F_CANONICAL) |
467 | if (enc->json.flags & F_CANONICAL) |
468 | { |
468 | { |
469 | int count = hv_iterinit (hv); |
469 | int count = hv_iterinit (hv); |
470 | |
470 | |
… | |
… | |
1410 | { |
1410 | { |
1411 | dec_t dec; |
1411 | dec_t dec; |
1412 | STRLEN offset; |
1412 | STRLEN offset; |
1413 | SV *sv; |
1413 | SV *sv; |
1414 | |
1414 | |
|
|
1415 | /* work around bugs in 5.10 where manipulating magic values |
|
|
1416 | * will perl ignore the magic in subsequent accesses |
|
|
1417 | */ |
1415 | SvGETMAGIC (string); |
1418 | /*SvGETMAGIC (string);*/ |
|
|
1419 | if (SvMAGICAL (string)) |
|
|
1420 | string = sv_2mortal (newSVsv (string)); |
|
|
1421 | |
1416 | SvUPGRADE (string, SVt_PV); |
1422 | SvUPGRADE (string, SVt_PV); |
1417 | |
1423 | |
1418 | /* work around a bug in perl 5.10, which causes SvCUR to fail an |
1424 | /* work around a bug in perl 5.10, which causes SvCUR to fail an |
1419 | * assertion with -DDEBUGGING, although SvCUR is documented to |
1425 | * assertion with -DDEBUGGING, although SvCUR is documented to |
1420 | * return the xpv_cur field which certainly exists after upgrading. |
1426 | * return the xpv_cur field which certainly exists after upgrading. |