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
2cc54d4b
Commit
2cc54d4b
authored
Apr 11, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Support UTF-8 as default Ansi codepage in MultiByteToWideChar().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8993e15c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
27 deletions
+16
-27
locale.c
dlls/kernelbase/locale.c
+16
-27
No files found.
dlls/kernelbase/locale.c
View file @
2cc54d4b
...
...
@@ -2283,11 +2283,6 @@ static int mbstowcs_utf8( DWORD flags, const char *src, int srclen, WCHAR *dst,
DWORD
reslen
;
NTSTATUS
status
;
if
(
flags
&
~
(
MB_PRECOMPOSED
|
MB_COMPOSITE
|
MB_USEGLYPHCHARS
|
MB_ERR_INVALID_CHARS
))
{
SetLastError
(
ERROR_INVALID_FLAGS
);
return
0
;
}
if
(
!
dstlen
)
dst
=
NULL
;
status
=
RtlUTF8ToUnicodeN
(
dst
,
dstlen
*
sizeof
(
WCHAR
),
&
reslen
,
src
,
srclen
);
if
(
status
==
STATUS_SOME_NOT_MAPPED
)
...
...
@@ -2528,24 +2523,12 @@ static int mbstowcs_dbcs( const CPTABLEINFO *info, const unsigned char *src, int
}
static
int
mbstowcs_codepage
(
UINT
codepage
,
DWORD
flags
,
const
char
*
src
,
int
srclen
,
static
int
mbstowcs_codepage
(
const
CPTABLEINFO
*
info
,
DWORD
flags
,
const
char
*
src
,
int
srclen
,
WCHAR
*
dst
,
int
dstlen
)
{
CPTABLEINFO
local_info
;
const
CPTABLEINFO
*
info
=
get_codepage_table
(
codepage
);
const
unsigned
char
*
str
=
(
const
unsigned
char
*
)
src
;
if
(
!
info
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
if
(
flags
&
~
(
MB_PRECOMPOSED
|
MB_COMPOSITE
|
MB_USEGLYPHCHARS
|
MB_ERR_INVALID_CHARS
))
{
SetLastError
(
ERROR_INVALID_FLAGS
);
return
0
;
}
if
((
flags
&
MB_USEGLYPHCHARS
)
&&
info
->
MultiByteTable
[
256
]
==
256
)
{
local_info
=
*
info
;
...
...
@@ -6161,6 +6144,7 @@ LCID WINAPI DECLSPEC_HOTPATCH LocaleNameToLCID( const WCHAR *name, DWORD flags )
INT
WINAPI
DECLSPEC_HOTPATCH
MultiByteToWideChar
(
UINT
codepage
,
DWORD
flags
,
const
char
*
src
,
INT
srclen
,
WCHAR
*
dst
,
INT
dstlen
)
{
const
CPTABLEINFO
*
info
;
int
ret
;
if
(
!
src
||
!
srclen
||
(
!
dst
&&
dstlen
)
||
dstlen
<
0
)
...
...
@@ -6178,19 +6162,24 @@ INT WINAPI DECLSPEC_HOTPATCH MultiByteToWideChar( UINT codepage, DWORD flags, co
case
CP_UTF7
:
ret
=
mbstowcs_utf7
(
flags
,
src
,
srclen
,
dst
,
dstlen
);
break
;
case
CP_UTF8
:
ret
=
mbstowcs_utf8
(
flags
,
src
,
srclen
,
dst
,
dstlen
);
break
;
case
CP_UNIXCP
:
if
(
unix_cp
==
CP_UTF8
)
{
ret
=
mbstowcs_utf8
(
flags
,
src
,
srclen
,
dst
,
dstlen
);
break
;
}
codepage
=
unix_cp
;
/* fall through */
default
:
ret
=
mbstowcs_codepage
(
codepage
,
flags
,
src
,
srclen
,
dst
,
dstlen
);
if
(
!
(
info
=
get_codepage_table
(
codepage
)))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
if
(
flags
&
~
(
MB_PRECOMPOSED
|
MB_COMPOSITE
|
MB_USEGLYPHCHARS
|
MB_ERR_INVALID_CHARS
))
{
SetLastError
(
ERROR_INVALID_FLAGS
);
return
0
;
}
if
(
info
->
CodePage
==
CP_UTF8
)
ret
=
mbstowcs_utf8
(
flags
,
src
,
srclen
,
dst
,
dstlen
);
else
ret
=
mbstowcs_codepage
(
info
,
flags
,
src
,
srclen
,
dst
,
dstlen
);
break
;
}
TRACE
(
"cp %d %s -> %s, ret = %d
\n
"
,
codepage
,
debugstr_an
(
src
,
srclen
),
debugstr_wn
(
dst
,
ret
),
ret
);
...
...
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