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
b6722aa7
Commit
b6722aa7
authored
Jun 30, 2020
by
Gijs Vermeulen
Committed by
Alexandre Julliard
Jun 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Don't use WCHAR in unix_to_win_locale().
Signed-off-by:
Gijs Vermeulen
<
gijsvrm@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d324014d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
30 deletions
+19
-30
env.c
dlls/ntdll/unix/env.c
+19
-30
No files found.
dlls/ntdll/unix/env.c
View file @
b6722aa7
...
...
@@ -74,8 +74,8 @@ char **main_envp = NULL;
static
WCHAR
**
main_wargv
;
static
CPTABLEINFO
unix_table
;
static
WCHAR
system_locale
[
LOCALE_NAME_MAX_LENGTH
];
static
WCHAR
user_locale
[
LOCALE_NAME_MAX_LENGTH
];
static
char
system_locale
[
LOCALE_NAME_MAX_LENGTH
];
static
char
user_locale
[
LOCALE_NAME_MAX_LENGTH
];
static
void
*
read_nls_file
(
const
char
*
name
)
{
...
...
@@ -649,18 +649,11 @@ static WCHAR **build_wargv( char **argv )
/* Unix format is: lang[_country][.charset][@modifier]
* Windows format is: lang[-script][-country][_modifier] */
static
BOOL
unix_to_win_locale
(
const
char
*
unix_name
,
WCHAR
*
win_name
)
static
BOOL
unix_to_win_locale
(
const
char
*
unix_name
,
char
*
win_name
)
{
static
const
WCHAR
sepW
[]
=
{
'_'
,
'.'
,
'@'
,
0
};
static
const
WCHAR
posixW
[]
=
{
'P'
,
'O'
,
'S'
,
'I'
,
'X'
,
0
};
static
const
WCHAR
cW
[]
=
{
'C'
,
0
};
static
const
WCHAR
euroW
[]
=
{
'e'
,
'u'
,
'r'
,
'o'
,
0
};
static
const
WCHAR
latinW
[]
=
{
'l'
,
'a'
,
't'
,
'i'
,
'n'
,
0
};
static
const
WCHAR
latnW
[]
=
{
'-'
,
'L'
,
'a'
,
't'
,
'n'
,
0
};
static
const
WCHAR
enUSW
[]
=
{
'e'
,
'n'
,
'-'
,
'U'
,
'S'
,
0
};
WCHAR
buffer
[
LOCALE_NAME_MAX_LENGTH
];
WCHAR
*
p
,
*
country
=
NULL
,
*
modifier
=
NULL
;
DWORD
len
;
static
const
char
sep
[]
=
"_.@"
;
char
buffer
[
LOCALE_NAME_MAX_LENGTH
];
char
*
p
,
*
country
=
NULL
,
*
modifier
=
NULL
;
if
(
!
unix_name
||
!
unix_name
[
0
]
||
!
strcmp
(
unix_name
,
"C"
))
{
...
...
@@ -668,16 +661,12 @@ static BOOL unix_to_win_locale( const char *unix_name, WCHAR *win_name )
if
(
!
unix_name
||
!
unix_name
[
0
])
return
FALSE
;
}
len
=
ntdll_umbstowcs
(
unix_name
,
strlen
(
unix_name
),
buffer
,
ARRAY_SIZE
(
buffer
)
);
if
(
len
==
ARRAY_SIZE
(
buffer
))
return
FALSE
;
buffer
[
len
]
=
0
;
if
(
!
(
p
=
wcspbrk
(
buffer
,
sepW
)))
if
(
!
(
p
=
strpbrk
(
buffer
,
sep
)))
{
if
(
!
wcscmp
(
buffer
,
posixW
)
||
!
wcscmp
(
buffer
,
cW
))
wcscpy
(
win_name
,
enUSW
);
if
(
!
strcmp
(
buffer
,
"POSIX"
)
||
!
strcmp
(
buffer
,
"C"
))
strcpy
(
win_name
,
"en-US"
);
else
wcs
cpy
(
win_name
,
buffer
);
str
cpy
(
win_name
,
buffer
);
return
TRUE
;
}
...
...
@@ -685,13 +674,13 @@ static BOOL unix_to_win_locale( const char *unix_name, WCHAR *win_name )
{
*
p
++
=
0
;
country
=
p
;
p
=
wcspbrk
(
p
,
sepW
+
1
);
p
=
strpbrk
(
p
,
sep
+
1
);
}
if
(
p
&&
*
p
==
'.'
)
{
*
p
++
=
0
;
/* charset, ignore */
p
=
wcs
chr
(
p
,
'@'
);
p
=
str
chr
(
p
,
'@'
);
}
if
(
p
)
{
...
...
@@ -701,18 +690,18 @@ static BOOL unix_to_win_locale( const char *unix_name, WCHAR *win_name )
/* rebuild a Windows name */
wcs
cpy
(
win_name
,
buffer
);
str
cpy
(
win_name
,
buffer
);
if
(
modifier
)
{
if
(
!
wcscmp
(
modifier
,
latinW
))
wcscat
(
win_name
,
latnW
);
else
if
(
!
wcscmp
(
modifier
,
euroW
))
{}
/* ignore */
if
(
!
strcmp
(
modifier
,
"latin"
))
strcat
(
win_name
,
"-Latn"
);
else
if
(
!
strcmp
(
modifier
,
"euro"
))
{}
/* ignore */
else
return
FALSE
;
}
if
(
country
)
{
p
=
win_name
+
wcs
len
(
win_name
);
p
=
win_name
+
str
len
(
win_name
);
*
p
++
=
'-'
;
wcs
cpy
(
p
,
country
);
str
cpy
(
p
,
country
);
}
return
TRUE
;
}
...
...
@@ -1083,6 +1072,6 @@ void CDECL get_unix_codepage( CPTABLEINFO *table )
*/
void
CDECL
get_locales
(
WCHAR
*
sys
,
WCHAR
*
user
)
{
wcscpy
(
sys
,
system_locale
);
wcscpy
(
user
,
user_locale
);
ntdll_umbstowcs
(
system_locale
,
ARRAY_SIZE
(
system_locale
),
sys
,
LOCALE_NAME_MAX_LENGTH
*
sizeof
(
WCHAR
)
);
ntdll_umbstowcs
(
user_locale
,
ARRAY_SIZE
(
user_locale
),
user
,
LOCALE_NAME_MAX_LENGTH
*
sizeof
(
WCHAR
)
);
}
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