[svn:parrot] r47795 - branches/gsoc_nfg/src/string/encoding

darbelo at svn.parrot.org darbelo at svn.parrot.org
Thu Jun 24 05:15:17 UTC 2010


Author: darbelo
Date: Thu Jun 24 05:15:17 2010
New Revision: 47795
URL: https://trac.parrot.org/parrot/changeset/47795

Log:
Make sure we don't try to lookbeind for the first char in a string.

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

Modified: branches/gsoc_nfg/src/string/encoding/nfg.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/nfg.c	Thu Jun 24 04:21:36 2010	(r47794)
+++ branches/gsoc_nfg/src/string/encoding/nfg.c	Thu Jun 24 05:15:17 2010	(r47795)
@@ -517,10 +517,11 @@
     UChar32 *s   = (UChar32 *) i->str->strstart;
     size_t   pos = i->bytepos / sizeof (UChar32);
 
-    if (!ISCOMBINING(c)) {
+    if (pos = 0 || !ISCOMBINING(c)) {
         s[pos++] = (UChar32) c;
         ++i->charpos;
         i->bytepos = pos * sizeof (UChar32);
+        return;
     }
     // TODO: This can create dynamic graphemes for valid Unicode compositions.
     else {


More information about the parrot-commits mailing list