From 41b7b3efa4e2684085be7c7dd76baea17f269988 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 7 Feb 2011 10:06:50 -0500 Subject: libarchive: Define major/minor/makedev only where needed (#11648) If neither MAJOR_IN_MKDEV or MAJOR_IN_SYSMACROS is defined then provide our own implementation of these macros locally. This complements the change in commit cf5ad183 (Fix major() check for LSB 4.0, 2011-01-12). This patch is based on upstream libarchive SVN commit 1553 (Shuffle the major/minor/makedev support a bit; this should work on both Windows and Haiku, 2009-10-31). Inspired-by: Tim Kientzle --- Utilities/cmlibarchive/libarchive/archive_entry.c | 15 +++++++++++---- Utilities/cmlibarchive/libarchive/archive_entry_xattr.c | 7 ------- Utilities/cmlibarchive/libarchive/archive_windows.h | 5 ----- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Utilities/cmlibarchive/libarchive/archive_entry.c b/Utilities/cmlibarchive/libarchive/archive_entry.c index d75dde5..c304231 100644 --- a/Utilities/cmlibarchive/libarchive/archive_entry.c +++ b/Utilities/cmlibarchive/libarchive/archive_entry.c @@ -32,12 +32,12 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.55 2008/12/23 05:01:4 #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef MAJOR_IN_MKDEV +#if MAJOR_IN_MKDEV #include -#else -#ifdef MAJOR_IN_SYSMACROS +#define HAVE_MAJOR +#elif MAJOR_IN_SYSMACROS #include -#endif +#define HAVE_MAJOR #endif #ifdef HAVE_LIMITS_H #include @@ -75,6 +75,13 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.55 2008/12/23 05:01:4 #undef max #define max(a, b) ((a)>(b)?(a):(b)) +#if !defined(HAVE_MAJOR) && !defined(major) +/* Replacement for major/minor/makedev. */ +#define major(x) ((int)(0x00ff & ((x) >> 8))) +#define minor(x) ((int)(0xffff00ff & (x))) +#define makedev(maj,min) ((0xff00 & ((maj)<<8)) | (0xffff00ff & (min))) +#endif + /* Play games to come up with a suitable makedev() definition. */ #ifdef __QNXNTO__ /* QNX. */ diff --git a/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c b/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c index c35c7b3..28b8ff5 100644 --- a/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c +++ b/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c @@ -32,13 +32,6 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.55 2008/12/23 05:01:4 #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef MAJOR_IN_MKDEV -#include -#else -#ifdef MAJOR_IN_SYSMACROS -#include -#endif -#endif #ifdef HAVE_LIMITS_H #include #endif diff --git a/Utilities/cmlibarchive/libarchive/archive_windows.h b/Utilities/cmlibarchive/libarchive/archive_windows.h index 17f5698..f85f3f0 100644 --- a/Utilities/cmlibarchive/libarchive/archive_windows.h +++ b/Utilities/cmlibarchive/libarchive/archive_windows.h @@ -94,11 +94,6 @@ #endif #endif -/* Replacement for major/minor/makedev. */ -#define major(x) ((int)(0x00ff & ((x) >> 8))) -#define minor(x) ((int)(0xffff00ff & (x))) -#define makedev(maj,min) ((0xff00 & ((maj)<<8))|(0xffff00ff & (min))) - /* Alias the Windows _function to the POSIX equivalent. */ #define access _access #define chdir __la_chdir -- cgit v0.12