History

Remove some unnecessary STRNCPY/WelsStrncpy calls and intermediate buffers

Martin Storsjö committed 12 years ago

Commit ec20ab51 parent 783adb92 files · +4 −13Browse files

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

Unified · Split

codec/decoder/plus/src/welsCodecTrace.cpp+1−6
@@ -59,19 +59,14 @@ int32_t CWelsTraceBase::SetTraceLevel (int iLevel) { · 58 unmodified lines
59 59
60int32_t CWelsTraceBase::Trace (const int kLevel, const str_t* kpFormat, va_list pVl) {60int32_t CWelsTraceBase::Trace (const int kLevel, const str_t* kpFormat, va_list pVl) {
61 if (kLevel & m_iLevel) {61 if (kLevel & m_iLevel) {
62 str_t chWStrFormat[MAX_LOG_SIZE] = {0};
63 str_t chBuf[MAX_LOG_SIZE] = {0};62 str_t chBuf[MAX_LOG_SIZE] = {0};
64 str_t chResult[MAX_LOG_SIZE] = {0};
65 const int32_t kLen = WelsStrnlen ((const str_t*)"[DECODER]: ", MAX_LOG_SIZE);63 const int32_t kLen = WelsStrnlen ((const str_t*)"[DECODER]: ", MAX_LOG_SIZE);
66 64
67 WelsStrncpy (chWStrFormat, MAX_LOG_SIZE, (const str_t*)kpFormat, WelsStrnlen ((const str_t*)kpFormat, MAX_LOG_SIZE));
68
69 WelsStrncpy (chBuf, MAX_LOG_SIZE, (const str_t*)"[DECODER]: ", kLen);65 WelsStrncpy (chBuf, MAX_LOG_SIZE, (const str_t*)"[DECODER]: ", kLen);
70 66
71 WelsVsnprintf ((chBuf + kLen), MAX_LOG_SIZE - kLen, (const str_t*)kpFormat, pVl);67 WelsVsnprintf ((chBuf + kLen), MAX_LOG_SIZE - kLen, (const str_t*)kpFormat, pVl);
72 WelsStrncpy (chResult, MAX_LOG_SIZE, (const str_t*)chBuf, WelsStrnlen ((const str_t*)chBuf, MAX_LOG_SIZE));
73 68
74 WriteString (kLevel, chResult);69 WriteString (kLevel, chBuf);
75 }70 }
76 71
77 return 0;72 return 0;

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