chsvlib
chsv helper source code

◆ ucpsCpy_s()

errno_t Chusov::String::ucpsCpy_s ( ucp_t *restrict  pDest,
rsize_t  cchDest,
const ucp_t *restrict  pszSrc 
)
noexcept

Copies a zero-terminated source string of Unicode code points, including a terminating null code, to a destination buffer of a specified size.

Parameters
[out]pDestis a pointer to the destination buffer where the source string is to be copied to. A size of the buffer, in code points, is specified by the value of cchDest.
[in]cchDestis a size of the destination buffer in code points.
[in]pszSrcis a pointer to a zero-terminated string to be copied into the buffer pointed by the value of pDest.
Returns
On success the function returns 0. If an error occurs, the function returns the corresponding errno code.

The function behaves similarly to the strcpy_s function as specified in the ISO/IEC TR 24731-1 specifications and C11 standard. This includes the following runtime constraints:

  1. Neither pDest nor pszSrc must be a NULL pointer.
  2. cchDest must neither equal zero nor be greater than RSIZE_MAX nor be less or equal to a value returned by a call

    ucpsnLen_s(pszSrc, cchDest).

  3. The input and output buffers must not overlap.

If any of these constraints is violated the function generates a corresponding assertion and, if execution is allowed to continue, returns a corresponding errno code. If pDest is not NULL and cchDest is neither zero not greater than RSIZE_MAX, the function sets pDest[0] to 0.

See also
strCpy_s;
wcsCpy_s;
ucpsCpy;
ucpnLen_s.