History

Use strlen() instead of WelsStrnlen/STRNLEN for string constants

A string constant is guaranteed to be null terminated, and thus doesn't need to use a version of strlen with a fixed buffer size limit.

Martin Storsjö committed 12 years ago

Commit 082a9861 parent da7d3d94 files · +8 −8Browse files

Showing the changes to codec/decoder/plus/src/welsCodecTrace.cpp (1 of 4 files). Show all

Unified · Split

codec/decoder/plus/src/welsCodecTrace.cpp+2−2
@@ -60,7 +60,7 @@ int32_t CWelsTraceBase::SetTraceLevel (int iLevel) { · 59 unmodified lines
6060 int32_t CWelsTraceBase::Trace (const int kLevel, const str_t* kpFormat, va_list pVl) {
6161 if (kLevel & m_iLevel) {
6262 str_t chBuf[MAX_LOG_SIZE] = {0};
63− const int32_t kLen = WelsStrnlen ((const str_t*)"[DECODER]: ", MAX_LOG_SIZE);
63+ const int32_t kLen = strlen ("[DECODER]: ");
6464
6565 WelsStrncpy (chBuf, MAX_LOG_SIZE, (const str_t*)"[DECODER]: ", kLen);
6666
@@ -88,7 +88,7 @@ int32_t CWelsTraceFile::WriteString (int32_t iLevel, const str_t* pStr) { · 21 unmodified lines
8888 const static str_t chEnter[16] = "\n";
8989 if (m_pTraceFile) {
9090 iRC += WelsFwrite (pStr, 1, WelsStrnlen (pStr, MAX_LOG_SIZE), m_pTraceFile);
91− iRC += WelsFwrite (chEnter, 1, WelsStrnlen (chEnter, 16), m_pTraceFile);
91+ iRC += WelsFwrite (chEnter, 1, strlen (chEnter), m_pTraceFile);
9292 WelsFflush (m_pTraceFile);
9393 }
9494 return iRC;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t