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

Functions

EXPORT errno_t memset16_s (uint16_t *dest, rsize_t dmax, uint16_t value, rsize_t n)
 Sets the first n uint16_t values starting at dest to the specified value, but maximal dmax bytes. More...
 

Function Documentation

◆ memset16_s()

EXPORT errno_t memset16_s ( uint16_t *  dest,
rsize_t  dmax,
uint16_t  value,
rsize_t  n 
)

Sets the first n uint16_t values starting at dest to the specified value, but maximal dmax bytes.

Remarks
EXTENSION TO 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 memory that will be set to the value
[in]dmaxmaximum number of bytes to be written
[in]valuebyte value to be written
[in]nnumber of short (2-byte) words to be set
Precondition
dest shall not be a null pointer.
dmax shall not be 0
dmax shall not be greater than RSIZE_MAX_MEM.
n shall not be greater than RSIZE_MAX_MEM16.
dmax*2 may not be smaller than n.
Returns
If there is a runtime-constraints violation, and if dest is not a null pointer, and if dmax is not larger than RSIZE_MAX_MEM, then, before reporting the runtime-constraints violation, memset16_s() copies dmax bytes to the destination.
Return values
EOKwhen operation is successful
ESNULLPwhen dest is NULL POINTER
ESZEROLOnly before C11 when n = ZERO
ESLEMAXwhen dmax > RSIZE_MAX_MEM
ESLEMAXwhen n > RSIZE_MAX_MEM16
ESNOSPCwhen dmax/2 < n
See also
memset_s(), memset32_s()