ref: 783adb9afe83af4f598ad19d327aa813e71276a1
parent: 6fea084a42413b295abde288ea533d99ee71b75b
parent: 2bcadff204dac8630acc5b9c0040ed7c0e399ad4
author: Ethan Hugg <ethanhugg@gmail.com>
date: Mon Jan 27 04:44:51 EST 2014
Merge pull request #238 from mstorsjo/merge-snprintf-strftime-wrappers Use WelsSnprintf/WelsVsnprintf/WelsGetTimeOfDay/WelsStrftime instead of inconsistent macros
--- a/codec/common/crt_util_safe_x.cpp
+++ b/codec/common/crt_util_safe_x.cpp
@@ -266,7 +266,7 @@
return fwrite (kpBuffer, iSize, iCount, pFp);
}
-uint16_t WelsGetMillsecond (const SWelsTime* kpTp) {
+uint16_t WelsGetMillisecond (const SWelsTime* kpTp) {
return kpTp->millitm;
}
--- a/codec/common/crt_util_safe_x.h
+++ b/codec/common/crt_util_safe_x.h
@@ -90,7 +90,7 @@
int32_t WelsGetTimeOfDay (SWelsTime* tp);
int32_t WelsStrftime (str_t* buffer, int32_t size, const str_t* format, const SWelsTime* tp);
-uint16_t WelsGetMillsecond (const SWelsTime* tp);
+uint16_t WelsGetMillisecond (const SWelsTime* tp);
#ifdef __cplusplus
@@ -420,31 +420,20 @@
#if defined(WIN32) && defined(_MSC_VER)
#if _MSC_VER >= 1500 // VS2008
-#define SNPRINTF _snprintf_s
-#define LOCALTIME localtime_s
-#define FTIME _ftime_s
#define STRNCPY strncpy_s
#define STRCAT strcat_s
#define STRNLEN strnlen_s
-#define VSPRINTF vsprintf_s
#else // mainly for VC6
-#define SNPRINTF _snprintf
-#define LOCALTIME localtime
-#define FTIME _ftime
#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__
-#define SNPRINTF snprintf
-#define LOCALTIME localtime
#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/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -132,7 +132,7 @@
}
if (iBufLeft > 0) {
- iCurUsed = WelsSnprintf (&chFileName[iBufUsed], iBufLeft, ".%03.3u.264", WelsGetMillsecond (&sCurTime));
+ iCurUsed = WelsSnprintf (&chFileName[iBufUsed], iBufLeft, ".%03.3u.264", WelsGetMillisecond (&sCurTime));
if (iCurUsed > 0) {
iBufUsed += iCurUsed;
iBufLeft -= iCurUsed;
@@ -141,7 +141,7 @@
if (iBufLeftSize > 0) {
iCurUsedSize = WelsSnprintf (&chFileNameSize[iBufUsedSize], iBufLeftSize, ".%03.3u.len",
- WelsGetMillsecond (&sCurTime));
+ WelsGetMillisecond (&sCurTime));
if (iCurUsedSize > 0) {
iBufUsedSize += iCurUsedSize;
iBufLeftSize -= iCurUsedSize;
--- a/codec/encoder/core/src/encoder.cpp
+++ b/codec/encoder/core/src/encoder.cpp
@@ -327,11 +327,7 @@
pDumpRecFile = WelsFopen (kpFileName, "ab");
else {
str_t sDependencyRecFileName[16] = {0};
-#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER>=1500) // vs2008
- SNPRINTF (sDependencyRecFileName, 16, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage
-#else
- SNPRINTF (sDependencyRecFileName, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage
-#endif//WIN32..
+ WelsSnprintf (sDependencyRecFileName, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage
pDumpRecFile = WelsFopen (sDependencyRecFileName, "ab");
}
if (NULL != pDumpRecFile)
@@ -341,11 +337,7 @@
pDumpRecFile = WelsFopen (kpFileName, "wb");
} else {
str_t sDependencyRecFileName[16] = {0};
-#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER>=1500) // vs2008
- SNPRINTF (sDependencyRecFileName, 16, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage
-#else
- SNPRINTF (sDependencyRecFileName, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage
-#endif//WIN32..
+ WelsSnprintf (sDependencyRecFileName, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage
pDumpRecFile = WelsFopen (sDependencyRecFileName, "wb");
}
bDependencyRecFlag[kiDid] = true;
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -2085,19 +2085,8 @@
if (wlog == WelsLogDefault) {
str_t fname[MAX_FNAME_LEN] = {0};
-#if defined (_MSC_VER)
-#if _MSC_VER>=1500
- SNPRINTF (fname, MAX_FNAME_LEN, MAX_FNAME_LEN, "%swels_svc_encoder_trace.txt",
- pCodingParam->sTracePath); // confirmed_safe_unsafe_usage
-#else
- SNPRINTF (fname, MAX_FNAME_LEN, "%swels_svc_encoder_trace.txt",
- pCodingParam->sTracePath); // confirmed_safe_unsafe_usage
-#endif//_MSC_VER>=1500
-#else
- //GNUC/
- SNPRINTF (fname, MAX_FNAME_LEN, "%swels_svc_encoder_trace.txt",
- pCodingParam->sTracePath); // confirmed_safe_unsafe_usage
-#endif//_MSC_VER
+ WelsSnprintf (fname, MAX_FNAME_LEN, "%swels_svc_encoder_trace.txt",
+ pCodingParam->sTracePath); // confirmed_safe_unsafe_usage
pCtx->pFileLog = WelsFopen (fname, "wt+");
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -456,12 +456,12 @@
WelsEventInit (&pSmt->pFinUpdateMbListEvent[iIdx]);
#else
// length of semaphore name should be system constrained at least on mac 10.7
- SNPRINTF (name, SEM_NAME_MAX, "ud%d%p", iIdx, (void*) (*ppCtx));
+ WelsSnprintf (name, SEM_NAME_MAX, "ud%d%p", iIdx, (void*) (*ppCtx));
err = WelsEventOpen (&pSmt->pUpdateMbListEvent[iIdx], name);
#if defined(ENABLE_TRACE_MT)
WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno);
#endif
- SNPRINTF (name, SEM_NAME_MAX, "fu%d%p", iIdx, (void*) (*ppCtx));
+ WelsSnprintf (name, SEM_NAME_MAX, "fu%d%p", iIdx, (void*) (*ppCtx));
err = WelsEventOpen (&pSmt->pFinUpdateMbListEvent[iIdx], name);
#if defined(ENABLE_TRACE_MT)
WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno);
@@ -475,12 +475,12 @@
WelsEventInit (&pSmt->pFinSliceCodingEvent[iIdx]);
WelsEventInit (&pSmt->pExitEncodeEvent[iIdx]);
#else
- SNPRINTF (name, SEM_NAME_MAX, "sc%d%p", iIdx, (void*) (*ppCtx));
+ WelsSnprintf (name, SEM_NAME_MAX, "sc%d%p", iIdx, (void*) (*ppCtx));
err = WelsEventOpen (&pSmt->pSliceCodedEvent[iIdx], name);
#if defined(ENABLE_TRACE_MT)
WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pSliceCodedEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno);
#endif
- SNPRINTF (name, SEM_NAME_MAX, "rc%d%p", iIdx, (void*) (*ppCtx));
+ WelsSnprintf (name, SEM_NAME_MAX, "rc%d%p", iIdx, (void*) (*ppCtx));
err = WelsEventOpen (&pSmt->pReadySliceCodingEvent[iIdx], name);
#if defined(ENABLE_TRACE_MT)
WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pReadySliceCodingEvent%d = 0x%p named(%s) ret%d err%d\n", iIdx,
@@ -574,14 +574,14 @@
#else
str_t ename[SEM_NAME_MAX] = {0};
// length of semaphore name should be system constrained at least on mac 10.7
- SNPRINTF (ename, SEM_NAME_MAX, "sc%d%p", iIdx, (void*) (*ppCtx));
+ WelsSnprintf (ename, SEM_NAME_MAX, "sc%d%p", iIdx, (void*) (*ppCtx));
WelsEventClose (pSmt->pSliceCodedEvent[iIdx], ename);
- SNPRINTF (ename, SEM_NAME_MAX, "rc%d%p", iIdx, (void*) (*ppCtx));
+ WelsSnprintf (ename, SEM_NAME_MAX, "rc%d%p", iIdx, (void*) (*ppCtx));
WelsEventClose (pSmt->pReadySliceCodingEvent[iIdx], ename);
#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE)
- SNPRINTF (ename, SEM_NAME_MAX, "ud%d%p", iIdx, (void*) (*ppCtx));
+ WelsSnprintf (ename, SEM_NAME_MAX, "ud%d%p", iIdx, (void*) (*ppCtx));
WelsEventClose (pSmt->pUpdateMbListEvent[iIdx], ename);
- SNPRINTF (ename, SEM_NAME_MAX, "fu%d%p", iIdx, (void*) (*ppCtx));
+ WelsSnprintf (ename, SEM_NAME_MAX, "fu%d%p", iIdx, (void*) (*ppCtx));
WelsEventClose (pSmt->pFinUpdateMbListEvent[iIdx], ename);
#endif//DYNAMIC_SLICE_ASSIGN && TRY_SLICING_BALANCE
#endif//_WIN32
@@ -1224,7 +1224,7 @@
dw = SetThreadAffinityMask (pCtx->pSliceThreading->pThreadHandles[iIdx], dwAffinityMask); //1 << iIdx
if (dw == 0) {
str_t str[64] = {0};
- SNPRINTF (str, 64, "SetThreadAffinityMask iIdx:%d", iIdx);
+ WelsSnprintf (str, 64, "SetThreadAffinityMask iIdx:%d", iIdx);
}
}
}
--- a/codec/encoder/core/src/utils.cpp
+++ b/codec/encoder/core/src/utils.cpp
@@ -140,43 +140,10 @@
int32_t iBufLeft = kiBufSize - iBufUsed;
if (pEncCtx) {
- time_t l_time;
-#if defined(_WIN32) && defined(_MSC_VER)
-#if _MSC_VER >= 1500
- struct tm t_now;
-#else//VC6
- struct tm* t_now;
-#endif//_MSC_VER >= 1500
-#else//__GNUC__
- struct tm* t_now;
-#endif//WIN32
+ SWelsTime tTime;
-#if defined( _WIN32 ) && defined(_MSC_VER)
- struct _timeb tb;
-
- time (&l_time);
-#if _MSC_VER >= 1500
- LOCALTIME (&t_now, &l_time);
-#else
- t_now = LOCALTIME (&l_time);
- if (NULL == t_now) {
- return;
- }
-#endif//_MSC_VER >= 1500
- FTIME (&tb);
-#elif defined( __GNUC__ )
- struct timeval tv;
- time (&l_time);
- t_now = (struct tm*)LOCALTIME (&l_time);
- gettimeofday (&tv, NULL);
-#endif//WIN32
-#ifdef _MSC_VER
-#if _MSC_VER >= 1500
- iCurUsed = SNPRINTF (&pBuf[iBufUsed], iBufLeft, iBufLeft, "[0x%p @ ", pEncCtx); // confirmed_safe_unsafe_usage
-#else
- iCurUsed = SNPRINTF (&pBuf[iBufUsed], iBufLeft, "[0x%p @ ", pEncCtx); // confirmed_safe_unsafe_usage
-#endif//_MSC_VER >= 1500
-#endif//_MSC_VER
+ WelsGetTimeOfDay(&tTime);
+ iCurUsed = WelsSnprintf (&pBuf[iBufUsed], iBufLeft, "[0x%p @ ", pEncCtx); // confirmed_safe_unsafe_usage
if (iCurUsed >= 0) {
iBufUsed += iCurUsed;
iBufLeft -= iCurUsed;
@@ -215,11 +182,7 @@
}
if (iBufLeft > 0) {
-#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1500)
- iCurUsed = strftime (&pBuf[iBufUsed], iBufLeft, "%y-%m-%d %H:%M:%S", &t_now);
-#else
- iCurUsed = strftime (&pBuf[iBufUsed], iBufLeft, "%y-%m-%d %H:%M:%S", t_now);
-#endif//WIN32..
+ iCurUsed = WelsStrftime (&pBuf[iBufUsed], iBufLeft, "%y-%m-%d %H:%M:%S", &tTime);
if (iCurUsed > 0) {
iBufUsed += iCurUsed;
iBufLeft -= iCurUsed;
@@ -229,18 +192,7 @@
}
if (iBufLeft > 0) {
-#if defined (_WIN32)
-#ifdef _MSC_VER
-#if _MSC_VER >= 1500
- iCurUsed = SNPRINTF (&pBuf[iBufUsed], iBufLeft, iBufLeft, ".%03.3u]: ", tb.millitm); // confirmed_safe_unsafe_usage
-#else
- iCurUsed = SNPRINTF (&pBuf[iBufUsed], iBufLeft, ".%3.3u]: ", tb.millitm); // confirmed_safe_unsafe_usage
-#endif//_MSC_VER >= 1500
-#endif//_MSC_VER
-#elif defined (__GNUC__)
- iCurUsed = SNPRINTF (&pBuf[iBufUsed], iBufLeft, ".%3.3u]: ",
- static_cast<unsigned int> (tv.tv_usec / 1000)); // confirmed_safe_unsafe_usage
-#endif//WIN32
+ iCurUsed = WelsSnprintf (&pBuf[iBufUsed], iBufLeft, ".%3.3u]: ", tTime.millitm); // confirmed_safe_unsafe_usage
if (iCurUsed >= 0) {
iBufUsed += iCurUsed;
iBufLeft -= iCurUsed;
@@ -266,14 +218,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);
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -86,71 +86,20 @@
#endif//OUTPUT_BIT_STREAM
#ifdef OUTPUT_BIT_STREAM
- time_t tTime;
+ SWelsTime tTime;
-#if defined( _WIN32 )
-#if defined(_MSC_VER)
-#if _MSC_VER>=1500
- struct tm tTimeNow;
-#else
- struct tm* tTimeNow;
-#endif//_MSC_VER>=1500
-#endif//_MSC_VER
- struct _timeb tTimeb;
+ WelsGetTimeOfDay(&tTime);
- time (&tTime);
-#if defined(_MSC_VER)
-#if _MSC_VER>=1500
- LOCALTIME (&tTimeNow, &tTime);
-#else
- tTimeNow = LOCALTIME (&tTime);
- if (NULL == tTimeNow)
- return;
-#endif//_MSC_VER>=1500
-#endif//_MSC_VER
- FTIME (&tTimeb);
-#elif defined( __GNUC__ )
- struct tm* tTimeNow;
- struct timeval tTimev;
- time (&tTime);
- tTimeNow = (struct tm*)localtime (&tTime);
- gettimeofday (&tTimev, NULL);
-#endif//WIN32
+ iCurUsed = WelsSnprintf (strStreamFileName, iBufferLeft, "enc_bs_0x%p_", (void*)this);
+ iCurUsedSize = WelsSnprintf (strLenFileName, iBufferLeftSize, "enc_size_0x%p_", (void*)this);
-#ifdef _WIN32
-#if defined(_MSC_VER)
-#if _MSC_VER>=1500
- iCurUsed = SNPRINTF (strStreamFileName, iBufferLeft, iBufferLeft, "enc_bs_0x%p_", (void*)this);
- iCurUsedSize = SNPRINTF (strLenFileName, iBufferLeftSize, iBufferLeftSize, "enc_size_0x%p_", (void*)this);
-#else
- iCurUsed = SNPRINTF (strStreamFileName, iBufferLeft, "enc_bs_0x%p_", (void*)this);
- iCurUsedSize = SNPRINTF (strLenFileName, iBufferLeftSize, "enc_size_0x%p_", (void*)this);
-#endif//_MSC_VER>=1500
-#endif//_MSC_VER
-#else
- iCurUsed = SNPRINTF (strStreamFileName, iBufferLeft, "/tmp/enc_bs_0x%p_", (void*)this);
- iCurUsedSize = SNPRINTF (strLenFileName, iBufferLeftSize, "/tmp/enc_size_0x%p", (void*)this);
-#endif//WIN32
-
if (iCurUsed > 0) {
iBufferUsed += iCurUsed;
iBufferLeft -= iCurUsed;
}
if (iBufferLeft > 0) {
-#if defined(_GNUC__)
- iCurUsed = strftime (&strStreamFileName[iBufferUsed], iBufferLeft, "%y%m%d%H%M%S", tTimeNow);
-#else
-#if defined(_MSC_VER)
- iCurUsed = strftime (&strStreamFileName[iBufferUsed], iBufferLeft, "%y%m%d%H%M%S",
-#if _MSC_VER>=1500
- & tTimeNow
-#else
- tTimeNow
-#endif//_MSC_VER>=1500
- );
-#endif//_MSC_VER
-#endif//__GNUC__
+ iCurUsed = WelsStrftime (&strStreamFileName[iBufferUsed], iBufferLeft, "%y%m%d%H%M%S", &tTime);
iBufferUsed += iCurUsed;
iBufferLeft -= iCurUsed;
}
@@ -160,35 +109,14 @@
iBufferLeftSize -= iCurUsedSize;
}
if (iBufferLeftSize > 0) {
-#if defined(_GNUC__)
- iCurUsedSize = strftime (&strLenFileName[iBufferUsedSize], iBufferLeftSize, "%y%m%d%H%M%S", tTimeNow);
-#else
-#if defined(_MSC_VER)
- iCurUsedSize = strftime (&strLenFileName[iBufferUsedSize], iBufferLeftSize, "%y%m%d%H%M%S",
-#if _MSC_VER>=1500
- & tTimeNow
-#else
- tTimeNow
-#endif//_MSC_VER>=1500
- );
-#endif//_MSC_VER
-#endif//__GNUC__
+ iCurUsedSize = WelsStrftime (&strLenFileName[iBufferUsedSize], iBufferLeftSize, "%y%m%d%H%M%S", &tTime);
iBufferUsedSize += iCurUsedSize;
iBufferLeftSize -= iCurUsedSize;
}
if (iBufferLeft > 0) {
-#ifdef _WIN32
-#if defined(_MSC_VER)
-#if _MSC_VER>=1500
- iCurUsed = SNPRINTF (&strStreamFileName[iBufferUsed], iBufferLeft, iBufferLeft, ".%03.3u.264", tTimeb.millitm);
-#else
- iCurUsed = SNPRINTF (&strStreamFileName[iBufferUsed], iBufferLeft, ".%03.3u.264", tTimeb.millitm);
-#endif//_MSC_VER>=1500
-#endif//_MSC_VER
-#else
- iCurUsed = SNPRINTF (&strStreamFileName[iBufferUsed], iBufferLeft, ".%03.3u.264", tTimev.tv_usec / 1000);
-#endif//WIN32
+ iCurUsed = WelsSnprintf (&strStreamFileName[iBufferUsed], iBufferLeft, ".%03.3u.264",
+ WelsGetMillisecond(&tTime));
if (iCurUsed > 0) {
iBufferUsed += iCurUsed;
iBufferLeft -= iCurUsed;
@@ -196,18 +124,8 @@
}
if (iBufferLeftSize > 0) {
-#ifdef _WIN32
-#if defined(_MSC_VER)
-#if _MSC_VER>=1500
- iCurUsedSize = SNPRINTF (&strLenFileName[iBufferUsedSize], iBufferLeftSize, iBufferLeftSize, ".%03.3u.len",
- tTimeb.millitm);
-#else
- iCurUsedSize = SNPRINTF (&strLenFileName[iBufferUsedSize], iBufferLeftSize, ".%03.3u.len", tTimeb.millitm);
-#endif//_MSC_VER>=1500
-#endif//_MSC_VER
-#else
- iCurUsedSize = SNPRINTF (&strLenFileName[iBufferUsedSize], iBufferLeftSize, ".%03.3u.len", tTimev.tv_usec / 1000);
-#endif//WIN32
+ iCurUsedSize = WelsSnprintf (&strLenFileName[iBufferUsedSize], iBufferLeftSize, ".%03.3u.len",
+ WelsGetMillisecond(&tTime));
if (iCurUsedSize > 0) {
iBufferUsedSize += iCurUsedSize;
iBufferLeftSize -= iCurUsedSize;
@@ -492,17 +410,11 @@
#if defined(OUTPUT_BIT_STREAM) || defined(ENABLE_TRACE_FILE)
str_t fpath[MAX_FNAME_LEN] = {0};
#if defined(__GNUC__)
- SNPRINTF (fpath, MAX_FNAME_LEN, "/tmp/"); // confirmed_safe_unsafe_usage
+ WelsSnprintf (fpath, MAX_FNAME_LEN, "/tmp/"); // confirmed_safe_unsafe_usage
#else//__GNUC__
-#if defined (_MSC_VER)
-#if _MSC_VER>=1500
- SNPRINTF (fpath, MAX_FNAME_LEN, MAX_FNAME_LEN, ".\\"); // confirmed_safe_unsafe_usage
-#else
- SNPRINTF (fpath, MAX_FNAME_LEN, ".\\"); // confirmed_safe_unsafe_usage
-#endif//_MSC_VER>=1500
-#endif//_MSC_VER
+ WelsSnprintf (fpath, MAX_FNAME_LEN, ".\\"); // confirmed_safe_unsafe_usage
#endif //__GNUC__
strcpy (pCfg->sTracePath, fpath); // confirmed_safe_unsafe_usage
@@ -681,36 +593,13 @@
m_pFileBsSize = NULL;
}
str_t strStreamFileName[128] = {0};
-#if defined(__GNUC__)
-
- int32_t iLen = SNPRINTF (strStreamFileName, 128, "%sadj%d_w%d.264", m_pEncContext->sTracePath, m_iSwitchTimes,
- m_pEncContext->pSvcParam->iActualPicWidth);
+ int32_t iLen = WelsSnprintf (strStreamFileName, 128, "adj%d_w%d.264", m_iSwitchTimes,
+ m_pEncContext->pSvcParam->iActualPicWidth);
m_pFileBs = WelsFopen (strStreamFileName, "wb");
- SNPRINTF (strStreamFileName, 128, "%sadj%d_w%d_size.iLen", m_pEncContext->sTracePath, m_iSwitchTimes,
- m_pEncContext->pSvcParam->iActualPicWidth);
+ WelsSnprintf (strStreamFileName, 128, "adj%d_w%d_size.iLen", m_iSwitchTimes,
+ m_pEncContext->pSvcParam->iActualPicWidth);
m_pFileBsSize = WelsFopen (strStreamFileName, "wb");
-#else//__GNUC__
-
-#if defined (_MSC_VER)
-#if _MSC_VER>=1500
- int32_t iLen = SNPRINTF (strStreamFileName, 128, 128, "adj%d_w%d.264", m_iSwitchTimes,
- m_pEncContext->pSvcParam->iActualPicWidth);
- m_pFileBs = WelsFopen (strStreamFileName, "wb");
- SNPRINTF (strStreamFileName, 128, 128, "adj%d_w%d_size.iLen", m_iSwitchTimes,
- m_pEncContext->pSvcParam->iActualPicWidth);
- m_pFileBsSize = WelsFopen (strStreamFileName, "wb");
-#else
- int32_t iLen = SNPRINTF (strStreamFileName, 128, "adj%d_w%d.264", m_iSwitchTimes,
- m_pEncContext->pSvcParam->iActualPicWidth);
- m_pFileBs = WelsFopen (strStreamFileName, "wb");
- SNPRINTF (strStreamFileName, 128, "adj%d_w%d_size.iLen", m_iSwitchTimes, m_pEncContext->pSvcParam->iActualPicWidth);
- m_pFileBsSize = WelsFopen (strStreamFileName, "wb");
-#endif//_MSC_VER>=1500
-#endif//_MSC_VER
-
-
-#endif//__GNUC__
m_bSwitch = FALSE;
}