diff --git a/taglib/toolkit/tdebug.cpp b/taglib/toolkit/tdebug.cpp index 557baed6..d630791c 100644 --- a/taglib/toolkit/tdebug.cpp +++ b/taglib/toolkit/tdebug.cpp @@ -27,6 +27,8 @@ #include #endif +#if !defined(NDEBUG) || defined(TRACE_IN_RELEASE) + #include "tdebug.h" #include "tstring.h" #include "tdebuglistener.h" @@ -43,17 +45,11 @@ namespace TagLib void debug(const String &s) { -#if !defined(NDEBUG) || defined(TRACE_IN_RELEASE) - debugListener->printMessage("TagLib: " + s + "\n"); - -#endif } void debugData(const ByteVector &v) { -#if !defined(NDEBUG) || defined(TRACE_IN_RELEASE) - for(size_t i = 0; i < v.size(); ++i) { std::string bits = std::bitset<8>(v[i]).to_string(); @@ -63,7 +59,7 @@ namespace TagLib debugListener->printMessage(msg); } - -#endif } } + +#endif diff --git a/taglib/toolkit/tdebug.h b/taglib/toolkit/tdebug.h index bd94d159..80d00d39 100644 --- a/taglib/toolkit/tdebug.h +++ b/taglib/toolkit/tdebug.h @@ -32,10 +32,11 @@ namespace TagLib { class ByteVector; #ifndef DO_NOT_DOCUMENT +#if !defined(NDEBUG) || defined(TRACE_IN_RELEASE) /*! - * A simple function that outputs the debug messages to the listener. - * The default listener redirects the messages to \a stderr when NDEBUG is + * A simple function that outputs the debug messages to the listener. + * The default listener redirects the messages to \a stderr when NDEBUG is * not defined. * * \warning Do not use this outside of TagLib, it could lead to undefined @@ -45,7 +46,7 @@ namespace TagLib { * \internal */ void debug(const String &s); - + /*! * For debugging binary data. * @@ -56,6 +57,13 @@ namespace TagLib { * \internal */ void debugData(const ByteVector &v); + +#else + + #define debug(x) ((void)0) + #define debugData(x) ((void)0) + +#endif } #endif