… | |
… | |
100 | #define F_SHRINK 0x00000001UL |
100 | #define F_SHRINK 0x00000001UL |
101 | #define F_ALLOW_UNKNOWN 0x00000002UL |
101 | #define F_ALLOW_UNKNOWN 0x00000002UL |
102 | #define F_ALLOW_SHARING 0x00000004UL |
102 | #define F_ALLOW_SHARING 0x00000004UL |
103 | #define F_ALLOW_CYCLES 0x00000008UL |
103 | #define F_ALLOW_CYCLES 0x00000008UL |
104 | #define F_PACK_STRINGS 0x00000010UL |
104 | #define F_PACK_STRINGS 0x00000010UL |
|
|
105 | #define F_TEXT_KEYS 0x00000020UL |
|
|
106 | #define F_TEXT_STRINGS 0x00000040UL |
105 | #define F_VALIDATE_UTF8 0x00000020UL |
107 | #define F_VALIDATE_UTF8 0x00000080UL |
106 | |
108 | |
107 | #define INIT_SIZE 32 // initial scalar size to be allocated |
109 | #define INIT_SIZE 32 // initial scalar size to be allocated |
108 | |
110 | |
109 | #define SB do { |
111 | #define SB do { |
110 | #define SE } while (0) |
112 | #define SE } while (0) |
… | |
… | |
276 | encode_tag (enc_t *enc, UV tag) |
278 | encode_tag (enc_t *enc, UV tag) |
277 | { |
279 | { |
278 | encode_uint (enc, MAJOR_TAG, tag); |
280 | encode_uint (enc, MAJOR_TAG, tag); |
279 | } |
281 | } |
280 | |
282 | |
|
|
283 | // exceptional (hopefully) slow path for byte strings that need to be utf8-encoded |
|
|
284 | ecb_noinline static void |
|
|
285 | encode_str_utf8 (enc_t *enc, int utf8, char *str, STRLEN len) |
|
|
286 | { |
|
|
287 | STRLEN ulen = len; |
|
|
288 | U8 *p, *pend = (U8 *)str + len; |
|
|
289 | |
|
|
290 | for (p = (U8 *)str; p < pend; ++p) |
|
|
291 | ulen += *p >> 7; // count set high bits |
|
|
292 | |
|
|
293 | encode_uint (enc, MAJOR_TEXT, ulen); |
|
|
294 | |
|
|
295 | need (enc, ulen); |
|
|
296 | for (p = (U8 *)str; p < pend; ++p) |
|
|
297 | if (*p < 0x80) |
|
|
298 | *enc->cur++ = *p; |
|
|
299 | else |
|
|
300 | { |
|
|
301 | *enc->cur++ = 0xc0 + (*p >> 6); |
|
|
302 | *enc->cur++ = 0x80 + (*p & 63); |
|
|
303 | } |
|
|
304 | } |
|
|
305 | |
281 | ecb_inline void |
306 | ecb_inline void |
282 | encode_str (enc_t *enc, int utf8, char *str, STRLEN len) |
307 | encode_str (enc_t *enc, int upgrade_utf8, int utf8, char *str, STRLEN len) |
283 | { |
308 | { |
|
|
309 | if (ecb_expect_false (upgrade_utf8)) |
|
|
310 | if (!utf8) |
|
|
311 | { |
|
|
312 | encode_str_utf8 (enc, utf8, str, len); |
|
|
313 | return; |
|
|
314 | } |
|
|
315 | |
284 | encode_uint (enc, utf8 ? MAJOR_TEXT : MAJOR_BYTES, len); |
316 | encode_uint (enc, utf8 ? MAJOR_TEXT : MAJOR_BYTES, len); |
285 | need (enc, len); |
317 | need (enc, len); |
286 | memcpy (enc->cur, str, len); |
318 | memcpy (enc->cur, str, len); |
287 | enc->cur += len; |
319 | enc->cur += len; |
288 | } |
320 | } |
289 | |
321 | |
290 | static void |
322 | ecb_inline void |
291 | encode_strref (enc_t *enc, int utf8, char *str, STRLEN len) |
323 | encode_strref (enc_t *enc, int upgrade_utf8, int utf8, char *str, STRLEN len) |
292 | { |
324 | { |
293 | if (ecb_expect_false (enc->cbor.flags & F_PACK_STRINGS)) |
325 | if (ecb_expect_false (enc->cbor.flags & F_PACK_STRINGS)) |
294 | { |
326 | { |
295 | SV **svp = hv_fetch (enc->stringref[!!utf8], str, len, 1); |
327 | SV **svp = hv_fetch (enc->stringref[!!utf8], str, len, 1); |
296 | |
328 | |
… | |
… | |
307 | sv_setuv (*svp, enc->stringref_idx); |
339 | sv_setuv (*svp, enc->stringref_idx); |
308 | ++enc->stringref_idx; |
340 | ++enc->stringref_idx; |
309 | } |
341 | } |
310 | } |
342 | } |
311 | |
343 | |
312 | encode_str (enc, utf8, str, len); |
344 | encode_str (enc, upgrade_utf8, utf8, str, len); |
313 | } |
345 | } |
314 | |
346 | |
315 | static void encode_sv (enc_t *enc, SV *sv); |
347 | static void encode_sv (enc_t *enc, SV *sv); |
316 | |
348 | |
317 | static void |
349 | static void |
… | |
… | |
324 | |
356 | |
325 | ++enc->depth; |
357 | ++enc->depth; |
326 | |
358 | |
327 | encode_uint (enc, MAJOR_ARRAY, len + 1); |
359 | encode_uint (enc, MAJOR_ARRAY, len + 1); |
328 | |
360 | |
|
|
361 | if (SvMAGICAL (av)) |
329 | for (i = 0; i <= len; ++i) |
362 | for (i = 0; i <= len; ++i) |
330 | { |
363 | { |
331 | SV **svp = av_fetch (av, i, 0); |
364 | SV **svp = av_fetch (av, i, 0); |
332 | encode_sv (enc, svp ? *svp : &PL_sv_undef); |
365 | encode_sv (enc, svp ? *svp : &PL_sv_undef); |
333 | } |
366 | } |
|
|
367 | else |
|
|
368 | for (i = 0; i <= len; ++i) |
|
|
369 | { |
|
|
370 | SV *sv = AvARRAY (av)[i]; |
|
|
371 | encode_sv (enc, sv ? sv : &PL_sv_undef); |
|
|
372 | } |
334 | |
373 | |
335 | --enc->depth; |
374 | --enc->depth; |
336 | } |
375 | } |
337 | |
376 | |
338 | static void |
377 | static void |
… | |
… | |
356 | while ((he = hv_iternext (hv))) |
395 | while ((he = hv_iternext (hv))) |
357 | { |
396 | { |
358 | if (HeKLEN (he) == HEf_SVKEY) |
397 | if (HeKLEN (he) == HEf_SVKEY) |
359 | encode_sv (enc, HeSVKEY (he)); |
398 | encode_sv (enc, HeSVKEY (he)); |
360 | else |
399 | else |
361 | encode_strref (enc, HeKUTF8 (he), HeKEY (he), HeKLEN (he)); |
400 | encode_strref (enc, enc->cbor.flags & (F_TEXT_KEYS | F_TEXT_STRINGS), HeKUTF8 (he), HeKEY (he), HeKLEN (he)); |
362 | |
401 | |
363 | encode_sv (enc, ecb_expect_false (mg) ? hv_iterval (hv, he) : HeVAL (he)); |
402 | encode_sv (enc, ecb_expect_false (mg) ? hv_iterval (hv, he) : HeVAL (he)); |
364 | } |
403 | } |
365 | |
404 | |
366 | if (mg) |
405 | if (mg) |
… | |
… | |
442 | |
481 | |
443 | if ((method = gv_fetchmethod_autoload (stash, "TO_CBOR", 0))) |
482 | if ((method = gv_fetchmethod_autoload (stash, "TO_CBOR", 0))) |
444 | { |
483 | { |
445 | dSP; |
484 | dSP; |
446 | |
485 | |
447 | ENTER; SAVETMPS; PUSHMARK (SP); |
486 | ENTER; SAVETMPS; |
|
|
487 | PUSHMARK (SP); |
448 | // we re-bless the reference to get overload and other niceties right |
488 | // we re-bless the reference to get overload and other niceties right |
449 | XPUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash)); |
489 | XPUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash)); |
450 | |
490 | |
451 | PUTBACK; |
491 | PUTBACK; |
452 | // G_SCALAR ensures that return value is 1 |
492 | // G_SCALAR ensures that return value is 1 |
… | |
… | |
465 | } |
505 | } |
466 | else if ((method = gv_fetchmethod_autoload (stash, "FREEZE", 0)) != 0) |
506 | else if ((method = gv_fetchmethod_autoload (stash, "FREEZE", 0)) != 0) |
467 | { |
507 | { |
468 | dSP; |
508 | dSP; |
469 | |
509 | |
470 | ENTER; SAVETMPS; PUSHMARK (SP); |
510 | ENTER; SAVETMPS; |
|
|
511 | SAVESTACK_POS (); |
|
|
512 | PUSHMARK (SP); |
471 | EXTEND (SP, 2); |
513 | EXTEND (SP, 2); |
472 | // we re-bless the reference to get overload and other niceties right |
514 | // we re-bless the reference to get overload and other niceties right |
473 | PUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash)); |
515 | PUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash)); |
474 | PUSHs (sv_cbor); |
516 | PUSHs (sv_cbor); |
475 | |
517 | |
… | |
… | |
481 | if (count == 1 && SvROK (TOPs) && SvRV (TOPs) == sv) |
523 | if (count == 1 && SvROK (TOPs) && SvRV (TOPs) == sv) |
482 | croak ("%s::FREEZE(CBOR) method returned same object as was passed instead of a new one", HvNAME (stash)); |
524 | croak ("%s::FREEZE(CBOR) method returned same object as was passed instead of a new one", HvNAME (stash)); |
483 | |
525 | |
484 | encode_tag (enc, CBOR_TAG_PERL_OBJECT); |
526 | encode_tag (enc, CBOR_TAG_PERL_OBJECT); |
485 | encode_uint (enc, MAJOR_ARRAY, count + 1); |
527 | encode_uint (enc, MAJOR_ARRAY, count + 1); |
486 | encode_strref (enc, HvNAMEUTF8 (stash), HvNAME (stash), HvNAMELEN (stash)); |
528 | encode_strref (enc, 0, HvNAMEUTF8 (stash), HvNAME (stash), HvNAMELEN (stash)); |
487 | |
529 | |
488 | while (count) |
530 | while (count) |
489 | encode_sv (enc, SP[1 - count--]); |
531 | encode_sv (enc, SP[1 - count--]); |
490 | |
532 | |
491 | PUTBACK; |
533 | PUTBACK; |
… | |
… | |
550 | |
592 | |
551 | if (SvPOKp (sv)) |
593 | if (SvPOKp (sv)) |
552 | { |
594 | { |
553 | STRLEN len; |
595 | STRLEN len; |
554 | char *str = SvPV (sv, len); |
596 | char *str = SvPV (sv, len); |
555 | encode_strref (enc, SvUTF8 (sv), str, len); |
597 | encode_strref (enc, enc->cbor.flags & F_TEXT_STRINGS, SvUTF8 (sv), str, len); |
556 | } |
598 | } |
557 | else if (SvNOKp (sv)) |
599 | else if (SvNOKp (sv)) |
558 | encode_nv (enc, sv); |
600 | encode_nv (enc, sv); |
559 | else if (SvIOKp (sv)) |
601 | else if (SvIOKp (sv)) |
560 | { |
602 | { |
… | |
… | |
577 | } |
619 | } |
578 | |
620 | |
579 | static SV * |
621 | static SV * |
580 | encode_cbor (SV *scalar, CBOR *cbor) |
622 | encode_cbor (SV *scalar, CBOR *cbor) |
581 | { |
623 | { |
582 | enc_t enc = { }; |
624 | enc_t enc = { 0 }; |
583 | |
625 | |
584 | enc.cbor = *cbor; |
626 | enc.cbor = *cbor; |
585 | enc.sv = sv_2mortal (NEWSV (0, INIT_SIZE)); |
627 | enc.sv = sv_2mortal (NEWSV (0, INIT_SIZE)); |
586 | enc.cur = SvPVX (enc.sv); |
628 | enc.cur = SvPVX (enc.sv); |
587 | enc.end = SvEND (enc.sv); |
629 | enc.end = SvEND (enc.sv); |
… | |
… | |
623 | SV *decode_tagged; |
665 | SV *decode_tagged; |
624 | } dec_t; |
666 | } dec_t; |
625 | |
667 | |
626 | #define ERR(reason) SB if (!dec->err) dec->err = reason; goto fail; SE |
668 | #define ERR(reason) SB if (!dec->err) dec->err = reason; goto fail; SE |
627 | |
669 | |
628 | #define WANT(len) if (ecb_expect_false (dec->cur + len > dec->end)) ERR ("unexpected end of CBOR data") |
670 | #define WANT(len) if (ecb_expect_false ((UV)(dec->end - dec->cur) < (UV)len)) ERR ("unexpected end of CBOR data") |
629 | |
671 | |
630 | #define DEC_INC_DEPTH if (++dec->depth > dec->cbor.max_depth) ERR (ERR_NESTING_EXCEEDED) |
672 | #define DEC_INC_DEPTH if (ecb_expect_false (++dec->depth > dec->cbor.max_depth)) ERR (ERR_NESTING_EXCEEDED) |
631 | #define DEC_DEC_DEPTH --dec->depth |
673 | #define DEC_DEC_DEPTH --dec->depth |
632 | |
674 | |
633 | static UV |
675 | static UV |
634 | decode_uint (dec_t *dec) |
676 | decode_uint (dec_t *dec) |
635 | { |
677 | { |
… | |
… | |
712 | av_push (av, decode_sv (dec)); |
754 | av_push (av, decode_sv (dec)); |
713 | } |
755 | } |
714 | } |
756 | } |
715 | else |
757 | else |
716 | { |
758 | { |
717 | int i, len = decode_uint (dec); |
759 | UV i, len = decode_uint (dec); |
718 | |
760 | |
719 | WANT (len); // complexity check for av_fill - need at least one byte per value, do not allow supersize arrays |
761 | WANT (len); // complexity check for av_fill - need at least one byte per value, do not allow supersize arrays |
720 | av_fill (av, len - 1); |
762 | av_fill (av, len - 1); |
721 | |
763 | |
722 | for (i = 0; i < len; ++i) |
764 | for (i = 0; i < len; ++i) |
… | |
… | |
739 | // byte or utf-8 strings as keys, but only when !stringref |
781 | // byte or utf-8 strings as keys, but only when !stringref |
740 | |
782 | |
741 | if (ecb_expect_true (!dec->stringref)) |
783 | if (ecb_expect_true (!dec->stringref)) |
742 | if (ecb_expect_true ((U8)(*dec->cur - MAJOR_BYTES) <= LENGTH_EXT8)) |
784 | if (ecb_expect_true ((U8)(*dec->cur - MAJOR_BYTES) <= LENGTH_EXT8)) |
743 | { |
785 | { |
744 | I32 len = decode_uint (dec); |
786 | STRLEN len = decode_uint (dec); |
745 | char *key = (char *)dec->cur; |
787 | char *key = (char *)dec->cur; |
746 | |
788 | |
|
|
789 | WANT (len); |
747 | dec->cur += len; |
790 | dec->cur += len; |
748 | |
791 | |
749 | hv_store (hv, key, len, decode_sv (dec), 0); |
792 | hv_store (hv, key, len, decode_sv (dec), 0); |
750 | |
793 | |
751 | return; |
794 | return; |
752 | } |
795 | } |
753 | else if (ecb_expect_true ((U8)(*dec->cur - MAJOR_TEXT) <= LENGTH_EXT8)) |
796 | else if (ecb_expect_true ((U8)(*dec->cur - MAJOR_TEXT) <= LENGTH_EXT8)) |
754 | { |
797 | { |
755 | I32 len = decode_uint (dec); |
798 | STRLEN len = decode_uint (dec); |
756 | char *key = (char *)dec->cur; |
799 | char *key = (char *)dec->cur; |
757 | |
800 | |
|
|
801 | WANT (len); |
758 | dec->cur += len; |
802 | dec->cur += len; |
759 | |
803 | |
760 | if (ecb_expect_false (dec->cbor.flags & F_VALIDATE_UTF8)) |
804 | if (ecb_expect_false (dec->cbor.flags & F_VALIDATE_UTF8)) |
761 | if (!is_utf8_string (key, len)) |
805 | if (!is_utf8_string (key, len)) |
762 | ERR ("corrupted CBOR data (invalid UTF-8 in map key)"); |
806 | ERR ("corrupted CBOR data (invalid UTF-8 in map key)"); |
… | |
… | |
800 | decode_he (dec, hv); |
844 | decode_he (dec, hv); |
801 | } |
845 | } |
802 | } |
846 | } |
803 | else |
847 | else |
804 | { |
848 | { |
805 | int pairs = decode_uint (dec); |
849 | UV pairs = decode_uint (dec); |
|
|
850 | |
|
|
851 | WANT (pairs); // complexity check - need at least one byte per value, do not allow supersize hashes |
806 | |
852 | |
807 | while (pairs--) |
853 | while (pairs--) |
808 | decode_he (dec, hv); |
854 | decode_he (dec, hv); |
809 | } |
855 | } |
810 | |
856 | |
… | |
… | |
898 | sv = newRV_noinc (decode_sv (dec)); |
944 | sv = newRV_noinc (decode_sv (dec)); |
899 | break; |
945 | break; |
900 | |
946 | |
901 | case CBOR_TAG_STRINGREF_NAMESPACE: |
947 | case CBOR_TAG_STRINGREF_NAMESPACE: |
902 | { |
948 | { |
|
|
949 | // do nmot use SAVETMPS/FREETMPS, as these will |
|
|
950 | // erase mortalised caches, e.g. "shareable" |
903 | ENTER; SAVETMPS; |
951 | ENTER; |
904 | |
952 | |
905 | SAVESPTR (dec->stringref); |
953 | SAVESPTR (dec->stringref); |
906 | dec->stringref = (AV *)sv_2mortal ((SV *)newAV ()); |
954 | dec->stringref = (AV *)sv_2mortal ((SV *)newAV ()); |
907 | |
955 | |
908 | sv = decode_sv (dec); |
956 | sv = decode_sv (dec); |
909 | |
957 | |
910 | FREETMPS; LEAVE; |
958 | LEAVE; |
911 | } |
959 | } |
912 | break; |
960 | break; |
913 | |
961 | |
914 | case CBOR_TAG_STRINGREF: |
962 | case CBOR_TAG_STRINGREF: |
915 | { |
963 | { |
… | |
… | |
985 | if (!method) |
1033 | if (!method) |
986 | ERR ("cannot decode perl-object (package does not have a THAW method)"); |
1034 | ERR ("cannot decode perl-object (package does not have a THAW method)"); |
987 | |
1035 | |
988 | dSP; |
1036 | dSP; |
989 | |
1037 | |
990 | ENTER; SAVETMPS; PUSHMARK (SP); |
1038 | ENTER; SAVETMPS; |
|
|
1039 | PUSHMARK (SP); |
991 | EXTEND (SP, len + 1); |
1040 | EXTEND (SP, len + 1); |
992 | // we re-bless the reference to get overload and other niceties right |
1041 | // we re-bless the reference to get overload and other niceties right |
993 | PUSHs (*av_fetch (av, 0, 1)); |
1042 | PUSHs (*av_fetch (av, 0, 1)); |
994 | PUSHs (sv_cbor); |
1043 | PUSHs (sv_cbor); |
995 | |
1044 | |
… | |
… | |
1020 | default: |
1069 | default: |
1021 | { |
1070 | { |
1022 | sv = decode_sv (dec); |
1071 | sv = decode_sv (dec); |
1023 | |
1072 | |
1024 | dSP; |
1073 | dSP; |
1025 | ENTER; SAVETMPS; PUSHMARK (SP); |
1074 | ENTER; SAVETMPS; |
|
|
1075 | SAVESTACK_POS (); |
|
|
1076 | PUSHMARK (SP); |
1026 | EXTEND (SP, 2); |
1077 | EXTEND (SP, 2); |
1027 | PUSHs (newSVuv (tag)); |
1078 | PUSHs (newSVuv (tag)); |
1028 | PUSHs (sv); |
1079 | PUSHs (sv); |
1029 | |
1080 | |
1030 | PUTBACK; |
1081 | PUTBACK; |
… | |
… | |
1156 | } |
1207 | } |
1157 | |
1208 | |
1158 | static SV * |
1209 | static SV * |
1159 | decode_cbor (SV *string, CBOR *cbor, char **offset_return) |
1210 | decode_cbor (SV *string, CBOR *cbor, char **offset_return) |
1160 | { |
1211 | { |
1161 | dec_t dec = { }; |
1212 | dec_t dec = { 0 }; |
1162 | SV *sv; |
1213 | SV *sv; |
1163 | STRLEN len; |
1214 | STRLEN len; |
1164 | char *data = SvPVbyte (string, len); |
1215 | char *data = SvPVbyte (string, len); |
1165 | |
1216 | |
1166 | if (len > cbor->max_size && cbor->max_size) |
1217 | if (len > cbor->max_size && cbor->max_size) |
… | |
… | |
1257 | |
1308 | |
1258 | int major = *p >> MAJOR_SHIFT; |
1309 | int major = *p >> MAJOR_SHIFT; |
1259 | |
1310 | |
1260 | switch (major) |
1311 | switch (major) |
1261 | { |
1312 | { |
|
|
1313 | case MAJOR_TAG >> MAJOR_SHIFT: |
|
|
1314 | ++count; // tags merely prefix another value |
|
|
1315 | break; |
|
|
1316 | |
1262 | case MAJOR_BYTES >> MAJOR_SHIFT: |
1317 | case MAJOR_BYTES >> MAJOR_SHIFT: |
1263 | case MAJOR_TEXT >> MAJOR_SHIFT: |
1318 | case MAJOR_TEXT >> MAJOR_SHIFT: |
1264 | case MAJOR_ARRAY >> MAJOR_SHIFT: |
1319 | case MAJOR_ARRAY >> MAJOR_SHIFT: |
1265 | case MAJOR_MAP >> MAJOR_SHIFT: |
1320 | case MAJOR_MAP >> MAJOR_SHIFT: |
1266 | { |
1321 | { |
… | |
… | |
1341 | |
1396 | |
1342 | default_filter = newSVpv ("CBOR::XS::default_filter", 0); |
1397 | default_filter = newSVpv ("CBOR::XS::default_filter", 0); |
1343 | |
1398 | |
1344 | sv_cbor = newSVpv ("CBOR", 0); |
1399 | sv_cbor = newSVpv ("CBOR", 0); |
1345 | SvREADONLY_on (sv_cbor); |
1400 | SvREADONLY_on (sv_cbor); |
|
|
1401 | |
|
|
1402 | assert (("STRLEN must be an unsigned type", 0 <= (STRLEN)-1)); |
1346 | } |
1403 | } |
1347 | |
1404 | |
1348 | PROTOTYPES: DISABLE |
1405 | PROTOTYPES: DISABLE |
1349 | |
1406 | |
1350 | void CLONE (...) |
1407 | void CLONE (...) |
… | |
… | |
1371 | shrink = F_SHRINK |
1428 | shrink = F_SHRINK |
1372 | allow_unknown = F_ALLOW_UNKNOWN |
1429 | allow_unknown = F_ALLOW_UNKNOWN |
1373 | allow_sharing = F_ALLOW_SHARING |
1430 | allow_sharing = F_ALLOW_SHARING |
1374 | allow_cycles = F_ALLOW_CYCLES |
1431 | allow_cycles = F_ALLOW_CYCLES |
1375 | pack_strings = F_PACK_STRINGS |
1432 | pack_strings = F_PACK_STRINGS |
|
|
1433 | text_keys = F_TEXT_KEYS |
|
|
1434 | text_strings = F_TEXT_STRINGS |
1376 | validate_utf8 = F_VALIDATE_UTF8 |
1435 | validate_utf8 = F_VALIDATE_UTF8 |
1377 | PPCODE: |
1436 | PPCODE: |
1378 | { |
1437 | { |
1379 | if (enable) |
1438 | if (enable) |
1380 | self->flags |= ix; |
1439 | self->flags |= ix; |
… | |
… | |
1389 | get_shrink = F_SHRINK |
1448 | get_shrink = F_SHRINK |
1390 | get_allow_unknown = F_ALLOW_UNKNOWN |
1449 | get_allow_unknown = F_ALLOW_UNKNOWN |
1391 | get_allow_sharing = F_ALLOW_SHARING |
1450 | get_allow_sharing = F_ALLOW_SHARING |
1392 | get_allow_cycles = F_ALLOW_CYCLES |
1451 | get_allow_cycles = F_ALLOW_CYCLES |
1393 | get_pack_strings = F_PACK_STRINGS |
1452 | get_pack_strings = F_PACK_STRINGS |
|
|
1453 | get_text_keys = F_TEXT_KEYS |
|
|
1454 | get_text_strings = F_TEXT_STRINGS |
1394 | get_validate_utf8 = F_VALIDATE_UTF8 |
1455 | get_validate_utf8 = F_VALIDATE_UTF8 |
1395 | PPCODE: |
1456 | PPCODE: |
1396 | XPUSHs (boolSV (self->flags & ix)); |
1457 | XPUSHs (boolSV (self->flags & ix)); |
1397 | |
1458 | |
1398 | void max_depth (CBOR *self, U32 max_depth = 0x80000000UL) |
1459 | void max_depth (CBOR *self, U32 max_depth = 0x80000000UL) |