On Solaris 8, I'm seeing these warnings: "./vasnprintf.c", line 2385: warning: argument #3 is incompatible with prototype: "./vasnprintf.c", line 2430: warning: argument #3 is incompatible with prototype: "./vasnprintf.c", line 2479: warning: argument #3 is incompatible with prototype: "./vasnprintf.c", line 2561: warning: argument #3 is incompatible with prototype: "./vasnprintf.c", line 2590: warning: argument #3 is incompatible with prototype:
The reason is that the system's wcrtomb function is being called with a parameter that points to an 'rpl_mbstate_t' (rather than an 'mbstate_t'). This could be dangerous, because sizeof (rpl_mbstate_t) < sizeof (mbstate_t). This fixes it: 2010-01-01 Bruno Haible <[email protected]> vasnprintf: Avoid passing an 'rpl_mbstate_t *' to the system's wcrtomb. * lib/vasnprintf.c (VASNPRINTF): If GNULIB_defined_mbstate_t is defined, use wctomb instead of wcrtomb. --- lib/vasnprintf.c.orig Fri Jan 1 02:54:06 2010 +++ lib/vasnprintf.c Fri Jan 1 02:51:15 2010 @@ -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 General Public License as published by @@ -2367,7 +2367,7 @@ { /* 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 @@ -2381,7 +2381,7 @@ 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); @@ -2412,7 +2412,7 @@ { /* 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 @@ -2426,7 +2426,7 @@ 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); @@ -2464,7 +2464,7 @@ { 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 @@ -2475,7 +2475,7 @@ 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); @@ -2545,7 +2545,7 @@ { /* 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 @@ -2557,7 +2557,7 @@ 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); @@ -2575,7 +2575,7 @@ } else { -# if HAVE_WCRTOMB +# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t mbstate_t state; memset (&state, '\0', sizeof (mbstate_t)); # endif @@ -2586,7 +2586,7 @@ 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);
