summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-02-06 19:15:48 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-02-07 17:40:31 (GMT)
commitb2cb485268b1290b6c0984c328fd5ffbddfada78 (patch)
treebe6825408416a64f461354f3c9b0410ee312eec7 /src
parent021740bac0893a87c762959b284283bc236d0ab3 (diff)
downloadhdf5-b2cb485268b1290b6c0984c328fd5ffbddfada78.zip
hdf5-b2cb485268b1290b6c0984c328fd5ffbddfada78.tar.gz
hdf5-b2cb485268b1290b6c0984c328fd5ffbddfada78.tar.bz2
Provide C99/POSIX.1 format strings PRI[doux]{8,16,32,64,MAX,PTR} on systems
that are missing <inttypes.h>.
Diffstat (limited to 'src')
-rw-r--r--src/H5public.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/H5public.h b/src/H5public.h
index 86a1fbb..3312cf4 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -51,7 +51,45 @@
# endif
#endif
#ifdef H5_HAVE_INTTYPES_H
-# include <inttypes.h> /* For uint64_t on some platforms */
+# include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */
+#else /* H5_HAVE_INTTYPES_H */
+/* The following definitions should be suitable for 64-bit Windows, which is
+ * LLP64, and for 32-bit Windows, which is ILP32. Those are the only
+ * platforms where <inttypes.h> is likely to be missing. VS2015 and later
+ * *may* provide these definitions.
+ */
+#ifdef _WIN64
+# define PRIdPTR "lld"
+# define PRIoPTR "llo"
+# define PRIuPTR "llu"
+# define PRIxPTR "llx"
+#else /* _WIN64 */
+# define PRIdPTR "ld"
+# define PRIoPTR "lo"
+# define PRIuPTR "lu"
+# define PRIxPTR "lx"
+#endif /* _WIN64 */
+
+# define PRId8 "d"
+# define PRIo8 "o"
+# define PRIu8 "u"
+# define PRIx8 "x"
+# define PRId16 "d"
+# define PRIo16 "o"
+# define PRIu16 "u"
+# define PRIx16 "x"
+# define PRId32 "d"
+# define PRIo32 "o"
+# define PRIu32 "u"
+# define PRIx32 "x"
+# define PRId64 "lld"
+# define PRIo64 "llo"
+# define PRIu64 "llu"
+# define PRIx64 "llx"
+# define PRIdMAX "lld"
+# define PRIoMAX "llo"
+# define PRIuMAX "llu"
+# define PRIxMAX "llx"
#endif
#ifdef H5_HAVE_STDDEF_H
# include <stddef.h>