… | |
… | |
225 | static void |
225 | static void |
226 | encode_str (enc_t *enc, int utf8, char *str, STRLEN len) |
226 | encode_str (enc_t *enc, int utf8, char *str, STRLEN len) |
227 | { |
227 | { |
228 | if (ecb_expect_false (enc->cbor.flags & F_DEDUP_STRINGS)) |
228 | if (ecb_expect_false (enc->cbor.flags & F_DEDUP_STRINGS)) |
229 | { |
229 | { |
230 | SV **svp = hv_fetch (enc->stringref[utf8], str, len, 1); |
230 | SV **svp = hv_fetch (enc->stringref[!!utf8], str, len, 1); |
231 | |
231 | |
232 | if (SvOK (*svp)) |
232 | if (SvOK (*svp)) |
233 | { |
233 | { |
234 | // already registered, use stringref |
234 | // already registered, use stringref |
235 | encode_tag (enc, CBOR_TAG_STRINGREF); |
235 | encode_tag (enc, CBOR_TAG_STRINGREF); |
… | |
… | |
656 | decode_he (dec_t *dec, HV *hv) |
656 | decode_he (dec_t *dec, HV *hv) |
657 | { |
657 | { |
658 | // for speed reasons, we specialcase single-string |
658 | // for speed reasons, we specialcase single-string |
659 | // byte or utf-8 strings as keys, but only when !stringref |
659 | // byte or utf-8 strings as keys, but only when !stringref |
660 | |
660 | |
661 | if (expect_true (!dec->stringref)) |
661 | if (ecb_expect_true (!dec->stringref)) |
662 | if (*dec->cur >= 0x40 && *dec->cur <= 0x40 + 27) |
662 | if (*dec->cur >= 0x40 && *dec->cur <= 0x40 + 27) |
663 | { |
663 | { |
664 | I32 len = decode_uint (dec); |
664 | I32 len = decode_uint (dec); |
665 | char *key = (char *)dec->cur; |
665 | char *key = (char *)dec->cur; |
666 | |
666 | |