From: Hans Hinrichsen Date: Thu, 30 Apr 2015 03:45:31 +0000 (-0500) Subject: Fixes for VS2012 Compile X-Git-Tag: v3.1.900a~29^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbfb0093011984cd91eab01532f104813955417d;p=thirdparty%2Flibarchive.git Fixes for VS2012 Compile Fixes for VS2012 Compile Added headers needed when compiling in Win32 without Cygwin Some pointers needed to be explicitly cast VS had a lot of trouble with storing the result of archive_entry_pathname in a local variable The only way I could get it to compile was to call the function twice --- diff --git a/tar/read.c b/tar/read.c index 430cff043..7c93467fd 100644 --- a/tar/read.c +++ b/tar/read.c @@ -67,6 +67,8 @@ __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; @@ -112,7 +114,7 @@ tar_mode_x(struct bsdtar *bsdtar) static void progress_func(void *cookie) { - struct progress_data *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; @@ -182,7 +184,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (reader_options != NULL) { char *p; /* Set default read options. */ - p = 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"); @@ -264,8 +266,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) } if (r == ARCHIVE_FATAL) break; - const char *p = archive_entry_pathname(entry); - if (p == NULL || p[0] == '\0') { + if (archive_entry_pathname(entry) == NULL || archive_entry_pathname(entry)[0] == '\0') { lafe_warnc(0, "Archive entry has empty or unreadable filename ... skipping."); bsdtar->return_value = 1; continue;