ntdll: Add strcat_s and wcscat_s.

Implementation copied from msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-06-29 11:49:14 +02:00
parent 41f488a32d
commit 83cd792e35
3 changed files with 42 additions and 0 deletions

View file

@ -1587,6 +1587,7 @@
@ cdecl sqrt(double)
@ varargs sscanf(str str)
@ cdecl strcat(str str)
@ cdecl strcat_s(str long str)
@ cdecl strchr(str long)
@ cdecl strcmp(str str)
@ cdecl strcpy(ptr str)
@ -1616,6 +1617,7 @@
@ cdecl vsprintf_s(ptr long str ptr)
@ cdecl vswprintf_s(ptr long wstr ptr)
@ cdecl wcscat(wstr wstr)
@ cdecl wcscat_s(wstr long wstr)
@ cdecl wcschr(wstr long)
@ cdecl wcscmp(wstr wstr)
@ cdecl wcscpy(ptr wstr)

View file

@ -224,6 +224,26 @@ char * __cdecl strcat( char *dst, const char *src )
}
/*********************************************************************
* strcat_s (NTDLL.@)
*/
errno_t __cdecl strcat_s( char *dst, size_t len, const char *src )
{
size_t i, j;
if (!dst || !len) return EINVAL;
if (!src)
{
*dst = 0;
return EINVAL;
}
for (i = 0; i < len; i++) if (!dst[i]) break;
for (j = 0; (j + i) < len; j++) if (!(dst[j + i] = src[j])) return 0;
*dst = 0;
return ERANGE;
}
/*********************************************************************
* strchr (NTDLL.@)
*/

View file

@ -204,6 +204,26 @@ LPWSTR __cdecl wcscat( LPWSTR dst, LPCWSTR src )
}
/*********************************************************************
* wcscat_s (NTDLL.@)
*/
errno_t __cdecl wcscat_s( wchar_t *dst, size_t len, const wchar_t *src )
{
size_t i, j;
if (!dst || !len) return EINVAL;
if (!src)
{
*dst = 0;
return EINVAL;
}
for (i = 0; i < len; i++) if (!dst[i]) break;
for (j = 0; (j + i) < len; j++) if (!(dst[j + i] = src[j])) return 0;
*dst = 0;
return ERANGE;
}
/*********************************************************************
* wcschr (NTDLL.@)
*/