msvcrt: Use WEOF from public header.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a7c320d184
commit
7acfe8fb73
|
@ -29,8 +29,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* MT */
|
/* MT */
|
||||||
#define LOCK_CONSOLE _lock(_CONIO_LOCK)
|
#define LOCK_CONSOLE _lock(_CONIO_LOCK)
|
||||||
#define UNLOCK_CONSOLE _unlock(_CONIO_LOCK)
|
#define UNLOCK_CONSOLE _unlock(_CONIO_LOCK)
|
||||||
|
@ -38,7 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
||||||
static HANDLE MSVCRT_console_in = INVALID_HANDLE_VALUE;
|
static HANDLE MSVCRT_console_in = INVALID_HANDLE_VALUE;
|
||||||
static HANDLE MSVCRT_console_out= INVALID_HANDLE_VALUE;
|
static HANDLE MSVCRT_console_out= INVALID_HANDLE_VALUE;
|
||||||
static int __MSVCRT_console_buffer = MSVCRT_EOF;
|
static int __MSVCRT_console_buffer = MSVCRT_EOF;
|
||||||
static wchar_t __MSVCRT_console_buffer_w = MSVCRT_WEOF;
|
static wchar_t __MSVCRT_console_buffer_w = WEOF;
|
||||||
|
|
||||||
/* INTERNAL: Initialise console handles */
|
/* INTERNAL: Initialise console handles */
|
||||||
void msvcrt_init_console(void)
|
void msvcrt_init_console(void)
|
||||||
|
@ -222,12 +220,12 @@ int CDECL _getch(void)
|
||||||
*/
|
*/
|
||||||
wchar_t CDECL _getwch_nolock(void)
|
wchar_t CDECL _getwch_nolock(void)
|
||||||
{
|
{
|
||||||
wchar_t retval = MSVCRT_WEOF;
|
wchar_t retval = WEOF;
|
||||||
|
|
||||||
if (__MSVCRT_console_buffer_w != MSVCRT_WEOF)
|
if (__MSVCRT_console_buffer_w != WEOF)
|
||||||
{
|
{
|
||||||
retval = __MSVCRT_console_buffer_w;
|
retval = __MSVCRT_console_buffer_w;
|
||||||
__MSVCRT_console_buffer_w = MSVCRT_WEOF;
|
__MSVCRT_console_buffer_w = WEOF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -314,7 +312,7 @@ wchar_t CDECL _putwch_nolock(wchar_t c)
|
||||||
DWORD count;
|
DWORD count;
|
||||||
if (WriteConsoleW(MSVCRT_console_out, &c, 1, &count, NULL) && count==1)
|
if (WriteConsoleW(MSVCRT_console_out, &c, 1, &count, NULL) && count==1)
|
||||||
return c;
|
return c;
|
||||||
return MSVCRT_WEOF;
|
return WEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
@ -360,7 +358,7 @@ wchar_t CDECL _getwche_nolock(void)
|
||||||
{
|
{
|
||||||
wchar_t wch;
|
wchar_t wch;
|
||||||
wch = _getch_nolock();
|
wch = _getch_nolock();
|
||||||
if (wch == MSVCRT_WEOF)
|
if (wch == WEOF)
|
||||||
return wch;
|
return wch;
|
||||||
return _putwch_nolock(wch);
|
return _putwch_nolock(wch);
|
||||||
}
|
}
|
||||||
|
@ -443,8 +441,8 @@ int CDECL _ungetch(int c)
|
||||||
*/
|
*/
|
||||||
wchar_t CDECL _ungetwch_nolock(wchar_t c)
|
wchar_t CDECL _ungetwch_nolock(wchar_t c)
|
||||||
{
|
{
|
||||||
wchar_t retval = MSVCRT_WEOF;
|
wchar_t retval = WEOF;
|
||||||
if (c != MSVCRT_WEOF && __MSVCRT_console_buffer_w == MSVCRT_WEOF)
|
if (c != WEOF && __MSVCRT_console_buffer_w == WEOF)
|
||||||
retval = __MSVCRT_console_buffer_w = c;
|
retval = __MSVCRT_console_buffer_w = c;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3824,7 +3824,7 @@ wint_t CDECL MSVCRT__fgetwc_nolock(MSVCRT_FILE* file)
|
||||||
for(p=(char*)&ret; (wint_t*)p<&ret+1; p++) {
|
for(p=(char*)&ret; (wint_t*)p<&ret+1; p++) {
|
||||||
ch = MSVCRT__fgetc_nolock(file);
|
ch = MSVCRT__fgetc_nolock(file);
|
||||||
if(ch == MSVCRT_EOF) {
|
if(ch == MSVCRT_EOF) {
|
||||||
ret = MSVCRT_WEOF;
|
ret = WEOF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*p = (char)ch;
|
*p = (char)ch;
|
||||||
|
@ -3848,7 +3848,7 @@ wint_t CDECL MSVCRT__fgetwc_nolock(MSVCRT_FILE* file)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!len || MSVCRT_mbtowc(&ret, mbs, len)==-1)
|
if(!len || MSVCRT_mbtowc(&ret, mbs, len)==-1)
|
||||||
ret = MSVCRT_WEOF;
|
ret = WEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -3908,7 +3908,7 @@ wint_t CDECL MSVCRT_getwchar(void)
|
||||||
*/
|
*/
|
||||||
wchar_t * CDECL MSVCRT_fgetws(wchar_t *s, int size, MSVCRT_FILE* file)
|
wchar_t * CDECL MSVCRT_fgetws(wchar_t *s, int size, MSVCRT_FILE* file)
|
||||||
{
|
{
|
||||||
wint_t cc = MSVCRT_WEOF;
|
wint_t cc = WEOF;
|
||||||
wchar_t * buf_start = s;
|
wchar_t * buf_start = s;
|
||||||
|
|
||||||
TRACE(":file(%p) fd (%d) str (%p) len (%d)\n",
|
TRACE(":file(%p) fd (%d) str (%p) len (%d)\n",
|
||||||
|
@ -3916,18 +3916,18 @@ wchar_t * CDECL MSVCRT_fgetws(wchar_t *s, int size, MSVCRT_FILE* file)
|
||||||
|
|
||||||
MSVCRT__lock_file(file);
|
MSVCRT__lock_file(file);
|
||||||
|
|
||||||
while ((size >1) && (cc = MSVCRT__fgetwc_nolock(file)) != MSVCRT_WEOF && cc != '\n')
|
while ((size >1) && (cc = MSVCRT__fgetwc_nolock(file)) != WEOF && cc != '\n')
|
||||||
{
|
{
|
||||||
*s++ = cc;
|
*s++ = cc;
|
||||||
size --;
|
size --;
|
||||||
}
|
}
|
||||||
if ((cc == MSVCRT_WEOF) && (s == buf_start)) /* If nothing read, return 0*/
|
if ((cc == WEOF) && (s == buf_start)) /* If nothing read, return 0*/
|
||||||
{
|
{
|
||||||
TRACE(":nothing read\n");
|
TRACE(":nothing read\n");
|
||||||
MSVCRT__unlock_file(file);
|
MSVCRT__unlock_file(file);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((cc != MSVCRT_WEOF) && (size > 1))
|
if ((cc != WEOF) && (size > 1))
|
||||||
*s++ = cc;
|
*s++ = cc;
|
||||||
*s = 0;
|
*s = 0;
|
||||||
TRACE(":got %s\n", debugstr_w(buf_start));
|
TRACE(":got %s\n", debugstr_w(buf_start));
|
||||||
|
@ -4096,11 +4096,11 @@ wint_t CDECL MSVCRT__fputwc_nolock(wint_t wc, MSVCRT_FILE* file)
|
||||||
if(char_len!=-1 && MSVCRT__fwrite_nolock(buf, char_len, 1, file)==1)
|
if(char_len!=-1 && MSVCRT__fwrite_nolock(buf, char_len, 1, file)==1)
|
||||||
ret = wc;
|
ret = wc;
|
||||||
else
|
else
|
||||||
ret = MSVCRT_WEOF;
|
ret = WEOF;
|
||||||
}else if(MSVCRT__fwrite_nolock(&mwc, sizeof(mwc), 1, file) == 1) {
|
}else if(MSVCRT__fwrite_nolock(&mwc, sizeof(mwc), 1, file) == 1) {
|
||||||
ret = wc;
|
ret = wc;
|
||||||
}else {
|
}else {
|
||||||
ret = MSVCRT_WEOF;
|
ret = WEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -4681,10 +4681,10 @@ int CDECL MSVCRT_fputws(const wchar_t *s, MSVCRT_FILE* file)
|
||||||
|
|
||||||
tmp_buf = add_std_buffer(file);
|
tmp_buf = add_std_buffer(file);
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
if(MSVCRT__fputwc_nolock(s[i], file) == MSVCRT_WEOF) {
|
if(MSVCRT__fputwc_nolock(s[i], file) == WEOF) {
|
||||||
if(tmp_buf) remove_std_buffer(file);
|
if(tmp_buf) remove_std_buffer(file);
|
||||||
MSVCRT__unlock_file(file);
|
MSVCRT__unlock_file(file);
|
||||||
return MSVCRT_WEOF;
|
return WEOF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4768,7 +4768,7 @@ wchar_t* CDECL MSVCRT__getws(wchar_t* buf)
|
||||||
wchar_t* ws = buf;
|
wchar_t* ws = buf;
|
||||||
|
|
||||||
MSVCRT__lock_file(MSVCRT_stdin);
|
MSVCRT__lock_file(MSVCRT_stdin);
|
||||||
for (cc = MSVCRT__fgetwc_nolock(MSVCRT_stdin); cc != MSVCRT_WEOF && cc != '\n';
|
for (cc = MSVCRT__fgetwc_nolock(MSVCRT_stdin); cc != WEOF && cc != '\n';
|
||||||
cc = MSVCRT__fgetwc_nolock(MSVCRT_stdin))
|
cc = MSVCRT__fgetwc_nolock(MSVCRT_stdin))
|
||||||
{
|
{
|
||||||
if (cc != '\r')
|
if (cc != '\r')
|
||||||
|
@ -4776,7 +4776,7 @@ wchar_t* CDECL MSVCRT__getws(wchar_t* buf)
|
||||||
}
|
}
|
||||||
MSVCRT__unlock_file(MSVCRT_stdin);
|
MSVCRT__unlock_file(MSVCRT_stdin);
|
||||||
|
|
||||||
if ((cc == MSVCRT_WEOF) && (ws == buf))
|
if ((cc == WEOF) && (ws == buf))
|
||||||
{
|
{
|
||||||
TRACE(":nothing read\n");
|
TRACE(":nothing read\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -4834,7 +4834,7 @@ int CDECL MSVCRT__putws(const wchar_t *s)
|
||||||
if(ret >= 0)
|
if(ret >= 0)
|
||||||
ret = MSVCRT__fputwc_nolock('\n', MSVCRT_stdout);
|
ret = MSVCRT__fputwc_nolock('\n', MSVCRT_stdout);
|
||||||
MSVCRT__unlock_file(MSVCRT_stdout);
|
MSVCRT__unlock_file(MSVCRT_stdout);
|
||||||
return ret >= 0 ? 0 : MSVCRT_WEOF;
|
return ret >= 0 ? 0 : WEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
@ -5140,7 +5140,7 @@ static int puts_clbk_file_w(void *file, int len, const wchar_t *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<len; i++) {
|
for(i=0; i<len; i++) {
|
||||||
if(MSVCRT__fputwc_nolock(str[i], file) == MSVCRT_WEOF) {
|
if(MSVCRT__fputwc_nolock(str[i], file) == WEOF) {
|
||||||
MSVCRT__unlock_file(file);
|
MSVCRT__unlock_file(file);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -5553,7 +5553,7 @@ wint_t CDECL MSVCRT_ungetwc(wint_t wc, MSVCRT_FILE * file)
|
||||||
{
|
{
|
||||||
wint_t ret;
|
wint_t ret;
|
||||||
|
|
||||||
if(!MSVCRT_CHECK_PMT(file != NULL)) return MSVCRT_WEOF;
|
if(!MSVCRT_CHECK_PMT(file != NULL)) return WEOF;
|
||||||
|
|
||||||
MSVCRT__lock_file(file);
|
MSVCRT__lock_file(file);
|
||||||
ret = MSVCRT__ungetwc_nolock(wc, file);
|
ret = MSVCRT__ungetwc_nolock(wc, file);
|
||||||
|
@ -5569,9 +5569,9 @@ wint_t CDECL MSVCRT__ungetwc_nolock(wint_t wc, MSVCRT_FILE * file)
|
||||||
{
|
{
|
||||||
wchar_t mwc = wc;
|
wchar_t mwc = wc;
|
||||||
|
|
||||||
if(!MSVCRT_CHECK_PMT(file != NULL)) return MSVCRT_WEOF;
|
if(!MSVCRT_CHECK_PMT(file != NULL)) return WEOF;
|
||||||
if (wc == MSVCRT_WEOF)
|
if (wc == WEOF)
|
||||||
return MSVCRT_WEOF;
|
return WEOF;
|
||||||
|
|
||||||
if((get_ioinfo_nolock(file->_file)->exflag & (EF_UTF8 | EF_UTF16))
|
if((get_ioinfo_nolock(file->_file)->exflag & (EF_UTF8 | EF_UTF16))
|
||||||
|| !(get_ioinfo_nolock(file->_file)->wxflag & WX_TEXT)) {
|
|| !(get_ioinfo_nolock(file->_file)->wxflag & WX_TEXT)) {
|
||||||
|
@ -5580,7 +5580,7 @@ wint_t CDECL MSVCRT__ungetwc_nolock(wint_t wc, MSVCRT_FILE * file)
|
||||||
|
|
||||||
for(i=sizeof(wchar_t)-1;i>=0;i--) {
|
for(i=sizeof(wchar_t)-1;i>=0;i--) {
|
||||||
if(pp[i] != MSVCRT__ungetc_nolock(pp[i],file))
|
if(pp[i] != MSVCRT__ungetc_nolock(pp[i],file))
|
||||||
return MSVCRT_WEOF;
|
return WEOF;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
char mbs[MB_LEN_MAX];
|
char mbs[MB_LEN_MAX];
|
||||||
|
@ -5588,11 +5588,11 @@ wint_t CDECL MSVCRT__ungetwc_nolock(wint_t wc, MSVCRT_FILE * file)
|
||||||
|
|
||||||
len = MSVCRT_wctomb(mbs, mwc);
|
len = MSVCRT_wctomb(mbs, mwc);
|
||||||
if(len == -1)
|
if(len == -1)
|
||||||
return MSVCRT_WEOF;
|
return WEOF;
|
||||||
|
|
||||||
for(len--; len>=0; len--) {
|
for(len--; len>=0; len--) {
|
||||||
if(mbs[len] != MSVCRT__ungetc_nolock(mbs[len], file))
|
if(mbs[len] != MSVCRT__ungetc_nolock(mbs[len], file))
|
||||||
return MSVCRT_WEOF;
|
return WEOF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2445,12 +2445,12 @@ wint_t CDECL btowc(int c)
|
||||||
wchar_t ret;
|
wchar_t ret;
|
||||||
|
|
||||||
if(c == MSVCRT_EOF)
|
if(c == MSVCRT_EOF)
|
||||||
return MSVCRT_WEOF;
|
return WEOF;
|
||||||
if(!get_locinfo()->lc_codepage)
|
if(!get_locinfo()->lc_codepage)
|
||||||
return c & 255;
|
return c & 255;
|
||||||
if(!MultiByteToWideChar(get_locinfo()->lc_codepage,
|
if(!MultiByteToWideChar(get_locinfo()->lc_codepage,
|
||||||
MB_ERR_INVALID_CHARS, (LPCSTR)&letter, 1, &ret, 1))
|
MB_ERR_INVALID_CHARS, (LPCSTR)&letter, 1, &ret, 1))
|
||||||
return MSVCRT_WEOF;
|
return WEOF;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -555,7 +555,6 @@ struct MSVCRT__stat64 {
|
||||||
#define MSVCRT__stati64 MSVCRT__stat32i64
|
#define MSVCRT__stati64 MSVCRT__stat32i64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MSVCRT_WEOF (wint_t)(0xFFFF)
|
|
||||||
#define MSVCRT_EOF (-1)
|
#define MSVCRT_EOF (-1)
|
||||||
#define MSVCRT_TMP_MAX 0x7fff
|
#define MSVCRT_TMP_MAX 0x7fff
|
||||||
#define MSVCRT_TMP_MAX_S 0x7fffffff
|
#define MSVCRT_TMP_MAX_S 0x7fffffff
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
#ifdef WIDE_SCANF
|
#ifdef WIDE_SCANF
|
||||||
#define _CHAR_ wchar_t
|
#define _CHAR_ wchar_t
|
||||||
#define _EOF_ MSVCRT_WEOF
|
#define _EOF_ WEOF
|
||||||
#define _EOF_RET (short)MSVCRT_WEOF
|
#define _EOF_RET (short)WEOF
|
||||||
#define _ISSPACE_(c) MSVCRT_iswspace(c)
|
#define _ISSPACE_(c) MSVCRT_iswspace(c)
|
||||||
#define _WIDE2SUPPORTED_(c) c /* No conversion needed (wide to wide) */
|
#define _WIDE2SUPPORTED_(c) c /* No conversion needed (wide to wide) */
|
||||||
#define _CHAR2SUPPORTED_(c) c /* FIXME: convert char to wide char */
|
#define _CHAR2SUPPORTED_(c) c /* FIXME: convert char to wide char */
|
||||||
|
@ -167,13 +167,13 @@ static wchar_t _STRTOD_NAME_(strtod_scanf_get)(void *ctx)
|
||||||
struct _STRTOD_NAME_(strtod_scanf_ctx) *context = ctx;
|
struct _STRTOD_NAME_(strtod_scanf_ctx) *context = ctx;
|
||||||
|
|
||||||
context->cur = _EOF_;
|
context->cur = _EOF_;
|
||||||
if (!context->length) return MSVCRT_WEOF;
|
if (!context->length) return WEOF;
|
||||||
if (context->unget != _EOF_) {
|
if (context->unget != _EOF_) {
|
||||||
context->cur = context->unget;
|
context->cur = context->unget;
|
||||||
context->unget = _EOF_;
|
context->unget = _EOF_;
|
||||||
} else {
|
} else {
|
||||||
context->cur = _GETC_FUNC_(context->file);
|
context->cur = _GETC_FUNC_(context->file);
|
||||||
if (context->cur == _EOF_) return MSVCRT_WEOF;
|
if (context->cur == _EOF_) return WEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->length > 0) context->length--;
|
if (context->length > 0) context->length--;
|
||||||
|
|
|
@ -648,7 +648,7 @@ static struct fpnum fpnum_parse16(wchar_t get(void *ctx), void unget(void *ctx),
|
||||||
}
|
}
|
||||||
else if (!found_digit)
|
else if (!found_digit)
|
||||||
{
|
{
|
||||||
if(nch!=MSVCRT_WEOF) unget(ctx);
|
if(nch!=WEOF) unget(ctx);
|
||||||
unget(ctx);
|
unget(ctx);
|
||||||
return fpnum(0, 0, 0, 0);
|
return fpnum(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,7 @@ static struct fpnum fpnum_parse16(wchar_t get(void *ctx), void unget(void *ctx),
|
||||||
|
|
||||||
if (!found_digit)
|
if (!found_digit)
|
||||||
{
|
{
|
||||||
if (nch != MSVCRT_WEOF) unget(ctx);
|
if (nch != WEOF) unget(ctx);
|
||||||
if (found_dp) unget(ctx);
|
if (found_dp) unget(ctx);
|
||||||
unget(ctx);
|
unget(ctx);
|
||||||
return fpnum(0, 0, 0, 0);
|
return fpnum(0, 0, 0, 0);
|
||||||
|
@ -706,14 +706,14 @@ static struct fpnum fpnum_parse16(wchar_t get(void *ctx), void unget(void *ctx),
|
||||||
e = e*10+nch-'0';
|
e = e*10+nch-'0';
|
||||||
nch = get(ctx);
|
nch = get(ctx);
|
||||||
}
|
}
|
||||||
if((nch!=MSVCRT_WEOF) && (nch < '0' || nch > '9')) unget(ctx);
|
if((nch!=WEOF) && (nch < '0' || nch > '9')) unget(ctx);
|
||||||
e *= s;
|
e *= s;
|
||||||
|
|
||||||
if(e<0 && exp<INT_MIN-e) exp = INT_MIN;
|
if(e<0 && exp<INT_MIN-e) exp = INT_MIN;
|
||||||
else if(e>0 && exp>INT_MAX-e) exp = INT_MAX;
|
else if(e>0 && exp>INT_MAX-e) exp = INT_MAX;
|
||||||
else exp += e;
|
else exp += e;
|
||||||
} else {
|
} else {
|
||||||
if(nch != MSVCRT_WEOF) unget(ctx);
|
if(nch != WEOF) unget(ctx);
|
||||||
if(found_sign) unget(ctx);
|
if(found_sign) unget(ctx);
|
||||||
unget(ctx);
|
unget(ctx);
|
||||||
}
|
}
|
||||||
|
@ -768,7 +768,7 @@ static struct fpnum fpnum_parse_bnum(wchar_t (*get)(void *ctx), void (*unget)(vo
|
||||||
str_match = _infinity;
|
str_match = _infinity;
|
||||||
if(nch == _nan[0] || nch == MSVCRT__toupper(_nan[0]))
|
if(nch == _nan[0] || nch == MSVCRT__toupper(_nan[0]))
|
||||||
str_match = _nan;
|
str_match = _nan;
|
||||||
while(str_match && nch != MSVCRT_WEOF &&
|
while(str_match && nch != WEOF &&
|
||||||
(nch == str_match[matched] || nch == MSVCRT__toupper(str_match[matched]))) {
|
(nch == str_match[matched] || nch == MSVCRT__toupper(str_match[matched]))) {
|
||||||
nch = get(ctx);
|
nch = get(ctx);
|
||||||
matched++;
|
matched++;
|
||||||
|
@ -777,7 +777,7 @@ static struct fpnum fpnum_parse_bnum(wchar_t (*get)(void *ctx), void (*unget)(vo
|
||||||
int keep = 0;
|
int keep = 0;
|
||||||
if(matched >= 8) keep = 8;
|
if(matched >= 8) keep = 8;
|
||||||
else if(matched >= 3) keep = 3;
|
else if(matched >= 3) keep = 3;
|
||||||
if(nch != MSVCRT_WEOF) unget(ctx);
|
if(nch != WEOF) unget(ctx);
|
||||||
for (; matched > keep; matched--) {
|
for (; matched > keep; matched--) {
|
||||||
unget(ctx);
|
unget(ctx);
|
||||||
}
|
}
|
||||||
|
@ -866,7 +866,7 @@ static struct fpnum fpnum_parse_bnum(wchar_t (*get)(void *ctx), void (*unget)(vo
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found_digit) {
|
if(!found_digit) {
|
||||||
if(nch != MSVCRT_WEOF) unget(ctx);
|
if(nch != WEOF) unget(ctx);
|
||||||
if(found_dp) unget(ctx);
|
if(found_dp) unget(ctx);
|
||||||
if(found_sign) unget(ctx);
|
if(found_sign) unget(ctx);
|
||||||
return fpnum(0, 0, 0, 0);
|
return fpnum(0, 0, 0, 0);
|
||||||
|
@ -895,18 +895,18 @@ static struct fpnum fpnum_parse_bnum(wchar_t (*get)(void *ctx), void (*unget)(vo
|
||||||
e = e*10+nch-'0';
|
e = e*10+nch-'0';
|
||||||
nch = get(ctx);
|
nch = get(ctx);
|
||||||
}
|
}
|
||||||
if(nch != MSVCRT_WEOF) unget(ctx);
|
if(nch != WEOF) unget(ctx);
|
||||||
e *= s;
|
e *= s;
|
||||||
|
|
||||||
if(e<0 && dp<INT_MIN-e) dp = INT_MIN;
|
if(e<0 && dp<INT_MIN-e) dp = INT_MIN;
|
||||||
else if(e>0 && dp>INT_MAX-e) dp = INT_MAX;
|
else if(e>0 && dp>INT_MAX-e) dp = INT_MAX;
|
||||||
else dp += e;
|
else dp += e;
|
||||||
} else {
|
} else {
|
||||||
if(nch != MSVCRT_WEOF) unget(ctx);
|
if(nch != WEOF) unget(ctx);
|
||||||
if(found_sign) unget(ctx);
|
if(found_sign) unget(ctx);
|
||||||
unget(ctx);
|
unget(ctx);
|
||||||
}
|
}
|
||||||
} else if(nch != MSVCRT_WEOF) {
|
} else if(nch != WEOF) {
|
||||||
unget(ctx);
|
unget(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -991,7 +991,7 @@ struct fpnum fpnum_parse(wchar_t (*get)(void *ctx), void (*unget)(void *ctx),
|
||||||
static wchar_t strtod_str_get(void *ctx)
|
static wchar_t strtod_str_get(void *ctx)
|
||||||
{
|
{
|
||||||
const char **p = ctx;
|
const char **p = ctx;
|
||||||
if (!**p) return MSVCRT_WEOF;
|
if (!**p) return WEOF;
|
||||||
return *(*p)++;
|
return *(*p)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -533,7 +533,7 @@ int CDECL MSVCRT__wcsncoll(const wchar_t* str1, const wchar_t* str2, size_t coun
|
||||||
static wchar_t strtod_wstr_get(void *ctx)
|
static wchar_t strtod_wstr_get(void *ctx)
|
||||||
{
|
{
|
||||||
const wchar_t **p = ctx;
|
const wchar_t **p = ctx;
|
||||||
if (!**p) return MSVCRT_WEOF;
|
if (!**p) return WEOF;
|
||||||
return *(*p)++;
|
return *(*p)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2076,7 +2076,7 @@ INT CDECL MSVCRT__iswctype_l( wchar_t wc, wctype_t type, _locale_t locale )
|
||||||
{
|
{
|
||||||
WORD ct;
|
WORD ct;
|
||||||
|
|
||||||
if (wc == MSVCRT_WEOF) return 0;
|
if (wc == WEOF) return 0;
|
||||||
if (wc < 256) return MSVCRT__pwctype[wc] & type;
|
if (wc < 256) return MSVCRT__pwctype[wc] & type;
|
||||||
|
|
||||||
if (!GetStringTypeW(CT_CTYPE1, &wc, 1, &ct))
|
if (!GetStringTypeW(CT_CTYPE1, &wc, 1, &ct))
|
||||||
|
|
Loading…
Reference in New Issue