[svn:parrot] r39771 - trunk/src/string/charset

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Thu Jun 25 16:22:19 UTC 2009


Author: pmichaud
Date: Thu Jun 25 16:22:18 2009
New Revision: 39771
URL: https://trac.parrot.org/parrot/changeset/39771

Log:
[core]:  modify upcase to work like downcase on unicode strings containing only ASCII characters

Modified:
   trunk/src/string/charset/unicode.c

Modified: trunk/src/string/charset/unicode.c
==============================================================================
--- trunk/src/string/charset/unicode.c	Thu Jun 25 16:08:26 2009	(r39770)
+++ trunk/src/string/charset/unicode.c	Thu Jun 25 16:22:18 2009	(r39771)
@@ -416,8 +416,13 @@
 upcase(PARROT_INTERP, ARGIN(STRING *src))
 {
     ASSERT_ARGS(upcase)
-#if PARROT_HAS_ICU
+    if (src->bufused  == src->strlen
+            && src->encoding == Parrot_utf8_encoding_ptr) {
+        Parrot_ascii_charset_ptr->downcase(interp, src);
+        return;
+    }
 
+#if PARROT_HAS_ICU
     UErrorCode err;
     int dest_len, src_len, needed;
 
@@ -511,13 +516,12 @@
 {
     ASSERT_ARGS(downcase)
     if (src->bufused  == src->strlen
-    &&  src->encoding == Parrot_utf8_encoding_ptr) {
+            && src->encoding == Parrot_utf8_encoding_ptr) {
         Parrot_ascii_charset_ptr->downcase(interp, src);
         return;
     }
-    else {
-#if PARROT_HAS_ICU
 
+#if PARROT_HAS_ICU
     UErrorCode err;
     int dest_len, src_len;
 
@@ -554,7 +558,6 @@
     Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
         "no ICU lib loaded");
 #endif
-    }
 }
 
 


More information about the parrot-commits mailing list