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

bacek at svn.parrot.org bacek at svn.parrot.org
Sat May 8 22:30:15 UTC 2010


Author: bacek
Date: Sat May  8 22:30:14 2010
New Revision: 46418
URL: https://trac.parrot.org/parrot/changeset/46418

Log:
Use str_lenght instead of str_byte_length in charset validation functions

Modified:
   trunk/src/string/charset/ascii.c
   trunk/src/string/charset/iso-8859-1.c
   trunk/src/string/charset/unicode.c

Modified: trunk/src/string/charset/ascii.c
==============================================================================
--- trunk/src/string/charset/ascii.c	Sat May  8 22:29:01 2010	(r46417)
+++ trunk/src/string/charset/ascii.c	Sat May  8 22:30:14 2010	(r46418)
@@ -647,11 +647,11 @@
 validate(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(validate)
-    UINTVAL offset;
+    INTVAL      offset;
     String_iter iter;
 
     ENCODING_ITER_INIT(interp, src, &iter);
-    for (offset = 0; offset < Parrot_str_byte_length(interp, src); ++offset) {
+    for (offset = 0; offset < Parrot_str_length(interp, src); ++offset) {
         const UINTVAL codepoint = iter.get_and_advance(interp, &iter);
         if (codepoint >= 0x80)
             return 0;

Modified: trunk/src/string/charset/iso-8859-1.c
==============================================================================
--- trunk/src/string/charset/iso-8859-1.c	Sat May  8 22:29:01 2010	(r46417)
+++ trunk/src/string/charset/iso-8859-1.c	Sat May  8 22:30:14 2010	(r46418)
@@ -525,9 +525,9 @@
 validate(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(validate)
-    UINTVAL offset;
+    INTVAL offset;
 
-    for (offset = 0; offset < Parrot_str_byte_length(interp, src); ++offset) {
+    for (offset = 0; offset < Parrot_str_length(interp, src); ++offset) {
         const UINTVAL codepoint = ENCODING_GET_CODEPOINT(interp, src, offset);
         if (codepoint >= 0x100)
             return 0;

Modified: trunk/src/string/charset/unicode.c
==============================================================================
--- trunk/src/string/charset/unicode.c	Sat May  8 22:29:01 2010	(r46417)
+++ trunk/src/string/charset/unicode.c	Sat May  8 22:30:14 2010	(r46418)
@@ -716,11 +716,11 @@
 validate(PARROT_INTERP, ARGIN(const STRING *src))
 {
     ASSERT_ARGS(validate)
-    UINTVAL     offset;
+    INTVAL      offset;
     String_iter iter;
 
     ENCODING_ITER_INIT(interp, src, &iter);
-    for (offset = 0; offset < Parrot_str_byte_length(interp, src); ++offset) {
+    for (offset = 0; offset < Parrot_str_length(interp, src); ++offset) {
         const UINTVAL codepoint = iter.get_and_advance(interp, &iter);
         /* Check for Unicode non-characters */
         if (codepoint >= 0xfdd0


More information about the parrot-commits mailing list