|
|
@ -81,27 +81,11 @@ hb_utf_prev (const uint8_t *text, |
|
|
|
while (start < text && (*text & 0xc0) == 0x80 && end - text < 4) |
|
|
|
while (start < text && (*text & 0xc0) == 0x80 && end - text < 4) |
|
|
|
text--; |
|
|
|
text--; |
|
|
|
|
|
|
|
|
|
|
|
hb_codepoint_t c = *text, mask; |
|
|
|
if (likely (hb_utf_next (text, end, unicode) == end)) |
|
|
|
unsigned int len; |
|
|
|
return text; |
|
|
|
|
|
|
|
|
|
|
|
/* TODO check for overlong sequences? */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HB_UTF8_COMPUTE (c, mask, len); |
|
|
|
|
|
|
|
if (unlikely (!len || (unsigned int) (end - text) != len)) { |
|
|
|
|
|
|
|
*unicode = -1; |
|
|
|
*unicode = -1; |
|
|
|
return end - 1; |
|
|
|
return end - 1; |
|
|
|
} else { |
|
|
|
|
|
|
|
hb_codepoint_t result; |
|
|
|
|
|
|
|
unsigned int i; |
|
|
|
|
|
|
|
result = c & mask; |
|
|
|
|
|
|
|
for (i = 1; i < len; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
result <<= 6; |
|
|
|
|
|
|
|
result |= (text[i] & 0x3f); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
*unicode = result; |
|
|
|
|
|
|
|
return text; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|