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
748628e2
Commit
748628e2
authored
Mar 26, 2019
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use ANSI code page in toupper.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4ed79243
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
string.c
dlls/ntdll/string.c
+11
-1
string.c
dlls/ntdll/tests/string.c
+32
-0
No files found.
dlls/ntdll/string.c
View file @
748628e2
...
@@ -321,7 +321,17 @@ LPSTR __cdecl _strlwr( LPSTR str )
...
@@ -321,7 +321,17 @@ LPSTR __cdecl _strlwr( LPSTR str )
*/
*/
int
__cdecl
NTDLL_toupper
(
int
c
)
int
__cdecl
NTDLL_toupper
(
int
c
)
{
{
return
toupper
(
c
);
char
str
[
2
],
*
p
=
str
;
WCHAR
wc
;
DWORD
len
;
str
[
0
]
=
c
;
str
[
1
]
=
c
>>
8
;
wc
=
RtlAnsiCharToUnicodeChar
(
&
p
);
wc
=
RtlUpcaseUnicodeChar
(
wc
);
RtlUnicodeToMultiByteN
(
str
,
sizeof
(
str
),
&
len
,
&
wc
,
sizeof
(
wc
)
);
if
(
len
==
2
)
return
((
unsigned
char
)
str
[
0
]
<<
8
)
+
(
unsigned
char
)
str
[
1
];
return
(
unsigned
char
)
str
[
0
];
}
}
...
...
dlls/ntdll/tests/string.c
View file @
748628e2
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include "ntdll_test.h"
#include "ntdll_test.h"
#include "winnls.h"
/* Function ptrs for ntdll calls */
/* Function ptrs for ntdll calls */
...
@@ -62,6 +63,7 @@ static void* (__cdecl *p_bsearch)(void *,void*,size_t,size_t, int(__cdecl *co
...
@@ -62,6 +63,7 @@ static void* (__cdecl *p_bsearch)(void *,void*,size_t,size_t, int(__cdecl *co
static
int
(
WINAPIV
*
p__snprintf
)(
char
*
,
size_t
,
const
char
*
,
...);
static
int
(
WINAPIV
*
p__snprintf
)(
char
*
,
size_t
,
const
char
*
,
...);
static
int
(
__cdecl
*
p_tolower
)(
int
);
static
int
(
__cdecl
*
p_tolower
)(
int
);
static
int
(
__cdecl
*
p_toupper
)(
int
);
static
void
InitFunctionPtrs
(
void
)
static
void
InitFunctionPtrs
(
void
)
{
{
...
@@ -102,6 +104,7 @@ static void InitFunctionPtrs(void)
...
@@ -102,6 +104,7 @@ static void InitFunctionPtrs(void)
p__snprintf
=
(
void
*
)
GetProcAddress
(
hntdll
,
"_snprintf"
);
p__snprintf
=
(
void
*
)
GetProcAddress
(
hntdll
,
"_snprintf"
);
p_tolower
=
(
void
*
)
GetProcAddress
(
hntdll
,
"tolower"
);
p_tolower
=
(
void
*
)
GetProcAddress
(
hntdll
,
"tolower"
);
p_toupper
=
(
void
*
)
GetProcAddress
(
hntdll
,
"toupper"
);
}
/* if */
}
/* if */
}
}
...
@@ -1350,6 +1353,34 @@ static void test_tolower(void)
...
@@ -1350,6 +1353,34 @@ static void test_tolower(void)
}
}
}
}
static
void
test_toupper
(
void
)
{
int
i
,
ret
,
exp_ret
;
char
str
[
2
],
*
p
;
WCHAR
wc
;
ok
(
p_toupper
!=
NULL
,
"toupper is not available
\n
"
);
for
(
i
=
-
512
;
i
<
0xffff
;
i
++
)
{
str
[
0
]
=
i
;
str
[
1
]
=
i
>>
8
;
p
=
str
;
wc
=
RtlAnsiCharToUnicodeChar
(
&
p
);
wc
=
RtlUpcaseUnicodeChar
(
wc
);
ret
=
WideCharToMultiByte
(
CP_ACP
,
0
,
&
wc
,
1
,
str
,
2
,
NULL
,
NULL
);
ok
(
ret
==
1
||
ret
==
2
,
"WideCharToMultiByte returned %d
\n
"
,
ret
);
if
(
ret
==
2
)
exp_ret
=
(
unsigned
char
)
str
[
1
]
+
((
unsigned
char
)
str
[
0
]
<<
8
);
else
exp_ret
=
(
unsigned
char
)
str
[
0
];
ret
=
p_toupper
(
i
);
ok
(
ret
==
exp_ret
,
"toupper(%x) = %x, expected %x
\n
"
,
i
,
ret
,
exp_ret
);
}
}
START_TEST
(
string
)
START_TEST
(
string
)
{
{
InitFunctionPtrs
();
InitFunctionPtrs
();
...
@@ -1387,4 +1418,5 @@ START_TEST(string)
...
@@ -1387,4 +1418,5 @@ START_TEST(string)
if
(
p__snprintf
)
if
(
p__snprintf
)
test__snprintf
();
test__snprintf
();
test_tolower
();
test_tolower
();
test_toupper
();
}
}
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