| 38 | */ |
| 39 | |
| 40 | static int UArray_SizeOfUTF8Char(const uint8_t *s) { |
| 41 | uint8_t c = *s; |
| 42 | |
| 43 | if (c & 0x80) { |
| 44 | if ((c & 0xE0) == 0xC0) |
| 45 | return 2; |
| 46 | if ((c & 0xF0) == 0xE0) |
| 47 | return 3; |
| 48 | if ((c & 0xF8) == 0xF0) |
| 49 | return 4; |
| 50 | if ((c & 0xFC) == 0xF8) |
| 51 | return 5; |
| 52 | if ((c & 0xFE) == 0xFC) |
| 53 | return 6; |
| 54 | return -1; |
| 55 | } |
| 56 | |
| 57 | return 1; |
| 58 | } |
| 59 | |
| 60 | int UArray_maxCharSize(const UArray *self) { |
| 61 | if (self->encoding == CENCODING_UTF8) { |
no outgoing calls
no test coverage detected