diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mupdf/fitz/system.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/include/mupdf/fitz/system.h b/include/mupdf/fitz/system.h index aeb5686c..abc3b9b7 100644 --- a/include/mupdf/fitz/system.h +++ b/include/mupdf/fitz/system.h @@ -112,11 +112,32 @@ struct timeval; struct timezone; int gettimeofday(struct timeval *tv, struct timezone *tz); -#define snprintf _snprintf -#if _MSC_VER < 1800 +#if _MSC_VER < 1900 /* MSVC 2015 */ +#define snprintf msvc_snprintf +#define vsnprintf msvc_vsnprintf +static int msvc_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) +{ + int n; + n = _vsnprintf(str, size, fmt, ap); + str[size-1] = 0; + return n; +} +static int msvc_snprintf(char *str, size_t size, const char *fmt, ...) +{ + int n; + va_list ap; + va_start(ap, fmt); + n = msvc_vsnprintf(str, size, fmt, ap); + va_end(ap); + return n; +} +#endif + +#if _MSC_VER < 1700 /* MSVC 2012 */ #define isnan(x) _isnan(x) #define isinf(x) (!_finite(x)) #endif + #define hypotf _hypotf FILE *fz_fopen_utf8(const char *name, const char *mode); |