summaryrefslogtreecommitdiff
path: root/source/fitz/printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz/printf.c')
-rw-r--r--source/fitz/printf.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/source/fitz/printf.c b/source/fitz/printf.c
index 3fe8c7e4..bbdda93f 100644
--- a/source/fitz/printf.c
+++ b/source/fitz/printf.c
@@ -5,6 +5,22 @@
#include <stdarg.h>
#include <stdio.h>
+#ifdef _MSC_VER
+#if _MSC_VER < 1500 /* MSVC 2008 */
+int snprintf(char *s, size_t n, const char *fmt, ...)
+{
+ int r;
+ va_list ap;
+ va_start(ap, fmt);
+ r = vsprintf(s, fmt, ap);
+ va_end(ap);
+ return r;
+}
+#else if _MSC_VER < 1900 /* MSVC 2015 */
+#define snprintf _snprintf
+#endif
+#endif
+
static const char *fz_hex_digits = "0123456789abcdef";
struct fmtbuf
@@ -290,11 +306,7 @@ fz_format_string(fz_context *ctx, void *user, void (*emit)(fz_context *ctx, void
bits = 0;
if (c == 'l') {
c = *fmt++;
- bits = sizeof(long) * 8;
- if (c == 'l') {
- c = *fmt++;
- bits = 64;
- }
+ bits = sizeof(int64_t) * 8;
if (c == 0)
break;
}
@@ -310,12 +322,6 @@ fz_format_string(fz_context *ctx, void *user, void (*emit)(fz_context *ctx, void
if (c == 0)
break;
}
- if (c == 'Z') {
- c = *fmt++;
- bits = sizeof(fz_off_t) * 8;
- if (c == 0)
- break;
- }
switch (c) {
default: