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
d5b2c3f2
Commit
d5b2c3f2
authored
Nov 25, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Lock _MB_CP_LOCK lock in setmbcp.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4fc2b729
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
19 deletions
+22
-19
locale.c
dlls/msvcrt/locale.c
+4
-8
mbcs.c
dlls/msvcrt/mbcs.c
+18
-10
msvcrt.h
dlls/msvcrt/msvcrt.h
+0
-1
No files found.
dlls/msvcrt/locale.c
View file @
d5b2c3f2
...
...
@@ -599,18 +599,14 @@ MSVCRT_pthreadlocinfo CDECL get_locinfo(void) {
return
*
get_locinfo_ptr
();
}
MSVCRT_pthreadmbcinfo
*
CDECL
get_mbcinfo_ptr
(
void
)
{
/* INTERNAL: returns pthreadmbcinfo struct */
MSVCRT_pthreadmbcinfo
CDECL
get_mbcinfo
(
void
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
if
(
!
data
||
!
(
data
->
locale_flags
&
LOCALE_THREAD
))
return
&
MSVCRT_locale
->
mbcinfo
;
return
&
data
->
mbcinfo
;
}
return
MSVCRT_locale
->
mbcinfo
;
/* INTERNAL: returns pthreadmbcinfo struct */
MSVCRT_pthreadmbcinfo
CDECL
get_mbcinfo
(
void
)
{
return
*
get_mbcinfo_ptr
();
return
data
->
mbcinfo
;
}
/* INTERNAL: constructs string returned by setlocale */
...
...
dlls/msvcrt/mbcs.c
View file @
d5b2c3f2
...
...
@@ -28,6 +28,7 @@
#include <mbctype.h>
#include "msvcrt.h"
#include "mtdll.h"
#include "winnls.h"
#include "wine/debug.h"
...
...
@@ -209,9 +210,6 @@ int CDECL ___mb_cur_max_l_func(MSVCRT__locale_t locale)
}
#endif
/*********************************************************************
* INTERNAL: _setmbcp_l
*/
MSVCRT_threadmbcinfo
*
create_mbcinfo
(
int
cp
,
LCID
lcid
,
MSVCRT_threadmbcinfo
*
old_mbcinfo
)
{
MSVCRT_threadmbcinfo
*
mbcinfo
;
...
...
@@ -386,20 +384,30 @@ MSVCRT_threadmbcinfo* create_mbcinfo(int cp, LCID lcid, MSVCRT_threadmbcinfo *ol
*/
int
CDECL
_setmbcp
(
int
cp
)
{
MSVCRT_threadmbcinfo
**
old_mbcinfo
=
get_mbcinfo_ptr
();
thread_data_t
*
data
=
msvcrt_get_thread_data
();
MSVCRT_threadmbcinfo
*
mbcinfo
;
mbcinfo
=
create_mbcinfo
(
cp
,
-
1
,
*
old_mbcinfo
);
if
(
!
mbcinfo
)
{
mbcinfo
=
create_mbcinfo
(
cp
,
-
1
,
get_mbcinfo
());
if
(
!
mbcinfo
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
-
1
;
}
free_mbcinfo
(
*
old_mbcinfo
);
*
old_mbcinfo
=
mbcinfo
;
if
(
mbcinfo
==
MSVCRT_locale
->
mbcinfo
)
if
(
data
->
locale_flags
&
LOCALE_THREAD
)
{
if
(
data
->
locale_flags
&
LOCALE_FREE
)
free_mbcinfo
(
data
->
mbcinfo
);
data
->
mbcinfo
=
mbcinfo
;
}
else
{
_lock
(
_MB_CP_LOCK
);
free_mbcinfo
(
MSVCRT_locale
->
mbcinfo
);
MSVCRT_locale
->
mbcinfo
=
mbcinfo
;
memcpy
(
MSVCRT_mbctype
,
MSVCRT_locale
->
mbcinfo
->
mbctype
,
sizeof
(
MSVCRT_mbctype
));
_unlock
(
_MB_CP_LOCK
);
}
return
0
;
}
...
...
dlls/msvcrt/msvcrt.h
View file @
d5b2c3f2
...
...
@@ -1008,7 +1008,6 @@ MSVCRT__locale_t CDECL get_current_locale_noalloc(MSVCRT__locale_t locale) DECLS
void
CDECL
free_locale_noalloc
(
MSVCRT__locale_t
locale
)
DECLSPEC_HIDDEN
;
MSVCRT_pthreadlocinfo
CDECL
get_locinfo
(
void
)
DECLSPEC_HIDDEN
;
MSVCRT_pthreadmbcinfo
CDECL
get_mbcinfo
(
void
)
DECLSPEC_HIDDEN
;
MSVCRT_pthreadmbcinfo
*
CDECL
get_mbcinfo_ptr
(
void
)
DECLSPEC_HIDDEN
;
void
__cdecl
MSVCRT__free_locale
(
MSVCRT__locale_t
);
MSVCRT_threadmbcinfo
*
create_mbcinfo
(
int
,
LCID
,
MSVCRT_threadmbcinfo
*
)
DECLSPEC_HIDDEN
;
void
free_locinfo
(
MSVCRT_pthreadlocinfo
)
DECLSPEC_HIDDEN
;
...
...
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