fix buggy scm_from_utf8_stringn (!)
authorAndy Wingo <wingo@pobox.com>
Tue, 14 Feb 2012 13:24:04 +0000 (14:24 +0100)
committerAndy Wingo <wingo@pobox.com>
Tue, 14 Feb 2012 13:24:32 +0000 (14:24 +0100)
* libguile/strings.c (scm_from_utf8_stringn): Embarassingly, my
  scm_from_utf8_stringn implementation was buggy for non-ascii
  characters, since October (41d1d984).  Fixed.  Will be tested with the
  next patch.

libguile/strings.c

index bdd0065..8c404a3 100644 (file)
@@ -1669,7 +1669,7 @@ scm_from_utf8_stringn (const char *str, size_t len)
 
       res = scm_i_make_string (char_len, &dst, 0);
 
-      for (i = 0, j = 0; i < len; i++, j++)
+      for (i = 0, j = 0; i < len; j++)
         {
           i += u8_mbtouc_unsafe (&c, ustr + i, len - i);
           dst[j] = (signed char) c;
@@ -1683,7 +1683,7 @@ scm_from_utf8_stringn (const char *str, size_t len)
 
       res = scm_i_make_wide_string (char_len, &dst, 0);
 
-      for (i = 0, j = 0; i < len; i++, j++)
+      for (i = 0, j = 0; i < len; j++)
         {
           i += u8_mbtouc_unsafe (&c, ustr + i, len - i);
           dst[j] = c;