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
3514e65f
Commit
3514e65f
authored
Jun 27, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Move the strncpy_s() implementation to string.c.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
aa7a4b78
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
38 deletions
+38
-38
heap.c
dlls/msvcrt/heap.c
+0
-38
string.c
dlls/msvcrt/string.c
+38
-0
No files found.
dlls/msvcrt/heap.c
View file @
3514e65f
...
...
@@ -827,44 +827,6 @@ int CDECL wmemcpy_s(wchar_t *dest, size_t numberOfElements,
}
#endif
/*********************************************************************
* strncpy_s (MSVCRT.@)
*/
int
CDECL
strncpy_s
(
char
*
dest
,
size_t
numberOfElements
,
const
char
*
src
,
size_t
count
)
{
size_t
i
,
end
;
TRACE
(
"(%p %Iu %s %Iu)
\n
"
,
dest
,
numberOfElements
,
debugstr_a
(
src
),
count
);
if
(
!
count
)
{
if
(
dest
&&
numberOfElements
)
*
dest
=
0
;
return
0
;
}
if
(
!
MSVCRT_CHECK_PMT
(
dest
!=
NULL
))
return
EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
src
!=
NULL
))
return
EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
numberOfElements
!=
0
))
return
EINVAL
;
if
(
count
!=
_TRUNCATE
&&
count
<
numberOfElements
)
end
=
count
;
else
end
=
numberOfElements
-
1
;
for
(
i
=
0
;
i
<
end
&&
src
[
i
];
i
++
)
dest
[
i
]
=
src
[
i
];
if
(
!
src
[
i
]
||
end
==
count
||
count
==
_TRUNCATE
)
{
dest
[
i
]
=
'\0'
;
return
0
;
}
MSVCRT_INVALID_PMT
(
"dest[numberOfElements] is too small"
,
EINVAL
);
dest
[
0
]
=
'\0'
;
return
EINVAL
;
}
BOOL
msvcrt_init_heap
(
void
)
{
heap
=
HeapCreate
(
0
,
0
,
0
);
...
...
dlls/msvcrt/string.c
View file @
3514e65f
...
...
@@ -1268,6 +1268,44 @@ char* __cdecl strncpy(char *dst, const char *src, size_t len)
return
dst
;
}
/******************************************************************
* strncpy_s (MSVCRT.@)
*/
int
CDECL
strncpy_s
(
char
*
dest
,
size_t
numberOfElements
,
const
char
*
src
,
size_t
count
)
{
size_t
i
,
end
;
TRACE
(
"(%p %Iu %s %Iu)
\n
"
,
dest
,
numberOfElements
,
debugstr_a
(
src
),
count
);
if
(
!
count
)
{
if
(
dest
&&
numberOfElements
)
*
dest
=
0
;
return
0
;
}
if
(
!
MSVCRT_CHECK_PMT
(
dest
!=
NULL
))
return
EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
src
!=
NULL
))
return
EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
numberOfElements
!=
0
))
return
EINVAL
;
if
(
count
!=
_TRUNCATE
&&
count
<
numberOfElements
)
end
=
count
;
else
end
=
numberOfElements
-
1
;
for
(
i
=
0
;
i
<
end
&&
src
[
i
];
i
++
)
dest
[
i
]
=
src
[
i
];
if
(
!
src
[
i
]
||
end
==
count
||
count
==
_TRUNCATE
)
{
dest
[
i
]
=
'\0'
;
return
0
;
}
MSVCRT_INVALID_PMT
(
"dest[numberOfElements] is too small"
,
EINVAL
);
dest
[
0
]
=
'\0'
;
return
EINVAL
;
}
/*********************************************************************
* strcpy (MSVCRT.@)
*/
...
...
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