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
fea69b23
Commit
fea69b23
authored
Oct 13, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 13, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Don't duplicate _setmbcp functionality inside _create_locale function.
parent
76ef1877
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
25 deletions
+43
-25
locale.c
dlls/msvcrt/locale.c
+1
-13
mbcs.c
dlls/msvcrt/mbcs.c
+41
-12
msvcrt.h
dlls/msvcrt/msvcrt.h
+1
-0
No files found.
dlls/msvcrt/locale.c
View file @
fea69b23
...
...
@@ -747,7 +747,6 @@ MSVCRT__locale_t MSVCRT__create_locale(int category, const char *locale)
}
memset
(
loc
->
locinfo
,
0
,
sizeof
(
MSVCRT_threadlocinfo
));
memset
(
loc
->
mbcinfo
,
0
,
sizeof
(
MSVCRT_threadmbcinfo
));
loc
->
locinfo
->
lconv
=
MSVCRT_malloc
(
sizeof
(
struct
MSVCRT_lconv
));
if
(
!
loc
->
locinfo
->
lconv
)
{
...
...
@@ -840,18 +839,7 @@ MSVCRT__locale_t MSVCRT__create_locale(int category, const char *locale)
}
}
loc
->
mbcinfo
->
refcount
=
1
;
loc
->
mbcinfo
->
mbcodepage
=
loc
->
locinfo
->
lc_id
[
MSVCRT_LC_CTYPE
].
wCodePage
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
if
(
loc
->
locinfo
->
pclmap
[
i
]
!=
i
)
{
loc
->
mbcinfo
->
mbctype
[
i
+
1
]
|=
0x10
;
loc
->
mbcinfo
->
mbcasemap
[
i
]
=
loc
->
locinfo
->
pclmap
[
i
];
}
else
if
(
loc
->
locinfo
->
pcumap
[
i
]
!=
i
)
{
loc
->
mbcinfo
->
mbctype
[
i
+
1
]
|=
0x20
;
loc
->
mbcinfo
->
mbcasemap
[
i
]
=
loc
->
locinfo
->
pcumap
[
i
];
}
}
_setmbcp_l
(
loc
->
locinfo
->
lc_id
[
MSVCRT_LC_CTYPE
].
wCodePage
,
loc
->
mbcinfo
);
if
(
lcid
[
MSVCRT_LC_MONETARY
]
&&
(
category
==
MSVCRT_LC_ALL
||
category
==
MSVCRT_LC_MONETARY
))
{
if
(
update_threadlocinfo_category
(
lcid
[
MSVCRT_LC_MONETARY
],
loc
,
MSVCRT_LC_MONETARY
))
{
...
...
dlls/msvcrt/mbcs.c
View file @
fea69b23
...
...
@@ -182,25 +182,25 @@ int* CDECL ___mb_cur_max_l_func(MSVCRT__locale_t locale)
}
/*********************************************************************
*
_setmbcp (MSVCRT.@)
*
INTERNAL: _setmbcp_l
*/
int
CDECL
_setmbcp
(
int
cp
)
int
_setmbcp_l
(
int
cp
,
MSVCRT_pthreadmbcinfo
mbcinfo
)
{
const
char
format
[]
=
".%d"
;
MSVCRT_pthreadmbcinfo
mbcinfo
=
get_mbcinfo
();
char
buf
[
32
];
int
newcp
;
CPINFO
cpi
;
BYTE
*
bytes
;
WORD
chartypes
[
256
];
WORD
*
curr_type
;
char
bufA
[
256
];
WCHAR
bufW
[
256
];
int
charcount
;
int
ret
;
int
i
;
if
(
!
mbcinfo
)
mbcinfo
=
get_mbcinfo
();
switch
(
cp
)
{
case
_MB_CP_ANSI
:
...
...
@@ -222,8 +222,8 @@ int CDECL _setmbcp(int cp)
break
;
}
sprintf
(
buf
,
format
,
newcp
);
mbcinfo
->
mblcid
=
MSVCRT_locale_to_LCID
(
buf
);
sprintf
(
buf
A
,
format
,
newcp
);
mbcinfo
->
mblcid
=
MSVCRT_locale_to_LCID
(
buf
A
);
if
(
mbcinfo
->
mblcid
==
-
1
)
{
WARN
(
"Can't assign LCID to codepage (%d)
\n
"
,
mbcinfo
->
mblcid
);
...
...
@@ -290,15 +290,36 @@ int CDECL _setmbcp(int cp)
GetStringTypeW
(
CT_CTYPE1
,
bufW
,
charcount
,
chartypes
);
c
urr_type
=
chartypes
;
c
harcount
=
0
;
for
(
i
=
0
;
i
<
256
;
i
++
)
if
(
!
(
mbcinfo
->
mbctype
[
i
+
1
]
&
_M1
))
{
if
((
*
curr_type
)
&
C1_UPPER
)
if
(
chartypes
[
charcount
]
&
C1_UPPER
)
{
mbcinfo
->
mbctype
[
i
+
1
]
|=
_SBUP
;
if
((
*
curr_type
)
&
C1_LOWER
)
bufW
[
charcount
]
=
tolowerW
(
bufW
[
charcount
]);
}
else
if
(
chartypes
[
charcount
]
&
C1_LOWER
)
{
mbcinfo
->
mbctype
[
i
+
1
]
|=
_SBLOW
;
curr_type
++
;
bufW
[
charcount
]
=
toupperW
(
bufW
[
charcount
]);
}
charcount
++
;
}
ret
=
WideCharToMultiByte
(
newcp
,
0
,
bufW
,
charcount
,
bufA
,
charcount
,
NULL
,
NULL
);
if
(
ret
!=
charcount
)
ERR
(
"WideCharToMultiByte failed for cp %d, ret=%d (exp %d), error=%d
\n
"
,
newcp
,
ret
,
charcount
,
GetLastError
());
charcount
=
0
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
if
(
!
(
mbcinfo
->
mbctype
[
i
+
1
]
&
_M1
))
{
if
(
mbcinfo
->
mbctype
[
i
]
&
(
C1_UPPER
|
C1_LOWER
))
mbcinfo
->
mbcasemap
[
i
]
=
bufA
[
charcount
];
charcount
++
;
}
}
if
(
newcp
==
932
)
/* CP932 only - set _MP and _MS */
...
...
@@ -315,13 +336,21 @@ int CDECL _setmbcp(int cp)
}
mbcinfo
->
mbcodepage
=
newcp
;
if
(
mbcinfo
==
MSVCRT_locale
->
mbcinfo
)
if
(
MSVCRT_locale
&&
mbcinfo
==
MSVCRT_locale
->
mbcinfo
)
memcpy
(
MSVCRT_mbctype
,
MSVCRT_locale
->
mbcinfo
->
mbctype
,
sizeof
(
MSVCRT_mbctype
));
return
0
;
}
/*********************************************************************
* _setmbcp (MSVCRT.@)
*/
int
CDECL
_setmbcp
(
int
cp
)
{
return
_setmbcp_l
(
cp
,
NULL
);
}
/*********************************************************************
* _getmbcp (MSVCRT.@)
*/
int
CDECL
_getmbcp
(
void
)
...
...
dlls/msvcrt/msvcrt.h
View file @
fea69b23
...
...
@@ -888,6 +888,7 @@ MSVCRT_pthreadmbcinfo get_mbcinfo(void);
void
__cdecl
MSVCRT__free_locale
(
MSVCRT__locale_t
);
void
free_locinfo
(
MSVCRT_pthreadlocinfo
);
void
free_mbcinfo
(
MSVCRT_pthreadmbcinfo
);
int
_setmbcp_l
(
int
,
MSVCRT_pthreadmbcinfo
);
#ifndef __WINE_MSVCRT_TEST
int
__cdecl
MSVCRT__write
(
int
,
const
void
*
,
unsigned
int
);
...
...
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