- Update fputwc implementation to current wine sources

- Fixes 23 msvcrt file winetests

svn path=/trunk/; revision=38185
This commit is contained in:
Gregor Schneider 2008-12-19 16:57:48 +00:00
parent 855ea53e48
commit f45ee646df

View file

@ -2167,27 +2167,9 @@ size_t CDECL fwrite(const void *ptr, size_t size, size_t nmemb, FILE* file)
*/
wint_t CDECL fputwc(wint_t wc, FILE* file)
{
if (file->_flag & _IOBINARY)
{
if (fwrite(&wc, sizeof(wc), 1, file) != 1)
wchar_t mwc=wc;
if (fwrite( &mwc, sizeof(mwc), 1, file) != 1)
return WEOF;
}
else
{
/* Convert to multibyte in text mode */
char mbc[MB_LEN_MAX];
int mb_return;
mb_return = wctomb(mbc, wc);
if(mb_return == -1)
return WEOF;
/* Output all characters */
if (fwrite(mbc, mb_return, 1, file) != 1)
return WEOF;
}
return wc;
}