Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
6122c2ba
Commit
6122c2ba
authored
Dec 30, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Dec 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Convert data to multibyte encoding in ungetwc if needed.
parent
71687bef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
file.c
dlls/msvcrt/file.c
+25
-4
No files found.
dlls/msvcrt/file.c
View file @
6122c2ba
...
@@ -4730,18 +4730,39 @@ int CDECL MSVCRT_ungetc(int c, MSVCRT_FILE * file)
...
@@ -4730,18 +4730,39 @@ int CDECL MSVCRT_ungetc(int c, MSVCRT_FILE * file)
MSVCRT_wint_t
CDECL
MSVCRT_ungetwc
(
MSVCRT_wint_t
wc
,
MSVCRT_FILE
*
file
)
MSVCRT_wint_t
CDECL
MSVCRT_ungetwc
(
MSVCRT_wint_t
wc
,
MSVCRT_FILE
*
file
)
{
{
MSVCRT_wchar_t
mwc
=
wc
;
MSVCRT_wchar_t
mwc
=
wc
;
unsigned
char
*
pp
=
(
unsigned
char
*
)
&
mwc
;
int
i
;
if
(
wc
==
MSVCRT_WEOF
)
if
(
wc
==
MSVCRT_WEOF
)
return
MSVCRT_WEOF
;
return
MSVCRT_WEOF
;
MSVCRT__lock_file
(
file
);
MSVCRT__lock_file
(
file
);
for
(
i
=
sizeof
(
MSVCRT_wchar_t
)
-
1
;
i
>=
0
;
i
--
)
{
if
(
pp
[
i
]
!=
MSVCRT_ungetc
(
pp
[
i
],
file
))
{
if
((
msvcrt_get_ioinfo
(
file
->
_file
)
->
exflag
&
(
EF_UTF8
|
EF_UTF16
))
||
!
(
msvcrt_get_ioinfo
(
file
->
_file
)
->
wxflag
&
WX_TEXT
))
{
unsigned
char
*
pp
=
(
unsigned
char
*
)
&
mwc
;
int
i
;
for
(
i
=
sizeof
(
MSVCRT_wchar_t
)
-
1
;
i
>=
0
;
i
--
)
{
if
(
pp
[
i
]
!=
MSVCRT_ungetc
(
pp
[
i
],
file
))
{
MSVCRT__unlock_file
(
file
);
return
MSVCRT_WEOF
;
}
}
}
else
{
char
mbs
[
MSVCRT_MB_LEN_MAX
];
int
len
;
len
=
MSVCRT_wctomb
(
mbs
,
mwc
);
if
(
len
==
-
1
)
{
MSVCRT__unlock_file
(
file
);
MSVCRT__unlock_file
(
file
);
return
MSVCRT_WEOF
;
return
MSVCRT_WEOF
;
}
}
for
(
len
--
;
len
>=
0
;
len
--
)
{
if
(
mbs
[
len
]
!=
MSVCRT_ungetc
(
mbs
[
len
],
file
))
{
MSVCRT__unlock_file
(
file
);
return
MSVCRT_WEOF
;
}
}
}
}
MSVCRT__unlock_file
(
file
);
MSVCRT__unlock_file
(
file
);
...
...
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