Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
332d5954
Commit
332d5954
authored
Mar 20, 2011
by
Konrad Rzepecki
Committed by
Alexandre Julliard
Mar 29, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Implement _mbslwr_s.
parent
0b3175cb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
4 deletions
+104
-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
mbcs.c
dlls/msvcrt/mbcs.c
+40
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
string.c
dlls/msvcrt/tests/string.c
+60
-0
No files found.
dlls/msvcr100/msvcr100.spec
View file @
332d5954
...
...
@@ -921,7 +921,7 @@
@ stub _mbslen_l
@ cdecl _mbslwr(str) msvcrt._mbslwr
@ stub _mbslwr_l
@
stub
_mbslwr_s
@
cdecl _mbslwr_s(str long) msvcrt.
_mbslwr_s
@ stub _mbslwr_s_l
@ cdecl _mbsnbcat(str str long) msvcrt._mbsnbcat
@ stub _mbsnbcat_l
...
...
dlls/msvcr80/msvcr80.spec
View file @
332d5954
...
...
@@ -767,7 +767,7 @@
@ stub _mbslen_l
@ cdecl _mbslwr(str) msvcrt._mbslwr
@ stub _mbslwr_l
@
stub
_mbslwr_s
@
cdecl _mbslwr_s(str long) msvcrt.
_mbslwr_s
@ stub _mbslwr_s_l
@ cdecl _mbsnbcat(str str long) msvcrt._mbsnbcat
@ stub _mbsnbcat_l
...
...
dlls/msvcr90/msvcr90.spec
View file @
332d5954
...
...
@@ -755,7 +755,7 @@
@ stub _mbslen_l
@ cdecl _mbslwr(str) msvcrt._mbslwr
@ stub _mbslwr_l
@
stub
_mbslwr_s
@
cdecl _mbslwr_s(str long) msvcrt.
_mbslwr_s
@ stub _mbslwr_s_l
@ cdecl _mbsnbcat(str str long) msvcrt._mbsnbcat
@ stub _mbsnbcat_l
...
...
dlls/msvcrt/mbcs.c
View file @
332d5954
...
...
@@ -1544,6 +1544,46 @@ unsigned char* CDECL _mbslwr(unsigned char* s)
/*********************************************************************
* _mbslwr_s(MSVCRT.@)
*/
int
CDECL
_mbslwr_s
(
unsigned
char
*
s
,
MSVCRT_size_t
len
)
{
if
(
!
s
&&
!
len
)
{
return
0
;
}
else
if
(
!
s
||
!
len
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
if
(
get_locale
()
->
locinfo
->
mb_cur_max
>
1
)
{
unsigned
int
c
;
for
(
;
*
s
&&
len
>
0
;
len
--
)
{
c
=
_mbctolower
(
_mbsnextc
(
s
));
/* Note that I assume that the size of the character is unchanged */
if
(
c
>
255
)
{
*
s
++=
(
c
>>
8
);
c
=
c
&
0xff
;
}
*
s
++=
c
;
}
}
else
for
(
;
*
s
&&
len
>
0
;
s
++
,
len
--
)
*
s
=
tolower
(
*
s
);
if
(
*
s
)
{
*
s
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
return
0
;
}
/*********************************************************************
* _mbsupr(MSVCRT.@)
*/
unsigned
char
*
CDECL
_mbsupr
(
unsigned
char
*
s
)
...
...
dlls/msvcrt/msvcrt.spec
View file @
332d5954
...
...
@@ -703,7 +703,7 @@
# stub _mbslen_l
@ cdecl _mbslwr(str)
# stub _mbslwr_l
# stub _mbslwr_s
@ cdecl _mbslwr_s(str long)
# stub _mbslwr_s_l
@ cdecl _mbsnbcat(str str long)
# stub _mbsnbcat_l
...
...
dlls/msvcrt/tests/string.c
View file @
332d5954
...
...
@@ -77,6 +77,7 @@ 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
);
static
errno_t
(
__cdecl
*
p_mbsupr_s
)(
unsigned
char
*
str
,
size_t
numberOfElements
);
static
errno_t
(
__cdecl
*
p_mbslwr_s
)(
unsigned
char
*
str
,
size_t
numberOfElements
);
#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)
...
...
@@ -1769,6 +1770,63 @@ static void test__mbsupr_s(void)
}
static
void
test__mbslwr_s
(
void
)
{
errno_t
ret
;
unsigned
char
buffer
[
20
];
if
(
!
p_mbslwr_s
)
{
win_skip
(
"Skipping _mbslwr_s tests
\n
"
);
return
;
}
errno
=
EBADF
;
ret
=
p_mbslwr_s
(
NULL
,
0
);
ok
(
ret
==
0
,
"Expected _mbslwr_s to return 0, got %d
\n
"
,
ret
);
errno
=
EBADF
;
ret
=
p_mbslwr_s
(
NULL
,
sizeof
(
buffer
));
ok
(
ret
==
EINVAL
,
"Expected _mbslwr_s to return EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
errno
=
EBADF
;
ret
=
p_mbslwr_s
(
buffer
,
0
);
ok
(
ret
==
EINVAL
,
"Expected _mbslwr_s to return EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
memcpy
(
buffer
,
"ABCDEFGH"
,
sizeof
(
"ABCDEFGH"
));
errno
=
EBADF
;
ret
=
p_mbslwr_s
(
buffer
,
sizeof
(
"ABCDEFGH"
));
ok
(
ret
==
0
,
"Expected _mbslwr_s to return 0, got %d
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"abcdefgh"
,
sizeof
(
"abcdefgh"
)),
"Expected the output buffer to be
\"
abcdefgh
\"
, got
\"
%s
\"\n
"
,
buffer
);
memcpy
(
buffer
,
"ABCDEFGH"
,
sizeof
(
"ABCDEFGH"
));
errno
=
EBADF
;
ret
=
p_mbslwr_s
(
buffer
,
sizeof
(
buffer
));
ok
(
ret
==
0
,
"Expected _mbslwr_s to return 0, got %d
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"abcdefgh"
,
sizeof
(
"abcdefgh"
)),
"Expected the output buffer to be
\"
abcdefgh
\"
, got
\"
%s
\"\n
"
,
buffer
);
memcpy
(
buffer
,
"ABCDEFGH"
,
sizeof
(
"ABCDEFGH"
));
errno
=
EBADF
;
ret
=
p_mbslwr_s
(
buffer
,
4
);
ok
(
ret
==
EINVAL
,
"Expected _mbslwr_s to return EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
memcpy
(
buffer
,
"ABCDEFGH
\0
IJKLMNOP"
,
sizeof
(
"ABCDEFGH
\0
IJKLMNOP"
));
errno
=
EBADF
;
ret
=
p_mbslwr_s
(
buffer
,
sizeof
(
buffer
));
ok
(
ret
==
0
,
"Expected _mbslwr_s to return 0, got %d
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"abcdefgh
\0
IJKLMNOP"
,
sizeof
(
"abcdefgh
\0
IJKLMNOP"
)),
"Expected the output buffer to be
\"
abcdefgh
\\
0IJKLMNOP
\"
, got
\"
%s
\"\n
"
,
buffer
);
}
static
void
test__ultoa_s
(
void
)
{
errno_t
ret
;
...
...
@@ -1880,6 +1938,7 @@ START_TEST(string)
p_set_invalid_parameter_handler
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_set_invalid_parameter_handler"
);
p_wcslwr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_wcslwr_s"
);
p_mbsupr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbsupr_s"
);
p_mbslwr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbslwr_s"
);
/* MSVCRT memcpy behaves like memmove for overlapping moves,
MFC42 CString::Insert seems to rely on that behaviour */
...
...
@@ -1921,4 +1980,5 @@ START_TEST(string)
test__ultoa_s
();
test__wcslwr_s
();
test__mbsupr_s
();
test__mbslwr_s
();
}
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