1 --- vswprintf.c.orig 2004-11-25 11:38:36.000000000 -0800
2 +++ vswprintf.c 2005-02-24 15:20:20.000000000 -0800
5 __FBSDID("$FreeBSD: src/lib/libc/stdio/vswprintf.c,v 1.5 2004/04/07 09:55:05 tjr Exp $");
7 +#include "xlocale_private.h"
17 + locale_t loc = __current_locale();
25 + f._flags = __SWR | __SSTR | __SALC;
26 + f._bf._base = f._p = (unsigned char *)malloc(128);
27 + if (f._bf._base == NULL) {
31 + f._bf._size = f._w = 127; /* Leave room for the NUL */
34 + ret = __vfwprintf(&f, loc, fmt, ap);
42 + mbp = (char *)f._bf._base;
44 + * XXX Undo the conversion from wide characters to multibyte that
45 + * fputwc() did in __vfwprintf().
48 + if ((conv = mbsrtowcs_l(s, (const char **)&mbp, n, &mbs, loc)) == (size_t)-1) {
64 +vswprintf_l(wchar_t * __restrict s, size_t n, locale_t loc,
65 + const wchar_t * __restrict fmt, __va_list ap)
67 + static const mbstate_t initial;
70 + struct __sFILEX ext;
75 + NORMALIZE_LOCALE(loc);
80 f._bf._size = f._w = 127; /* Leave room for the NUL */
83 - ret = __vfwprintf(&f, fmt, ap);
84 + ret = __vfwprintf(&f, loc, fmt, ap);
93 + mbp = (char *)f._bf._base;
95 * XXX Undo the conversion from wide characters to multibyte that
96 * fputwc() did in __vfwprintf().
99 - if (mbsrtowcs(s, (const char **)&mbp, n, &mbs) == (size_t)-1) {
100 + if ((conv = mbsrtowcs_l(s, (const char **)&mbp, n, &mbs, loc)) == (size_t)-1) {
106 - if (s[n - 1] != L'\0') {