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
e867af3b
Commit
e867af3b
authored
Jan 23, 2019
by
Piotr Caban
Committed by
Alexandre Julliard
Jan 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Optimize tolower function when locale was never changed.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ca683382
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
5 deletions
+18
-5
ctype.c
dlls/msvcrt/ctype.c
+3
-1
locale.c
dlls/msvcrt/locale.c
+4
-0
msvcrt.h
dlls/msvcrt/msvcrt.h
+1
-0
string.c
dlls/msvcrt/tests/string.c
+10
-4
No files found.
dlls/msvcrt/ctype.c
View file @
e867af3b
...
...
@@ -458,7 +458,9 @@ int CDECL MSVCRT__tolower_l(int c, MSVCRT__locale_t locale)
*/
int
CDECL
MSVCRT_tolower
(
int
c
)
{
return
MSVCRT__tolower_l
(
c
,
NULL
);
if
(
initial_locale
)
return
c
>=
'A'
&&
c
<=
'Z'
?
c
-
'A'
+
'a'
:
c
;
return
MSVCRT__tolower_l
(
c
,
NULL
);
}
/*********************************************************************
...
...
dlls/msvcrt/locale.c
View file @
e867af3b
...
...
@@ -48,6 +48,7 @@ int MSVCRT___lc_collate_cp = 0;
LCID
MSVCRT___lc_handle
[
MSVCRT_LC_MAX
-
MSVCRT_LC_MIN
+
1
]
=
{
0
};
int
MSVCRT___mb_cur_max
=
1
;
static
unsigned
char
charmax
=
CHAR_MAX
;
BOOL
initial_locale
=
TRUE
;
#define MSVCRT_LEADBYTE 0x8000
#define MSVCRT_C1_DEFINED 0x200
...
...
@@ -1780,6 +1781,9 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale)
_lock_locales
();
if
(
locale
[
0
]
!=
'C'
||
locale
[
1
]
!=
'\0'
)
initial_locale
=
FALSE
;
if
(
locinfo
->
lc_handle
[
MSVCRT_LC_COLLATE
]
!=
newlocinfo
->
lc_handle
[
MSVCRT_LC_COLLATE
]
||
locinfo
->
lc_id
[
MSVCRT_LC_COLLATE
].
wCodePage
!=
newlocinfo
->
lc_id
[
MSVCRT_LC_COLLATE
].
wCodePage
)
{
locinfo
->
lc_collate_cp
=
newlocinfo
->
lc_collate_cp
;
...
...
dlls/msvcrt/msvcrt.h
View file @
e867af3b
...
...
@@ -283,6 +283,7 @@ extern MSVCRT__locale_t MSVCRT_locale DECLSPEC_HIDDEN;
extern
unsigned
int
MSVCRT___lc_codepage
;
extern
int
MSVCRT___lc_collate_cp
;
extern
WORD
MSVCRT__ctype
[
257
];
extern
BOOL
initial_locale
DECLSPEC_HIDDEN
;
void
msvcrt_set_errno
(
int
)
DECLSPEC_HIDDEN
;
#if _MSVCR_VER >= 80
...
...
dlls/msvcrt/tests/string.c
View file @
e867af3b
...
...
@@ -2788,13 +2788,19 @@ static void test_tolower(void)
errno
=
0xdeadbeef
;
ret
=
p_tolower
((
char
)
0xF4
);
todo_wine
ok
(
ret
==
(
char
)
0xF4
,
"ret = %x
\n
"
,
ret
);
todo_wine
ok
(
errno
==
0xdeadbeef
,
"errno = %d
\n
"
,
errno
);
ok
(
ret
==
(
char
)
0xF4
,
"ret = %x
\n
"
,
ret
);
ok
(
errno
==
0xdeadbeef
,
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
ret
=
p_tolower
((
char
)
0xD0
);
todo_wine
ok
(
ret
==
(
char
)
0xD0
,
"ret = %x
\n
"
,
ret
);
todo_wine
ok
(
errno
==
0xdeadbeef
,
"errno = %d
\n
"
,
errno
);
ok
(
ret
==
(
char
)
0xD0
,
"ret = %x
\n
"
,
ret
);
ok
(
errno
==
0xdeadbeef
,
"errno = %d
\n
"
,
errno
);
setlocale
(
LC_ALL
,
"C"
);
errno
=
0xdeadbeef
;
ret
=
p_tolower
((
char
)
0xF4
);
ok
(
ret
==
(
char
)
0xF4
,
"ret = %x
\n
"
,
ret
);
ok
(
errno
==
0xdeadbeef
,
"errno = %d
\n
"
,
errno
);
/* test C locale after setting locale */
if
(
!
setlocale
(
LC_ALL
,
"us"
))
{
...
...
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