In perl.git, the branch khw/ebcdic has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/bae9126b71609a43fee91019f6a90539ff4d863a?hp=79329e397700e63c7c0115a3d7d11e09d8e3e758>

- Log -----------------------------------------------------------------
commit bae9126b71609a43fee91019f6a90539ff4d863a
Author: Karl Williamson <[email protected]>
Date:   Mon Mar 18 11:45:06 2013 -0600

    pp.c: White-space only
    
    Make a ternary operation more clear

M       pp.c

commit 2540758ca27f7726688dc294020aafaff227e926
Author: Karl Williamson <[email protected]>
Date:   Mon Mar 18 11:43:42 2013 -0600

    Fix valid_utf8_to_uvchr() for EBCDIC

M       utf8.c
-----------------------------------------------------------------------

Summary of changes:
 pp.c   |    6 +++---
 utf8.c |    6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/pp.c b/pp.c
index fad87c7..95b1179 100644
--- a/pp.c
+++ b/pp.c
@@ -3304,9 +3304,9 @@ PP(pp_ord)
         argsv = tmpsv;
     }
 
-    XPUSHu(DO_UTF8(argsv) ?
-          utf8n_to_uvchr(s, UTF8_MAXBYTES, 0, UTF8_ALLOW_ANYUV) :
-          (UV)(*s & 0xff));
+    XPUSHu(DO_UTF8(argsv)
+           ? utf8n_to_uvchr(s, UTF8_MAXBYTES, 0, UTF8_ALLOW_ANYUV)
+           : (UV)(*s & 0xff));
 
     RETURN;
 }
diff --git a/utf8.c b/utf8.c
index cade48c..1d9dc85 100644
--- a/utf8.c
+++ b/utf8.c
@@ -953,9 +953,13 @@ Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen)
 
     /* An invariant is trivially returned */
     if (expectlen == 1) {
-        return LATIN1_TO_NATIVE(uv);
+       return uv;
     }
 
+#ifdef EBCDIC
+    uv = NATIVE_UTF8_TO_I8(uv);
+#endif
+
     /* Remove the leading bits that indicate the number of bytes, leaving just
      * the bits that are part of the value */
     uv &= UTF_START_MASK(expectlen);

--
Perl5 Master Repository

Reply via email to