Commit cbf5ad74 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Add memcpy_s and memmove_s.

Implementation copied from msvcrt. Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 25f4760e
......@@ -1581,7 +1581,9 @@
@ cdecl memchr(ptr long long)
@ cdecl memcmp(ptr ptr long)
@ cdecl memcpy(ptr ptr long)
@ cdecl memcpy_s(ptr long ptr long)
@ cdecl memmove(ptr ptr long)
@ cdecl memmove_s(ptr long ptr long)
@ cdecl memset(ptr long long)
@ cdecl pow(double double)
@ cdecl qsort(ptr long long ptr)
......
......@@ -142,6 +142,42 @@ void * __cdecl memmove( void *dst, const void *src, size_t n )
}
/*********************************************************************
* memcpy_s (MSVCRT.@)
*/
errno_t __cdecl memcpy_s( void *dst, size_t len, const void *src, size_t count )
{
if (!count) return 0;
if (!dst) return EINVAL;
if (!src)
{
memset( dst, 0, len );
return EINVAL;
}
if (count > len)
{
memset( dst, 0, len );
return ERANGE;
}
memmove( dst, src, count );
return 0;
}
/*********************************************************************
* memmove_s (MSVCRT.@)
*/
errno_t __cdecl memmove_s( void *dst, size_t len, const void *src, size_t count )
{
if (!count) return 0;
if (!dst) return EINVAL;
if (!src) return EINVAL;
if (count > len) return ERANGE;
memmove( dst, src, count );
return 0;
}
static inline void memset_aligned_32( unsigned char *d, uint64_t v, size_t n )
{
unsigned char *end = d + n;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment