msvcrt: Fixed _ungetwc implementation.

This commit is contained in:
Piotr Caban 2012-10-23 18:09:48 +02:00 committed by Alexandre Julliard
parent 82dd739064
commit 39345a1b15
1 changed files with 4 additions and 1 deletions

View File

@ -3995,9 +3995,12 @@ int CDECL MSVCRT_ungetc(int c, MSVCRT_FILE * file)
MSVCRT_wint_t CDECL MSVCRT_ungetwc(MSVCRT_wint_t wc, MSVCRT_FILE * file)
{
MSVCRT_wchar_t mwc = wc;
char * pp = (char *)&mwc;
unsigned char * pp = (unsigned char *)&mwc;
int i;
if (wc == MSVCRT_WEOF)
return MSVCRT_WEOF;
MSVCRT__lock_file(file);
for(i=sizeof(MSVCRT_wchar_t)-1;i>=0;i--) {
if(pp[i] != MSVCRT_ungetc(pp[i],file)) {