Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7acfe8fb
Commit
7acfe8fb
authored
Nov 30, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Use WEOF from public header.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a7c320d1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
51 deletions
+48
-51
console.c
dlls/msvcrt/console.c
+8
-10
file.c
dlls/msvcrt/file.c
+21
-21
mbcs.c
dlls/msvcrt/mbcs.c
+2
-2
msvcrt.h
dlls/msvcrt/msvcrt.h
+0
-1
scanf.h
dlls/msvcrt/scanf.h
+4
-4
string.c
dlls/msvcrt/string.c
+11
-11
wcs.c
dlls/msvcrt/wcs.c
+2
-2
No files found.
dlls/msvcrt/console.c
View file @
7acfe8fb
...
...
@@ -29,8 +29,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
msvcrt
);
/* MT */
#define LOCK_CONSOLE _lock(_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_out
=
INVALID_HANDLE_VALUE
;
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 */
void
msvcrt_init_console
(
void
)
...
...
@@ -222,12 +220,12 @@ int CDECL _getch(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
;
__MSVCRT_console_buffer_w
=
MSVCRT_
WEOF
;
__MSVCRT_console_buffer_w
=
WEOF
;
}
else
{
...
...
@@ -314,7 +312,7 @@ wchar_t CDECL _putwch_nolock(wchar_t c)
DWORD
count
;
if
(
WriteConsoleW
(
MSVCRT_console_out
,
&
c
,
1
,
&
count
,
NULL
)
&&
count
==
1
)
return
c
;
return
MSVCRT_
WEOF
;
return
WEOF
;
}
/*********************************************************************
...
...
@@ -360,7 +358,7 @@ wchar_t CDECL _getwche_nolock(void)
{
wchar_t
wch
;
wch
=
_getch_nolock
();
if
(
wch
==
MSVCRT_
WEOF
)
if
(
wch
==
WEOF
)
return
wch
;
return
_putwch_nolock
(
wch
);
}
...
...
@@ -443,8 +441,8 @@ int CDECL _ungetch(int c)
*/
wchar_t
CDECL
_ungetwch_nolock
(
wchar_t
c
)
{
wchar_t
retval
=
MSVCRT_
WEOF
;
if
(
c
!=
MSVCRT_WEOF
&&
__MSVCRT_console_buffer_w
==
MSVCRT_
WEOF
)
wchar_t
retval
=
WEOF
;
if
(
c
!=
WEOF
&&
__MSVCRT_console_buffer_w
==
WEOF
)
retval
=
__MSVCRT_console_buffer_w
=
c
;
return
retval
;
}
...
...
dlls/msvcrt/file.c
View file @
7acfe8fb
...
...
@@ -3824,7 +3824,7 @@ wint_t CDECL MSVCRT__fgetwc_nolock(MSVCRT_FILE* file)
for
(
p
=
(
char
*
)
&
ret
;
(
wint_t
*
)
p
<&
ret
+
1
;
p
++
)
{
ch
=
MSVCRT__fgetc_nolock
(
file
);
if
(
ch
==
MSVCRT_EOF
)
{
ret
=
MSVCRT_
WEOF
;
ret
=
WEOF
;
break
;
}
*
p
=
(
char
)
ch
;
...
...
@@ -3848,7 +3848,7 @@ wint_t CDECL MSVCRT__fgetwc_nolock(MSVCRT_FILE* file)
}
if
(
!
len
||
MSVCRT_mbtowc
(
&
ret
,
mbs
,
len
)
==-
1
)
ret
=
MSVCRT_
WEOF
;
ret
=
WEOF
;
}
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
)
{
wint_t
cc
=
MSVCRT_
WEOF
;
wint_t
cc
=
WEOF
;
wchar_t
*
buf_start
=
s
;
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
);
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
;
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
"
);
MSVCRT__unlock_file
(
file
);
return
NULL
;
}
if
((
cc
!=
MSVCRT_
WEOF
)
&&
(
size
>
1
))
if
((
cc
!=
WEOF
)
&&
(
size
>
1
))
*
s
++
=
cc
;
*
s
=
0
;
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
)
ret
=
wc
;
else
ret
=
MSVCRT_
WEOF
;
ret
=
WEOF
;
}
else
if
(
MSVCRT__fwrite_nolock
(
&
mwc
,
sizeof
(
mwc
),
1
,
file
)
==
1
)
{
ret
=
wc
;
}
else
{
ret
=
MSVCRT_
WEOF
;
ret
=
WEOF
;
}
return
ret
;
...
...
@@ -4681,10 +4681,10 @@ int CDECL MSVCRT_fputws(const wchar_t *s, MSVCRT_FILE* file)
tmp_buf
=
add_std_buffer
(
file
);
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
);
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
;
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
))
{
if
(
cc
!=
'\r'
)
...
...
@@ -4776,7 +4776,7 @@ wchar_t* CDECL MSVCRT__getws(wchar_t* buf)
}
MSVCRT__unlock_file
(
MSVCRT_stdin
);
if
((
cc
==
MSVCRT_
WEOF
)
&&
(
ws
==
buf
))
if
((
cc
==
WEOF
)
&&
(
ws
==
buf
))
{
TRACE
(
":nothing read
\n
"
);
return
NULL
;
...
...
@@ -4834,7 +4834,7 @@ int CDECL MSVCRT__putws(const wchar_t *s)
if
(
ret
>=
0
)
ret
=
MSVCRT__fputwc_nolock
(
'\n'
,
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
++
)
{
if
(
MSVCRT__fputwc_nolock
(
str
[
i
],
file
)
==
MSVCRT_
WEOF
)
{
if
(
MSVCRT__fputwc_nolock
(
str
[
i
],
file
)
==
WEOF
)
{
MSVCRT__unlock_file
(
file
);
return
-
1
;
}
...
...
@@ -5553,7 +5553,7 @@ wint_t CDECL MSVCRT_ungetwc(wint_t wc, MSVCRT_FILE * file)
{
wint_t
ret
;
if
(
!
MSVCRT_CHECK_PMT
(
file
!=
NULL
))
return
MSVCRT_
WEOF
;
if
(
!
MSVCRT_CHECK_PMT
(
file
!=
NULL
))
return
WEOF
;
MSVCRT__lock_file
(
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
;
if
(
!
MSVCRT_CHECK_PMT
(
file
!=
NULL
))
return
MSVCRT_
WEOF
;
if
(
wc
==
MSVCRT_
WEOF
)
return
MSVCRT_
WEOF
;
if
(
!
MSVCRT_CHECK_PMT
(
file
!=
NULL
))
return
WEOF
;
if
(
wc
==
WEOF
)
return
WEOF
;
if
((
get_ioinfo_nolock
(
file
->
_file
)
->
exflag
&
(
EF_UTF8
|
EF_UTF16
))
||
!
(
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
--
)
{
if
(
pp
[
i
]
!=
MSVCRT__ungetc_nolock
(
pp
[
i
],
file
))
return
MSVCRT_
WEOF
;
return
WEOF
;
}
}
else
{
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
);
if
(
len
==
-
1
)
return
MSVCRT_
WEOF
;
return
WEOF
;
for
(
len
--
;
len
>=
0
;
len
--
)
{
if
(
mbs
[
len
]
!=
MSVCRT__ungetc_nolock
(
mbs
[
len
],
file
))
return
MSVCRT_
WEOF
;
return
WEOF
;
}
}
...
...
dlls/msvcrt/mbcs.c
View file @
7acfe8fb
...
...
@@ -2445,12 +2445,12 @@ wint_t CDECL btowc(int c)
wchar_t
ret
;
if
(
c
==
MSVCRT_EOF
)
return
MSVCRT_
WEOF
;
return
WEOF
;
if
(
!
get_locinfo
()
->
lc_codepage
)
return
c
&
255
;
if
(
!
MultiByteToWideChar
(
get_locinfo
()
->
lc_codepage
,
MB_ERR_INVALID_CHARS
,
(
LPCSTR
)
&
letter
,
1
,
&
ret
,
1
))
return
MSVCRT_
WEOF
;
return
WEOF
;
return
ret
;
}
...
...
dlls/msvcrt/msvcrt.h
View file @
7acfe8fb
...
...
@@ -555,7 +555,6 @@ struct MSVCRT__stat64 {
#define MSVCRT__stati64 MSVCRT__stat32i64
#endif
#define MSVCRT_WEOF (wint_t)(0xFFFF)
#define MSVCRT_EOF (-1)
#define MSVCRT_TMP_MAX 0x7fff
#define MSVCRT_TMP_MAX_S 0x7fffffff
...
...
dlls/msvcrt/scanf.h
View file @
7acfe8fb
...
...
@@ -25,8 +25,8 @@
#ifdef WIDE_SCANF
#define _CHAR_ wchar_t
#define _EOF_
MSVCRT_
WEOF
#define _EOF_RET (short)
MSVCRT_
WEOF
#define _EOF_ WEOF
#define _EOF_RET (short)WEOF
#define _ISSPACE_(c) MSVCRT_iswspace(c)
#define _WIDE2SUPPORTED_(c) c
/* No conversion needed (wide to wide) */
#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
;
context
->
cur
=
_EOF_
;
if
(
!
context
->
length
)
return
MSVCRT_
WEOF
;
if
(
!
context
->
length
)
return
WEOF
;
if
(
context
->
unget
!=
_EOF_
)
{
context
->
cur
=
context
->
unget
;
context
->
unget
=
_EOF_
;
}
else
{
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
--
;
...
...
dlls/msvcrt/string.c
View file @
7acfe8fb
...
...
@@ -648,7 +648,7 @@ static struct fpnum fpnum_parse16(wchar_t get(void *ctx), void unget(void *ctx),
}
else
if
(
!
found_digit
)
{
if
(
nch
!=
MSVCRT_
WEOF
)
unget
(
ctx
);
if
(
nch
!=
WEOF
)
unget
(
ctx
);
unget
(
ctx
);
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
(
nch
!=
MSVCRT_
WEOF
)
unget
(
ctx
);
if
(
nch
!=
WEOF
)
unget
(
ctx
);
if
(
found_dp
)
unget
(
ctx
);
unget
(
ctx
);
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'
;
nch
=
get
(
ctx
);
}
if
((
nch
!=
MSVCRT_
WEOF
)
&&
(
nch
<
'0'
||
nch
>
'9'
))
unget
(
ctx
);
if
((
nch
!=
WEOF
)
&&
(
nch
<
'0'
||
nch
>
'9'
))
unget
(
ctx
);
e
*=
s
;
if
(
e
<
0
&&
exp
<
INT_MIN
-
e
)
exp
=
INT_MIN
;
else
if
(
e
>
0
&&
exp
>
INT_MAX
-
e
)
exp
=
INT_MAX
;
else
exp
+=
e
;
}
else
{
if
(
nch
!=
MSVCRT_
WEOF
)
unget
(
ctx
);
if
(
nch
!=
WEOF
)
unget
(
ctx
);
if
(
found_sign
)
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
;
if
(
nch
==
_nan
[
0
]
||
nch
==
MSVCRT__toupper
(
_nan
[
0
]))
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
=
get
(
ctx
);
matched
++
;
...
...
@@ -777,7 +777,7 @@ static struct fpnum fpnum_parse_bnum(wchar_t (*get)(void *ctx), void (*unget)(vo
int
keep
=
0
;
if
(
matched
>=
8
)
keep
=
8
;
else
if
(
matched
>=
3
)
keep
=
3
;
if
(
nch
!=
MSVCRT_
WEOF
)
unget
(
ctx
);
if
(
nch
!=
WEOF
)
unget
(
ctx
);
for
(;
matched
>
keep
;
matched
--
)
{
unget
(
ctx
);
}
...
...
@@ -866,7 +866,7 @@ static struct fpnum fpnum_parse_bnum(wchar_t (*get)(void *ctx), void (*unget)(vo
}
if
(
!
found_digit
)
{
if
(
nch
!=
MSVCRT_
WEOF
)
unget
(
ctx
);
if
(
nch
!=
WEOF
)
unget
(
ctx
);
if
(
found_dp
)
unget
(
ctx
);
if
(
found_sign
)
unget
(
ctx
);
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'
;
nch
=
get
(
ctx
);
}
if
(
nch
!=
MSVCRT_
WEOF
)
unget
(
ctx
);
if
(
nch
!=
WEOF
)
unget
(
ctx
);
e
*=
s
;
if
(
e
<
0
&&
dp
<
INT_MIN
-
e
)
dp
=
INT_MIN
;
else
if
(
e
>
0
&&
dp
>
INT_MAX
-
e
)
dp
=
INT_MAX
;
else
dp
+=
e
;
}
else
{
if
(
nch
!=
MSVCRT_
WEOF
)
unget
(
ctx
);
if
(
nch
!=
WEOF
)
unget
(
ctx
);
if
(
found_sign
)
unget
(
ctx
);
unget
(
ctx
);
}
}
else
if
(
nch
!=
MSVCRT_
WEOF
)
{
}
else
if
(
nch
!=
WEOF
)
{
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
)
{
const
char
**
p
=
ctx
;
if
(
!**
p
)
return
MSVCRT_
WEOF
;
if
(
!**
p
)
return
WEOF
;
return
*
(
*
p
)
++
;
}
...
...
dlls/msvcrt/wcs.c
View file @
7acfe8fb
...
...
@@ -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
)
{
const
wchar_t
**
p
=
ctx
;
if
(
!**
p
)
return
MSVCRT_
WEOF
;
if
(
!**
p
)
return
WEOF
;
return
*
(
*
p
)
++
;
}
...
...
@@ -2076,7 +2076,7 @@ INT CDECL MSVCRT__iswctype_l( wchar_t wc, wctype_t type, _locale_t locale )
{
WORD
ct
;
if
(
wc
==
MSVCRT_
WEOF
)
return
0
;
if
(
wc
==
WEOF
)
return
0
;
if
(
wc
<
256
)
return
MSVCRT__pwctype
[
wc
]
&
type
;
if
(
!
GetStringTypeW
(
CT_CTYPE1
,
&
wc
,
1
,
&
ct
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment