From: Bruno Haible Date: Fri, 1 Jan 2010 02:04:02 +0000 (+0100) Subject: Avoid passing an 'rpl_mbstate_t *' to the system's wcrtomb. X-Git-Tag: v0.18~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79055a21a68c1ed45ac68ee193fa65827a6d419c;p=thirdparty%2Fgettext.git Avoid passing an 'rpl_mbstate_t *' to the system's wcrtomb. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index 654b16cfb..ab35972cd 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,8 @@ +2010-01-01 Bruno Haible + + * vasnprintf.c (VASNPRINTF): If GNULIB_defined_mbstate_t is defined, + use wctomb instead of wcrtomb. + 2009-12-26 Bruno Haible * libintl.rc: Update. diff --git a/gettext-runtime/intl/vasnprintf.c b/gettext-runtime/intl/vasnprintf.c index 08949b428..295dbc46b 100644 --- a/gettext-runtime/intl/vasnprintf.c +++ b/gettext-runtime/intl/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2009 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -2368,7 +2368,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* Use only as many wide characters as needed to produce at most PRECISION bytes, from the left. */ -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2382,7 +2382,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg_end == 0) /* Found the terminating null wide character. */ break; -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg_end, &state); # else count = wctomb (cbuf, *arg_end); @@ -2413,7 +2413,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* Use the entire string, and count the number of bytes. */ -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2427,7 +2427,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg_end == 0) /* Found the terminating null wide character. */ break; -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg_end, &state); # else count = wctomb (cbuf, *arg_end); @@ -2465,7 +2465,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { TCHAR_T *tmpptr = tmpsrc; size_t remaining; -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2476,7 +2476,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg == 0) abort (); -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg, &state); # else count = wctomb (cbuf, *arg); @@ -2546,7 +2546,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* We know the number of bytes in advance. */ size_t remaining; -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2558,7 +2558,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg == 0) abort (); -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg, &state); # else count = wctomb (cbuf, *arg); @@ -2576,7 +2576,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } else { -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2587,7 +2587,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg == 0) abort (); -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg, &state); # else count = wctomb (cbuf, *arg); diff --git a/gettext-runtime/libasprintf/ChangeLog b/gettext-runtime/libasprintf/ChangeLog index 1bd01bc8d..79761d257 100644 --- a/gettext-runtime/libasprintf/ChangeLog +++ b/gettext-runtime/libasprintf/ChangeLog @@ -1,3 +1,8 @@ +2010-01-01 Bruno Haible + + * vasnprintf.c (VASNPRINTF): If GNULIB_defined_mbstate_t is defined, + use wctomb instead of wcrtomb. + 2009-12-12 Bruno Haible * *.h, *.c: Untabify. diff --git a/gettext-runtime/libasprintf/vasnprintf.c b/gettext-runtime/libasprintf/vasnprintf.c index 08949b428..295dbc46b 100644 --- a/gettext-runtime/libasprintf/vasnprintf.c +++ b/gettext-runtime/libasprintf/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2009 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -2368,7 +2368,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* Use only as many wide characters as needed to produce at most PRECISION bytes, from the left. */ -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2382,7 +2382,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg_end == 0) /* Found the terminating null wide character. */ break; -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg_end, &state); # else count = wctomb (cbuf, *arg_end); @@ -2413,7 +2413,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* Use the entire string, and count the number of bytes. */ -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2427,7 +2427,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg_end == 0) /* Found the terminating null wide character. */ break; -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg_end, &state); # else count = wctomb (cbuf, *arg_end); @@ -2465,7 +2465,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { TCHAR_T *tmpptr = tmpsrc; size_t remaining; -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2476,7 +2476,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg == 0) abort (); -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg, &state); # else count = wctomb (cbuf, *arg); @@ -2546,7 +2546,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* We know the number of bytes in advance. */ size_t remaining; -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2558,7 +2558,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg == 0) abort (); -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg, &state); # else count = wctomb (cbuf, *arg); @@ -2576,7 +2576,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } else { -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2587,7 +2587,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (*arg == 0) abort (); -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t count = wcrtomb (cbuf, *arg, &state); # else count = wctomb (cbuf, *arg);