safec  3.2
Safe C Library - ISO TR24731 Bounds Checking Interface
wmemcpy_s.c File Reference
#include "safe_mem_lib.h"
+ Include dependency graph for wmemcpy_s.c:

Functions

EXPORT errno_t wmemcpy_s (wchar_t *dest, rsize_t dmax, const wchar_t *src, rsize_t smax)
 This function copies at most smax wchar_t's from src to dest, up to dmax. More...
 

Function Documentation

◆ wmemcpy_s()

EXPORT errno_t wmemcpy_s ( wchar_t *  dest,
rsize_t  dmax,
const wchar_t *  src,
rsize_t  smax 
)

This function copies at most smax wchar_t's from src to dest, up to dmax.

Remarks
EXTENSION TO
  • C11 standard (ISO/IEC 9899:2011): K.3.9.2.1.3 The wmemcpy_s function (p: 641) http://en.cppreference.com/w/c/string/wide/wmemcpy
  • ISO/IEC JTC1 SC22 WG14 N1172, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces
Parameters
[out]destpointer to the memory that will be replaced by src.
[in]dmaxmaximum length of the resulting dest, in wchar_t
[in]srcpointer to the memory that will be copied to dest
[in]smaxnumber of wide characters to copy
Precondition
Neither dest nor src shall be a null pointer.
Neither dmax nor smax shall be 0.
dmax shall not be greater than RSIZE_MAX_MEM16.
smax shall not be greater than dmax.
Copying shall not take place between regions that overlap.
Returns
If there is a runtime-constraint violation, the memcpy_s function stores zeros in the first dmax bytes of the region pointed to by dest if dest is not a null pointer and smax is valid.
Return values
EOKwhen operation is successful
ESNULLPwhen dst/src is NULL POINTER
ESZEROLwhen dmax/smax = ZERO
ESLEMAXwhen dmax/smax > RSIZE_MAX_MEM16
ESNOSPCwhen dmax < smax
ESOVRLPwhen src memory overlaps dst
See also
memcpy_s(), memcpy16_s(), wmemmove_s(), memmove16_s()