strcpy_s() and strcat_s() aren't drop-in replacements for strlcpy() and strlcat()

This commit is contained in:
Asanka Herath
2009-09-14 15:13:30 -04:00
committed by Love Hornquist Astrand
parent 6c45d5614a
commit 170e8158cb
2 changed files with 17 additions and 0 deletions

View File

@@ -49,4 +49,5 @@ strlcat (char *dst, const char *src, size_t dst_sz)
return len + strlcpy (dst + len, src, dst_sz - len); return len + strlcpy (dst + len, src, dst_sz - len);
} }
#endif #endif

View File

@@ -36,6 +36,20 @@
#ifndef HAVE_STRLCPY #ifndef HAVE_STRLCPY
#if defined(_MSC_VER) && _MSC_VER >= 1400
ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
strlcpy (char *dst, const char *src, size_t dst_cch)
{
errno_t e;
e = strcpy_s(dst, dst_cch, src);
return strlen (src);
}
#else
ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
strlcpy (char *dst, const char *src, size_t dst_sz) strlcpy (char *dst, const char *src, size_t dst_sz)
{ {
@@ -54,3 +68,5 @@ strlcpy (char *dst, const char *src, size_t dst_sz)
} }
#endif #endif
#endif