Files
Katayama Hirofumi MZ 0572d36024 [CRT][UCRT][MSVCRT] intrinsic functions: Follow-up of #9157 (#9226)
JIRA issue: CORE-20617
@learn-more found #9157 breaks the build as follows:
> error C2220: the following warning is treated as an error
> warning C4163: 'strncmp': not available as an intrinsic function
> warning C4163: 'strncpy': not available as an intrinsic function
_MSC_VER=1932 was not the version that the intrinsic functions
(strncmp, strncpy, wcsncmp, wcsncpy) added.
Using Compiler Explorer could detect the correct version:
_MSC_VER=1950.
2026-06-29 13:48:51 +09:00

31 lines
425 B
C

#include <stddef.h>
#include <tchar.h>
#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1950)
#pragma function(_tcsncpy)
#endif /* _MSC_VER */
_TCHAR * _tcsncpy(_TCHAR * dst, const _TCHAR * src, size_t n)
{
if(n != 0)
{
_TCHAR * d = dst;
const _TCHAR * s = src;
do
{
if((*d ++ = *s ++) == 0)
{
while (-- n != 0) *d ++ = 0;
break;
}
}
while(-- n != 0);
}
return dst;
}
/* EOF */