msvcrt: Use fputwc to output characters to file in fprintf functions.

This commit is contained in:
Piotr Caban 2013-01-11 11:19:08 +01:00 committed by Alexandre Julliard
parent 77f3ce0b10
commit a8c2ae1751
1 changed files with 19 additions and 1 deletions

View File

@ -4208,7 +4208,25 @@ static int puts_clbk_file_a(void *file, int len, const char *str)
static int puts_clbk_file_w(void *file, int len, const MSVCRT_wchar_t *str)
{
return MSVCRT_fwrite(str, sizeof(MSVCRT_wchar_t), len, file);
int i, ret;
MSVCRT__lock_file(file);
if(!(msvcrt_get_ioinfo(((MSVCRT_FILE*)file)->_file)->wxflag & WX_TEXT)) {
ret = MSVCRT_fwrite(str, sizeof(MSVCRT_wchar_t), len, file);
MSVCRT__unlock_file(file);
return ret;
}
for(i=0; i<len; i++) {
if(MSVCRT_fputwc(str[i], file) == MSVCRT_WEOF) {
MSVCRT__unlock_file(file);
return -1;
}
}
MSVCRT__unlock_file(file);
return len;
}
/*********************************************************************