msvcrt: Implement strncat_s.
This commit is contained in:
parent
745126b05d
commit
37cf8dc57d
|
@ -1585,7 +1585,7 @@
|
|||
@ cdecl strftime(str long str ptr) msvcrt.strftime
|
||||
@ cdecl strlen(str) msvcrt.strlen
|
||||
@ cdecl strncat(str str long) msvcrt.strncat
|
||||
@ stub strncat_s
|
||||
@ cdecl strncat_s(str long str long) msvcrt.strncat_s
|
||||
@ cdecl strncmp(str str long) msvcrt.strncmp
|
||||
@ cdecl strncpy(ptr str long) msvcrt.strncpy
|
||||
@ cdecl strncpy_s(ptr long str long) msvcrt.strncpy_s
|
||||
|
|
|
@ -1439,7 +1439,7 @@
|
|||
@ cdecl strftime(str long str ptr) msvcrt.strftime
|
||||
@ cdecl strlen(str) msvcrt.strlen
|
||||
@ cdecl strncat(str str long) msvcrt.strncat
|
||||
@ stub strncat_s
|
||||
@ cdecl strncat_s(str long str long) msvcrt.strncat_s
|
||||
@ cdecl strncmp(str str long) msvcrt.strncmp
|
||||
@ cdecl strncpy(ptr str long) msvcrt.strncpy
|
||||
@ cdecl strncpy_s(ptr long str long) msvcrt.strncpy_s
|
||||
|
|
|
@ -1423,7 +1423,7 @@
|
|||
@ cdecl strftime(str long str ptr) msvcrt.strftime
|
||||
@ cdecl strlen(str) msvcrt.strlen
|
||||
@ cdecl strncat(str str long) msvcrt.strncat
|
||||
@ stub strncat_s
|
||||
@ cdecl strncat_s(str long str long) msvcrt.strncat_s
|
||||
@ cdecl strncmp(str str long) msvcrt.strncmp
|
||||
@ cdecl strncpy(ptr str long) msvcrt.strncpy
|
||||
@ cdecl strncpy_s(ptr long str long) msvcrt.strncpy_s
|
||||
|
|
|
@ -1384,7 +1384,7 @@
|
|||
@ cdecl strftime(str long str ptr) MSVCRT_strftime
|
||||
@ cdecl strlen(str) ntdll.strlen
|
||||
@ cdecl strncat(str str long) ntdll.strncat
|
||||
# stub strncat_s
|
||||
@ cdecl strncat_s(str long str long) MSVCRT_strncat_s
|
||||
@ cdecl strncmp(str str long) ntdll.strncmp
|
||||
@ cdecl strncpy(ptr str long) ntdll.strncpy
|
||||
@ cdecl strncpy_s(ptr long str long)
|
||||
|
|
|
@ -392,6 +392,44 @@ int CDECL MSVCRT_strcat_s( char* dst, MSVCRT_size_t elem, const char* src )
|
|||
return MSVCRT_ERANGE;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* strncat_s (MSVCRT.@)
|
||||
*/
|
||||
int CDECL MSVCRT_strncat_s( char* dst, MSVCRT_size_t elem, const char* src, MSVCRT_size_t count )
|
||||
{
|
||||
MSVCRT_size_t i, j;
|
||||
if(!MSVCRT_CHECK_PMT(dst != 0) || !MSVCRT_CHECK_PMT(elem != 0))
|
||||
return MSVCRT_EINVAL;
|
||||
if(!MSVCRT_CHECK_PMT(src != 0))
|
||||
{
|
||||
dst[0] = '\0';
|
||||
return MSVCRT_EINVAL;
|
||||
}
|
||||
|
||||
for(i = 0; i < elem; i++)
|
||||
{
|
||||
if(dst[i] == '\0')
|
||||
{
|
||||
for(j = 0; (j + i) < elem; j++)
|
||||
{
|
||||
if(count == MSVCRT__TRUNCATE && j + i == elem - 1)
|
||||
{
|
||||
dst[j + i] = '\0';
|
||||
return MSVCRT_STRUNCATE;
|
||||
}
|
||||
if(j == count || (dst[j + i] = src[j]) == '\0')
|
||||
{
|
||||
dst[j + i] = '\0';
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Set the first element to 0, not the first element after the skipped part */
|
||||
dst[0] = '\0';
|
||||
return MSVCRT_ERANGE;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* strxfrm (MSVCRT.@)
|
||||
*/
|
||||
|
|
|
@ -68,6 +68,7 @@ size_t __cdecl strcspn(const char*,const char*);
|
|||
char* __cdecl strerror(int);
|
||||
size_t __cdecl strlen(const char*);
|
||||
char* __cdecl strncat(char*,const char*,size_t);
|
||||
errno_t __cdecl strncat_s(char*,size_t,const char*,size_t);
|
||||
int __cdecl strncmp(const char*,const char*,size_t);
|
||||
char* __cdecl strncpy(char*,const char*,size_t);
|
||||
errno_t __cdecl strncpy_s(char*,size_t,const char*,size_t);
|
||||
|
|
Loading…
Reference in New Issue