56 # define tchar wchar_t
57 # define T(string_literal) L ## string_literal
58 # define tnlen wcsnlen
59 # define tncpy_s wcsncpy_s
60 # define tcpy_s wcscpy_s
61 # define tncat_s wcsncat_s
62 # define tcat_s wcscat_s
65 # define tvsnprintf vswprintf // used by implementation
66 # define tvsprintf_s vswprintf_s
67 # define tsprintf_s swprintf_s
70 # define T(string_literal) string_literal
71 # define tnlen strnlen
72 # define tncpy_s strncpy_s
73 # define tcpy_s strcpy_s
74 # define tncat_s strncat_s
75 # define tcat_s strcat_s
78 # define tvsnprintf vsnprintf // used by implementation
79 # define tvsprintf_s vsprintf_s
80 # define tsprintf_s sprintf_s
81 #endif // #ifdef WSECURE_CRT
86 #define ENFORCE(condition, err_to_warn, retval) STMT(\
89 DEBUG_WARN_ERR(err_to_warn); \
99 #define WARN_IF_PTR_LEN(len)\
107 #if EMULATE_SECURE_CRT
109 #if !OS_UNIX || OS_MACOSX || OS_OPENBSD
122 for(len = 0; len < max_len; len++)
155 size_t chars_left = std::min(max_dst_chars, max_src_chars);
156 while(chars_left != 0)
159 if((*p++ = *src++) ==
'\0')
166 if(max_dst_chars <= max_src_chars)
200 const size_t dst_len =
tnlen(dst, max_dst_chars);
201 if(dst_len == max_dst_chars)
207 tchar*
const end = dst+dst_len;
208 const size_t chars_left = max_dst_chars-dst_len;
209 int ret =
tncpy_s(end, chars_left, src, max_src_chars);
233 if(!dst || !fmt || max_dst_chars == 0)
239 const int ret =
tvsnprintf(dst, max_dst_chars, fmt, ap);
240 if(ret >=
int(max_dst_chars))
258 #endif // #if EMULATE_SECURE_CRT
const Status STRING_NOT_TERMINATED
#define ENFORCE(condition, err_to_warn, retval)
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
#define WARN_IF_PTR_LEN(len)
const Status INVALID_POINTER
const Status INVALID_SIZE
#define STATUS_ADD_DEFINITIONS(definitions)
add a module's array of StatusDefinition to the list.
static const StatusDefinition secureCrtStatusDefinitions[]