From 1758e63f6b2335d6db04dc2aac5fe093ada3f22a Mon Sep 17 00:00:00 2001 From: Felicity Tarnell Date: Sat, 8 Mar 2014 13:05:44 +0000 Subject: [PATCH] Fix wcslcpy compat. --- wcslcpy.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wcslcpy.c b/wcslcpy.c index df007ba..d57cdd9 100644 --- a/wcslcpy.c +++ b/wcslcpy.c @@ -20,13 +20,14 @@ #include #include #include +#include #include "config.h" /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. + * Returns wcslen(src); if retval >= siz, truncation occurred. */ #ifndef HAVE_WCSLCPY size_t @@ -62,8 +63,8 @@ size_t n = siz; /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz <= strlen(dst)). - * Returns strlen(src) + MIN(siz, strlen(initial dst)). + * will be copied. Always NUL terminates (unless siz <= wcslen(dst)). + * Returns wcslen(src) + MIN(siz, wcslen(initial dst)). * If retval >= siz, truncation occurred. */ #ifndef HAVE_WCSLCAT @@ -82,7 +83,7 @@ size_t dlen; n = siz - dlen; if (n == 0) - return(dlen + strlen(s)); + return(dlen + wcslen(s)); while (*s != '\0') { if (n != 1) { *d++ = *s;