msvcrt: Implemented wcsncpy_s.
This commit is contained in:
parent
6d652ddc4f
commit
096991428f
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue