File indexing completed on 2025-01-18 10:13:18
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef UPB_PORT_VSNPRINTF_COMPAT_H_
0009 #define UPB_PORT_VSNPRINTF_COMPAT_H_
0010
0011
0012 #include "upb/port/def.inc"
0013
0014 UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt,
0015 va_list ap) {
0016 #if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
0017
0018
0019 int n = -1;
0020 if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap);
0021 if (n == -1) n = _vscprintf(fmt, ap);
0022 return n;
0023 #else
0024 return vsnprintf(buf, size, fmt, ap);
0025 #endif
0026 }
0027
0028 #include "upb/port/undef.inc"
0029
0030 #endif