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
302d63a2
Commit
302d63a2
authored
Oct 18, 2010
by
Damjan Jovanovic
Committed by
Alexandre Julliard
Oct 18, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Implement wcsncat_s.
parent
6733c40d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
4 deletions
+91
-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
+37
-0
wcs.c
dlls/msvcrt/wcs.c
+50
-0
No files found.
dlls/msvcr100/msvcr100.spec
View file @
302d63a2
...
...
@@ -1640,7 +1640,7 @@
@ cdecl wcsftime(ptr long wstr ptr) msvcrt.wcsftime
@ cdecl wcslen(wstr) msvcrt.wcslen
@ cdecl wcsncat(wstr wstr long) msvcrt.wcsncat
@
stub
wcsncat_s
@
cdecl wcsncat_s(wstr long wstr long) msvcrt.
wcsncat_s
@ cdecl wcsncmp(wstr wstr long) msvcrt.wcsncmp
@ cdecl wcsncpy(ptr wstr long) msvcrt.wcsncpy
@ cdecl wcsncpy_s(ptr long wstr long) msvcrt.wcsncpy_s
...
...
dlls/msvcr80/msvcr80.spec
View file @
302d63a2
...
...
@@ -1494,7 +1494,7 @@
@ cdecl wcsftime(ptr long wstr ptr) msvcrt.wcsftime
@ cdecl wcslen(wstr) msvcrt.wcslen
@ cdecl wcsncat(wstr wstr long) msvcrt.wcsncat
@
stub
wcsncat_s
@
cdecl wcsncat_s(wstr long wstr long) msvcrt.
wcsncat_s
@ cdecl wcsncmp(wstr wstr long) msvcrt.wcsncmp
@ cdecl wcsncpy(ptr wstr long) msvcrt.wcsncpy
@ cdecl wcsncpy_s(ptr long wstr long) msvcrt.wcsncpy_s
...
...
dlls/msvcr90/msvcr90.spec
View file @
302d63a2
...
...
@@ -1478,7 +1478,7 @@
@ cdecl wcsftime(ptr long wstr ptr) msvcrt.wcsftime
@ cdecl wcslen(wstr) msvcrt.wcslen
@ cdecl wcsncat(wstr wstr long) msvcrt.wcsncat
@
stub
wcsncat_s
@
cdecl wcsncat_s(wstr long wstr long) msvcrt.
wcsncat_s
@ cdecl wcsncmp(wstr wstr long) msvcrt.wcsncmp
@ cdecl wcsncpy(ptr wstr long) msvcrt.wcsncpy
@ cdecl wcsncpy_s(ptr long wstr long) msvcrt.wcsncpy_s
...
...
dlls/msvcrt/msvcrt.spec
View file @
302d63a2
...
...
@@ -1440,7 +1440,7 @@
@ cdecl wcsftime(ptr long wstr ptr) MSVCRT_wcsftime
@ cdecl wcslen(wstr) ntdll.wcslen
@ cdecl wcsncat(wstr wstr long) ntdll.wcsncat
# stub
wcsncat_s
@ cdecl wcsncat_s(wstr long wstr long) MSVCRT_
wcsncat_s
@ cdecl wcsncmp(wstr wstr long) ntdll.wcsncmp
@ cdecl wcsncpy(ptr wstr long) ntdll.wcsncpy
@ cdecl wcsncpy_s(ptr long wstr long) MSVCRT_wcsncpy_s
...
...
dlls/msvcrt/tests/string.c
View file @
302d63a2
...
...
@@ -52,6 +52,7 @@ 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_mbsnbcpy_s
)(
unsigned
char
*
dst
,
size_t
size
,
const
unsigned
char
*
src
,
size_t
count
);
static
int
(
__cdecl
*
p_wcscpy_s
)(
wchar_t
*
wcDest
,
size_t
size
,
const
wchar_t
*
wcSrc
);
static
int
(
__cdecl
*
p_wcsncat_s
)(
wchar_t
*
dst
,
size_t
elem
,
const
wchar_t
*
src
,
size_t
count
);
static
int
(
__cdecl
*
p_wcsupr_s
)(
wchar_t
*
str
,
size_t
size
);
static
size_t
(
__cdecl
*
p_strnlen
)(
const
char
*
,
size_t
);
static
__int64
(
__cdecl
*
p_strtoi64
)(
const
char
*
,
char
**
,
int
);
...
...
@@ -1428,6 +1429,40 @@ static void test__strlwr_s(void)
buffer
);
}
static
void
test_wcsncat_s
(
void
)
{
static
wchar_t
abcW
[]
=
{
'a'
,
'b'
,
'c'
,
0
};
int
ret
;
wchar_t
dst
[
4
];
wchar_t
src
[
4
];
if
(
!
p_wcsncat_s
)
{
win_skip
(
"skipping wcsncat_s tests
\n
"
);
return
;
}
memcpy
(
src
,
abcW
,
sizeof
(
abcW
));
dst
[
0
]
=
0
;
ret
=
p_wcsncat_s
(
NULL
,
4
,
src
,
4
);
ok
(
ret
==
EINVAL
,
"err = %d
\n
"
,
ret
);
ret
=
p_wcsncat_s
(
dst
,
0
,
src
,
4
);
ok
(
ret
==
EINVAL
,
"err = %d
\n
"
,
ret
);
ret
=
p_wcsncat_s
(
dst
,
0
,
src
,
_TRUNCATE
);
ok
(
ret
==
EINVAL
,
"err = %d
\n
"
,
ret
);
ret
=
p_wcsncat_s
(
dst
,
4
,
NULL
,
0
);
ok
(
ret
==
0
,
"err = %d
\n
"
,
ret
);
dst
[
0
]
=
0
;
ret
=
p_wcsncat_s
(
dst
,
2
,
src
,
4
);
ok
(
ret
==
ERANGE
,
"err = %d
\n
"
,
ret
);
dst
[
0
]
=
0
;
ret
=
p_wcsncat_s
(
dst
,
2
,
src
,
_TRUNCATE
);
todo_wine
ok
(
ret
==
80
,
"err = %d
\n
"
,
ret
);
ok
(
dst
[
0
]
==
'a'
&&
dst
[
1
]
==
0
,
"dst is %s
\n
"
,
wine_dbgstr_w
(
dst
));
}
START_TEST
(
string
)
{
char
mem
[
100
];
...
...
@@ -1446,6 +1481,7 @@ START_TEST(string)
pstrcat_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"strcat_s"
);
p_mbsnbcpy_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbsnbcpy_s"
);
p_wcscpy_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcscpy_s"
);
p_wcsncat_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcsncat_s"
);
p_wcsupr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_wcsupr_s"
);
p_strnlen
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"strnlen"
);
p_strtoi64
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_strtoi64"
);
...
...
@@ -1491,4 +1527,5 @@ START_TEST(string)
test_gcvt
();
test__itoa_s
();
test__strlwr_s
();
test_wcsncat_s
();
}
dlls/msvcrt/wcs.c
View file @
302d63a2
...
...
@@ -1581,6 +1581,56 @@ INT CDECL MSVCRT_wcscat_s(MSVCRT_wchar_t* dst, MSVCRT_size_t elem, const MSVCRT_
}
/*********************************************************************
* wcsncat_s (MSVCRT.@)
*
*/
INT
CDECL
MSVCRT_wcsncat_s
(
MSVCRT_wchar_t
*
dst
,
MSVCRT_size_t
elem
,
const
MSVCRT_wchar_t
*
src
,
MSVCRT_size_t
count
)
{
MSVCRT_size_t
srclen
;
MSVCRT_size_t
i
;
MSVCRT_wchar_t
dststart
;
if
(
src
==
NULL
&&
count
>
0
)
return
MSVCRT_EINVAL
;
if
(
dst
==
NULL
)
return
MSVCRT_EINVAL
;
if
(
elem
==
0
)
return
MSVCRT_EINVAL
;
for
(
i
=
0
;
i
<
elem
;
i
++
)
{
dststart
=
i
;
if
(
dst
[
i
]
==
'\0'
)
break
;
}
if
(
dststart
==
elem
)
return
MSVCRT_EINVAL
;
if
(
count
==
MSVCRT__TRUNCATE
)
srclen
=
elem
-
dststart
-
1
;
else
srclen
=
count
;
for
(
i
=
0
;
i
<
srclen
;
i
++
)
{
if
(
src
[
i
]
==
'\0'
)
{
srclen
=
i
;
break
;
}
}
if
(
srclen
<
(
elem
-
dststart
))
{
memcpy
(
&
dst
[
dststart
],
src
,
srclen
*
sizeof
(
MSVCRT_wchar_t
));
dst
[
srclen
]
=
'\0'
;
return
0
;
}
dst
[
0
]
=
'\0'
;
return
MSVCRT_ERANGE
;
}
/*********************************************************************
* _wcstoi64_l (MSVCRT.@)
*
* FIXME: locale parameter is ignored
...
...
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