/********************************************************************* * strncpy_s (MSVCRT.@) */ int CDECL strncpy_s(char *dest, MSVCRT_size_t numberOfElements, const char *src, MSVCRT_size_t count) { MSVCRT_size_t i, end; TRACE("(%s %lu %s %lu)\n", dest, numberOfElements, src, count); if(!count) return 0; if(!dest || !src || !numberOfElements) { MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0); *MSVCRT__errno() = MSVCRT_EINVAL; return MSVCRT_EINVAL; } if(count!=MSVCRT__TRUNCATE && count<numberOfElements) end = count; else end = numberOfElements-1; for(i=0; i<end && src[i]; i++) dest[i] = src[i]; if(!src[i] || end==count || count==MSVCRT__TRUNCATE) { dest[i] = '\0'; return 0; } MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0); dest[0] = '\0'; *MSVCRT__errno() = MSVCRT_EINVAL; return MSVCRT_EINVAL; }
/********************************************************************* * _strnset_s (MSVCRT.@) */ int CDECL MSVCRT__strnset_s(char *str, MSVCRT_size_t size, int c, MSVCRT_size_t count) { MSVCRT_size_t i; if(!str && !size && !count) return 0; if(!MSVCRT_CHECK_PMT(str != NULL)) return MSVCRT_EINVAL; if(!MSVCRT_CHECK_PMT(size > 0)) return MSVCRT_EINVAL; for(i=0; i<size-1 && i<count; i++) { if(!str[i]) return 0; str[i] = c; } for(; i<size; i++) if(!str[i]) return 0; str[0] = 0; MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0); *MSVCRT__errno() = MSVCRT_EINVAL; return MSVCRT_EINVAL; }
/********************************************************************* * _invalid_parameter_noinfo_noreturn (MSVCR80.@) */ void CDECL _invalid_parameter_noinfo_noreturn(void) { MSVCRT__invalid_parameter( NULL, NULL, NULL, 0, 0 ); MSVCRT__exit( STATUS_INVALID_CRUNTIME_PARAMETER ); }
/********************************************************************* * _invalid_parameter_noinfo (MSVCR80.@) */ void CDECL _invalid_parameter_noinfo(void) { MSVCRT__invalid_parameter( NULL, NULL, NULL, 0, 0 ); }