ref: 9840f11784a559443ea8af05ffaa447e40e4a916
parent: a16ccc0b4d7abae3e9a02e2ceed4150e2d0ab994
author: Martin Storsjö <martin@martin.st>
date: Tue Jan 28 07:12:42 EST 2014
Remove the now unused count parameter to WelsStrncpy Also remove manual null termination as WelsStrncpy now always takes care of it.
--- a/codec/common/crt_util_safe_x.cpp
+++ b/codec/common/crt_util_safe_x.cpp
@@ -74,7 +74,7 @@
return iRc;
}
-str_t* WelsStrncpy (str_t* pDest, int32_t iSizeInBytes, const str_t* kpSrc, int32_t iCount) {
+str_t* WelsStrncpy (str_t* pDest, int32_t iSizeInBytes, const str_t* kpSrc) {
strncpy_s (pDest, iSizeInBytes, kpSrc, _TRUNCATE);
return pDest;
@@ -130,7 +130,7 @@
return iRc;
}
-str_t* WelsStrncpy (str_t* pDest, int32_t iSizeInBytes, const str_t* kpSrc, int32_t iCount) {
+str_t* WelsStrncpy (str_t* pDest, int32_t iSizeInBytes, const str_t* kpSrc) {
strncpy (pDest, kpSrc, iSizeInBytes); //confirmed_safe_unsafe_usage
pDest[iSizeInBytes - 1] = '\0';
@@ -188,7 +188,7 @@
return iRc;
}
-str_t* WelsStrncpy (str_t* pDest, int32_t iSizeInBytes, const str_t* kpSrc, int32_t iCount) {
+str_t* WelsStrncpy (str_t* pDest, int32_t iSizeInBytes, const str_t* kpSrc) {
strncpy (pDest, kpSrc, iSizeInBytes); //confirmed_safe_unsafe_usage
pDest[iSizeInBytes - 1] = '\0';
return pDest;
--- a/codec/common/crt_util_safe_x.h
+++ b/codec/common/crt_util_safe_x.h
@@ -76,7 +76,7 @@
#endif
int32_t WelsSnprintf (str_t* buffer, int32_t sizeOfBuffer, const str_t* format, ...);
-str_t* WelsStrncpy (str_t* dest, int32_t sizeInBytes, const str_t* src, int32_t count);
+str_t* WelsStrncpy (str_t* dest, int32_t sizeInBytes, const str_t* src);
str_t* WelsStrcat (str_t* dest, int32_t sizeInBytes, str_t* src);
int32_t WelsVsnprintf (str_t* buffer, int32_t sizeOfBuffer, const str_t* format, va_list argptr);
--- a/codec/decoder/plus/src/welsCodecTrace.cpp
+++ b/codec/decoder/plus/src/welsCodecTrace.cpp
@@ -62,7 +62,7 @@
str_t chBuf[MAX_LOG_SIZE] = {0};
const int32_t kLen = strlen ("[DECODER]: ");
- WelsStrncpy (chBuf, MAX_LOG_SIZE, (const str_t*)"[DECODER]: ", kLen);
+ WelsStrncpy (chBuf, MAX_LOG_SIZE, (const str_t*)"[DECODER]: ");
WelsVsnprintf ((chBuf + kLen), MAX_LOG_SIZE - kLen, (const str_t*)kpFormat, pVl);
--- a/codec/encoder/core/src/property.cpp
+++ b/codec/encoder/core/src/property.cpp
@@ -68,8 +68,7 @@
if (iSize <= iLen)
return 0;
- pBuf[iLen] = '\0';
- WelsStrncpy (pBuf, iSize, WELS_CODE_NAME, iLen); // confirmed_safe_unsafe_usage
+ WelsStrncpy (pBuf, iSize, WELS_CODE_NAME); // confirmed_safe_unsafe_usage
return iLen;
}
@@ -90,8 +89,7 @@
if (iSize <= iLen)
return 0;
- pBuf[iLen] = '\0';
- WelsStrncpy (pBuf, iSize, WELS_LIB_NAME, iLen); // confirmed_safe_unsafe_usage
+ WelsStrncpy (pBuf, iSize, WELS_LIB_NAME); // confirmed_safe_unsafe_usage
return iLen;
}
@@ -112,8 +110,7 @@
if (iSize <= iLen)
return 0;
- pBuf[iLen] = '\0';
- WelsStrncpy (pBuf, iSize, WELS_VERSION_STR, iLen); // confirmed_safe_unsafe_usage
+ WelsStrncpy (pBuf, iSize, WELS_VERSION_STR); // confirmed_safe_unsafe_usage
return iLen;
}
@@ -134,8 +131,7 @@
if (iSize <= iLen)
return 0;
- pBuf[iLen] = '\0';
- WelsStrncpy (pBuf, iSize, WELS_IDENT, iLen); // confirmed_safe_unsafe_usage
+ WelsStrncpy (pBuf, iSize, WELS_IDENT); // confirmed_safe_unsafe_usage
return iLen;
}
--- a/codec/encoder/plus/src/welsCodecTrace.cpp
+++ b/codec/encoder/plus/src/welsCodecTrace.cpp
@@ -123,7 +123,7 @@
const int32_t len = strlen ("[ENCODER]: "); // confirmed_safe_unsafe_usage
- WelsStrncpy (pBuf, MAX_LOG_SIZE, "[ENCODER]: ", len); // confirmed_safe_unsafe_usage
+ WelsStrncpy (pBuf, MAX_LOG_SIZE, "[ENCODER]: "); // confirmed_safe_unsafe_usage
WelsVsnprintf (pBuf + len, MAX_LOG_SIZE - len, Str_Format, vl); // confirmed_safe_unsafe_usage
// g_WelsCodecTrace.TraceString(iLevel, pBuf);
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -994,7 +994,7 @@
str_t strFileName[256] = {0};
const int32_t iDataLength = m_iMaxPicWidth * m_iMaxPicHeight;
- WelsStrncpy (strFileName, 256, "pic_in_", strlen ("pic_in_")); // confirmed_safe_unsafe_usage
+ WelsStrncpy (strFileName, 256, "pic_in_"); // confirmed_safe_unsafe_usage
if (m_iMaxPicWidth == 640) {
STRCAT (strFileName, 256, "360p."); // confirmed_safe_unsafe_usage