]> git.sur5r.net Git - openldap/commitdiff
Check some mdb integer type assumptions
authorHallvard Furuseth <hallvard@openldap.org>
Sat, 10 Sep 2011 08:11:55 +0000 (10:11 +0200)
committerHallvard Furuseth <hallvard@openldap.org>
Sat, 10 Sep 2011 20:49:34 +0000 (22:49 +0200)
libraries/libmdb/mdb.c

index fb0df164ff4a4650e49274f88483b324ec54cb7f..9d925ca684ff9860901bae5c4a0d4f406f36f786 100644 (file)
@@ -48,6 +48,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <limits.h>
 #include <stddef.h>
 #include <stdint.h>
 #include <stdio.h>
 #include "mdb.h"
 #include "midl.h"
 
+#if (__BYTE_ORDER == __LITTLE_ENDIAN) == (__BYTE_ORDER == __BIG_ENDIAN)
+# error "Unknown or unsupported endianness (__BYTE_ORDER)"
+#elif (-6 & 5) || CHAR_BIT != 8 || UINT_MAX < 0xffffffff || ULONG_MAX % 0xFFFF
+# error "Two's complement, reasonably sized integer types, please"
+#endif
+
 /** @defgroup internal MDB Internals
  *     @{
  */