diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-07-03 16:48:23 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-07-03 17:49:31 +0100 |
commit | f191adc1fb899115915b5f0bf41bf32de518bc51 (patch) | |
tree | ab235f4a9b9be4f89dff85f710251cdf7be501c5 /source | |
parent | c49742f64fc6b6d0e62bb971f47c13d63bea7434 (diff) | |
download | mupdf-f191adc1fb899115915b5f0bf41bf32de518bc51.tar.xz |
Update Memento to output to debug window on windows.
Windows is stupid and doesn't display stderr/stdout in the debugger.
Update Memento so that messages will appear there too.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/memento.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/fitz/memento.c b/source/fitz/memento.c index 6a159f10..47aded31 100644 --- a/source/fitz/memento.c +++ b/source/fitz/memento.c @@ -61,6 +61,31 @@ android_fprintf(FILE *file, const char *fmt, ...) #define MEMENTO_STACKTRACE_METHOD 0 #endif +#ifdef _WIN32 +#include <windows.h> + +static int +windows_fprintf(FILE *file, const char *fmt, ...) +{ + va_list args; + char text[4096]; + int ret; + + va_start(args, fmt); + ret = vfprintf(file, fmt, args); + va_end(args); + + va_start(args, fmt); + vsnprintf(text, 4096, fmt, args); + OutputDebugStringA(text); + va_end(args); + + return ret; +} + +#define fprintf windows_fprintf +#endif + #ifndef MEMENTO_STACKTRACE_METHOD #ifdef __GNUC__ #define MEMENTO_STACKTRACE_METHOD 1 |