< prev index next >

src/java.desktop/share/native/libfontmanager/harfbuzz/hb-utf-private.hh

Print this page

        

*** 46,56 **** hb_codepoint_t c = *text++; if (c > 0x7Fu) { ! if (hb_in_range (c, 0xC2u, 0xDFu)) /* Two-byte */ { unsigned int t1; if (likely (text < end && (t1 = text[0] - 0x80u) <= 0x3Fu)) { --- 46,56 ---- hb_codepoint_t c = *text++; if (c > 0x7Fu) { ! if (hb_in_range<hb_codepoint_t> (c, 0xC2u, 0xDFu)) /* Two-byte */ { unsigned int t1; if (likely (text < end && (t1 = text[0] - 0x80u) <= 0x3Fu)) {
*** 58,92 **** text++; } else goto error; } ! else if (hb_in_range (c, 0xE0u, 0xEFu)) /* Three-byte */ { unsigned int t1, t2; if (likely (1 < end - text && (t1 = text[0] - 0x80u) <= 0x3Fu && (t2 = text[1] - 0x80u) <= 0x3Fu)) { c = ((c&0xFu)<<12) | (t1<<6) | t2; ! if (unlikely (c < 0x0800u || hb_in_range (c, 0xD800u, 0xDFFFu))) goto error; text += 2; } else goto error; } ! else if (hb_in_range (c, 0xF0u, 0xF4u)) /* Four-byte */ { unsigned int t1, t2, t3; if (likely (2 < end - text && (t1 = text[0] - 0x80u) <= 0x3Fu && (t2 = text[1] - 0x80u) <= 0x3Fu && (t3 = text[2] - 0x80u) <= 0x3Fu)) { c = ((c&0x7u)<<18) | (t1<<12) | (t2<<6) | t3; ! if (unlikely (!hb_in_range (c, 0x10000u, 0x10FFFFu))) goto error; text += 3; } else goto error; --- 58,92 ---- text++; } else goto error; } ! else if (hb_in_range<hb_codepoint_t> (c, 0xE0u, 0xEFu)) /* Three-byte */ { unsigned int t1, t2; if (likely (1 < end - text && (t1 = text[0] - 0x80u) <= 0x3Fu && (t2 = text[1] - 0x80u) <= 0x3Fu)) { c = ((c&0xFu)<<12) | (t1<<6) | t2; ! if (unlikely (c < 0x0800u || hb_in_range<hb_codepoint_t> (c, 0xD800u, 0xDFFFu))) goto error; text += 2; } else goto error; } ! else if (hb_in_range<hb_codepoint_t> (c, 0xF0u, 0xF4u)) /* Four-byte */ { unsigned int t1, t2, t3; if (likely (2 < end - text && (t1 = text[0] - 0x80u) <= 0x3Fu && (t2 = text[1] - 0x80u) <= 0x3Fu && (t3 = text[2] - 0x80u) <= 0x3Fu)) { c = ((c&0x7u)<<18) | (t1<<12) | (t2<<6) | t3; ! if (unlikely (!hb_in_range<hb_codepoint_t> (c, 0x10000u, 0x10FFFFu))) goto error; text += 3; } else goto error;
*** 138,158 **** hb_codepoint_t *unicode, hb_codepoint_t replacement) { hb_codepoint_t c = *text++; ! if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu))) { *unicode = c; return text; } if (likely (c <= 0xDBFFu && text < end)) { /* High-surrogate in c */ hb_codepoint_t l = *text; ! if (likely (hb_in_range (l, 0xDC00u, 0xDFFFu))) { /* Low-surrogate in l */ *unicode = (c << 10) + l - ((0xD800u << 10) - 0x10000u + 0xDC00u); text++; return text; --- 138,158 ---- hb_codepoint_t *unicode, hb_codepoint_t replacement) { hb_codepoint_t c = *text++; ! if (likely (!hb_in_range<hb_codepoint_t> (c, 0xD800u, 0xDFFFu))) { *unicode = c; return text; } if (likely (c <= 0xDBFFu && text < end)) { /* High-surrogate in c */ hb_codepoint_t l = *text; ! if (likely (hb_in_range<hb_codepoint_t> (l, 0xDC00u, 0xDFFFu))) { /* Low-surrogate in l */ *unicode = (c << 10) + l - ((0xD800u << 10) - 0x10000u + 0xDC00u); text++; return text;
*** 170,190 **** hb_codepoint_t *unicode, hb_codepoint_t replacement) { hb_codepoint_t c = *--text; ! if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu))) { *unicode = c; return text; } if (likely (c >= 0xDC00u && start < text)) { /* Low-surrogate in c */ hb_codepoint_t h = text[-1]; ! if (likely (hb_in_range (h, 0xD800u, 0xDBFFu))) { /* High-surrogate in h */ *unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u); text--; return text; --- 170,190 ---- hb_codepoint_t *unicode, hb_codepoint_t replacement) { hb_codepoint_t c = *--text; ! if (likely (!hb_in_range<hb_codepoint_t> (c, 0xD800u, 0xDFFFu))) { *unicode = c; return text; } if (likely (c >= 0xDC00u && start < text)) { /* Low-surrogate in c */ hb_codepoint_t h = text[-1]; ! if (likely (hb_in_range<hb_codepoint_t> (h, 0xD800u, 0xDBFFu))) { /* High-surrogate in h */ *unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u); text--; return text;
< prev index next >