summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-12-22 15:06:50 (GMT)
committerBrad King <brad.king@kitware.com>2011-12-23 21:04:58 (GMT)
commit297d9f20326ac87d637189df1ba3bf3b7db4d0b1 (patch)
tree669ba98df14d519330e645e73d226133ea5502aa
parente00dbe86d9ff0621780ff035122809cfcd36585b (diff)
downloadCMake-297d9f20326ac87d637189df1ba3bf3b7db4d0b1.zip
CMake-297d9f20326ac87d637189df1ba3bf3b7db4d0b1.tar.gz
CMake-297d9f20326ac87d637189df1ba3bf3b7db4d0b1.tar.bz2
libarchive: Cast mode constants to mode_t in case it is signed
At least one compiler (Borland) defines mode_t as just "short" which is signed. This breaks code like switch(archive_entry_filetype(e)) { case AE_IFREG: ... } if AE_IFREG and other constants have a longer signed type (int) because sign extension of the mode_t return type from archive_entry_filetype changes its value. Avoid the problem by ensuring the type of the constants matches mode_t. This change was originally made in commit a73acfbe (Fix for mode_t with signed types, 2009-11-07). Port it to the new libarchive snapshot.
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_entry.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_entry.h b/Utilities/cmlibarchive/libarchive/archive_entry.h
index 906779a..c85cf44 100644
--- a/Utilities/cmlibarchive/libarchive/archive_entry.h
+++ b/Utilities/cmlibarchive/libarchive/archive_entry.h
@@ -149,14 +149,14 @@ struct archive_entry;
* portable values to platform-native values when entries are read from
* or written to disk.
*/
-#define AE_IFMT 0170000
-#define AE_IFREG 0100000
-#define AE_IFLNK 0120000
-#define AE_IFSOCK 0140000
-#define AE_IFCHR 0020000
-#define AE_IFBLK 0060000
-#define AE_IFDIR 0040000
-#define AE_IFIFO 0010000
+#define AE_IFMT ((__LA_MODE_T)0170000)
+#define AE_IFREG ((__LA_MODE_T)0100000)
+#define AE_IFLNK ((__LA_MODE_T)0120000)
+#define AE_IFSOCK ((__LA_MODE_T)0140000)
+#define AE_IFCHR ((__LA_MODE_T)0020000)
+#define AE_IFBLK ((__LA_MODE_T)0060000)
+#define AE_IFDIR ((__LA_MODE_T)0040000)
+#define AE_IFIFO ((__LA_MODE_T)0010000)
/*
* Basic object manipulation