]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Work around a glibc-2.1 iconv bug.
authorBruno Haible <bruno@clisp.org>
Wed, 2 May 2001 11:57:56 +0000 (11:57 +0000)
committerBruno Haible <bruno@clisp.org>
Wed, 2 May 2001 11:57:56 +0000 (11:57 +0000)
lib/ChangeLog
lib/linebreak.c

index 97ba8fc995d8401e92a969d6f7dd81a5e79efcbd..3aea31995de090ff095a855cace5374e8e6c17a3 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-02  Bruno Haible  <haible@clisp.cons.org>
+
+       * linebreak.c (iconv_string_keeping_offsets): Work around a glibc-2.1
+       bug.
+
 2001-04-30  Bruno Haible  <haible@clisp.cons.org>
 
        Silence "gcc -Wall -Wwrite-strings" warnings.
index 599e9ecbbcdcf257af916c8c40926a1c4a8fc37d..164f730fdbcf35c18efc2729c3ff8fc114252ab3 100644 (file)
@@ -1630,6 +1630,12 @@ iconv_string_keeping_offsets (cd, s, n, offtable, t, m)
   const char *inptr;
   char *outptr;
   size_t outsize;
+  /* Avoid glibc-2.1 bug.  */
+#if !defined _LIBICONV_VERSION && (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1)
+  const size_t extra = 1;
+#else
+  const size_t extra = 0;
+#endif
 
   for (i = 0; i < n; i++)
     offtable[i] = (size_t)(-1);
@@ -1637,7 +1643,7 @@ iconv_string_keeping_offsets (cd, s, n, offtable, t, m)
   s_end = s + n;
   inptr = s;
   outptr = t;
-  outsize = m;
+  outsize = m + extra;
   while (inptr < s_end)
     {
       size_t insize;
@@ -1664,7 +1670,7 @@ iconv_string_keeping_offsets (cd, s, n, offtable, t, m)
     abort ();
 #endif
   /* We should have produced exactly m output bytes.  */
-  if (outsize != 0)
+  if (outsize != extra)
     abort ();
 }