summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2001-05-02 11:57:56 +0000
committerBruno Haible <bruno@clisp.org>2001-05-02 11:57:56 +0000
commit6b397893b9016a88cd56e4785c392bc84f387e12 (patch)
tree2d839eda9e990d78b0a5ef4b4beaf35c7aec4e5d
parent0ab2a856e517ec30496b136c97e4681bd9f43cb2 (diff)
downloadexternal_gettext-6b397893b9016a88cd56e4785c392bc84f387e12.zip
external_gettext-6b397893b9016a88cd56e4785c392bc84f387e12.tar.gz
external_gettext-6b397893b9016a88cd56e4785c392bc84f387e12.tar.bz2
Work around a glibc-2.1 iconv bug.
-rw-r--r--lib/ChangeLog5
-rw-r--r--lib/linebreak.c10
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 97ba8fc..3aea319 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -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.
diff --git a/lib/linebreak.c b/lib/linebreak.c
index 599e9ec..164f730 100644
--- a/lib/linebreak.c
+++ b/lib/linebreak.c
@@ -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 ();
}