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

Functions

EXPORT errno_t wmemcmp_s (const wchar_t *dest, rsize_t dmax, const wchar_t *src, rsize_t smax, int *diff)
 Compares buffers of wide chars until they differ, and return 0 if the same or -1 or 1 in diff. More...
 

Function Documentation

◆ wmemcmp_s()

EXPORT errno_t wmemcmp_s ( const wchar_t *  dest,
rsize_t  dmax,
const wchar_t *  src,
rsize_t  smax,
int *  diff 
)

Compares buffers of wide chars until they differ, and return 0 if the same or -1 or 1 in diff.

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 wchar_t buffer to compare against
srcpointer to the source wchar_t buffer to compare with dest
dmaxmaximum length of dest, in number of wchar_t
smaxlength of the source memory block
*diffpointer to the diff which is -1, 0 or 1 according to whether the object pointed to by dest is greater than, equal to or less than the object pointed to by src. Note that musl returns the diff here.
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_WMEM.
smax shall not be greater than dmax.
Return values
EOKwhen operation is successful
ESNULLPwhen dest/src is NULL POINTER
ESZEROLwhen dmax/smax = ZERO
ESLEMAXwhen dmax/smax > RSIZE_MAX_WMEM
ESNOSPCwhen dmax < smax
See also
memcmp16_s(), memcmp32_s()