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
fd2ddf8f
Commit
fd2ddf8f
authored
Jul 21, 2023
by
Victor Chiletto
Committed by
Alexandre Julliard
Jul 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Remove uses of wcsncpy from locale_to_sname.
parent
46596db7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
locale.c
dlls/msvcrt/locale.c
+11
-9
mbcs.c
dlls/msvcrt/mbcs.c
+1
-1
msvcrt.h
dlls/msvcrt/msvcrt.h
+1
-1
No files found.
dlls/msvcrt/locale.c
View file @
fd2ddf8f
...
...
@@ -329,8 +329,10 @@ find_best_locale_proc( WCHAR *name, DWORD locale_flags, LPARAM lParam )
return
CONTINUE_LOOKING
;
}
/* Internal: Find the sname for a locale specification */
BOOL
locale_to_sname
(
const
char
*
locale
,
unsigned
short
*
codepage
,
BOOL
*
sname_match
,
WCHAR
*
sname
,
int
sname_size
)
/* Internal: Find the sname for a locale specification.
* sname must be at least LOCALE_NAME_MAX_LENGTH characters long
*/
BOOL
locale_to_sname
(
const
char
*
locale
,
unsigned
short
*
codepage
,
BOOL
*
sname_match
,
WCHAR
*
sname
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
const
char
*
cp
,
*
region
;
...
...
@@ -342,7 +344,7 @@ BOOL locale_to_sname(const char *locale, unsigned short *codepage, BOOL *sname_m
*
codepage
=
data
->
cached_cp
;
if
(
sname_match
)
*
sname_match
=
data
->
cached_sname_match
;
wcs
ncpy
(
sname
,
data
->
cached_sname
,
sname_siz
e
);
wcs
cpy
(
sname
,
data
->
cached_snam
e
);
return
TRUE
;
}
...
...
@@ -350,7 +352,7 @@ BOOL locale_to_sname(const char *locale, unsigned short *codepage, BOOL *sname_m
region
=
strchr
(
locale
,
'_'
);
if
(
!
locale
[
0
]
||
(
cp
==
locale
&&
!
region
))
{
GetUserDefaultLocaleName
(
sname
,
sname_size
);
GetUserDefaultLocaleName
(
sname
,
LOCALE_NAME_MAX_LENGTH
);
}
else
{
char
search_language_buf
[
MAX_ELEM_LEN
]
=
{
0
},
search_country_buf
[
MAX_ELEM_LEN
]
=
{
0
};
locale_search_t
search
;
...
...
@@ -388,7 +390,7 @@ BOOL locale_to_sname(const char *locale, unsigned short *codepage, BOOL *sname_m
if
(
search
.
allow_sname
&&
IsValidLocaleName
(
search
.
search_language
))
{
search
.
match_flags
=
FOUND_SNAME
;
wcs
ncpy
(
sname
,
search
.
search_language
,
sname_siz
e
);
wcs
cpy
(
sname
,
search
.
search_languag
e
);
}
else
{
...
...
@@ -404,7 +406,7 @@ BOOL locale_to_sname(const char *locale, unsigned short *codepage, BOOL *sname_m
if
(
search
.
search_country
[
0
]
&&
!
(
search
.
match_flags
&
FOUND_COUNTRY
))
return
FALSE
;
wcs
ncpy
(
sname
,
search
.
found_lang_sname
,
sname_siz
e
);
wcs
cpy
(
sname
,
search
.
found_lang_snam
e
);
}
is_sname
=
!
remapped
&&
(
search
.
match_flags
&
FOUND_SNAME
)
!=
0
;
...
...
@@ -1333,9 +1335,9 @@ static pthreadlocinfo create_locinfo(int category,
if
(
p
)
{
memcpy
(
buf
,
locale
,
p
-
locale
);
buf
[
p
-
locale
]
=
'\0'
;
locale_found
=
locale_to_sname
(
buf
,
&
cp
[
i
],
&
sname_match
,
wbuf
,
LOCALE_NAME_MAX_LENGTH
);
locale_found
=
locale_to_sname
(
buf
,
&
cp
[
i
],
&
sname_match
,
wbuf
);
}
else
{
locale_found
=
locale_to_sname
(
locale
,
&
cp
[
i
],
&
sname_match
,
wbuf
,
LOCALE_NAME_MAX_LENGTH
);
locale_found
=
locale_to_sname
(
locale
,
&
cp
[
i
],
&
sname_match
,
wbuf
);
}
if
(
!
locale_found
||
!
(
locale_sname
[
i
]
=
wcsdup
(
wbuf
)))
...
...
@@ -1352,7 +1354,7 @@ static pthreadlocinfo create_locinfo(int category,
locale
=
p
+
1
;
}
}
else
{
BOOL
locale_found
=
locale_to_sname
(
locale
,
&
cp
[
0
],
&
sname_match
,
wbuf
,
LOCALE_NAME_MAX_LENGTH
);
BOOL
locale_found
=
locale_to_sname
(
locale
,
&
cp
[
0
],
&
sname_match
,
wbuf
);
if
(
!
locale_found
)
return
NULL
;
...
...
dlls/msvcrt/mbcs.c
View file @
fd2ddf8f
...
...
@@ -254,7 +254,7 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo)
if
(
lcid
==
-
1
)
{
WCHAR
wbuf
[
LOCALE_NAME_MAX_LENGTH
];
sprintf
(
bufA
,
".%d"
,
newcp
);
mbcinfo
->
mblcid
=
locale_to_sname
(
bufA
,
NULL
,
NULL
,
wbuf
,
LOCALE_NAME_MAX_LENGTH
)
?
LocaleNameToLCID
(
wbuf
,
LOCALE_ALLOW_NEUTRAL_NAMES
)
:
-
1
;
mbcinfo
->
mblcid
=
locale_to_sname
(
bufA
,
NULL
,
NULL
,
wbuf
)
?
LocaleNameToLCID
(
wbuf
,
LOCALE_ALLOW_NEUTRAL_NAMES
)
:
-
1
;
}
else
{
mbcinfo
->
mblcid
=
lcid
;
}
...
...
dlls/msvcrt/msvcrt.h
View file @
fd2ddf8f
...
...
@@ -186,7 +186,7 @@ typedef struct __thread_data thread_data_t;
extern
thread_data_t
*
CDECL
msvcrt_get_thread_data
(
void
)
DECLSPEC_HIDDEN
;
BOOL
locale_to_sname
(
const
char
*
,
unsigned
short
*
,
BOOL
*
,
WCHAR
*
,
int
)
DECLSPEC_HIDDEN
;
BOOL
locale_to_sname
(
const
char
*
,
unsigned
short
*
,
BOOL
*
,
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
_locale_t
MSVCRT_locale
DECLSPEC_HIDDEN
;
extern
__lc_time_data
cloc_time_data
DECLSPEC_HIDDEN
;
extern
unsigned
int
MSVCRT___lc_codepage
;
...
...
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