Commit 156684ba authored by Iván Matellanes's avatar Iván Matellanes Committed by Alexandre Julliard

msvcrt: Added _fgetwc_nolock implementation.

parent 878b4a92
......@@ -802,7 +802,7 @@
@ cdecl _fflush_nolock(ptr) MSVCRT__fflush_nolock
@ cdecl _fgetc_nolock(ptr) MSVCRT__fgetc_nolock
@ cdecl _fgetchar() MSVCRT__fgetchar
@ stub _fgetwc_nolock
@ cdecl _fgetwc_nolock(ptr) MSVCRT__fgetwc_nolock
@ cdecl _fgetwchar() MSVCRT__fgetwchar
@ cdecl _filbuf(ptr) MSVCRT__filbuf
@ cdecl _filelength(long) MSVCRT__filelength
......
......@@ -1150,7 +1150,7 @@
@ cdecl _fflush_nolock(ptr) MSVCRT__fflush_nolock
@ cdecl _fgetc_nolock(ptr) MSVCRT__fgetc_nolock
@ cdecl _fgetchar() MSVCRT__fgetchar
@ stub _fgetwc_nolock
@ cdecl _fgetwc_nolock(ptr) MSVCRT__fgetwc_nolock
@ cdecl _fgetwchar() MSVCRT__fgetwchar
@ cdecl _filbuf(ptr) MSVCRT__filbuf
@ cdecl _filelength(long) MSVCRT__filelength
......
......@@ -469,7 +469,7 @@
@ cdecl _fflush_nolock(ptr) MSVCRT__fflush_nolock
@ cdecl _fgetc_nolock(ptr) MSVCRT__fgetc_nolock
@ cdecl _fgetchar() MSVCRT__fgetchar
@ stub _fgetwc_nolock
@ cdecl _fgetwc_nolock(ptr) MSVCRT__fgetwc_nolock
@ cdecl _fgetwchar() MSVCRT__fgetwchar
@ cdecl _filbuf(ptr) MSVCRT__filbuf
@ cdecl _filelength(long) MSVCRT__filelength
......
......@@ -451,7 +451,7 @@
@ cdecl _fflush_nolock(ptr) MSVCRT__fflush_nolock
@ cdecl _fgetc_nolock(ptr) MSVCRT__fgetc_nolock
@ cdecl _fgetchar() MSVCRT__fgetchar
@ stub _fgetwc_nolock
@ cdecl _fgetwc_nolock(ptr) MSVCRT__fgetwc_nolock
@ cdecl _fgetwchar() MSVCRT__fgetwchar
@ cdecl _filbuf(ptr) MSVCRT__filbuf
@ cdecl _filelength(long) MSVCRT__filelength
......
......@@ -3576,16 +3576,28 @@ char * CDECL MSVCRT_fgets(char *s, int size, MSVCRT_FILE* file)
MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file)
{
MSVCRT_wint_t ret;
int ch;
MSVCRT__lock_file(file);
ret = MSVCRT__fgetwc_nolock(file);
MSVCRT__unlock_file(file);
return ret;
}
/*********************************************************************
* _fgetwc_nolock (MSVCRT.@)
*/
MSVCRT_wint_t CDECL MSVCRT__fgetwc_nolock(MSVCRT_FILE* file)
{
MSVCRT_wint_t ret;
int ch;
if((msvcrt_get_ioinfo(file->_file)->exflag & (EF_UTF8 | EF_UTF16))
|| !(msvcrt_get_ioinfo(file->_file)->wxflag & WX_TEXT)) {
char *p;
for(p=(char*)&ret; (MSVCRT_wint_t*)p<&ret+1; p++) {
ch = MSVCRT_fgetc(file);
ch = MSVCRT__fgetc_nolock(file);
if(ch == MSVCRT_EOF) {
ret = MSVCRT_WEOF;
break;
......@@ -3596,11 +3608,11 @@ MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file)
char mbs[MSVCRT_MB_LEN_MAX];
int len = 0;
ch = MSVCRT_fgetc(file);
ch = MSVCRT__fgetc_nolock(file);
if(ch != MSVCRT_EOF) {
mbs[0] = (char)ch;
if(MSVCRT_isleadbyte((unsigned char)mbs[0])) {
ch = MSVCRT_fgetc(file);
ch = MSVCRT__fgetc_nolock(file);
if(ch != MSVCRT_EOF) {
mbs[1] = (char)ch;
len = 2;
......@@ -3614,7 +3626,6 @@ MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file)
ret = MSVCRT_WEOF;
}
MSVCRT__unlock_file(file);
return ret;
}
......
......@@ -919,6 +919,7 @@ int __cdecl MSVCRT_fgetc(MSVCRT_FILE*);
int __cdecl MSVCRT__fgetc_nolock(MSVCRT_FILE*);
int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*);
MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*);
MSVCRT_wint_t __cdecl MSVCRT__fgetwc_nolock(MSVCRT_FILE*);
MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*);
int __cdecl MSVCRT__fseeki64_nolock(MSVCRT_FILE*,__int64,int);
__int64 __cdecl MSVCRT__ftelli64(MSVCRT_FILE* file);
......
......@@ -196,6 +196,7 @@ unsigned int __cdecl _set_output_format(void);
#ifndef _WSTDIO_DEFINED
#define _WSTDIO_DEFINED
wint_t __cdecl _fgetwc_nolock(FILE*);
wint_t __cdecl _fgetwchar(void);
wint_t __cdecl _fputwchar(wint_t);
wchar_t* __cdecl _getws(wchar_t*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment