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
27e18b3b
Commit
27e18b3b
authored
Mar 05, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added _wcslwr_s implementation.
parent
f1e59351
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
122 additions
and
4 deletions
+122
-4
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
string.c
dlls/msvcrt/tests/string.c
+90
-0
wcs.c
dlls/msvcrt/wcs.c
+28
-0
No files found.
dlls/msvcr100/msvcr100.spec
View file @
27e18b3b
...
...
@@ -1293,7 +1293,7 @@
@ stub _wcsicoll_l
@ cdecl _wcslwr(wstr) msvcrt._wcslwr
@ stub _wcslwr_l
@
stub
_wcslwr_s
@
cdecl _wcslwr_s(wstr long) msvcrt.
_wcslwr_s
@ stub _wcslwr_s_l
@ stub _wcsncoll
@ stub _wcsncoll_l
...
...
dlls/msvcr80/msvcr80.spec
View file @
27e18b3b
...
...
@@ -1146,7 +1146,7 @@
@ stub _wcsicoll_l
@ cdecl _wcslwr(wstr) msvcrt._wcslwr
@ stub _wcslwr_l
@
stub
_wcslwr_s
@
cdecl _wcslwr_s(wstr long) msvcrt.
_wcslwr_s
@ stub _wcslwr_s_l
@ stub _wcsncoll
@ stub _wcsncoll_l
...
...
dlls/msvcr90/msvcr90.spec
View file @
27e18b3b
...
...
@@ -1133,7 +1133,7 @@
@ stub _wcsicoll_l
@ cdecl _wcslwr(wstr) msvcrt._wcslwr
@ stub _wcslwr_l
@
stub
_wcslwr_s
@
cdecl _wcslwr_s(wstr long) msvcrt.
_wcslwr_s
@ stub _wcslwr_s_l
@ stub _wcsncoll
@ stub _wcsncoll_l
...
...
dlls/msvcrt/msvcrt.spec
View file @
27e18b3b
...
...
@@ -1067,7 +1067,7 @@
# stub _wcsicoll_l
@ cdecl _wcslwr(wstr) ntdll._wcslwr
# stub _wcslwr_l
# stub
_wcslwr_s
@ cdecl _wcslwr_s(wstr long) MSVCRT_
_wcslwr_s
# stub _wcslwr_s_l
@ stub _wcsncoll #(wstr wstr long)
# stub _wcsncoll_l
...
...
dlls/msvcrt/tests/string.c
View file @
27e18b3b
...
...
@@ -75,6 +75,7 @@ static errno_t (__cdecl *p_ultoa_s)(__msvcrt_ulong,char*,size_t,int);
static
int
*
p__mb_cur_max
;
static
unsigned
char
*
p_mbctype
;
static
_invalid_parameter_handler
(
__cdecl
*
p_set_invalid_parameter_handler
)(
_invalid_parameter_handler
);
static
int
(
__cdecl
*
p_wcslwr_s
)(
wchar_t
*
,
size_t
);
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
...
...
@@ -731,6 +732,93 @@ static void test__wcsupr_s(void)
ok
(
!
wcscmp
(
testBuffer
,
expectedString
),
"Expected the string to be fully upper-case
\n
"
);
}
static
void
test__wcslwr_s
(
void
)
{
static
const
WCHAR
mixedString
[]
=
{
'M'
,
'i'
,
'X'
,
'e'
,
'D'
,
'l'
,
'o'
,
'w'
,
'e'
,
'r'
,
'U'
,
'P'
,
'P'
,
'E'
,
'R'
,
0
};
static
const
WCHAR
expectedString
[]
=
{
'm'
,
'i'
,
'x'
,
'e'
,
'd'
,
'l'
,
'o'
,
'w'
,
'e'
,
'r'
,
'u'
,
'p'
,
'p'
,
'e'
,
'r'
,
0
};
WCHAR
buffer
[
2
*
sizeof
(
mixedString
)
/
sizeof
(
WCHAR
)];
int
ret
;
if
(
!
p_wcslwr_s
)
{
win_skip
(
"_wcslwr_s not found
\n
"
);
return
;
}
/* Test NULL input string and invalid size. */
errno
=
EBADF
;
ret
=
p_wcslwr_s
(
NULL
,
0
);
ok
(
ret
==
EINVAL
,
"expected EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"expected errno EINVAL, got %d
\n
"
,
errno
);
/* Test NULL input string and valid size. */
errno
=
EBADF
;
ret
=
p_wcslwr_s
(
NULL
,
sizeof
(
buffer
)
/
sizeof
(
wchar_t
));
ok
(
ret
==
EINVAL
,
"expected EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"expected errno EINVAL, got %d
\n
"
,
errno
);
/* Test empty string with zero size. */
errno
=
EBADF
;
buffer
[
0
]
=
'a'
;
ret
=
p_wcslwr_s
(
buffer
,
0
);
ok
(
ret
==
EINVAL
,
"expected EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"expected errno EINVAL, got %d
\n
"
,
errno
);
ok
(
buffer
[
0
]
==
0
,
"expected empty string
\n
"
);
/* Test empty string with size of one. */
buffer
[
0
]
=
0
;
ret
=
p_wcslwr_s
(
buffer
,
1
);
ok
(
ret
==
0
,
"got %d
\n
"
,
ret
);
ok
(
buffer
[
0
]
==
0
,
"expected buffer to be unchanged
\n
"
);
/* Test one-byte buffer with zero size. */
errno
=
EBADF
;
buffer
[
0
]
=
'x'
;
ret
=
p_wcslwr_s
(
buffer
,
0
);
ok
(
ret
==
EINVAL
,
"expected EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"expected errno to be EINVAL, got %d
\n
"
,
errno
);
ok
(
buffer
[
0
]
==
'\0'
,
"expected empty string
\n
"
);
/* Test one-byte buffer with size of one. */
errno
=
EBADF
;
buffer
[
0
]
=
'x'
;
ret
=
p_wcslwr_s
(
buffer
,
1
);
ok
(
ret
==
EINVAL
,
"expected EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"expected errno to be EINVAL, got %d
\n
"
,
errno
);
ok
(
buffer
[
0
]
==
'\0'
,
"expected empty string
\n
"
);
/* Test invalid size. */
wcscpy
(
buffer
,
mixedString
);
errno
=
EBADF
;
ret
=
p_wcslwr_s
(
buffer
,
0
);
ok
(
ret
==
EINVAL
,
"Expected EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"expected errno to be EINVAL, got %d
\n
"
,
errno
);
ok
(
buffer
[
0
]
==
'\0'
,
"expected empty string
\n
"
);
/* Test normal string uppercasing. */
wcscpy
(
buffer
,
mixedString
);
ret
=
p_wcslwr_s
(
buffer
,
sizeof
(
mixedString
)
/
sizeof
(
WCHAR
));
ok
(
ret
==
0
,
"expected 0, got %d
\n
"
,
ret
);
ok
(
!
wcscmp
(
buffer
,
expectedString
),
"expected lowercase
\n
"
);
/* Test uppercasing with a shorter buffer size count. */
wcscpy
(
buffer
,
mixedString
);
errno
=
EBADF
;
ret
=
p_wcslwr_s
(
buffer
,
sizeof
(
mixedString
)
/
sizeof
(
WCHAR
)
-
1
);
ok
(
ret
==
EINVAL
,
"expected EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"expected errno to be EINVAL, got %d
\n
"
,
errno
);
ok
(
buffer
[
0
]
==
'\0'
,
"expected empty string
\n
"
);
/* Test uppercasing with a longer buffer size count. */
wcscpy
(
buffer
,
mixedString
);
ret
=
p_wcslwr_s
(
buffer
,
sizeof
(
buffer
)
/
sizeof
(
WCHAR
));
ok
(
ret
==
0
,
"expected 0, got %d
\n
"
,
ret
);
ok
(
!
wcscmp
(
buffer
,
expectedString
),
"expected lowercase
\n
"
);
}
static
void
test_mbcjisjms
(
void
)
{
/* List of value-pairs to test. The test assumes the last pair to be {0, ..} */
...
...
@@ -1732,6 +1820,7 @@ START_TEST(string)
p_strlwr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_strlwr_s"
);
p_ultoa_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_ultoa_s"
);
p_set_invalid_parameter_handler
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_set_invalid_parameter_handler"
);
p_wcslwr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_wcslwr_s"
);
/* MSVCRT memcpy behaves like memmove for overlapping moves,
MFC42 CString::Insert seems to rely on that behaviour */
...
...
@@ -1771,4 +1860,5 @@ START_TEST(string)
test_wcsncat_s
();
test__mbsnbcat_s
();
test__ultoa_s
();
test__wcslwr_s
();
}
dlls/msvcrt/wcs.c
View file @
27e18b3b
...
...
@@ -131,6 +131,34 @@ INT CDECL MSVCRT__wcsupr_s( MSVCRT_wchar_t* str, MSVCRT_size_t n )
return
MSVCRT_EINVAL
;
}
/******************************************************************
* _wcslwr_s (MSVCRT.@)
*/
int
CDECL
MSVCRT__wcslwr_s
(
MSVCRT_wchar_t
*
str
,
MSVCRT_size_t
n
)
{
MSVCRT_wchar_t
*
ptr
=
str
;
if
(
!
str
||
!
n
)
{
if
(
str
)
*
str
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
while
(
n
--
)
{
if
(
!*
ptr
)
return
0
;
*
ptr
=
tolowerW
(
*
ptr
);
ptr
++
;
}
/* MSDN claims that the function should return and set errno to
* ERANGE, which doesn't seem to be true based on the tests. */
*
str
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
/*********************************************************************
* _wcstod_l - not exported in native msvcrt
*/
...
...
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