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
ed58b1ba
Commit
ed58b1ba
authored
Nov 07, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Better workaround for the lack of locale environment variables on MacOS.
parent
ac227461
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
24 deletions
+21
-24
locale.c
dlls/kernel32/locale.c
+21
-22
process.c
dlls/kernel32/process.c
+0
-2
No files found.
dlls/kernel32/locale.c
View file @
ed58b1ba
...
...
@@ -25,6 +25,7 @@
#include "wine/port.h"
#include <assert.h>
#include <locale.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
...
...
@@ -506,24 +507,12 @@ static int charset_cmp( const void *name, const void *entry )
/***********************************************************************
* get_env_lcid
*/
static
LCID
get_env_lcid
(
UINT
*
unix_cp
,
const
char
*
env_str
)
static
LCID
get_env_lcid
(
UINT
*
unix_cp
,
int
category
)
{
char
*
buf
,
*
lang
,
*
country
,
*
charset
,
*
dialect
,
*
next
;
LCID
ret
=
0
;
char
user_locale
[
50
]
=
{
0
};
#ifdef __APPLE__
CFLocaleRef
user_locale_ref
=
CFLocaleCopyCurrent
();
CFStringRef
user_locale_string_ref
=
CFLocaleGetIdentifier
(
user_locale_ref
);
CFStringGetCString
(
user_locale_string_ref
,
user_locale
,
sizeof
(
user_locale
),
kCFStringEncodingUTF8
);
CFRelease
(
user_locale_ref
);
#endif
if
(((
lang
=
getenv
(
"LC_ALL"
))
&&
*
lang
)
||
(
env_str
&&
(
lang
=
getenv
(
env_str
))
&&
*
lang
)
||
((
lang
=
getenv
(
"LANG"
))
&&
*
lang
)
||
((
lang
=
user_locale
)
&&
*
lang
))
if
((
lang
=
setlocale
(
category
,
NULL
))
&&
*
lang
)
{
if
(
!
strcmp
(
lang
,
"POSIX"
)
||
!
strcmp
(
lang
,
"C"
))
goto
done
;
...
...
@@ -560,11 +549,6 @@ static LCID get_env_lcid( UINT *unix_cp, const char *env_str )
else
FIXME
(
"charset %s was not recognized
\n
"
,
charset
);
}
#ifdef __APPLE__
/* charset on Mac OS X is always UTF8 */
else
if
(
unix_cp
)
*
unix_cp
=
CP_UTF8
;
#endif
lang
=
next
;
}
while
(
lang
&&
!
ret
);
...
...
@@ -2590,13 +2574,28 @@ void LOCALE_Init(void)
UINT
ansi_cp
=
1252
,
oem_cp
=
437
,
mac_cp
=
10000
,
unix_cp
=
~
0U
;
LCID
lcid
;
lcid
=
get_env_lcid
(
NULL
,
NULL
);
#ifdef __APPLE__
/* MacOS doesn't set the locale environment variables so we have to do it ourselves */
char
user_locale
[
50
];
CFLocaleRef
user_locale_ref
=
CFLocaleCopyCurrent
();
CFStringRef
user_locale_string_ref
=
CFLocaleGetIdentifier
(
user_locale_ref
);
CFStringGetCString
(
user_locale_string_ref
,
user_locale
,
sizeof
(
user_locale
),
kCFStringEncodingUTF8
);
CFRelease
(
user_locale_ref
);
if
(
!
strchr
(
user_locale
,
'.'
))
strcat
(
user_locale
,
".UTF-8"
);
unix_cp
=
CP_UTF8
;
/* default to utf-8 even if we don't get a valid locale */
setenv
(
"LANG"
,
user_locale
,
0
);
TRACE
(
"setting locale to '%s'
\n
"
,
user_locale
);
#endif
setlocale
(
LC_ALL
,
""
);
lcid
=
get_env_lcid
(
NULL
,
LC_ALL
);
NtSetDefaultLocale
(
TRUE
,
lcid
);
lcid
=
get_env_lcid
(
NULL
,
"LC_MESSAGES"
);
lcid
=
get_env_lcid
(
NULL
,
LC_MESSAGES
);
NtSetDefaultUILanguage
(
LANGIDFROMLCID
(
lcid
)
);
lcid
=
get_env_lcid
(
&
unix_cp
,
"LC_CTYPE"
);
lcid
=
get_env_lcid
(
&
unix_cp
,
LC_CTYPE
);
NtSetDefaultLocale
(
FALSE
,
lcid
);
ansi_cp
=
get_lcid_codepage
(
lcid
);
...
...
dlls/kernel32/process.c
View file @
ed58b1ba
...
...
@@ -24,7 +24,6 @@
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <time.h>
...
...
@@ -732,7 +731,6 @@ static BOOL process_init(void)
setbuf
(
stdout
,
NULL
);
setbuf
(
stderr
,
NULL
);
setlocale
(
LC_CTYPE
,
""
);
kernel32_handle
=
GetModuleHandleW
(
kernel32W
);
...
...
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