[svn:parrot] r48092 - in branches/gsoc_nfg/src/string: . encoding

darbelo at svn.parrot.org darbelo at svn.parrot.org
Thu Jul 15 00:44:40 UTC 2010


Author: darbelo
Date: Thu Jul 15 00:44:40 2010
New Revision: 48092
URL: https://trac.parrot.org/parrot/changeset/48092

Log:
Minor tweaks to get the concatenation lenght right.

Modified:
   branches/gsoc_nfg/src/string/api.c
   branches/gsoc_nfg/src/string/encoding/nfg.c

Modified: branches/gsoc_nfg/src/string/api.c
==============================================================================
--- branches/gsoc_nfg/src/string/api.c	Thu Jul 15 00:05:05 2010	(r48091)
+++ branches/gsoc_nfg/src/string/api.c	Thu Jul 15 00:44:40 2010	(r48092)
@@ -457,12 +457,12 @@
     if (!cs) {
         /* upgrade strings for concatenation */
         cs = Parrot_unicode_charset_ptr;
-        if (a->encoding == Parrot_ucs4_encoding_ptr
-            || b->encoding == Parrot_ucs4_encoding_ptr)
-            enc = Parrot_ucs4_encoding_ptr;
-        else if (a->encoding == Parrot_nfg_encoding_ptr
+        if (a->encoding == Parrot_nfg_encoding_ptr
             || b->encoding == Parrot_nfg_encoding_ptr)
             enc = Parrot_nfg_encoding_ptr;
+        else if (a->encoding == Parrot_ucs4_encoding_ptr
+            || b->encoding == Parrot_ucs4_encoding_ptr)
+            enc = Parrot_ucs4_encoding_ptr;
         else if (a->encoding == Parrot_utf16_encoding_ptr
             ||  b->encoding == Parrot_utf16_encoding_ptr
             ||  a->encoding == Parrot_ucs2_encoding_ptr
@@ -498,7 +498,7 @@
             b->strstart, b->bufused);
 
     dest->bufused = a->bufused + b->bufused;
-    dest->strlen  = a->strlen + b_len;
+    dest->strlen  = a->strlen + b->strlen;
 
 #if PARROT_HAS_ICU
     if (enc == Parrot_nfg_encoding_ptr) {

Modified: branches/gsoc_nfg/src/string/encoding/nfg.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/nfg.c	Thu Jul 15 00:05:05 2010	(r48091)
+++ branches/gsoc_nfg/src/string/encoding/nfg.c	Thu Jul 15 00:44:40 2010	(r48092)
@@ -232,7 +232,7 @@
 
         if (hash != 0xffff) {
             nfg_encode(interp, dest, index, src, offs, len, graphemes + 1);
-            buf[index] = add_grapheme_from_substr(interp, dest->extra, src, aux, offs-aux, hash);
+            buf[--index] = add_grapheme_from_substr(interp, dest->extra, src, aux, offs-aux, hash);
             return;
         }
         offs++;


More information about the parrot-commits mailing list