… | |
… | |
201 | #endif |
201 | #endif |
202 | } |
202 | } |
203 | } |
203 | } |
204 | |
204 | |
205 | // minimum length of a string to be registered for stringref |
205 | // minimum length of a string to be registered for stringref |
206 | ecb_inline int |
206 | ecb_inline STRLEN |
207 | minimum_string_length (UV idx) |
207 | minimum_string_length (UV idx) |
208 | { |
208 | { |
209 | return idx <= 23 ? 3 |
209 | return idx <= 23 ? 3 |
210 | : idx <= 0xffU ? 4 |
210 | : idx <= 0xffU ? 4 |
211 | : idx <= 0xffffU ? 5 |
211 | : idx <= 0xffffU ? 5 |
… | |
… | |
987 | |
987 | |
988 | WANT (len); |
988 | WANT (len); |
989 | dec->cur += len; |
989 | dec->cur += len; |
990 | |
990 | |
991 | if (ecb_expect_false (dec->cbor.flags & F_VALIDATE_UTF8)) |
991 | if (ecb_expect_false (dec->cbor.flags & F_VALIDATE_UTF8)) |
992 | if (!is_utf8_string (key, len)) |
992 | if (!is_utf8_string ((U8 *)key, len)) |
993 | ERR ("corrupted CBOR data (invalid UTF-8 in map key)"); |
993 | ERR ("corrupted CBOR data (invalid UTF-8 in map key)"); |
994 | |
994 | |
995 | hv_store (hv, key, -len, decode_sv (dec), 0); |
995 | hv_store (hv, key, -len, decode_sv (dec), 0); |
996 | |
996 | |
997 | return; |
997 | return; |
… | |
… | |
1569 | |
1569 | |
1570 | break; |
1570 | break; |
1571 | |
1571 | |
1572 | case MAJOR_MAP >> MAJOR_SHIFT: |
1572 | case MAJOR_MAP >> MAJOR_SHIFT: |
1573 | len <<= 1; |
1573 | len <<= 1; |
|
|
1574 | /* FALLTHROUGH */ |
1574 | case MAJOR_ARRAY >> MAJOR_SHIFT: |
1575 | case MAJOR_ARRAY >> MAJOR_SHIFT: |
1575 | if (len) |
1576 | if (len) |
1576 | { |
1577 | { |
1577 | av_push (self->incr_count, newSViv (len + 1)); //TODO: nest |
1578 | av_push (self->incr_count, newSViv (len + 1)); //TODO: nest |
1578 | count = len + 1; |
1579 | count = len + 1; |