]> 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:59:12 +0000 (11:59 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 28 Jun 2009 14:35:47 +0000 (16:35 +0200)
lib/ChangeLog
lib/linebreak.c

index 58fcffa6afd9bd852d1ba7f5502dd0ad9a876822..d5cfefa6ed6780607aa3170a755862ed162ddaf5 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-19  Bruno Haible  <haible@clisp.cons.org>
 
        * gettext-0.10.37 released.
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 ();
 }