… | |
… | |
15 | |
15 | |
16 | // some old perls do not have this, try to make it work, no |
16 | // some old perls do not have this, try to make it work, no |
17 | // guarantees, though. if it breaks, you get to keep the pieces. |
17 | // guarantees, though. if it breaks, you get to keep the pieces. |
18 | #ifndef UTF8_MAXBYTES |
18 | #ifndef UTF8_MAXBYTES |
19 | # define UTF8_MAXBYTES 13 |
19 | # define UTF8_MAXBYTES 13 |
|
|
20 | #endif |
|
|
21 | |
|
|
22 | // compatibility with perl <5.18 |
|
|
23 | #ifndef HvNAMELEN_get |
|
|
24 | # define HvNAMELEN_get(hv) strlen (HvNAME (hv)) |
|
|
25 | #endif |
|
|
26 | #ifndef HvNAMELEN |
|
|
27 | # define HvNAMELEN(hv) HvNAMELEN_get (hv) |
|
|
28 | #endif |
|
|
29 | #ifndef HvNAMEUTF8 |
|
|
30 | # define HvNAMEUTF8(hv) 0 |
20 | #endif |
31 | #endif |
21 | |
32 | |
22 | // three extra for rounding, sign, and end of string |
33 | // three extra for rounding, sign, and end of string |
23 | #define IVUV_MAXCHARS (sizeof (UV) * CHAR_BIT * 28 / 93 + 3) |
34 | #define IVUV_MAXCHARS (sizeof (UV) * CHAR_BIT * 28 / 93 + 3) |
24 | |
35 | |
… | |
… | |
1492 | if (!(dec->json.flags & F_ALLOW_TAGS)) |
1503 | if (!(dec->json.flags & F_ALLOW_TAGS)) |
1493 | ERR ("malformed JSON string, neither array, object, number, string or atom"); |
1504 | ERR ("malformed JSON string, neither array, object, number, string or atom"); |
1494 | |
1505 | |
1495 | ++dec->cur; |
1506 | ++dec->cur; |
1496 | |
1507 | |
|
|
1508 | decode_ws (dec); |
|
|
1509 | |
1497 | tag = decode_sv (dec); |
1510 | tag = decode_sv (dec); |
1498 | if (!tag) |
1511 | if (!tag) |
1499 | goto fail; |
1512 | goto fail; |
1500 | |
1513 | |
1501 | if (!SvPOK (tag)) |
1514 | if (!SvPOK (tag)) |
1502 | ERR ("malformed JSON string, (tag) must be a string"); |
1515 | ERR ("malformed JSON string, (tag) must be a string"); |
1503 | |
1516 | |
|
|
1517 | decode_ws (dec); |
|
|
1518 | |
1504 | if (*dec->cur != ')') |
1519 | if (*dec->cur != ')') |
1505 | ERR (") expected after tag"); |
1520 | ERR (") expected after tag"); |
1506 | |
1521 | |
1507 | ++dec->cur; |
1522 | ++dec->cur; |
|
|
1523 | |
|
|
1524 | decode_ws (dec); |
1508 | |
1525 | |
1509 | val = decode_sv (dec); |
1526 | val = decode_sv (dec); |
1510 | if (!val) |
1527 | if (!val) |
1511 | goto fail; |
1528 | goto fail; |
1512 | |
1529 | |