Fix wcslcpy compat.
This commit is contained in:
parent
7c26144e31
commit
1758e63f6b
1 changed files with 5 additions and 4 deletions
|
|
@ -20,13 +20,14 @@
|
|||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue