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

Functions

EXPORT errno_t memcmp16_s (const uint16_t *dest, rsize_t dmax, const uint16_t *src, rsize_t smax, int *diff)
 Compares memory until they differ, and their difference is returned in diff. More...
 

Function Documentation

◆ memcmp16_s()

EXPORT errno_t memcmp16_s ( const uint16_t *  dest,
rsize_t  dmax,
const uint16_t *  src,
rsize_t  smax,
int *  diff 
)

Compares memory until they differ, and their difference is returned in diff.

If the block of memory is the same, diff=0.

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
destpointer to memory to compare against
srcpointer to the source memory to compare with dest
dmaxmaximum length of dest, in bytess
smaxlength of the source memory block
*diffpointer to the diff which is an integer greater than, equal to or less than zero according to whether the object pointed to by dest is greater than, equal to or less than the object pointed to by src.
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.
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
memcmp_s(), memcmp32_s()