summaryrefslogtreecommitdiff
path: root/upb/port_def.inc
diff options
context:
space:
mode:
Diffstat (limited to 'upb/port_def.inc')
-rw-r--r--upb/port_def.inc20
1 files changed, 18 insertions, 2 deletions
diff --git a/upb/port_def.inc b/upb/port_def.inc
index 5220c29..0650920 100644
--- a/upb/port_def.inc
+++ b/upb/port_def.inc
@@ -75,8 +75,16 @@
/* Windows versions */
#include <stdarg.h>
#include <stdio.h>
-#define _upb_snprintf _snprintf_s
-#define _upb_vsnprintf _vsnprintf_s
+#if defined(_MSC_VER) && _MSC_VER < 1900
+int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg);
+int msvc_snprintf(char* s, size_t n, const char* format, ...);
+#define UPB_MSVC_VSNPRINTF
+#define _upb_snprintf msvc_snprintf
+#define _upb_vsnprintf msvc_vsnprintf
+#else
+#define _upb_snprintf snprintf
+#define _upb_vsnprintf vsnprintf
+#endif
#define _upb_va_copy(a, b) va_copy(a, b)
#else
#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L
@@ -130,3 +138,11 @@
#else
#define UPB_UNREACHABLE() do { assert(0); } while(0)
#endif
+
+/* UPB_INFINITY representing floating-point positive infinity. */
+#include <math.h>
+#ifdef INFINITY
+#define UPB_INFINITY INFINITY
+#else
+#define UPB_INFINITY (1.0 / 0.0)
+#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback