| 1770 | } |
| 1771 | |
| 1772 | static int jl_validate_utf8(const char *text, size_t length) { |
| 1773 | size_t pos = 0; |
| 1774 | while (pos < length) { |
| 1775 | uint32_t codepoint = 0; |
| 1776 | size_t byte_count = 0; |
| 1777 | if (jl_decode_utf8((const unsigned char *)text + pos, length - pos, &codepoint, |
| 1778 | &byte_count) != 0) { |
| 1779 | return -1; |
| 1780 | } |
| 1781 | pos += byte_count; |
| 1782 | } |
| 1783 | return 0; |
| 1784 | } |
| 1785 | |
| 1786 | static int jl_validate_key(const char *key) { |
| 1787 | if (!key) { |
no test coverage detected