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
8adfd63c
Commit
8adfd63c
authored
Apr 19, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Return correct strings in setlocale.
parent
0d79b4b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
18 deletions
+38
-18
locale.c
dlls/msvcrt/locale.c
+36
-16
locale.c
dlls/msvcrt/tests/locale.c
+2
-2
No files found.
dlls/msvcrt/locale.c
View file @
8adfd63c
...
...
@@ -348,6 +348,32 @@ MSVCRT__locale_t get_locale(void) {
return
data
->
locale
;
}
/* INTERNAL: constructs string returned by setlocale */
static
inline
char
*
construct_lc_all
(
MSVCRT__locale_t
cur
)
{
static
char
current_lc_all
[
MAX_LOCALE_LENGTH
];
int
i
;
for
(
i
=
MSVCRT_LC_MIN
+
1
;
i
<
MSVCRT_LC_MAX
;
i
++
)
{
if
(
strcmp
(
cur
->
locinfo
->
lc_category
[
i
].
locale
,
cur
->
locinfo
->
lc_category
[
i
+
1
].
locale
))
break
;
}
if
(
i
==
MSVCRT_LC_MAX
)
return
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_COLLATE
].
locale
;
sprintf
(
current_lc_all
,
"LC_COLLATE=%s;LC_CTYPE=%s;LC_MONETARY=%s;LC_NUMERIC=%s;LC_TIME=%s"
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_COLLATE
].
locale
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_CTYPE
].
locale
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_MONETARY
].
locale
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_NUMERIC
].
locale
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_TIME
].
locale
);
return
current_lc_all
;
}
/*********************************************************************
* wsetlocale (MSVCRT.@)
...
...
@@ -1020,31 +1046,25 @@ int CDECL _configthreadlocale(int type)
*/
char
*
CDECL
MSVCRT_setlocale
(
int
category
,
const
char
*
locale
)
{
static
char
current_lc_all
[
MAX_LOCALE_LENGTH
];
MSVCRT__locale_t
loc
,
cur
;
cur
=
get_locale
();
if
(
locale
==
NULL
)
{
if
(
category
==
MSVCRT_LC_ALL
)
{
sprintf
(
current_lc_all
,
"LC_COLLATE=%s;LC_CTYPE=%s;LC_MONETARY=%s;LC_NUMERIC=%s;LC_TIME=%s"
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_COLLATE
].
locale
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_CTYPE
].
locale
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_MONETARY
].
locale
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_NUMERIC
].
locale
,
cur
->
locinfo
->
lc_category
[
MSVCRT_LC_TIME
].
locale
);
return
current_lc_all
;
}
if
(
category
<
MSVCRT_LC_MIN
||
category
>
MSVCRT_LC_MAX
)
return
NULL
;
if
(
!
locale
)
{
if
(
category
==
MSVCRT_LC_ALL
)
return
construct_lc_all
(
cur
);
return
cur
->
locinfo
->
lc_category
[
category
].
locale
;
}
loc
=
_create_locale
(
category
,
locale
);
if
(
!
loc
)
if
(
!
loc
)
{
WARN
(
"%d %s failed
\n
"
,
category
,
locale
);
return
NULL
;
}
LOCK_LOCALE
;
...
...
@@ -1163,7 +1183,7 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale)
}
if
(
category
==
MSVCRT_LC_ALL
)
return
c
ur
->
locinfo
->
lc_category
[
MSVCRT_LC_COLLATE
].
locale
;
return
c
onstruct_lc_all
(
cur
)
;
return
cur
->
locinfo
->
lc_category
[
category
].
locale
;
}
dlls/msvcrt/tests/locale.c
View file @
8adfd63c
...
...
@@ -51,7 +51,7 @@ static void test_setlocale(void)
ok
(
!
strcmp
(
ret
,
"C"
),
"ret = %s
\n
"
,
ret
);
ret
=
setlocale
(
LC_ALL
,
NULL
);
todo_wine
ok
(
!
strcmp
(
ret
,
"C"
),
"ret = %s
\n
"
,
ret
);
ok
(
!
strcmp
(
ret
,
"C"
),
"ret = %s
\n
"
,
ret
);
if
(
!
setlocale
(
LC_NUMERIC
,
"Polish"
)
||
!
setlocale
(
LC_NUMERIC
,
"Greek"
)
...
...
@@ -72,7 +72,7 @@ static void test_setlocale(void)
strcpy
(
buf
,
ret
);
ret
=
setlocale
(
LC_ALL
,
buf
);
todo_wine
ok
(
!
strcmp
(
ret
,
lc_all
),
"ret = %s
\n
"
,
ret
);
ok
(
!
strcmp
(
ret
,
lc_all
),
"ret = %s
\n
"
,
ret
);
ret
=
setlocale
(
LC_ALL
,
"German"
);
todo_wine
ok
(
!
strcmp
(
ret
,
"German_Germany.1252"
),
"ret = %s
\n
"
,
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