Avoid a failure on strings longer than 4 KB.
authorBruno Haible <bruno@clisp.org>
Mon, 12 May 2003 09:49:42 +0000 (09:49 +0000)
committerBruno Haible <bruno@clisp.org>
Mon, 12 May 2003 09:49:42 +0000 (09:49 +0000)
lib/ChangeLog
lib/linebreak.c

index d7cea73..70951b4 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-10  Bruno Haible  <bruno@clisp.org>
+
+       * linebreak.c (iconv_string_length): Don't return -1 just because the
+       string is longer than 4 KB.
+
 2003-05-12  Jim Meyering  <jim@meyering.net>
 
        * strftime.c (my_strftime): Let the `-' (no-pad) flag affect
index 2274d16..c0ae082 100644 (file)
@@ -1379,7 +1379,7 @@ iconv_string_length (iconv_t cd, const char *s, size_t n)
       char *outptr = tmpbuf;
       size_t outsize = TMPBUFSIZE;
       size_t res = iconv (cd, (ICONV_CONST char **) &inptr, &insize, &outptr, &outsize);
-      if (res == (size_t)(-1))
+      if (res == (size_t)(-1) && errno != E2BIG)
         return (size_t)(-1);
       count += outptr - tmpbuf;
     }