| 11 | // ReadUnicodeCharacter -------------------------------------------------------- |
| 12 | |
| 13 | bool ReadUnicodeCharacter(const char* src, |
| 14 | int32_t src_len, |
| 15 | int32_t* char_index, |
| 16 | uint32_t* code_point_out) { |
| 17 | // U8_NEXT expects to be able to use -1 to signal an error, so we must |
| 18 | // use a signed type for code_point. But this function returns false |
| 19 | // on error anyway, so code_point_out is unsigned. |
| 20 | int32_t code_point; |
| 21 | CBU8_NEXT(src, *char_index, src_len, code_point); |
| 22 | *code_point_out = static_cast<uint32_t>(code_point); |
| 23 | |
| 24 | // The ICU macro above moves to the next char, we want to point to the last |
| 25 | // char consumed. |
| 26 | (*char_index)--; |
| 27 | |
| 28 | // Validate the decoded value. |
| 29 | return IsValidCodepoint(code_point); |
| 30 | } |
| 31 | |
| 32 | bool ReadUnicodeCharacter(const char16* src, |
| 33 | int32_t src_len, |
no test coverage detected