From: Hans Hinrichsen Date: Tue, 5 May 2015 03:30:01 +0000 (-0500) Subject: Fixes for VS2012 Compile X-Git-Tag: v3.1.900a~29^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F531%2Fhead;p=thirdparty%2Flibarchive.git Fixes for VS2012 Compile Updated includes in bsdtar_windows.h to bring in _setmode and _O_BINARY via io.h and fcntl.h Explicitly cast a few void * to their structs to suppress Intellisense warnings Moved variable in read_archive - VS2012 needs variables declared at the top of the block (does not support C99) --- diff --git a/tar/bsdtar_windows.h b/tar/bsdtar_windows.h index f025d056f..308ad1107 100644 --- a/tar/bsdtar_windows.h +++ b/tar/bsdtar_windows.h @@ -29,6 +29,8 @@ #define BSDTAR_WINDOWS_H 1 #include #include +#include +#include #ifndef PRId64 #define PRId64 "I64" diff --git a/tar/read.c b/tar/read.c index 7c93467fd..81b671111 100644 --- a/tar/read.c +++ b/tar/read.c @@ -67,8 +67,6 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/read.c,v 1.40 2008/08/21 06:41:14 kientzle E #include "bsdtar.h" #include "err.h" -#include "archive_platform.h" -#include "archive_entry.h" struct progress_data { struct bsdtar *bsdtar; @@ -114,7 +112,7 @@ tar_mode_x(struct bsdtar *bsdtar) static void progress_func(void *cookie) { - struct progress_data *progress_data = (struct progress_data*)cookie; + struct progress_data *progress_data = (struct progress_data *)cookie; struct bsdtar *bsdtar = progress_data->bsdtar; struct archive *a = progress_data->archive; struct archive_entry *entry = progress_data->entry; @@ -184,7 +182,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (reader_options != NULL) { char *p; /* Set default read options. */ - p = (char*)malloc(sizeof(IGNORE_WRONG_MODULE_NAME) + p = (char *)malloc(sizeof(IGNORE_WRONG_MODULE_NAME) + strlen(reader_options) + 1); if (p == NULL) lafe_errc(1, errno, "Out of memory"); @@ -247,6 +245,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) for (;;) { /* Support --fast-read option */ + const char *p; if (bsdtar->option_fast_read && archive_match_path_unmatched_inclusions(bsdtar->matching) == 0) break; @@ -266,7 +265,8 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) } if (r == ARCHIVE_FATAL) break; - if (archive_entry_pathname(entry) == NULL || archive_entry_pathname(entry)[0] == '\0') { + p = archive_entry_pathname(entry); + if (p == NULL || p[0] == '\0') { lafe_warnc(0, "Archive entry has empty or unreadable filename ... skipping."); bsdtar->return_value = 1; continue;