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
5959
6060 int32_t CWelsTraceBase::Trace (const int kLevel, const str_t* kpFormat, va_list pVl) {
6161 if (kLevel & m_iLevel) {
62− str_t chWStrFormat[MAX_LOG_SIZE] = {0};
6362 str_t chBuf[MAX_LOG_SIZE] = {0};
64− str_t chResult[MAX_LOG_SIZE] = {0};
6563 const int32_t kLen = WelsStrnlen ((const str_t*)"[DECODER]: ", MAX_LOG_SIZE);
6664
67− WelsStrncpy (chWStrFormat, MAX_LOG_SIZE, (const str_t*)kpFormat, WelsStrnlen ((const str_t*)kpFormat, MAX_LOG_SIZE));
68−
6965 WelsStrncpy (chBuf, MAX_LOG_SIZE, (const str_t*)"[DECODER]: ", kLen);
7066
7167 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));
7368
74− WriteString (kLevel, chResult);
69+ WriteString (kLevel, chBuf);
7570 }
7671
7772 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