ref: 3a5ff9b6c87ad740ac4dea33c835431370ab4f05
parent: f6fe4ddeaa1a4751b3f7d58480be824b4fc522fe
author: Martin Storsjö <martin@martin.st>
date: Sun Jan 26 09:53:10 EST 2014
Use WelsVsnprintf instead of VSPRINTF
--- a/codec/common/crt_util_safe_x.h
+++ b/codec/common/crt_util_safe_x.h
@@ -425,7 +425,6 @@
#define STRNCPY strncpy_s
#define STRCAT strcat_s
#define STRNLEN strnlen_s
-#define VSPRINTF vsprintf_s
#else // mainly for VC6
#define LOCALTIME localtime
#define FTIME _ftime
@@ -432,7 +431,6 @@
#define STRNCPY wels_strncpy_s // override s.t.r.n.c.p.y here for safe
#define STRCAT wels_strcat_s // override s.t.r.c.a.t here for safe
#define STRNLEN wels_strnlen_s // override s.t.r.n.l.e.n here for safe
-#define VSPRINTF vsprintf
#endif//_MSC_VER >= 1500
#else//__GNUC__
@@ -441,7 +439,6 @@
#define STRNCPY wels_strncpy_s // override s.t.r.n.c.p.y here for safe
#define STRCAT wels_strcat_s // override s.t.r.c.a.t here for safe
#define STRNLEN wels_strnlen_s // override s.t.r.n.l.e.n here for safe
-#define VSPRINTF vsprintf
#endif//WIN32
--- a/codec/encoder/core/src/utils.cpp
+++ b/codec/encoder/core/src/utils.cpp
@@ -254,14 +254,7 @@
}
}
if (iBufLeft > 0) {
-#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1500)
- int32_t len = 0;
- len = _vscprintf (kpFmtStr, argv) // _vscprintf doesn't count
- + 1; // terminating '\0'
- iCurUsed = VSPRINTF (&pBuf[iBufUsed], len, kpFmtStr, argv); // confirmed_safe_unsafe_usage
-#else
- iCurUsed = VSPRINTF (&pBuf[iBufUsed], kpFmtStr, argv); // confirmed_safe_unsafe_usage
-#endif//WIN32..
+ iCurUsed = WelsVsnprintf (&pBuf[iBufUsed], iBufLeft, kpFmtStr, argv); // confirmed_safe_unsafe_usage
if (iCurUsed > 0) {
iBufUsed += iCurUsed;
iBufLeft -= iCurUsed;
--- a/codec/encoder/plus/src/welsCodecTrace.cpp
+++ b/codec/encoder/plus/src/welsCodecTrace.cpp
@@ -127,17 +127,7 @@
STRNCPY (WStr_Format, MAX_LOG_SIZE, Str_Format, STRNLEN (Str_Format, MAX_LOG_SIZE)); // confirmed_safe_unsafe_usage
STRNCPY (pBuf, MAX_LOG_SIZE, "[ENCODER]: ", len); // confirmed_safe_unsafe_usage
-#if defined(_WIN32)
-#if defined(_MSC_VER)
-#if _MSC_VER>=1500
- VSPRINTF (pBuf + len, MAX_LOG_SIZE - len, WStr_Format, vl); // confirmed_safe_unsafe_usage
-#else
- VSPRINTF (pBuf + len, WStr_Format, vl); // confirmed_safe_unsafe_usage
-#endif//_MSC_VER>=1500
-#endif//_MSC_VER
-#else//__GNUC__
- VSPRINTF (pBuf + len, WStr_Format, vl); // confirmed_safe_unsafe_usage
-#endif//WIN32
+ WelsVsnprintf (pBuf + len, MAX_LOG_SIZE - len, WStr_Format, vl); // confirmed_safe_unsafe_usage
STRNCPY (cResult, MAX_LOG_SIZE, pBuf, STRNLEN (pBuf, MAX_LOG_SIZE)); // confirmed_safe_unsafe_usage
// g_WelsCodecTrace.TraceString(iLevel, cResult);