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

Functions

EXPORT errno_t wmemmove_s (wchar_t *dest, rsize_t dmax, const wchar_t *src, rsize_t smax)
 The wmemmove_s function copies smax wchar_t's from the region pointed to by src into the region pointed to by dest. More...
 

Function Documentation

◆ wmemmove_s()

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

The wmemmove_s function copies smax wchar_t's from the region pointed to by src into the region pointed to by dest.

This copying takes place as if the smax wchar_ts from the region pointed to by src are first copied into a temporary array of smax wchar_ts that does not overlap the regions pointed to by dest or src, and then the smax wchar_ts from the temporary array are copied into the region pointed to by dest.

Remarks
EXTENSION TO
  • C11 standard (ISO/IEC 9899:2011): K.3.9.2.1.4 The wmemmove_s function (p: 642) http://en.cppreference.com/w/c/string/wide/wmemmove
  • 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 bytes
[in]srcpointer to the memory that will be copied to dest
[in]smaxmaximum number bytes of src that can be copied
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_MEM.
smax shall not be greater than dmax.
Returns
If there is a runtime-constraint violation, the memmove_s function stores zeros in the first dmax characters of the region pointed to by dest if dest is not a null pointer and dmax is not greater than RSIZE_MAX_MEM.
Return values
EOKwhen operation is successful
ESNULLPwhen dst/src is NULL POINTER
ESZEROLwhen dmax/smax = ZERO
ESLEMAXwhen dmax/smax > RSIZE_MAX_MEM
ESNOSPCwhen dmax < smax
See also
memmove_s(), memmove16_s(), memcpy_s(), memcpy16_s() memcpy32_s()