shithub: openh264

Download patch

ref: 20e889fadbfdfa74fee8fcec5e18e03d96ea5d7f
parent: 5e22d5366eb56bae9e92471ea0601f361c35494e
author: Martin Storsjö <[email protected]>
date: Tue Jun 10 08:11:02 EDT 2014

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

The format string was always "%s" anyway.

--- a/codec/common/inc/logging.h
+++ b/codec/common/inc/logging.h
@@ -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
--- a/codec/common/inc/welsCodecTrace.h
+++ b/codec/common/inc/welsCodecTrace.h
@@ -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:
--- a/codec/common/src/logging.cpp
+++ b/codec/common/src/logging.cpp
@@ -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;
 }
--- a/codec/common/src/welsCodecTrace.cpp
+++ b/codec/common/src/welsCodecTrace.cpp
@@ -54,10 +54,10 @@
 
 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 @@
   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;
   }
 }