Use memcpy instead of strncpy in wxStrlcpy

Avoid stringop-overflow warning about strncpy size argument depending on source size.
Checking for null in src is not needed because it is already checked by strlen.
This commit is contained in:
pavel-t
2018-07-12 12:19:07 +03:00
parent 915b5212f8
commit 82881d6b03

View File

@@ -257,7 +257,7 @@ inline size_t wxStrlcpy(char *dest, const char *src, size_t n)
{
if ( n-- > len )
n = len;
wxCRT_StrncpyA(dest, src, n);
wxTmemcpy(dest, src, n);
dest[n] = '\0';
}
@@ -270,7 +270,7 @@ inline size_t wxStrlcpy(wchar_t *dest, const wchar_t *src, size_t n)
{
if ( n-- > len )
n = len;
wxCRT_StrncpyW(dest, src, n);
wxTmemcpy(dest, src, n);
dest[n] = L'\0';
}