diff --git a/Jupiter/CString_Imp.h b/Jupiter/CString_Imp.h index 1509558..efcd5ff 100644 --- a/Jupiter/CString_Imp.h +++ b/Jupiter/CString_Imp.h @@ -38,6 +38,16 @@ #endif // va_copy +#if !defined JUPITER_VSCPRINTF + +#if defined _WIN32 +#define JUPITER_VSCPRINTF(format, format_args) _vscprintf(format, format_args) +#else // _WIN32 +#define JUPITER_VSCPRINTF(format, format_args) vsnprintf(nullptr, 0, format, format_args) +#endif // _WIN32 + +#endif // JUPITER_VSCPRINTF + /** * IMPLEMENTATION: * CString_Type @@ -141,7 +151,7 @@ template<> size_t inline Jupiter::CString_Type::vformat(const char *format int minLen; va_list sargs; va_copy(sargs, args); - minLen = vsnprintf(nullptr, 0, format, sargs); + minLen = JUPITER_VSCPRINTF(format, sargs); va_end(sargs); if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSizeNoCopy(minLen); @@ -178,7 +188,7 @@ template<> size_t inline Jupiter::CString_Type::avformat(const char *forma int minLen; va_list sargs; va_copy(sargs, args); - minLen = vsnprintf(nullptr, 0, format, sargs); + minLen = JUPITER_VSCPRINTF(format, sargs); va_end(sargs); if (minLen < 0) return 0; // We simply can not work with this. this->setBufferSize(Jupiter::String_Type::length + minLen); diff --git a/Jupiter/String_Imp.h b/Jupiter/String_Imp.h index 9b65847..7e093a9 100644 --- a/Jupiter/String_Imp.h +++ b/Jupiter/String_Imp.h @@ -37,6 +37,16 @@ #endif // va_copy +#if !defined JUPITER_VSCPRINTF + +#if defined _WIN32 +#define JUPITER_VSCPRINTF(format, format_args) _vscprintf(format, format_args) +#else // _WIN32 +#define JUPITER_VSCPRINTF(format, format_args) vsnprintf(nullptr, 0, format, format_args) +#endif // _WIN32 + +#endif // JUPITER_VSCPRINTF + /** * IMPLEMENTATION: * String_Strict @@ -100,7 +110,7 @@ template<> size_t inline Jupiter::String_Strict::vformat(const char *forma int minLen; va_list sargs; va_copy(sargs, args); - minLen = vsnprintf(nullptr, 0, format, sargs); + minLen = JUPITER_VSCPRINTF(format, sargs); va_end(sargs); if (minLen < 0) return 0; // We simply can not work with this. @@ -137,7 +147,7 @@ template<> size_t inline Jupiter::String_Strict::avformat(const char *form int minLen; va_list sargs; va_copy(sargs, args); - minLen = vsnprintf(nullptr, 0, format, sargs); + minLen = JUPITER_VSCPRINTF(format, sargs); va_end(sargs); if (minLen < 0) return 0; // We simply can not work with this. @@ -390,7 +400,7 @@ template<> size_t inline Jupiter::String_Loose::vformat(const char *format int minLen; va_list sargs; va_copy(sargs, args); - minLen = vsnprintf(nullptr, 0, format, sargs); + minLen = JUPITER_VSCPRINTF(format, sargs); va_end(sargs); if (minLen < 0) return 0; // We simply can not work with this. @@ -427,7 +437,7 @@ template<> size_t inline Jupiter::String_Loose::avformat(const char *forma int minLen; va_list sargs; va_copy(sargs, args); - minLen = vsnprintf(nullptr, 0, format, sargs); + minLen = JUPITER_VSCPRINTF(format, sargs); va_end(sargs); if (minLen < 0) return 0; // We simply can not work with this. diff --git a/Release/Jupiter.lib b/Release/Jupiter.lib index dc39e41..f3edbf6 100644 Binary files a/Release/Jupiter.lib and b/Release/Jupiter.lib differ