diff --git a/src/global.cpp b/src/global.cpp index 9da66d0..2a62153 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -2282,6 +2282,23 @@ void x264_fatal_exit(const wchar_t* exitMessage, const char* errorBoxMessage) } } +/* + * Output string to debugger [debug only] + */ +void x264_dbg_output_string(const char* format, ...) +{ +#if X264_DEBUG + char buffer[256]; + va_list args; + va_start (args, format); + vsnprintf_s(buffer, 256, _TRUNCATE, format, args); + OutputDebugStringA(buffer); + va_end(args); +#else + THROW("Cannot call this function in a non-debug build!"); +#endif //LAMEXP_DEBUG +} + /* * Entry point checks */ diff --git a/src/global.h b/src/global.h index 8510741..f52edff 100644 --- a/src/global.h +++ b/src/global.h @@ -139,6 +139,7 @@ bool x264_change_process_priority(const int priority); bool x264_change_process_priority(void *hProcess, const int priority); QDate x264_current_date_safe(void); const QString &x264_data_path(void); +void x264_dbg_output_string(const char* format, ...); size_t x264_dbg_private_bytes(void); x264_cpu_t x264_detect_cpu_features(const int argc, char **argv); bool x264_enable_close_button(const QWidget *win, const bool bEnable); @@ -219,7 +220,7 @@ while(0) RETV = FUNC(__VA_ARGS__); \ size_t _privateBytesLeak = (x264_dbg_private_bytes() - _privateBytesBefore) / 1024; \ if(_privateBytesLeak > 0) { \ - x264_dbg_dbg_output_string("\nMemory leak: Lost %u KiloBytes of PrivateUsage memory!\n\n", _privateBytesLeak); \ + x264_dbg_output_string("\nMemory leak: Lost %u KiloBytes of PrivateUsage memory!\n\n", _privateBytesLeak); \ } \ } \ while(0)