Browse Source

libarchive: Fix Borland integer constants

Some versions of Borland provide <stdint.h>, so we use it when possible.
However, the 64-bit signed and unsigned integer min/max constants cause
overflow warnings from Borland itself!  For these constants we fall back
on our default definitions.
Brad King 16 years ago
parent
commit
c9a9c88634

+ 1 - 1
Utilities/cmlibarchive/build/cmake/config.h.in

@@ -698,7 +698,7 @@
 /* Define to `unsigned int' if <sys/types.h> does not define. */
 #cmakedefine uintptr_t  ${uintptr_t }
 
-#ifdef __BORLANDC__
+#if defined(__BORLANDC__) && !defined(HAVE_STDINT_H)
 #define uintptr_t unsigned int
 #define intptr_t  int
 #endif

+ 1 - 1
Utilities/cmlibarchive/libarchive/archive.h

@@ -61,7 +61,7 @@
 #else
 #include <unistd.h>  /* ssize_t, uid_t, and gid_t */
 #endif
-#if defined(__BORLANDC__)
+#if defined(__BORLANDC__) && !defined(HAVE_SYS_TYPES_H)
 #define __LA_INT64_T    __int64
 #define __LA_SSIZE_T  long
 #else

+ 1 - 1
Utilities/cmlibarchive/libarchive/archive_entry.h

@@ -58,7 +58,7 @@
 #else
 # include <unistd.h>
 #endif
-#if defined(__BORLANDC__)
+#if defined(__BORLANDC__) && !defined(HAVE_SYS_TYPES_H)
 #define __LA_INT64_T    __int64
 #else
 #define __LA_INT64_T    int64_t

+ 1 - 1
Utilities/cmlibarchive/libarchive/archive_entry_copy_bhfi.c

@@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$");
 
 #if defined(_WIN32) && !defined(__CYGWIN__) 
 #if defined(__BORLANDC__) || (defined(_MSC_VER) &&  _MSC_VER <= 1300)
-# define EPOC_TIME   (116444736000000000)
+# define EPOC_TIME   (116444736000000000UI64)
 #else
 # define EPOC_TIME   (116444736000000000ULL)
 #endif

+ 24 - 0
Utilities/cmlibarchive/libarchive/archive_platform.h

@@ -86,6 +86,30 @@
 #include <stdint.h>
 #endif
 
+/* Borland warns about its own constants!  */
+#if defined(__BORLANDC__)
+# if HAVE_DECL_UINT64_MAX
+#  undef UINT64_MAX
+#  undef HAVE_DECL_UINT64_MAX
+#  define HAVE_DECL_UINT64_MAX 0
+# endif
+# if HAVE_DECL_UINT64_MIN
+#  undef UINT64_MIN
+#  undef HAVE_DECL_UINT64_MIN
+#  define HAVE_DECL_UINT64_MIN 0
+# endif
+# if HAVE_DECL_INT64_MAX
+#  undef INT64_MAX
+#  undef HAVE_DECL_INT64_MAX
+#  define HAVE_DECL_INT64_MAX 0
+# endif
+# if HAVE_DECL_INT64_MIN
+#  undef INT64_MIN
+#  undef HAVE_DECL_INT64_MIN
+#  define HAVE_DECL_INT64_MIN 0
+# endif
+#endif
+
 /* Some platforms lack the standard *_MAX definitions. */
 #if !HAVE_DECL_SIZE_MAX
 #define SIZE_MAX (~(size_t)0)

+ 1 - 1
Utilities/cmlibarchive/libarchive/archive_windows.c

@@ -60,7 +60,7 @@
 #include <wchar.h>
 #include <windows.h>
 #if defined(__BORLANDC__) || (defined(_MSC_VER) &&  _MSC_VER <= 1300)
-# define EPOC_TIME   (116444736000000000)
+# define EPOC_TIME   (116444736000000000UI64)
 #else
 # define EPOC_TIME   (116444736000000000ULL)
 #endif