mirror of
https://github.com/reactos/reactos.git
synced 2024-09-06 10:52:52 +00:00
Fix Unicode output on the console, broken in 33866, fixed in 34042, broken again in 38185, fixed again in 51058 and finally broken yet another time since 54651...
I think this history deserves champagne and forceful warning comments, which have been added. Simple solution: Don't blindly sync Wine code! #resolve #CORE-6495 svn path=/trunk/; revision=57747
This commit is contained in:
parent
392231efa4
commit
80a52b6aa4
|
@ -7,6 +7,14 @@
|
||||||
* Ported to ReactOS by Aleksey Bragin (aleksey@reactos.org)
|
* Ported to ReactOS by Aleksey Bragin (aleksey@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*********************************************
|
||||||
|
* This file contains ReactOS changes!!
|
||||||
|
* Don't blindly sync it with Wine code!
|
||||||
|
*
|
||||||
|
* If you break Unicode output on the console again, please update this counter:
|
||||||
|
* int hours_wasted_on_this = 42;
|
||||||
|
*********************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* msvcrt.dll file functions
|
* msvcrt.dll file functions
|
||||||
*
|
*
|
||||||
|
@ -2505,13 +2513,38 @@ size_t CDECL fwrite(const void *ptr, size_t size, size_t nmemb, FILE* file)
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* fputwc (MSVCRT.@)
|
* fputwc (MSVCRT.@)
|
||||||
|
* FORKED for ReactOS, don't sync with Wine!
|
||||||
|
* References:
|
||||||
|
* - http://jira.reactos.org/browse/CORE-6495
|
||||||
|
* - http://bugs.winehq.org/show_bug.cgi?id=8598
|
||||||
*/
|
*/
|
||||||
wint_t CDECL fputwc(wint_t wc, FILE* file)
|
wint_t CDECL fputwc(wchar_t c, FILE* stream)
|
||||||
{
|
{
|
||||||
wchar_t mwc=wc;
|
/* If this is a real file stream (and not some temporary one for
|
||||||
if (fwrite( &mwc, sizeof(mwc), 1, file) != 1)
|
sprintf-like functions), check whether it is opened in text mode.
|
||||||
|
In this case, we have to perform an implicit conversion to ANSI. */
|
||||||
|
if (!(stream->_flag & _IOSTRG) && get_ioinfo(stream->_file)->wxflag & WX_TEXT)
|
||||||
|
{
|
||||||
|
/* Convert to multibyte in text mode */
|
||||||
|
char mbc[MB_LEN_MAX];
|
||||||
|
int mb_return;
|
||||||
|
|
||||||
|
mb_return = wctomb(mbc, c);
|
||||||
|
|
||||||
|
if(mb_return == -1)
|
||||||
return WEOF;
|
return WEOF;
|
||||||
return wc;
|
|
||||||
|
/* Output all characters */
|
||||||
|
if (fwrite(mbc, mb_return, 1, stream) != 1)
|
||||||
|
return WEOF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (fwrite(&c, sizeof(c), 1, stream) != 1)
|
||||||
|
return WEOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
Loading…
Reference in a new issue