Don't include <limits.h>. Include <inttypes.h> if available,
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Aug 2004 05:20:05 +0000 (05:20 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Aug 2004 05:20:05 +0000 (05:20 +0000)
as it defines symbols like UINT32_MAX on Solaris 8.
(md5_uint32): Assume uint32_t exists; Autoconf will define it
otherwise (if the host has a 32-bit unsigned type, anyway).

lib/md5.h

index 7cc0c6f..661de4b 100644 (file)
--- a/lib/md5.h
+++ b/lib/md5.h
 #define _MD5_H 1
 
 #include <stdio.h>
-#include <limits.h>
-
-/* The following contortions are an attempt to use the C preprocessor
-   to determine an unsigned integral type that is exactly 32 bits wide.  */
 
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
 #if HAVE_STDINT_H || _LIBC
 # include <stdint.h>
 #endif
 
-#ifdef UINT32_MAX
 typedef uint32_t md5_uint32;
-#else
-# define UINT_MAX_32_BITS 4294967295U
-# if UINT_MAX == UINT_MAX_32_BITS
-   typedef unsigned int md5_uint32;
-# elif USHRT_MAX == UINT_MAX_32_BITS
-   typedef unsigned short int md5_uint32;
-# elif ULONG_MAX == UINT_MAX_32_BITS
-   typedef unsigned long md5_uint32;
-# else
-   /* The following line is intended to evoke an error.
-      Using #error is not portable enough.  */
-   "Cannot determine unsigned 32-bit data type."
-# endif
-#endif
 
 /* Structure to save state of computation between the single steps.  */
 struct md5_ctx