summaryrefslogtreecommitdiff
path: root/source/fitz/memento.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-07-03 16:48:23 +0100
committerRobin Watts <robin.watts@artifex.com>2013-07-03 17:49:31 +0100
commitf191adc1fb899115915b5f0bf41bf32de518bc51 (patch)
treeab235f4a9b9be4f89dff85f710251cdf7be501c5 /source/fitz/memento.c
parentc49742f64fc6b6d0e62bb971f47c13d63bea7434 (diff)
downloadmupdf-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/fitz/memento.c')
-rw-r--r--source/fitz/memento.c25
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