| 1837 | } |
| 1838 | |
| 1839 | static int jl_validate_utf8(const char *text, size_t length) { |
| 1840 | size_t pos = 0; |
| 1841 | while (pos < length) { |
| 1842 | uint32_t codepoint = 0; |
| 1843 | size_t byte_count = 0; |
| 1844 | if (jl_decode_utf8((const unsigned char *)text + pos, length - pos, &codepoint, |
| 1845 | &byte_count) != 0) { |
| 1846 | return -1; |
| 1847 | } |
| 1848 | pos += byte_count; |
| 1849 | } |
| 1850 | return 0; |
| 1851 | } |
| 1852 | |
| 1853 | static int jl_validate_key(const char *key) { |
| 1854 | if (!key) { |
no test coverage detected