msvcrt: Added _fgetwc_nolock implementation.

oldstable
Iván Matellanes 2014-10-28 14:43:47 +01:00 committed by Alexandre Julliard
parent 878b4a9280
commit 156684ba91
7 changed files with 22 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View 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*);