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_read_extract.c | |
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_read_extract.c')
-rw-r--r-- | lib/libarchive/archive_read_extract.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/lib/libarchive/archive_read_extract.c b/lib/libarchive/archive_read_extract.c index f9e180f..5cb65b4 100644 --- a/lib/libarchive/archive_read_extract.c +++ b/lib/libarchive/archive_read_extract.c @@ -27,7 +27,9 @@ #include "archive_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> +#endif #ifdef HAVE_SYS_ACL_H #include <sys/acl.h> #endif @@ -37,24 +39,44 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_IOCTL_H #include <sys/ioctl.h> #endif +#ifdef HAVE_SYS_STAT_H #include <sys/stat.h> +#endif +#ifdef HAVE_SYS_TIME_H #include <sys/time.h> +#endif #ifdef HAVE_EXT2FS_EXT2_FS_H #include <ext2fs/ext2_fs.h> /* for Linux file flags */ #endif +#ifdef HAVE_ERRNO_H #include <errno.h> +#endif +#ifdef HAVE_FCNTL_H #include <fcntl.h> +#endif +#ifdef HAVE_GRP_H #include <grp.h> +#endif #ifdef HAVE_LINUX_EXT2_FS_H #include <linux/ext2_fs.h> /* for Linux file flags */ #endif +#ifdef HAVE_LIMITS_H #include <limits.h> +#endif +#ifdef HAVE_PWD_H #include <pwd.h> +#endif #include <stdio.h> +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include "archive.h" #include "archive_string.h" @@ -296,7 +318,7 @@ create_extract(struct archive *a) { struct extract *extract; - extract = malloc(sizeof(*extract)); + extract = (struct extract *)malloc(sizeof(*extract)); if (extract == NULL) { archive_set_error(a, ENOMEM, "Can't extract"); return (ARCHIVE_FATAL); @@ -460,7 +482,7 @@ new_fixup(struct archive *a, const char *pathname) struct fixup_entry *fe; extract = a->extract; - fe = malloc(sizeof(struct fixup_entry)); + fe = (struct fixup_entry *)malloc(sizeof(struct fixup_entry)); if (fe == NULL) return (NULL); fe->next = extract->fixup_list; @@ -1381,7 +1403,7 @@ set_acls(struct archive *a, int fd, struct archive_entry *entry) static int set_acl(struct archive *a, int fd, struct archive_entry *entry, - acl_type_t acl_type, int ae_requested_type, const char *typename) + acl_type_t acl_type, int ae_requested_type, const char *tname) { acl_t acl; acl_entry_t acl_entry; @@ -1456,7 +1478,7 @@ set_acl(struct archive *a, int fd, struct archive_entry *entry, #endif #endif if (acl_set_file(name, acl_type, acl) != 0) { - archive_set_error(a, errno, "Failed to set %s acl", typename); + archive_set_error(a, errno, "Failed to set %s acl", tname); ret = ARCHIVE_WARN; } acl_free(acl); |