]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix build failure on mingw32.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 4 Oct 2012 00:41:57 +0000 (09:41 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 4 Oct 2012 00:41:57 +0000 (09:41 +0900)
cpio/test/main.c
libarchive/archive_read_disk_windows.c
libarchive/archive_windows.h
libarchive/archive_write_set_format_zip.c
libarchive/test/main.c
libarchive/test/test_archive_read_multiple_data_objects.c
libarchive/test/test_open_fd.c
tar/test/main.c
tar/test/test_copy.c
tar/test/test_windows.c
tar/write.c

index d4cd865c50dbf9db926608653cb5341b8941f4ae..ac03475297973db6f597f7c260966674e0509beb 100644 (file)
@@ -92,6 +92,7 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kient
  */
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #include <io.h>
+#include <direct.h>
 #include <windows.h>
 #ifndef F_OK
 #define F_OK (0)
@@ -1177,11 +1178,11 @@ assertion_file_time(const char *file, int line,
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #define EPOC_TIME      (116444736000000000ULL)
-       FILETIME ftime, fbirthtime, fatime, fmtime;
+       FILETIME fxtime, fbirthtime, fatime, fmtime;
        ULARGE_INTEGER wintm;
        HANDLE h;
-       ftime.dwLowDateTime = 0;
-       ftime.dwHighDateTime = 0;
+       fxtime.dwLowDateTime = 0;
+       fxtime.dwHighDateTime = 0;
 
        assertion_count(file, line);
        /* Note: FILE_FLAG_BACKUP_SEMANTICS applies to open
@@ -1196,9 +1197,9 @@ assertion_file_time(const char *file, int line,
        }
        r = GetFileTime(h, &fbirthtime, &fatime, &fmtime);
        switch (type) {
-       case 'a': ftime = fatime; break;
-       case 'b': ftime = fbirthtime; break;
-       case 'm': ftime = fmtime; break;
+       case 'a': fxtime = fatime; break;
+       case 'b': fxtime = fbirthtime; break;
+       case 'm': fxtime = fmtime; break;
        }
        CloseHandle(h);
        if (r == 0) {
@@ -1206,8 +1207,8 @@ assertion_file_time(const char *file, int line,
                failure_finish(NULL);
                return (0);
        }
-       wintm.LowPart = ftime.dwLowDateTime;
-       wintm.HighPart = ftime.dwHighDateTime;
+       wintm.LowPart = fxtime.dwLowDateTime;
+       wintm.HighPart = fxtime.dwHighDateTime;
        filet = (wintm.QuadPart - EPOC_TIME) / 10000000;
        filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100;
        nsec = (nsec / 100) * 100; /* Round the request */
index 7bc141f41063e93bf3546ca00298e93e2e61edff..40a1ca8c3eacad015b2a31d1228965426fc8320b 100644 (file)
@@ -669,7 +669,7 @@ _archive_read_data_block(struct archive *_a, const void **buff,
        struct tree *t = a->tree;
        struct la_overlapped *olp;
        DWORD bytes_transferred;
-       int r;
+       int r = ARCHIVE_FATAL;
 
        archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA,
            "archive_read_data_block");
index a8e54c593d078e30c638726c2b5181a30722c995..f755d5d72ae806504af664a030037857fafd2e21 100644 (file)
@@ -49,6 +49,9 @@
 #define        LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED
 
 /* Start of configuration for native Win32  */
+#ifndef MINGW_HAS_SECURE_API
+#define MINGW_HAS_SECURE_API 1
+#endif
 
 #include <errno.h>
 #define        set_errno(val)  ((errno)=val)
 #ifndef fileno
 #define        fileno          _fileno
 #endif
+#ifdef fstat
+#undef fstat
+#endif
 #define        fstat           __la_fstat
 #if !defined(__BORLANDC__)
+#ifdef lseek
+#undef lseek
+#endif
 #define        lseek           _lseeki64
 #else
 #define        lseek           __la_lseek
 #if !defined(__BORLANDC__)
 #define setmode                _setmode
 #endif
+#ifdef stat
+#undef stat
+#endif
 #define        stat(path,stref)                __la_stat(path,stref)
 #if !defined(__BORLANDC__)
 #define        strdup          _strdup
index 1f8a4737144a99714abcaa01fe54287ba9a4c29f..e8dca57db4b6bd5fda8b80c7e606acb25c47e6de 100644 (file)
@@ -260,7 +260,6 @@ int
 archive_write_zip_set_compression_deflate(struct archive *_a)
 {
        struct archive_write *a = (struct archive_write *)_a;
-       struct zip *zip = a->format_data;
        int ret = ARCHIVE_FAILED;
        
        archive_check_magic(_a, ARCHIVE_WRITE_MAGIC,
@@ -273,6 +272,7 @@ archive_write_zip_set_compression_deflate(struct archive *_a)
                ret = ARCHIVE_FATAL;
        } else {
 #ifdef HAVE_ZLIB_H
+               struct zip *zip = a->format_data;
                zip->compression = COMPRESSION_DEFLATE;
                ret = ARCHIVE_OK;
 #else
index fd2e5dd9340db041cc8cfc1af00e4cb56cbbfa6a..f9db144377e8cfe0e03aa7c7fdb06ce527a7c2f5 100644 (file)
@@ -90,6 +90,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/main.c 201247 2009-12-30 05:59:21Z
  */
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #include <io.h>
+#include <direct.h>
 #include <windows.h>
 #ifndef F_OK
 #define F_OK (0)
@@ -1175,11 +1176,11 @@ assertion_file_time(const char *file, int line,
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #define EPOC_TIME      (116444736000000000ULL)
-       FILETIME ftime, fbirthtime, fatime, fmtime;
+       FILETIME fxtime, fbirthtime, fatime, fmtime;
        ULARGE_INTEGER wintm;
        HANDLE h;
-       ftime.dwLowDateTime = 0;
-       ftime.dwHighDateTime = 0;
+       fxtime.dwLowDateTime = 0;
+       fxtime.dwHighDateTime = 0;
 
        assertion_count(file, line);
        /* Note: FILE_FLAG_BACKUP_SEMANTICS applies to open
@@ -1194,9 +1195,9 @@ assertion_file_time(const char *file, int line,
        }
        r = GetFileTime(h, &fbirthtime, &fatime, &fmtime);
        switch (type) {
-       case 'a': ftime = fatime; break;
-       case 'b': ftime = fbirthtime; break;
-       case 'm': ftime = fmtime; break;
+       case 'a': fxtime = fatime; break;
+       case 'b': fxtime = fbirthtime; break;
+       case 'm': fxtime = fmtime; break;
        }
        CloseHandle(h);
        if (r == 0) {
@@ -1204,8 +1205,8 @@ assertion_file_time(const char *file, int line,
                failure_finish(NULL);
                return (0);
        }
-       wintm.LowPart = ftime.dwLowDateTime;
-       wintm.HighPart = ftime.dwHighDateTime;
+       wintm.LowPart = fxtime.dwLowDateTime;
+       wintm.HighPart = fxtime.dwHighDateTime;
        filet = (wintm.QuadPart - EPOC_TIME) / 10000000;
        filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100;
        nsec = (nsec / 100) * 100; /* Round the request */
index 437f2b5579311dc0aef0f6e9b636d153223b55c1..391bf673f28096d33d2bdf3c9c8d0377b08a9f84 100644 (file)
@@ -31,8 +31,13 @@ __FBSDID("$FreeBSD$");
 #define open _open
 #define close _close
 #define read _read
+#if !defined(__BORLANDC__)
+#ifdef lseek
+#undef lseek
+#endif
 #define lseek(f, o, w) _lseek(f, (long)(o), (int)(w))
 #endif
+#endif
 
 static void
 test_splitted_file(void)
index 52b34bd125f7e639367a7afd89b633291aed217d..13b594a05fa27906abc33f9b983b57eba92b2cfd 100644 (file)
@@ -28,6 +28,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/test_open_fd.c 201247 2009-12-30 05
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #define open _open
 #if !defined(__BORLANDC__)
+#ifdef lseek
+#undef lseek
+#endif
 #define lseek _lseek
 #endif
 #define close _close
index 26bab757c6b6490bd054b8e1f48065edfdf75f06..140939321f2e07d4f303e9b1883d7a104316dbf3 100644 (file)
@@ -92,6 +92,7 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/test/main.c,v 1.6 2008/11/05 06:40:53 kientz
  */
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #include <io.h>
+#include <direct.h>
 #include <windows.h>
 #ifndef F_OK
 #define F_OK (0)
@@ -1177,11 +1178,11 @@ assertion_file_time(const char *file, int line,
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #define EPOC_TIME      (116444736000000000ULL)
-       FILETIME ftime, fbirthtime, fatime, fmtime;
+       FILETIME fxtime, fbirthtime, fatime, fmtime;
        ULARGE_INTEGER wintm;
        HANDLE h;
-       ftime.dwLowDateTime = 0;
-       ftime.dwHighDateTime = 0;
+       fxtime.dwLowDateTime = 0;
+       fxtime.dwHighDateTime = 0;
 
        assertion_count(file, line);
        /* Note: FILE_FLAG_BACKUP_SEMANTICS applies to open
@@ -1196,9 +1197,9 @@ assertion_file_time(const char *file, int line,
        }
        r = GetFileTime(h, &fbirthtime, &fatime, &fmtime);
        switch (type) {
-       case 'a': ftime = fatime; break;
-       case 'b': ftime = fbirthtime; break;
-       case 'm': ftime = fmtime; break;
+       case 'a': fxtime = fatime; break;
+       case 'b': fxtime = fbirthtime; break;
+       case 'm': fxtime = fmtime; break;
        }
        CloseHandle(h);
        if (r == 0) {
@@ -1206,8 +1207,8 @@ assertion_file_time(const char *file, int line,
                failure_finish(NULL);
                return (0);
        }
-       wintm.LowPart = ftime.dwLowDateTime;
-       wintm.HighPart = ftime.dwHighDateTime;
+       wintm.LowPart = fxtime.dwLowDateTime;
+       wintm.HighPart = fxtime.dwHighDateTime;
        filet = (wintm.QuadPart - EPOC_TIME) / 10000000;
        filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100;
        nsec = (nsec / 100) * 100; /* Round the request */
index 69112900e536c0d0035803f7664f556cade94b59..dd49bc410ab56137ab45b5b788b74ccb860b6343 100644 (file)
@@ -29,6 +29,9 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/test/test_copy.c,v 1.3 2008/08/15 06:12:02 k
 # include <limits.h>
 # include <sys/cygwin.h>
 #endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
+# include <direct.h>
+#endif
 
 /*
  * Try to figure out how deep we can go in our tests.  Assumes that
index a2d0c214b956e4f5c8733c87d74ac410a80db067..b3f3546be08fbd4309db6636f8472d69c4339164 100644 (file)
@@ -25,6 +25,7 @@
 #include "test.h"
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
+#include <direct.h>
 #include <windows.h>
 
 static void
index 98ae2d95c9a3321b35e771df4cab9dcc13e0fc60..659b412ce8b917643d237a5f33c51ecf88be97de 100644 (file)
@@ -131,6 +131,9 @@ seek_file(int fd, int64_t offset, int whence)
 #define        open _open
 #define        close _close
 #define        read _read
+#ifdef lseek
+#undef lseek
+#endif
 #define        lseek seek_file
 #endif