[svn:parrot] r47943 - branches/gsoc_nfg/src/packfile

darbelo at svn.parrot.org darbelo at svn.parrot.org
Wed Jun 30 23:50:55 UTC 2010


Author: darbelo
Date: Wed Jun 30 23:50:55 2010
New Revision: 47943
URL: https://trac.parrot.org/parrot/changeset/47943

Log:
Increment the right variable in the packfile storage loop.

Modified:
   branches/gsoc_nfg/src/packfile/pf_items.c

Modified: branches/gsoc_nfg/src/packfile/pf_items.c
==============================================================================
--- branches/gsoc_nfg/src/packfile/pf_items.c	Wed Jun 30 23:50:42 2010	(r47942)
+++ branches/gsoc_nfg/src/packfile/pf_items.c	Wed Jun 30 23:50:55 2010	(r47943)
@@ -1359,7 +1359,7 @@
        INTVAL i = 0;
        *cursor++ = table->used;
 
-        while (i++ < table->used) {
+        for (i = 0; i < table->used; i++) {
             char *auxcursor;
             INTVAL len = table->graphemes[i].len;
             /* Store the length and then memcpy() the codepoints over. */
@@ -1368,12 +1368,15 @@
                                         len * sizeof (UChar32));
 
             /* Adjust the cursor, and auxcursor ... */
-            cursor += ((len * sizeof (UChar32)) / sizeof (opcode_t)) + 1;
+            cursor += ((len * sizeof (UChar32)) / sizeof (opcode_t));
+            cursor++;
             auxcursor += len * sizeof (UChar32); 
 
+            
             /* ...and pad the difference with zeros. */
-            while ((unsigned long) (auxcursor - (char *) cursor) % sizeof (opcode_t))
-                *charcursor++ = 0;
+            while ((unsigned long) (auxcursor - (char *) cursor) % sizeof (opcode_t)){
+                *auxcursor++ = 0;
+            }
         }
     }
     else {
@@ -1427,11 +1430,9 @@
         grapheme_table *table = (grapheme_table *) s->extra;
         INTVAL              i = 0;
 
-        while (i < table->used) {
-            extra_len += ((table->graphemes[i].len * sizeof (UChar32)) / sizeof (opcode_t) + 1)
+        while (i < table->used)
+            extra_len += ((table->graphemes[i++].len * sizeof (UChar32)) / sizeof (opcode_t) + 2)
                          * sizeof (opcode_t);
-            extra_len += sizeof (opcode_t);
-        }
     }
 #endif /* PARROT_HAS_ICU */
     return PF_size_strlen(len + extra_len);


More information about the parrot-commits mailing list