msvcrt: Implemented wcsncpy_s.

This commit is contained in:
Eric Pouech 2008-10-02 22:00:34 +02:00 committed by Alexandre Julliard
parent 6d652ddc4f
commit 096991428f
2 changed files with 32 additions and 0 deletions

View File

@ -772,6 +772,7 @@
@ cdecl wcsncat(wstr wstr long) ntdll.wcsncat
@ cdecl wcsncmp(wstr wstr long) ntdll.wcsncmp
@ cdecl wcsncpy(ptr wstr long) ntdll.wcsncpy
@ cdecl wcsncpy_s(ptr long wstr long) MSVCRT_wcsncpy_s
@ cdecl wcspbrk(wstr wstr) MSVCRT_wcspbrk
@ cdecl wcsrchr(wstr long) ntdll.wcsrchr
@ cdecl wcsspn(wstr wstr) ntdll.wcsspn

View File

@ -1046,3 +1046,34 @@ INT CDECL MSVCRT_wcscpy_s( MSVCRT_wchar_t* wcDest, MSVCRT_size_t numElement, con
return 0;
}
/******************************************************************
* wcsncpy_s (MSVCRT.@)
*/
INT CDECL MSVCRT_wcsncpy_s( MSVCRT_wchar_t* wcDest, MSVCRT_size_t numElement, const MSVCRT_wchar_t *wcSrc,
MSVCRT_size_t count )
{
INT size = 0;
if (!wcDest || !numElement)
return MSVCRT_EINVAL;
wcDest[0] = 0;
if (!wcSrc)
{
return MSVCRT_EINVAL;
}
size = min(strlenW(wcSrc), count);
if (size >= numElement)
{
return MSVCRT_ERANGE;
}
memcpy( wcDest, wcSrc, size*sizeof(WCHAR) );
wcDest[size] = '\0';
return 0;
}