]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use macro for 64-bit integer literal suffixes
authorBrad King <brad.king@kitware.com>
Wed, 11 Nov 2009 14:19:34 +0000 (09:19 -0500)
committerBrad King <brad.king@kitware.com>
Wed, 11 Nov 2009 14:19:34 +0000 (09:19 -0500)
Some compilers, such as Borland and VS 6, define __int64 instead of the
more standard long long.  Integer literals of type __int64 use the
suffix 'i64' instead of 'll'.  We define the helper macros

  ARCHIVE_LITERAL_LL(n)
  ARCHIVE_LITERAL_ULL(n)

for 'long long' and 'unsigned long long' literals.  The macros use the
proper suffix for the current compiler.

SVN-Revision: 1635

libarchive/archive_entry_copy_bhfi.c
libarchive/archive_private.h
libarchive/archive_read_support_compression_xz.c
libarchive/archive_windows.c

index 9ad181e264259abfad1fb7f411444553b87af1ca..8339032c5c35687f79883b6b79fae1740d986c08 100644 (file)
 #include "archive_platform.h"
 __FBSDID("$FreeBSD$");
 
+#include "archive_private.h"
 #include "archive_entry.h"
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
 
-#define EPOC_TIME      (116444736000000000ULL)
+#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
 
 __inline static void
 fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
index 67374a4ff456201089029c45fe0107635cdeb460..8b32b99329baebcd3cdf48835e581086fef753a0 100644 (file)
@@ -113,4 +113,12 @@ int        __archive_parse_options(const char *p, const char *fn,
 
 #define        err_combine(a,b)        ((a) < (b) ? (a) : (b))
 
+#if defined(__BORLANDC__) || (defined(_MSC_VER) &&  _MSC_VER <= 1300)
+# define       ARCHIVE_LITERAL_LL(x)   x##i64
+# define       ARCHIVE_LITERAL_ULL(x)  x##ui64
+#else
+# define       ARCHIVE_LITERAL_LL(x)   x##ll
+# define       ARCHIVE_LITERAL_ULL(x)  x##ull
+#endif
+
 #endif
index 3b927b01e8d20010382d4297906a7f3dd77ced00..cbe6720bdf06ddc7ecd67afa7e81af5e2649c0ff 100644 (file)
@@ -244,7 +244,7 @@ lzma_bidder_bid(struct archive_read_filter_bidder *self,
         * size is unknown and lzma of XZ Utils always records `-1'
         * in this field. */
        uncompressed_size = archive_le64dec(buffer+5);
-       if (uncompressed_size == (uint64_t)-1LL)
+       if (uncompressed_size == (uint64_t)ARCHIVE_LITERAL_LL(-1))
                bits_checked += 64;
 
        /* Second through fifth bytes are dictionary size, stored in
index 84add03cb50fa21f69ca8baa4b176fbb4c995194..176f2c6e56c90badd71dcf3b0243172f58fa71c1 100644 (file)
@@ -47,6 +47,7 @@
 #if defined(_WIN32) && !defined(__CYGWIN__)
 
 #include "archive_platform.h"
+#include "archive_private.h"
 #include <ctype.h>
 #include <errno.h>
 #include <stddef.h>
@@ -57,7 +58,7 @@
 #include <wchar.h>
 #include <windows.h>
 
-#define EPOC_TIME      (116444736000000000ULL)
+#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
 
 struct ustat {
        int64_t         st_atime;