Fixed DEBUG configuration.

This commit is contained in:
LoRd_MuldeR 2014-04-20 21:23:14 +02:00
parent d3130ee1d2
commit d0cc5d5637
2 changed files with 19 additions and 1 deletions

View File

@ -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 * Entry point checks
*/ */

View File

@ -139,6 +139,7 @@ bool x264_change_process_priority(const int priority);
bool x264_change_process_priority(void *hProcess, const int priority); bool x264_change_process_priority(void *hProcess, const int priority);
QDate x264_current_date_safe(void); QDate x264_current_date_safe(void);
const QString &x264_data_path(void); const QString &x264_data_path(void);
void x264_dbg_output_string(const char* format, ...);
size_t x264_dbg_private_bytes(void); size_t x264_dbg_private_bytes(void);
x264_cpu_t x264_detect_cpu_features(const int argc, char **argv); x264_cpu_t x264_detect_cpu_features(const int argc, char **argv);
bool x264_enable_close_button(const QWidget *win, const bool bEnable); bool x264_enable_close_button(const QWidget *win, const bool bEnable);
@ -219,7 +220,7 @@ while(0)
RETV = FUNC(__VA_ARGS__); \ RETV = FUNC(__VA_ARGS__); \
size_t _privateBytesLeak = (x264_dbg_private_bytes() - _privateBytesBefore) / 1024; \ size_t _privateBytesLeak = (x264_dbg_private_bytes() - _privateBytesBefore) / 1024; \
if(_privateBytesLeak > 0) { \ 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) while(0)