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
27ff2ae9
Commit
27ff2ae9
authored
May 26, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
May 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Improved locale initialization.
parent
3b4cc446
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
9 deletions
+34
-9
locale.c
dlls/msvcrt/locale.c
+26
-3
main.c
dlls/msvcrt/main.c
+5
-3
msvcrt.h
dlls/msvcrt/msvcrt.h
+2
-2
crtdefs.h
include/msvcrt/crtdefs.h
+1
-1
No files found.
dlls/msvcrt/locale.c
View file @
27ff2ae9
...
...
@@ -43,8 +43,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
MSVCRT__locale_t
MSVCRT_locale
=
NULL
;
int
MSVCRT___lc_codepage
=
0
;
int
MSVCRT___lc_collate_cp
=
0
;
HANDLE
MSVCRT___lc_handle
[
MSVCRT_LC_MAX
-
MSVCRT_LC_MIN
+
1
]
=
{
0
};
unsigned
char
charmax
=
CHAR_MAX
;
LCID
MSVCRT___lc_handle
[
MSVCRT_LC_MAX
-
MSVCRT_LC_MIN
+
1
]
=
{
0
};
static
unsigned
char
charmax
=
CHAR_MAX
;
/* MT */
#define LOCK_LOCALE _mlock(_SETLOCALE_LOCK);
...
...
@@ -572,7 +572,7 @@ int CDECL __lconv_init(void)
/*********************************************************************
* ___lc_handle_func (MSVCRT.@)
*/
HANDLE
*
CDECL
___lc_handle_func
(
void
)
LCID
*
CDECL
___lc_handle_func
(
void
)
{
return
MSVCRT___lc_handle
;
}
...
...
@@ -1234,10 +1234,14 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale)
UNLOCK_LOCALE
;
if
(
locinfo
==
MSVCRT_locale
->
locinfo
)
{
int
i
;
MSVCRT___lc_codepage
=
locinfo
->
lc_codepage
;
MSVCRT___lc_collate_cp
=
locinfo
->
lc_collate_cp
;
MSVCRT___mb_cur_max
=
locinfo
->
mb_cur_max
;
MSVCRT__pctype
=
locinfo
->
pctype
;
for
(
i
=
MSVCRT_LC_MIN
;
i
<=
MSVCRT_LC_MAX
;
i
++
)
MSVCRT___lc_handle
[
i
]
=
MSVCRT_locale
->
locinfo
->
lc_handle
[
i
];
}
if
(
category
==
MSVCRT_LC_ALL
)
...
...
@@ -1291,3 +1295,22 @@ int CDECL _configthreadlocale(int type)
return
-
1
;
}
BOOL
msvcrt_init_locale
(
void
)
{
int
i
;
LOCK_LOCALE
;
MSVCRT_locale
=
MSVCRT__create_locale
(
0
,
"C"
);
UNLOCK_LOCALE
;
if
(
!
MSVCRT_locale
)
return
FALSE
;
MSVCRT___lc_codepage
=
MSVCRT_locale
->
locinfo
->
lc_codepage
;
MSVCRT___lc_collate_cp
=
MSVCRT_locale
->
locinfo
->
lc_collate_cp
;
MSVCRT___mb_cur_max
=
MSVCRT_locale
->
locinfo
->
mb_cur_max
;
MSVCRT__pctype
=
MSVCRT_locale
->
locinfo
->
pctype
;
for
(
i
=
MSVCRT_LC_MIN
;
i
<=
MSVCRT_LC_MAX
;
i
++
)
MSVCRT___lc_handle
[
i
]
=
MSVCRT_locale
->
locinfo
->
lc_handle
[
i
];
return
TRUE
;
}
dlls/msvcrt/main.c
View file @
27ff2ae9
...
...
@@ -74,8 +74,10 @@ static inline void msvcrt_free_tls_mem(void)
HeapFree
(
GetProcessHeap
(),
0
,
tls
->
strerror_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
tls
->
wcserror_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
tls
->
time_buffer
);
free_locinfo
(
tls
->
locinfo
);
free_mbcinfo
(
tls
->
mbcinfo
);
if
(
tls
->
have_locale
)
{
free_locinfo
(
tls
->
locinfo
);
free_mbcinfo
(
tls
->
mbcinfo
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
tls
);
}
...
...
@@ -96,7 +98,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
if
(
!
msvcrt_init_tls
())
return
FALSE
;
msvcrt_init_mt_locks
();
if
(
!
(
MSVCRT_locale
=
MSVCRT__create_locale
(
0
,
"C"
)
))
{
if
(
!
msvcrt_init_locale
(
))
{
msvcrt_free_mt_locks
();
msvcrt_free_tls_mem
();
return
FALSE
;
...
...
dlls/msvcrt/msvcrt.h
View file @
27ff2ae9
...
...
@@ -112,7 +112,7 @@ typedef struct MSVCRT_threadlocaleinfostruct {
int
refcount
;
unsigned
int
lc_codepage
;
unsigned
int
lc_collate_cp
;
unsigned
long
lc_handle
[
6
];
MSVCRT_u
long
lc_handle
[
6
];
MSVCRT_LC_ID
lc_id
[
6
];
struct
{
char
*
locale
;
...
...
@@ -234,6 +234,7 @@ extern char* __cdecl __unDNameEx(char *,const char*,int,malloc_func_t,free_func_
extern
void
msvcrt_init_mt_locks
(
void
);
extern
void
msvcrt_free_mt_locks
(
void
);
extern
BOOL
msvcrt_init_locale
(
void
);
extern
void
msvcrt_init_math
(
void
);
extern
void
msvcrt_init_io
(
void
);
extern
void
msvcrt_free_io
(
void
);
...
...
@@ -881,7 +882,6 @@ int __cdecl MSVCRT_raise(int sig);
#define MSVCRT__DISABLE_PER_THREAD_LOCALE 2
extern
MSVCRT__locale_t
MSVCRT_locale
;
MSVCRT__locale_t
MSVCRT__create_locale
(
int
,
const
char
*
);
MSVCRT_pthreadlocinfo
get_locinfo
(
void
);
void
__cdecl
MSVCRT__free_locale
(
MSVCRT__locale_t
);
void
free_locinfo
(
MSVCRT_pthreadlocinfo
);
...
...
include/msvcrt/crtdefs.h
View file @
27ff2ae9
...
...
@@ -212,7 +212,7 @@ typedef struct threadlocaleinfostruct {
int
refcount
;
unsigned
int
lc_codepage
;
unsigned
int
lc_collate_cp
;
unsigned
long
lc_handle
[
6
];
__msvcrt_u
long
lc_handle
[
6
];
LC_ID
lc_id
[
6
];
struct
{
char
*
locale
;
...
...
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