| | |
| | | if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) { |
| | | /* If the 16 bits following the high surrogate are in the source buffer... */ |
| | | if (source < sourceEnd) { |
| | | UTF32 ch2 = *source; |
| | | const UTF32 ch2 = *source; |
| | | /* If it's a low surrogate, convert to UTF32. */ |
| | | if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) { |
| | | ch = ((ch - UNI_SUR_HIGH_START) << halfShift) |
| | |
| | | * This is not used here; it's just exported. |
| | | */ |
| | | Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) { |
| | | int length = trailingBytesForUTF8[*source]+1; |
| | | const int length = trailingBytesForUTF8[*source]+1; |
| | | if (source+length > sourceEnd) { |
| | | return false; |
| | | } |
| | |
| | | UTF16* target = *targetStart; |
| | | while (source < sourceEnd) { |
| | | UTF32 ch = 0; |
| | | unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; |
| | | const unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; |
| | | if (source + extraBytesToRead >= sourceEnd) { |
| | | result = sourceExhausted; break; |
| | | } |
| | |
| | | UTF32* target = *targetStart; |
| | | while (source < sourceEnd) { |
| | | UTF32 ch = 0; |
| | | unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; |
| | | const unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; |
| | | if (source + extraBytesToRead >= sourceEnd) { |
| | | result = sourceExhausted; break; |
| | | } |