Lines Matching refs:strDest
23 #define SECUREC_STRNCPY_PARAM_OK(strDest, destMax, strSrc, count) \
24 (((destMax) > 0 && (destMax) <= SECUREC_STRING_MAX_LEN && (strDest) != NULL && (strSrc) != NULL && \
27 #define SECUREC_STRNCPY_PARAM_OK(strDest, destMax, strSrc, count) \
28 (((destMax) > 0 && (destMax) <= SECUREC_STRING_MAX_LEN && (strDest) != NULL && (strSrc) != NULL && \
35 SECUREC_INLINE errno_t CheckSrcCountRange(char *strDest, size_t destMax, const char *strSrc, size_t count)
48 strDest[0] = '\0';
58 errno_t strncpy_error(char *strDest, size_t destMax, const char *strSrc, size_t count)
64 if (strDest == NULL || strSrc == NULL) {
66 if (strDest != NULL) {
67 strDest[0] = '\0';
73 strDest[0] = '\0'; /* Clear dest string */
78 strDest[0] = '\0';
81 return CheckSrcCountRange(strDest, destMax, strSrc, count);
87 * from the array pointed to by strSrc to the array pointed to by strDest.
90 * strDest Destination string.
96 * strDest is updated
100 * EINVAL strDest is NULL and destMax != 0 and destMax <= SECUREC_STRING_MAX_LEN
101 * EINVAL_AND_RESET strDest != NULL and strSrc is NULL and destMax != 0 and destMax <= SECUREC_STRING_MAX_LEN
103 * ERANGE_AND_RESET strDest have not enough space and all other parameters are valid and not overlap
106 * If there is a runtime-constraint violation, strDest[0] will be set to the '\0' when strDest and destMax valid
108 errno_t strncpy_s(char *strDest, size_t destMax, const char *strSrc, size_t count)
110 if (SECUREC_STRNCPY_PARAM_OK(strDest, destMax, strSrc, count)) {
123 strDest[0] = '\0';
128 if (SECUREC_STRING_NO_OVERLAP(strDest, strSrc, minCpLen) || strDest == strSrc) {
130 SECUREC_MEMCPY_WARP_OPT(strDest, strSrc, minCpLen); /* Copy string without terminator */
131 strDest[minCpLen] = '\0';
134 strDest[0] = '\0';
139 return strncpy_error(strDest, destMax, strSrc, count);