| 78 | } |
| 79 | |
| 80 | size_t |
| 81 | serd_strlen(const uint8_t* str, size_t* n_bytes, SerdNodeFlags* flags) |
| 82 | { |
| 83 | size_t n_chars = 0; |
| 84 | size_t i = 0; |
| 85 | SerdNodeFlags f = 0; |
| 86 | for (; str[i]; ++i) { |
| 87 | if ((str[i] & 0xC0) != 0x80) { // Start of new character |
| 88 | ++n_chars; |
| 89 | serd_update_flags(str[i], &f); |
| 90 | } |
| 91 | } |
| 92 | if (n_bytes) { |
| 93 | *n_bytes = i; |
| 94 | } |
| 95 | if (flags) { |
| 96 | *flags = f; |
| 97 | } |
| 98 | return n_chars; |
| 99 | } |
| 100 | |
| 101 | static inline double |
| 102 | read_sign(const char** sptr) |