Change CM_WELS_TRACE to take a plain string, not a format and variadic arguments

The format string was always "%s" anyway.
This commit is contained in:
Martin Storsjö 2014-06-10 12:11:02 +03:00
parent 5e22d5366e
commit 20e889fadb
4 changed files with 13 additions and 22 deletions

View File

@ -37,15 +37,6 @@
// Internal details.
int32_t welsStderrLevelTrace (const char* format, va_list ap);
template<int level> int32_t welsStderrTrace (
const char* format, ...) {
va_list ap;
va_start (ap, format);
welsStderrLevelTrace (format, ap);
va_end (ap);
return 0;
}
int32_t welsStderrTrace (const char* string);
#endif

View File

@ -36,7 +36,7 @@
#include <stdarg.h>
#include "typedefs.h"
typedef int32_t (*CM_WELS_TRACE) (const char* format, ...);
typedef int32_t (*CM_WELS_TRACE) (const char* string);
class welsCodecTrace {
public:

View File

@ -35,7 +35,7 @@
#include <stdio.h>
#include "typedefs.h"
int32_t welsStderrLevelTrace (const char* format, va_list ap) {
vfprintf (stderr, format, ap);
int32_t welsStderrTrace (const char* string) {
fprintf (stderr, "%s", string);
return 0;
}

View File

@ -54,10 +54,10 @@ CM_WELS_TRACE welsCodecTrace::m_fpErrorTrace = NULL;
welsCodecTrace::welsCodecTrace() {
m_fpDebugTrace = welsStderrTrace<WELS_LOG_DEBUG>;
m_fpInfoTrace = welsStderrTrace<WELS_LOG_INFO>;
m_fpWarnTrace = welsStderrTrace<WELS_LOG_WARNING>;
m_fpErrorTrace = welsStderrTrace<WELS_LOG_ERROR>;
m_fpDebugTrace = welsStderrTrace;
m_fpInfoTrace = welsStderrTrace;
m_fpWarnTrace = welsStderrTrace;
m_fpErrorTrace = welsStderrTrace;
}
welsCodecTrace::~welsCodecTrace() {
@ -71,23 +71,23 @@ void welsCodecTrace::TraceString (int32_t iLevel, const char* str) {
switch (iLevel) {
case WELS_LOG_ERROR:
if (m_fpErrorTrace)
m_fpErrorTrace ("%s", str);
m_fpErrorTrace (str);
break;
case WELS_LOG_WARNING:
if (m_fpWarnTrace)
m_fpWarnTrace ("%s", str);
m_fpWarnTrace (str);
break;
case WELS_LOG_INFO:
if (m_fpInfoTrace)
m_fpInfoTrace ("%s", str);
m_fpInfoTrace (str);
break;
case WELS_LOG_DEBUG:
if (m_fpDebugTrace)
m_fpDebugTrace ("%s", str);
m_fpDebugTrace (str);
break;
default:
if (m_fpDebugTrace)
m_fpInfoTrace ("%s", str);
m_fpInfoTrace (str);
break;
}
}