]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fixes for VS2012 Compile 531/head
authorHans Hinrichsen <hh@etcconnect.com>
Tue, 5 May 2015 03:30:01 +0000 (22:30 -0500)
committerHans Hinrichsen <hh@etcconnect.com>
Tue, 5 May 2015 03:30:01 +0000 (22:30 -0500)
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)

tar/bsdtar_windows.h
tar/read.c

index f025d056fe2f053cee2ae9ccd2c1d6b202353d2d..308ad1107befe882c27a48d1ab756a476fb1b623 100644 (file)
@@ -29,6 +29,8 @@
 #define        BSDTAR_WINDOWS_H 1
 #include <direct.h>
 #include <windows.h>
+#include <io.h>
+#include <fcntl.h>
 
 #ifndef PRId64
 #define        PRId64 "I64"
index 7c93467fd61912d838d8b8139d2d0c5dc757a93a..81b6711111b5f3b91df6aaa1bf7bd2e227915285 100644 (file)
@@ -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;