From 356979f4a7d780fd67a92a9ca6c8659bd12e7168 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 15 Nov 2010 10:27:02 -0700 Subject: [PATCH] pp.c, utf8.c: Convert to use TWO_BYTE_UTF8_TO_UNI --- pp.c | 6 +++--- utf8.c | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pp.c b/pp.c index 9a74280..ca73573 100644 --- a/pp.c +++ b/pp.c @@ -3828,7 +3828,7 @@ PP(pp_ucfirst) /* Convert the two source bytes to a single Unicode code point * value, change case and save for below */ - chr = UTF8_ACCUMULATE(*s, *(s+1)); + chr = TWO_BYTE_UTF8_TO_UNI(*s, *(s+1)); if (op_type == OP_LCFIRST) { /* lower casing is easy */ U8 lower = toLOWER_LATIN1(chr); STORE_UNI_TO_UTF8_TWO_BYTE(tmpbuf, lower); @@ -4153,7 +4153,7 @@ PP(pp_uc) /* Likewise, if it fits in a byte, its case change is in our * table */ - U8 orig = UTF8_ACCUMULATE(*s, *(s+1)); + U8 orig = TWO_BYTE_UTF8_TO_UNI(*s, *(s+1)); U8 upper = toUPPER_LATIN1_MOD(orig); CAT_TWO_BYTE_UNI_UPPER_MOD(d, orig, upper); s += 2; @@ -4391,7 +4391,7 @@ PP(pp_lc) else if (UTF8_IS_DOWNGRADEABLE_START(*s)) { /* As do the ones in the Latin1 range */ - U8 lower = toLOWER_LATIN1(UTF8_ACCUMULATE(*s, *(s+1))); + U8 lower = toLOWER_LATIN1(TWO_BYTE_UTF8_TO_UNI(*s, *(s+1))); CAT_UNI_TO_UTF8_TWO_BYTE(d, lower); s += 2; } diff --git a/utf8.c b/utf8.c index 019d49f..a818b3e 100644 --- a/utf8.c +++ b/utf8.c @@ -836,8 +836,7 @@ Perl_bytes_cmp_utf8(pTHX_ const U8 *b, STRLEN blen, const U8 *u, STRLEN ulen) if (u < uend) { U8 c1 = *u++; if (UTF8_IS_CONTINUATION(c1)) { - c = UTF8_ACCUMULATE(NATIVE_TO_UTF(c), c1); - c = ASCII_TO_NATIVE(c); + c = UNI_TO_NATIVE(TWO_BYTE_UTF8_TO_UNI(c, c1)); } else { Perl_ck_warner_d(aTHX_ packWARN(WARN_UTF8), "Malformed UTF-8 character " @@ -966,8 +965,7 @@ Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *len, bool *is_utf8) U8 c = *s++; if (!UTF8_IS_INVARIANT(c)) { /* Then it is two-byte encoded */ - c = UTF8_ACCUMULATE(NATIVE_TO_UTF(c), *s++); - c = ASCII_TO_NATIVE(c); + c = UNI_TO_NATIVE(TWO_BYTE_UTF8_TO_UNI(c, *s++)); } *d++ = c; } -- 2.7.4