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
cf207314
Commit
cf207314
authored
Jul 06, 2015
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Add _mbscat_s_l implementation.
parent
0eb112aa
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
146 additions
and
12 deletions
+146
-12
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+2
-2
msvcr110.spec
dlls/msvcr110/msvcr110.spec
+2
-2
msvcr120.spec
dlls/msvcr120/msvcr120.spec
+2
-2
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+2
-2
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+2
-2
mbcs.c
dlls/msvcrt/mbcs.c
+50
-0
msvcrt.h
dlls/msvcrt/msvcrt.h
+1
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+2
-2
string.c
dlls/msvcrt/tests/string.c
+83
-0
No files found.
dlls/msvcr100/msvcr100.spec
View file @
cf207314
...
...
@@ -1096,8 +1096,8 @@
@ stub _mblen_l
@ cdecl _mbsbtype(str long)
@ stub _mbsbtype_l
@
stub _mbscat_s
@
stub _mbscat_s_l
@
cdecl _mbscat_s(ptr long str)
@
cdecl _mbscat_s_l(ptr long str ptr)
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
...
...
dlls/msvcr110/msvcr110.spec
View file @
cf207314
...
...
@@ -1454,8 +1454,8 @@
@ stub _mblen_l
@ cdecl _mbsbtype(str long)
@ stub _mbsbtype_l
@
stub _mbscat_s
@
stub _mbscat_s_l
@
cdecl _mbscat_s(ptr long str)
@
cdecl _mbscat_s_l(ptr long str ptr)
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
...
...
dlls/msvcr120/msvcr120.spec
View file @
cf207314
...
...
@@ -1462,8 +1462,8 @@
@ stub _mblen_l
@ cdecl _mbsbtype(str long)
@ stub _mbsbtype_l
@
stub _mbscat_s
@
stub _mbscat_s_l
@
cdecl _mbscat_s(ptr long str)
@
cdecl _mbscat_s_l(ptr long str ptr)
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
...
...
dlls/msvcr80/msvcr80.spec
View file @
cf207314
...
...
@@ -769,8 +769,8 @@
@ stub _mblen_l
@ cdecl _mbsbtype(str long)
@ stub _mbsbtype_l
@
stub _mbscat_s
@
stub _mbscat_s_l
@
cdecl _mbscat_s(ptr long str)
@
cdecl _mbscat_s_l(ptr long str ptr)
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
...
...
dlls/msvcr90/msvcr90.spec
View file @
cf207314
...
...
@@ -746,8 +746,8 @@
@ stub _mblen_l
@ cdecl _mbsbtype(str long)
@ stub _mbsbtype_l
@
stub _mbscat_s
@
stub _mbscat_s_l
@
cdecl _mbscat_s(ptr long str)
@
cdecl _mbscat_s_l(ptr long str ptr)
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
...
...
dlls/msvcrt/mbcs.c
View file @
cf207314
...
...
@@ -1053,6 +1053,56 @@ unsigned char * CDECL _mbscat( unsigned char *dst, const unsigned char *src )
}
/*********************************************************************
* _mbscat_s_l (MSVCRT.@)
*/
int
CDECL
_mbscat_s_l
(
unsigned
char
*
dst
,
MSVCRT_size_t
size
,
const
unsigned
char
*
src
,
MSVCRT__locale_t
locale
)
{
MSVCRT_size_t
i
,
j
;
int
ret
=
0
;
if
(
!
MSVCRT_CHECK_PMT
(
dst
!=
NULL
))
return
MSVCRT_EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
src
!=
NULL
))
return
MSVCRT_EINVAL
;
for
(
i
=
0
;
i
<
size
;
i
++
)
if
(
!
dst
[
i
])
break
;
if
(
i
==
size
)
{
MSVCRT_INVALID_PMT
(
"dst is not NULL-terminated"
,
MSVCRT_EINVAL
);
if
(
size
)
dst
[
0
]
=
0
;
return
MSVCRT_EINVAL
;
}
if
(
i
&&
_ismbblead_l
(
dst
[
i
-
1
],
locale
))
{
ret
=
MSVCRT_EILSEQ
;
i
--
;
}
for
(
j
=
0
;
src
[
j
]
&&
i
+
j
<
size
;
j
++
)
dst
[
i
+
j
]
=
src
[
j
];
if
(
i
+
j
==
size
)
{
MSVCRT_INVALID_PMT
(
"dst buffer is to small"
,
MSVCRT_ERANGE
);
dst
[
0
]
=
0
;
return
MSVCRT_ERANGE
;
}
if
(
j
&&
_ismbblead_l
(
src
[
j
-
1
],
locale
))
{
ret
=
MSVCRT_EILSEQ
;
j
--
;
}
dst
[
i
+
j
]
=
0
;
return
ret
;
}
/*********************************************************************
* _mbscat_s (MSVCRT.@)
*/
int
CDECL
_mbscat_s
(
unsigned
char
*
dst
,
MSVCRT_size_t
size
,
const
unsigned
char
*
src
)
{
return
_mbscat_s_l
(
dst
,
size
,
src
,
NULL
);
}
/*********************************************************************
* _mbscpy (MSVCRT.@)
*/
unsigned
char
*
CDECL
_mbscpy
(
unsigned
char
*
dst
,
const
unsigned
char
*
src
)
...
...
dlls/msvcrt/msvcrt.h
View file @
cf207314
...
...
@@ -1009,6 +1009,7 @@ int _setmbcp_l(int, LCID, MSVCRT_pthreadmbcinfo) DECLSPEC_HIDDEN;
int
__cdecl
MSVCRT__write
(
int
,
const
void
*
,
unsigned
int
);
int
__cdecl
_getch
(
void
);
int
__cdecl
_ismbblead
(
unsigned
int
);
int
__cdecl
_ismbblead_l
(
unsigned
int
,
MSVCRT__locale_t
);
int
__cdecl
_ismbclegal
(
unsigned
int
c
);
int
__cdecl
_ismbstrail
(
const
unsigned
char
*
start
,
const
unsigned
char
*
str
);
int
__cdecl
MSVCRT_mbtowc
(
MSVCRT_wchar_t
*
,
const
char
*
,
MSVCRT_size_t
);
...
...
dlls/msvcrt/msvcrt.spec
View file @
cf207314
...
...
@@ -713,8 +713,8 @@
@ cdecl _mbsbtype(str long)
# stub _mbsbtype_l(str long ptr)
@ cdecl _mbscat(str str)
# stub _mbscat_s(s
tr long str)
# stub _mbscat_s_l(s
tr long str ptr)
@ cdecl _mbscat_s(p
tr long str)
@ cdecl _mbscat_s_l(p
tr long str ptr)
@ cdecl _mbschr(str long)
# stub _mbschr_l(str long ptr)
@ cdecl _mbscmp(str str)
...
...
dlls/msvcrt/tests/string.c
View file @
cf207314
...
...
@@ -58,6 +58,7 @@ static int (__cdecl *p_memmove_s)(void *, size_t, const void *, size_t);
static
int
*
(
__cdecl
*
pmemcmp
)(
void
*
,
const
void
*
,
size_t
n
);
static
int
(
__cdecl
*
pstrcpy_s
)(
char
*
dst
,
size_t
len
,
const
char
*
src
);
static
int
(
__cdecl
*
pstrcat_s
)(
char
*
dst
,
size_t
len
,
const
char
*
src
);
static
int
(
__cdecl
*
p_mbscat_s
)(
unsigned
char
*
dst
,
size_t
size
,
const
unsigned
char
*
src
);
static
int
(
__cdecl
*
p_mbsnbcat_s
)(
unsigned
char
*
dst
,
size_t
size
,
const
unsigned
char
*
src
,
size_t
count
);
static
int
(
__cdecl
*
p_mbsnbcpy_s
)(
unsigned
char
*
dst
,
size_t
size
,
const
unsigned
char
*
src
,
size_t
count
);
static
int
(
__cdecl
*
p__mbscpy_s
)(
unsigned
char
*
,
size_t
,
const
unsigned
char
*
);
...
...
@@ -732,6 +733,86 @@ static void test_strcat_s(void)
ok
(
ret
==
EINVAL
,
"strcat_s: Writing to a NULL string returned %d, expected EINVAL
\n
"
,
ret
);
}
static
void
test__mbscat_s
(
void
)
{
unsigned
char
dst
[
8
],
src
[
4
];
int
err
;
int
prev_cp
=
_getmbcp
();
if
(
!
p_mbscat_s
)
{
win_skip
(
"_mbscat_s not found
\n
"
);
return
;
}
src
[
0
]
=
dst
[
0
]
=
0
;
err
=
p_mbscat_s
(
NULL
,
sizeof
(
dst
),
src
);
ok
(
err
==
EINVAL
,
"_mbscat_s returned %d
\n
"
,
err
);
err
=
p_mbscat_s
(
dst
,
sizeof
(
dst
),
NULL
);
ok
(
err
==
EINVAL
,
"_mbscat_s returned %d
\n
"
,
err
);
dst
[
0
]
=
'a'
;
err
=
p_mbscat_s
(
dst
,
1
,
src
);
ok
(
err
==
EINVAL
,
"_mbscat_s returned %d
\n
"
,
err
);
memset
(
dst
,
'a'
,
sizeof
(
dst
));
dst
[
6
]
=
0
;
src
[
0
]
=
'b'
;
src
[
1
]
=
0
;
err
=
p_mbscat_s
(
dst
,
sizeof
(
dst
),
src
);
ok
(
err
==
0
,
"_mbscat_s returned %d
\n
"
,
err
);
ok
(
!
memcmp
(
dst
,
"aaaaaab"
,
8
),
"dst = %s
\n
"
,
dst
);
err
=
p_mbscat_s
(
dst
,
sizeof
(
dst
),
src
);
ok
(
err
==
ERANGE
,
"_mbscat_s returned %d
\n
"
,
err
);
ok
(
!
dst
[
0
],
"dst[0] = %c
\n
"
,
dst
[
0
]);
ok
(
dst
[
1
]
==
'a'
,
"dst[1] = %c
\n
"
,
dst
[
1
]);
_setmbcp
(
932
);
/* test invalid str in dst */
dst
[
0
]
=
0x81
;
dst
[
1
]
=
0x81
;
dst
[
2
]
=
0x52
;
dst
[
3
]
=
0
;
src
[
0
]
=
'a'
;
src
[
1
]
=
0
;
err
=
p_mbscat_s
(
dst
,
sizeof
(
dst
),
src
);
ok
(
err
==
0
,
"_mbscat_s returned %d
\n
"
,
err
);
/* test invalid str in src */
dst
[
0
]
=
0
;
src
[
0
]
=
0x81
;
src
[
1
]
=
0x81
;
src
[
2
]
=
0x52
;
src
[
3
]
=
0
;
err
=
p_mbscat_s
(
dst
,
sizeof
(
dst
),
src
);
ok
(
err
==
0
,
"_mbscat_s returned %d
\n
"
,
err
);
/* test dst with leading byte on the end of buffer */
dst
[
0
]
=
'a'
;
dst
[
1
]
=
0x81
;
dst
[
2
]
=
0
;
src
[
0
]
=
'R'
;
src
[
1
]
=
0
;
err
=
p_mbscat_s
(
dst
,
sizeof
(
dst
),
src
);
ok
(
err
==
EILSEQ
,
"_mbscat_s returned %d
\n
"
,
err
);
ok
(
!
memcmp
(
dst
,
"aR"
,
3
),
"dst = %s
\n
"
,
dst
);
/* test src with leading byte on the end of buffer */
dst
[
0
]
=
'a'
;
dst
[
1
]
=
0
;
src
[
0
]
=
'b'
;
src
[
1
]
=
0x81
;
src
[
2
]
=
0
;
err
=
p_mbscat_s
(
dst
,
sizeof
(
dst
),
src
);
ok
(
err
==
EILSEQ
,
"_mbscat_s returned %d
\n
"
,
err
);
ok
(
!
memcmp
(
dst
,
"ab"
,
3
),
"dst = %s
\n
"
,
dst
);
_setmbcp
(
prev_cp
);
}
static
void
test__mbsnbcpy_s
(
void
)
{
unsigned
char
dest
[
8
];
...
...
@@ -2984,6 +3065,7 @@ START_TEST(string)
SET
(
p__mb_cur_max
,
"__mb_cur_max"
);
pstrcpy_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"strcpy_s"
);
pstrcat_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"strcat_s"
);
p_mbscat_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbscat_s"
);
p_mbsnbcat_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbsnbcat_s"
);
p_mbsnbcpy_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbsnbcpy_s"
);
p__mbscpy_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbscpy_s"
);
...
...
@@ -3037,6 +3119,7 @@ START_TEST(string)
test_memcpy_s
();
test_memmove_s
();
test_strcat_s
();
test__mbscat_s
();
test__mbsnbcpy_s
();
test__mbscpy_s
();
test_mbcjisjms
();
...
...
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