From: Bruno Haible Date: Wed, 2 May 2001 11:59:12 +0000 (+0000) Subject: Work around a glibc-2.1 iconv bug. X-Git-Tag: v0.10.38~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82b19b90ad4ef6f4c5fc714f10084b1de3aeb388;p=thirdparty%2Fgettext.git Work around a glibc-2.1 iconv bug. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 58fcffa6a..d5cfefa6e 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2001-05-02 Bruno Haible + + * linebreak.c (iconv_string_keeping_offsets): Work around a glibc-2.1 + bug. + 2001-04-19 Bruno Haible * gettext-0.10.37 released. diff --git a/lib/linebreak.c b/lib/linebreak.c index 599e9ecbb..164f730fd 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 (); }