This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.h: EBCDIC fix
authorKarl Williamson <khw@cpan.org>
Fri, 17 Oct 2014 01:44:07 +0000 (19:44 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 21 Oct 2014 15:26:50 +0000 (09:26 -0600)
These macros are supposed to accommodate larger than a byte inputs.
Therefore, under EBCDIC, we have to use a different macro which handles
the larger values.  On ASCII platforms, these called macros are no-ops
so it doesn't matter there.

utf8.h

diff --git a/utf8.h b/utf8.h
index d3b55ee..3d29706 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -382,11 +382,11 @@ Perl's extended UTF-8 means we can have start bytes up to FF.
 #define UTF8_TWO_BYTE_HI(c)                                                    \
        (__ASSERT_((sizeof(c) ==  1)                                            \
                   || !(((WIDEST_UTYPE)(c)) & ~MAX_PORTABLE_UTF8_TWO_BYTE))     \
-        ((U8) __BASE_TWO_BYTE_HI(c, NATIVE_TO_LATIN1)))
+        ((U8) __BASE_TWO_BYTE_HI(c, NATIVE_TO_UNI)))
 #define UTF8_TWO_BYTE_LO(c)                                                    \
        (__ASSERT_((sizeof(c) ==  1)                                            \
                   || !(((WIDEST_UTYPE)(c)) & ~MAX_PORTABLE_UTF8_TWO_BYTE))     \
-        ((U8) __BASE_TWO_BYTE_LO(c, NATIVE_TO_LATIN1)))
+        ((U8) __BASE_TWO_BYTE_LO(c, NATIVE_TO_UNI)))
 
 /* This is illegal in any well-formed UTF-8 in both EBCDIC and ASCII
  * as it is only in overlongs. */