Bytes the sequence starting with `lead` occupies (1 for ASCII or a byte that * is not a valid lead). */
| 6868 | /* Bytes the sequence starting with `lead` occupies (1 for ASCII or a byte that |
| 6869 | * is not a valid lead). */ |
| 6870 | static size_t utf8_sequence_len(unsigned char lead) { |
| 6871 | if ((lead & UTF8_LEAD2_MASK) == UTF8_LEAD2_MARK) { |
| 6872 | return UTF8_LEN_2; |
| 6873 | } |
| 6874 | if ((lead & UTF8_LEAD3_MASK) == UTF8_LEAD3_MARK) { |
| 6875 | return UTF8_LEN_3; |
| 6876 | } |
| 6877 | if ((lead & UTF8_LEAD4_MASK) == UTF8_LEAD4_MARK) { |
| 6878 | return UTF8_LEN_4; |
| 6879 | } |
| 6880 | return UTF8_LEN_1; |
| 6881 | } |
| 6882 | |
| 6883 | /* Drop a trailing PARTIAL UTF-8 sequence left behind by a byte-length cut, so |
| 6884 | * a capped prose value never ends mid-codepoint (#1017's rule, applied to the |
no outgoing calls
no test coverage detected