From: Brad King Date: Wed, 11 Nov 2009 14:19:34 +0000 (-0500) Subject: Use macro for 64-bit integer literal suffixes X-Git-Tag: v2.8.0~180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94b7d844be306d045eccf78722181a2a591c9a07;p=thirdparty%2Flibarchive.git Use macro for 64-bit integer literal suffixes 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 --- diff --git a/libarchive/archive_entry_copy_bhfi.c b/libarchive/archive_entry_copy_bhfi.c index 9ad181e26..8339032c5 100644 --- a/libarchive/archive_entry_copy_bhfi.c +++ b/libarchive/archive_entry_copy_bhfi.c @@ -26,11 +26,12 @@ #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) diff --git a/libarchive/archive_private.h b/libarchive/archive_private.h index 67374a4ff..8b32b9932 100644 --- a/libarchive/archive_private.h +++ b/libarchive/archive_private.h @@ -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 diff --git a/libarchive/archive_read_support_compression_xz.c b/libarchive/archive_read_support_compression_xz.c index 3b927b01e..cbe6720bd 100644 --- a/libarchive/archive_read_support_compression_xz.c +++ b/libarchive/archive_read_support_compression_xz.c @@ -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 diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c index 84add03cb..176f2c6e5 100644 --- a/libarchive/archive_windows.c +++ b/libarchive/archive_windows.c @@ -47,6 +47,7 @@ #if defined(_WIN32) && !defined(__CYGWIN__) #include "archive_platform.h" +#include "archive_private.h" #include #include #include @@ -57,7 +58,7 @@ #include #include -#define EPOC_TIME (116444736000000000ULL) +#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) struct ustat { int64_t st_atime;