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
b38b2076
Commit
b38b2076
authored
Feb 23, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libwine: Get the reverse mapping of the Unicode default char to check for invalid chars.
We can't assume that wctomb(Unicode default char) is identical to the Ansi default char.
parent
5a0079f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
mbtowc.c
libs/wine/mbtowc.c
+10
-7
No files found.
libs/wine/mbtowc.c
View file @
b38b2076
...
...
@@ -44,10 +44,12 @@ static inline int check_invalid_chars_sbcs( const struct sbcs_table *table, int
const
unsigned
char
*
src
,
unsigned
int
srclen
)
{
const
WCHAR
*
const
cp2uni
=
(
flags
&
MB_USEGLYPHCHARS
)
?
table
->
cp2uni_glyphs
:
table
->
cp2uni
;
const
WCHAR
def_unicode_char
=
table
->
info
.
def_unicode_char
;
const
unsigned
char
def_char
=
table
->
uni2cp_low
[
table
->
uni2cp_high
[
def_unicode_char
>>
8
]
+
(
def_unicode_char
&
0xff
)];
while
(
srclen
)
{
if
(
cp2uni
[
*
src
]
==
table
->
info
.
def_unicode_char
&&
*
src
!=
table
->
info
.
def_char
)
break
;
if
(
cp2uni
[
*
src
]
==
def_unicode_char
&&
*
src
!=
def_char
)
break
;
src
++
;
srclen
--
;
}
...
...
@@ -151,20 +153,21 @@ static inline int check_invalid_chars_dbcs( const struct dbcs_table *table,
{
const
WCHAR
*
const
cp2uni
=
table
->
cp2uni
;
const
unsigned
char
*
const
cp2uni_lb
=
table
->
cp2uni_leadbytes
;
const
WCHAR
def_unicode_char
=
table
->
info
.
def_unicode_char
;
const
unsigned
short
def_char
=
table
->
uni2cp_low
[
table
->
uni2cp_high
[
def_unicode_char
>>
8
]
+
(
def_unicode_char
&
0xff
)];
while
(
srclen
)
{
unsigned
char
off
=
cp2uni_lb
[
*
src
];
if
(
off
)
/* multi-byte char */
{
if
(
srclen
==
1
)
break
;
/* partial char, error */
if
(
cp2uni
[(
off
<<
8
)
+
src
[
1
]]
==
table
->
info
.
def_unicode_char
&&
((
src
[
0
]
<<
8
)
|
src
[
1
])
!=
table
->
info
.
def_char
)
break
;
if
(
cp2uni
[(
off
<<
8
)
+
src
[
1
]]
==
def_unicode_char
&&
((
src
[
0
]
<<
8
)
|
src
[
1
])
!=
def_char
)
break
;
src
++
;
srclen
--
;
}
else
if
(
cp2uni
[
*
src
]
==
table
->
info
.
def_unicode_char
&&
*
src
!=
table
->
info
.
def_char
)
break
;
else
if
(
cp2uni
[
*
src
]
==
def_unicode_char
&&
*
src
!=
def_char
)
break
;
src
++
;
srclen
--
;
}
...
...
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