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
0b3175cb
Commit
0b3175cb
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 _mbsupr_s.
parent
41d9d0a2
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 @
0b3175cb
...
...
@@ -1001,7 +1001,7 @@
@ stub _mbstrnlen_l
@ cdecl _mbsupr(str) msvcrt._mbsupr
@ stub _mbsupr_l
@
stub
_mbsupr_s
@
cdecl _mbsupr_s(str long) msvcrt.
_mbsupr_s
@ stub _mbsupr_s_l
@ stub _mbtowc_l
@ cdecl _memccpy(ptr ptr long long) msvcrt._memccpy
...
...
dlls/msvcr80/msvcr80.spec
View file @
0b3175cb
...
...
@@ -847,7 +847,7 @@
@ stub _mbstrnlen_l
@ cdecl _mbsupr(str) msvcrt._mbsupr
@ stub _mbsupr_l
@
stub
_mbsupr_s
@
cdecl _mbsupr_s(str long) msvcrt.
_mbsupr_s
@ stub _mbsupr_s_l
@ stub _mbtowc_l
@ cdecl _memccpy(ptr ptr long long) msvcrt._memccpy
...
...
dlls/msvcr90/msvcr90.spec
View file @
0b3175cb
...
...
@@ -835,7 +835,7 @@
@ stub _mbstrnlen_l
@ cdecl _mbsupr(str) msvcrt._mbsupr
@ stub _mbsupr_l
@
stub
_mbsupr_s
@
cdecl _mbsupr_s(str long) msvcrt.
_mbsupr_s
@ stub _mbsupr_s_l
@ stub _mbtowc_l
@ cdecl _memccpy(ptr ptr long long) msvcrt._memccpy
...
...
dlls/msvcrt/mbcs.c
View file @
0b3175cb
...
...
@@ -1572,6 +1572,46 @@ unsigned char* CDECL _mbsupr(unsigned char* s)
/*********************************************************************
* _mbsupr_s(MSVCRT.@)
*/
int
CDECL
_mbsupr_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
=
_mbctoupper
(
_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
=
toupper
(
*
s
);
if
(
*
s
)
{
*
s
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
return
0
;
}
/*********************************************************************
* _mbsspn (MSVCRT.@)
*/
MSVCRT_size_t
CDECL
_mbsspn
(
const
unsigned
char
*
string
,
const
unsigned
char
*
set
)
...
...
dlls/msvcrt/msvcrt.spec
View file @
0b3175cb
...
...
@@ -783,7 +783,7 @@
# stub _mbstrnlen_l
@ cdecl _mbsupr(str)
# stub _mbsupr_l
# stub _mbsupr_s
@ cdecl _mbsupr_s(str long)
# stub _mbsupr_s_l
# stub _mbtowc_l
@ cdecl _memccpy(ptr ptr long long) ntdll._memccpy
...
...
dlls/msvcrt/tests/string.c
View file @
0b3175cb
...
...
@@ -76,6 +76,7 @@ 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
);
static
errno_t
(
__cdecl
*
p_mbsupr_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)
...
...
@@ -1711,6 +1712,63 @@ static void test__mbsnbcat_s(void)
"Expected the output buffer string to be
\"\\
0inosaurdu
\"
without ending null terminator
\n
"
);
}
static
void
test__mbsupr_s
(
void
)
{
errno_t
ret
;
unsigned
char
buffer
[
20
];
if
(
!
p_mbsupr_s
)
{
win_skip
(
"Skipping _mbsupr_s tests
\n
"
);
return
;
}
errno
=
EBADF
;
ret
=
p_mbsupr_s
(
NULL
,
0
);
ok
(
ret
==
0
,
"Expected _mbsupr_s to return 0, got %d
\n
"
,
ret
);
errno
=
EBADF
;
ret
=
p_mbsupr_s
(
NULL
,
sizeof
(
buffer
));
ok
(
ret
==
EINVAL
,
"Expected _mbsupr_s to return EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
errno
=
EBADF
;
ret
=
p_mbsupr_s
(
buffer
,
0
);
ok
(
ret
==
EINVAL
,
"Expected _mbsupr_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_mbsupr_s
(
buffer
,
sizeof
(
"abcdefgh"
));
ok
(
ret
==
0
,
"Expected _mbsupr_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_mbsupr_s
(
buffer
,
sizeof
(
buffer
));
ok
(
ret
==
0
,
"Expected _mbsupr_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_mbsupr_s
(
buffer
,
4
);
ok
(
ret
==
EINVAL
,
"Expected _mbsupr_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_mbsupr_s
(
buffer
,
sizeof
(
buffer
));
ok
(
ret
==
0
,
"Expected _mbsupr_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
;
...
...
@@ -1821,6 +1879,7 @@ START_TEST(string)
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"
);
p_mbsupr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbsupr_s"
);
/* MSVCRT memcpy behaves like memmove for overlapping moves,
MFC42 CString::Insert seems to rely on that behaviour */
...
...
@@ -1861,4 +1920,5 @@ START_TEST(string)
test__mbsnbcat_s
();
test__ultoa_s
();
test__wcslwr_s
();
test__mbsupr_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