shithub: openh264

Download patch

ref: 771ff739b6e601d261fe01b86492c17c64ca6c08
parent: e17e664e1a4738ac289fa3ff231ec8916608e07a
author: Martin Storsjö <martin@martin.st>
date: Mon Jan 27 17:05:38 EST 2014

Simplify debugging code - always write debug trace files to the cur directory

This reduces the amount of platform ifdefs.

--- a/codec/decoder/core/src/mem_align.cpp
+++ b/codec/decoder/core/src/mem_align.cpp
@@ -53,8 +53,8 @@
 
 #ifdef MEMORY_CHECK
   if (pMemCheckMalloc == NULL) {
-    pMemCheckMalloc = WelsFopen (".\\mem_check_malloc.txt", "at+");
-    pMemCheckFree   = WelsFopen (".\\mem_check_free.txt", "at+");
+    pMemCheckMalloc = WelsFopen ("mem_check_malloc.txt", "at+");
+    pMemCheckFree   = WelsFopen ("mem_check_free.txt", "at+");
   }
 
   if (kpTag != NULL) {
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -428,11 +428,7 @@
     fclose (pSmt->pFSliceDiff);
     pSmt->pFSliceDiff = NULL;
   }
-#ifdef _WIN32
-  pSmt->pFSliceDiff	= fopen (".\\slice_time.txt", "wt+");
-#else
-  pSmt->pFSliceDiff	= fopen ("/tmp/slice_time.txt", "wt+");
-#endif//_WIN32
+  pSmt->pFSliceDiff	= fopen ("slice_time.txt", "wt+");
 #endif//MT_DEBUG
 
 #if defined(ENABLE_TRACE_MT)
--- a/codec/encoder/core/src/utils.cpp
+++ b/codec/encoder/core/src/utils.cpp
@@ -264,7 +264,6 @@
 #ifdef ENABLE_TRACE_FILE
   sWelsEncCtx* pEncCtx	= (sWelsEncCtx*)pCtx;
   if (wlog == WelsLogDefault) {
-    str_t strTraceFile[MAX_FNAME_LEN] = {0};
     int32_t len = 0;
     if (pEncCtx->pFileLog != NULL) {
       fclose (pEncCtx->pFileLog);
@@ -274,14 +273,7 @@
     len = STRNLEN (pCurPath, MAX_FNAME_LEN - 1);	// confirmed_safe_unsafe_usage
     if (len >= MAX_FNAME_LEN)
       return;
-    STRNCPY (strTraceFile, MAX_FNAME_LEN, pCurPath, len);	// confirmed_safe_unsafe_usage
-#ifdef __GNUC__
-    STRCAT (strTraceFile, MAX_FNAME_LEN - len, "/wels_encoder_trace.txt");	// confirmed_safe_unsafe_usage
-#elif _WIN32
-    STRCAT (strTraceFile, MAX_FNAME_LEN - len, "\\wels_encoder_trace.txt"); // confirmed_safe_unsafe_usage
-#else
-#endif//__GNUC__
-    pEncCtx->pFileLog	= WelsFopen (strTraceFile, "wt+");	// confirmed_safe_unsafe_usage
+    pEncCtx->pFileLog	= WelsFopen ("wels_encoder_trace.txt", "wt+");	// confirmed_safe_unsafe_usage
   }
 #endif//ENABLE_TRACE_FILE
 }
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -408,16 +408,7 @@
   }
 
 #if defined(OUTPUT_BIT_STREAM) || defined(ENABLE_TRACE_FILE)
-  str_t fpath[MAX_FNAME_LEN] = {0};
-#if defined(__GNUC__)
-  WelsSnprintf (fpath, MAX_FNAME_LEN, "/tmp/");		// confirmed_safe_unsafe_usage
-
-#else//__GNUC__
-
-  WelsSnprintf (fpath, MAX_FNAME_LEN, ".\\");		// confirmed_safe_unsafe_usage
-#endif //__GNUC__
-
-  strcpy (pCfg->sTracePath, fpath);		// confirmed_safe_unsafe_usage
+  pCfg->sTracePath[0] = '\0';
 
 #endif //#if defined(OUTPUT_BIT_STREAM) || defined(ENABLE_TRACE_FILE)