diff src/vim.h @ 2199:014a996ac896 vim73

Use UINT32_T in the code, define it to uint32_t or unsigned int. Better autoconf check for uint32_t.
author Bram Moolenaar <bram@vim.org>
date Wed, 19 May 2010 21:57:45 +0200
parents 898bc87c6600
children f8222d1f9a73
line wrap: on
line diff
--- a/src/vim.h
+++ b/src/vim.h
@@ -32,10 +32,6 @@
 # include "auto/config.h"
 # define HAVE_PATHDEF
 
-/* Avoid a problem when stdint.h gets included later, autoconf defines
- * uint32_t when it is not typedef'ed. */
-# define __uint32_t_defined
-
 /*
  * Check if configure correctly managed to find sizeof(int).  If this failed,
  * it becomes zero.  This is likely a problem of not being able to run the
@@ -52,6 +48,20 @@
 # if defined(__CYGWIN32__) && defined(HAVE_FCHDIR)
 #  undef HAVE_FCHDIR
 # endif
+
+/* We may need to define the uint32_t on non-Unix system, but using the same
+ * identifier causes conflicts.  Therefore use UINT32_T. */
+# define UINT32_T uint32_t
+#endif
+
+#if !defined(UINT32_T)
+# if defined(uint32_t)  /* this doesn't catch typedefs, unfortunately */
+#  define UINT32_T uint32_t
+# else
+  /* Fall back to assuming unsigned int is 32 bit.  If this is wrong then the
+   * test in blowfish.c will fail. */
+#  define UINT32_T unsigned int
+# endif
 #endif
 
 /* user ID of root is usually zero, but not for everybody */
@@ -474,6 +484,12 @@ typedef unsigned long u8char_T;	    /* l
 
 #include <assert.h>
 
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
 #ifdef HAVE_WCTYPE_H
 # include <wctype.h>
 #endif
@@ -1984,12 +2000,6 @@ typedef int VimClipboard;	/* This is req
 
 #endif
 
-#if !defined(HAVE_CONFIG_H) && !defined(uint32_t) \
-	&& (defined(__CYGWIN32__) || defined(__MINGW32__))
-  /* Assuming that MingW and Cygwin do not typedef uint32_t. */
-# define uint32_t unsigned int
-#endif
-
 /* ISSYMLINK(mode) tests if a file is a symbolic link. */
 #if (defined(S_IFMT) && defined(S_IFLNK)) || defined(S_ISLNK)
 # define HAVE_ISSYMLINK
@@ -2075,13 +2085,6 @@ typedef int VimClipboard;	/* This is req
 #  undef bool
 # endif
 
-/* uint32_t may be defined by configure, but perh.h may indirectly include
- * stdint.h which tries to typedef uint32_t and fails. */
-# ifdef uint32_t
-#  undef uint32_t
-#  undef __uint32_t_defined
-# endif
-
 # ifdef __BORLANDC__
   /* Borland has the structure stati64 but not _stati64 */
 #  define _stati64 stati64