[libbluray-devel] Fixed logging with non-default mask.

hpi1 git at videolan.org
Sun May 26 12:21:14 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri May 24 15:16:46 2013 +0300| [c599044043d05aeda67fe02e025a108ebf1a964b] | committer: hpi1

Fixed logging with non-default mask.
This problem was caused by earlier BD_DEBUG() optimization.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=c599044043d05aeda67fe02e025a108ebf1a964b
---

 src/util/logging.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/util/logging.c b/src/util/logging.c
index c64e0f6..d465c97 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -25,7 +25,7 @@
 #include <stdarg.h>
 #include <string.h>
 
-uint32_t            debug_mask = DBG_CRIT;
+uint32_t            debug_mask = (uint32_t)-1; /* set all bits to make sure bd_debug() is called for initialization */
 static BD_LOG_FUNC  log_func   = NULL;
 
 void bd_set_debug_handler(BD_LOG_FUNC f)
@@ -64,6 +64,10 @@ void bd_debug(const char *file, int line, uint32_t mask, const char *format, ...
         logfile = stderr;
 
         char *env = NULL;
+        if (debug_mask == (uint32_t)-1) {
+            /* might be set by application with bd_set_debug_mask() */
+            debug_mask = DBG_CRIT;
+        }
         if ((env = getenv("BD_DEBUG_MASK")))
             debug_mask = strtol(env, NULL, 0);
 



More information about the libbluray-devel mailing list