3 #include "upb/port_def.inc"
5 #ifdef UPB_MSVC_VSNPRINTF
6 /* Visual C++ earlier than 2015 doesn't have standard C99 snprintf and
7 * vsnprintf. To support them, missing functions are manually implemented
8 * using the existing secure functions. */
9 int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg) {
11 return _vscprintf(format, arg);
13 int ret = _vsnprintf_s(s, n, _TRUNCATE, format, arg);
15 ret = _vscprintf(format, arg);
20 int msvc_snprintf(char* s, size_t n, const char* format, ...) {
22 va_start(arg, format);
23 int ret = msvc_vsnprintf(s, n, format, arg);