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
c7aba973
Commit
c7aba973
authored
Mar 24, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 25, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added strnlen implementation.
parent
bf128642
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
3 deletions
+39
-3
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/string.c
+13
-0
string.c
dlls/msvcrt/tests/string.c
+23
-0
No files found.
dlls/msvcr80/msvcr80.spec
View file @
c7aba973
...
...
@@ -1389,7 +1389,7 @@
@ cdecl strncmp(str str long) msvcrt.strncmp
@ cdecl strncpy(ptr str long) msvcrt.strncpy
@ stub strncpy_s
@
stub
strnlen
@
cdecl strnlen(str long) msvcrt.
strnlen
@ cdecl strpbrk(str str) msvcrt.strpbrk
@ cdecl strrchr(str long) msvcrt.strrchr
@ cdecl strspn(str str) msvcrt.strspn
...
...
dlls/msvcr90/msvcr90.spec
View file @
c7aba973
...
...
@@ -1373,7 +1373,7 @@
@ cdecl strncmp(str str long) msvcrt.strncmp
@ cdecl strncpy(ptr str long) msvcrt.strncpy
@ stub strncpy_s
@
stub
strnlen
@
cdecl strnlen(str long) msvcrt.
strnlen
@ cdecl strpbrk(str str) msvcrt.strpbrk
@ cdecl strrchr(str long) msvcrt.strrchr
@ cdecl strspn(str str) msvcrt.strspn
...
...
dlls/msvcrt/msvcrt.spec
View file @
c7aba973
...
...
@@ -1327,7 +1327,7 @@
@ cdecl strncmp(str str long) ntdll.strncmp
@ cdecl strncpy(ptr str long) ntdll.strncpy
# stub strncpy_s
# stub
strnlen
@ cdecl strnlen(str long) MSVCRT_
strnlen
@ cdecl strpbrk(str str) ntdll.strpbrk
@ cdecl strrchr(str long) ntdll.strrchr
@ cdecl strspn(str str) ntdll.strspn
...
...
dlls/msvcrt/string.c
View file @
c7aba973
...
...
@@ -314,3 +314,16 @@ MSVCRT_ulong CDECL MSVCRT_strtoul(const char* nptr, char** end, int base)
return
ret
;
}
/******************************************************************
* strnlen (MSVCRT.@)
*/
MSVCRT_size_t
CDECL
MSVCRT_strnlen
(
const
char
*
s
,
MSVCRT_size_t
maxlen
)
{
MSVCRT_size_t
i
;
for
(
i
=
0
;
i
<
maxlen
;
i
++
)
if
(
!
s
[
i
])
break
;
return
i
;
}
dlls/msvcrt/tests/string.c
View file @
c7aba973
...
...
@@ -52,6 +52,7 @@ 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_wcsupr_s
)(
wchar_t
*
str
,
size_t
size
);
static
size_t
(
__cdecl
*
p_strnlen
)(
const
char
*
,
size_t
);
static
int
*
p__mb_cur_max
;
static
unsigned
char
*
p_mbctype
;
...
...
@@ -911,6 +912,26 @@ static void test_strtol(void)
ok
(
errno
==
ERANGE
,
"wrong errno %d
\n
"
,
errno
);
}
static
void
test_strnlen
(
void
)
{
static
const
char
str
[]
=
"string"
;
size_t
res
;
if
(
!
p_strnlen
)
{
win_skip
(
"strnlen not found
\n
"
);
return
;
}
res
=
p_strnlen
(
str
,
20
);
ok
(
res
==
6
,
"Returned length = %d
\n
"
,
(
int
)
res
);
res
=
p_strnlen
(
str
,
3
);
ok
(
res
==
3
,
"Returned length = %d
\n
"
,
(
int
)
res
);
res
=
p_strnlen
(
NULL
,
0
);
ok
(
res
==
0
,
"Returned length = %d
\n
"
,
(
int
)
res
);
}
START_TEST
(
string
)
{
char
mem
[
100
];
...
...
@@ -930,6 +951,7 @@ START_TEST(string)
p_mbsnbcpy_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbsnbcpy_s"
);
p_wcscpy_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcscpy_s"
);
p_wcsupr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_wcsupr_s"
);
p_strnlen
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"strnlen"
);
/* MSVCRT memcpy behaves like memmove for overlapping moves,
MFC42 CString::Insert seems to rely on that behaviour */
...
...
@@ -959,4 +981,5 @@ START_TEST(string)
test_wcscpy_s
();
test__wcsupr_s
();
test_strtol
();
test_strnlen
();
}
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