diff options
author | kientzle <kientzle@FreeBSD.org> | 2006-11-10 06:39:46 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2006-11-10 06:39:46 +0000 |
commit | 50bb724108b7417b0df3bbf7029c43dbd734df49 (patch) | |
tree | f89881956f7ca553a6834444961e2cb90388cc29 /lib/libarchive/archive_platform.h | |
parent | 56ac4302e20c910a87bfc933138eb38f4c21af7a (diff) | |
download | FreeBSD-src-50bb724108b7417b0df3bbf7029c43dbd734df49.zip FreeBSD-src-50bb724108b7417b0df3bbf7029c43dbd734df49.tar.gz |
Portability and style fixes:
* Actually use the HAVE_<header>_H macros to conditionally include
system headers. They've been defined for a long time, but only
used in a few places. Now they're used pretty consistently
throughout.
* Fill in a lot of missing casts for conversions from void*.
Although Standard C doesn't require this, some people have been
trying to use C++ compilers with this code, and they do require it.
Bit-for-bit, the compiled object files are identical, except for
one assert() whose line number changed, so I'm pretty confident I
didn't break anything. ;-)
Diffstat (limited to 'lib/libarchive/archive_platform.h')
-rw-r--r-- | lib/libarchive/archive_platform.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/libarchive/archive_platform.h b/lib/libarchive/archive_platform.h index e49ab5e..26a8926 100644 --- a/lib/libarchive/archive_platform.h +++ b/lib/libarchive/archive_platform.h @@ -41,8 +41,14 @@ #include "../config.h" #else -/* A default configuration for FreeBSD, used if there is no config.h. */ +/* + * If there's no 'config.h' file, check if we have a hand-coded config + * for this platform. This handles systems where the library is built + * without running the configure script, such as FreeBSD (where + * libarchive is part of the base system). + */ #ifdef __FreeBSD__ +/* Begin of hand-coded __FreeBSD__ configuration. */ #if __FreeBSD__ > 4 #define HAVE_ACL_CREATE_ENTRY 1 #define HAVE_ACL_INIT 1 @@ -62,7 +68,9 @@ #define HAVE_FCHMOD 1 #define HAVE_FCHOWN 1 #define HAVE_FCNTL_H 1 +#define HAVE_FSEEKO 1 #define HAVE_FUTIMES 1 +#define HAVE_GRP_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_LCHFLAGS 1 #define HAVE_LCHMOD 1 @@ -71,11 +79,10 @@ #define HAVE_LUTIMES 1 #define HAVE_MALLOC 1 #define HAVE_MEMMOVE 1 -#define HAVE_MEMORY_H 1 #define HAVE_MEMSET 1 #define HAVE_MKDIR 1 #define HAVE_MKFIFO 1 -#define HAVE_PATHS_H 1 +#define HAVE_PWD_H 1 #define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRCHR 1 @@ -99,6 +106,7 @@ #define HAVE_ZLIB_H 1 #define STDC_HEADERS 1 #define TIME_WITH_SYS_TIME 1 +/* End of __FreeBSD__ definitions. */ #else /* !__FreeBSD__ */ /* Warn if the library hasn't been (automatically or manually) configured. */ #error Oops: No config.h and no built-in configuration in archive_platform.h. @@ -115,6 +123,8 @@ #if HAVE_INTTYPES_H #include <inttypes.h> +#elif HAVE_STDINT_H +#include <stdint.h> #endif /* FreeBSD 4 and earlier lack intmax_t/uintmax_t */ @@ -184,9 +194,9 @@ #define ARCHIVE_STAT_ATIME_NANOS(pstat) 0 #define ARCHIVE_STAT_CTIME_NANOS(pstat) 0 #define ARCHIVE_STAT_MTIME_NANOS(pstat) 0 -#define ARCHIVE_STAT_SET_ATIME_NANOS(st, n) -#define ARCHIVE_STAT_SET_CTIME_NANOS(st, n) -#define ARCHIVE_STAT_SET_MTIME_NANOS(st, n) +#define ARCHIVE_STAT_SET_ATIME_NANOS(st, n) ((void)(n)) +#define ARCHIVE_STAT_SET_CTIME_NANOS(st, n) ((void)(n)) +#define ARCHIVE_STAT_SET_MTIME_NANOS(st, n) ((void)(n)) #endif #endif |