]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix build failure in aggressive warnings on msys.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 16 Feb 2012 04:17:12 +0000 (13:17 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 16 Feb 2012 04:17:12 +0000 (13:17 +0900)
14 files changed:
cpio/cpio_windows.c
cpio/test/main.c
libarchive/archive_entry_copy_bhfi.c
libarchive/archive_match.c
libarchive/archive_read_disk_windows.c
libarchive/archive_read_support_format_7zip.c
libarchive/archive_string.c
libarchive/archive_windows.c
libarchive/archive_write_disk_windows.c
libarchive/archive_write_set_format_7zip.c
libarchive/archive_write_set_format_mtree.c
libarchive/test/main.c
tar/bsdtar_windows.c
tar/test/main.c

index 420e01d5e19285434f2a6fe8c218684d33a830a0..63f6df0397d2f8c3a538eb115862a34ff885be1b 100644 (file)
@@ -324,7 +324,7 @@ cpio_dosmaperr(unsigned long e)
                return;
        }
 
-       for (i = 0; i < sizeof(doserrors); i++) {
+       for (i = 0; i < (int)sizeof(doserrors); i++) {
                if (doserrors[i].winerr == e) {
                        errno = doserrors[i].doserr;
                        return;
index 30d5ea775da16e02155d09c4921749344befc10a..77bdabe6c692b688c96ce515f456479fdbb47118 100644 (file)
@@ -129,7 +129,14 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kient
 #endif
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
-void *GetFunctionKernel32(const char *name)
+static void    *GetFunctionKernel32(const char *);
+static int      my_CreateSymbolicLinkA(const char *, const char *, int);
+static int      my_CreateHardLinkA(const char *, const char *);
+static int      my_GetFileInformationByName(const char *,
+                    BY_HANDLE_FILE_INFORMATION *);
+
+static void *
+GetFunctionKernel32(const char *name)
 {
        static HINSTANCE lib;
        static int set;
@@ -168,7 +175,7 @@ my_CreateHardLinkA(const char *linkname, const char *target)
        return f == NULL ? 0 : (*f)(linkname, target, NULL);
 }
 
-int
+static int
 my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
 {
        HANDLE h;
index 7a4bc9cd0526c77216f3908f75eed5194e50fe8d..77bf38e450f20d0b9ebd9fe85c65941bee818b62 100644 (file)
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
 #define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
 
 __inline static void
-fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
+fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns)
 {
        ULARGE_INTEGER utc;
 
@@ -42,10 +42,10 @@ fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
        utc.LowPart  = filetime->dwLowDateTime;
        if (utc.QuadPart >= EPOC_TIME) {
                utc.QuadPart -= EPOC_TIME;
-               *time = (time_t)(utc.QuadPart / 10000000);      /* milli seconds base */
+               *t = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */
                *ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */
        } else {
-               *time = 0;
+               *t = 0;
                *ns = 0;
        }
 }
index ae049b0afe33aa9924af0134e7f8d29d56a830fb..f63d07bcc349d5b1112165ceac74175b0f97bbe7 100644 (file)
@@ -1112,37 +1112,38 @@ set_timefilter_date_w(struct archive_match *a, int timetype,
 }
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
-#define EPOC_TIME (116444736000000000ui64)
+#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
 static int
 set_timefilter_find_data(struct archive_match *a, int timetype,
     DWORD ftLastWriteTime_dwHighDateTime, DWORD ftLastWriteTime_dwLowDateTime,
     DWORD ftCreationTime_dwHighDateTime, DWORD ftCreationTime_dwLowDateTime)
 {
        ULARGE_INTEGER utc;
-       time_t ctime, mtime;
+       time_t ctime_sec, mtime_sec;
        long ctime_ns, mtime_ns;
 
        utc.HighPart = ftCreationTime_dwHighDateTime;
        utc.LowPart = ftCreationTime_dwLowDateTime;
        if (utc.QuadPart >= EPOC_TIME) {
                utc.QuadPart -= EPOC_TIME;
-               ctime = (time_t)(utc.QuadPart / 10000000);
+               ctime_sec = (time_t)(utc.QuadPart / 10000000);
                ctime_ns = (long)(utc.QuadPart % 10000000) * 100;
        } else {
-               ctime = 0;
+               ctime_sec = 0;
                ctime_ns = 0;
        }
        utc.HighPart = ftLastWriteTime_dwHighDateTime;
        utc.LowPart = ftLastWriteTime_dwLowDateTime;
        if (utc.QuadPart >= EPOC_TIME) {
                utc.QuadPart -= EPOC_TIME;
-               mtime = (time_t)(utc.QuadPart / 10000000);
+               mtime_sec = (time_t)(utc.QuadPart / 10000000);
                mtime_ns = (long)(utc.QuadPart % 10000000) * 100;
        } else {
-               mtime = 0;
+               mtime_sec = 0;
                mtime_ns = 0;
        }
-       return set_timefilter(a, timetype, mtime, mtime_ns, ctime, ctime_ns);
+       return set_timefilter(a, timetype,
+                       mtime_sec, mtime_ns, ctime_sec, ctime_ns);
 }
 
 static int
index 61889eaff148fcc75b1748949a23f82159b0e56e..ecd3d438bf1dc5250e965fb7930a17e3f5d1bb7a 100644 (file)
@@ -1775,7 +1775,7 @@ tree_dir_next_windows(struct tree *t, const wchar_t *pattern)
 
 #define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
 static void
-fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
+fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns)
 {
        ULARGE_INTEGER utc;
 
@@ -1784,11 +1784,11 @@ fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
        if (utc.QuadPart >= EPOC_TIME) {
                utc.QuadPart -= EPOC_TIME;
                /* milli seconds base */
-               *time = (time_t)(utc.QuadPart / 10000000);
+               *t = (time_t)(utc.QuadPart / 10000000);
                /* nano seconds base */
                *ns = (long)(utc.QuadPart % 10000000) * 100;
        } else {
-               *time = 0;
+               *t = 0;
                *ns = 0;
        }
 }
index a17025a0d13c2891766fa925011e728a1f2b3a28..316ad990e8dc2aab0e766cdffbc61911cbfac3f7 100644 (file)
@@ -2980,7 +2980,7 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
                size_t bytes_in, bytes_out;
                const void *buff_in;
                unsigned char *buff_out;
-               int eof;
+               int end_of_data;
 
                /*
                 * Note: '1' here is a performance optimization.
@@ -3008,10 +3008,10 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
                        buff_in, &bytes_in);
                switch (r) {
                case ARCHIVE_OK:
-                       eof = 0;
+                       end_of_data = 0;
                        break;
                case ARCHIVE_EOF:
-                       eof = 1;
+                       end_of_data = 1;
                        break;
                default:
                        return (ARCHIVE_FATAL);
@@ -3036,7 +3036,7 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
                if (zip->pack_stream_inbytes_remaining == 0 &&
                    zip->folder_outbytes_remaining == 0)
                        break;
-               if (eof || (bytes_in == 0 && bytes_out == 0)) {
+               if (end_of_data || (bytes_in == 0 && bytes_out == 0)) {
                        archive_set_error(&(a->archive),
                            ARCHIVE_ERRNO_MISC, "Damaged 7-Zip archive");
                        return (ARCHIVE_FATAL);
index 89f043a2ad6854a9db7c6787fc8d1a37eef8349a..ecdb01f0c8039247f07f676d29fdeb481c58f1b9 100644 (file)
@@ -517,7 +517,7 @@ archive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest,
                if (NULL == archive_wstring_ensure(dest,
                    dest->length + count + 1))
                        return (-1);
-               wmemcpy(dest->s + dest->length, (wchar_t *)s, count);
+               wmemcpy(dest->s + dest->length, (const wchar_t *)s, count);
                if ((sc->flag & SCONV_FROM_UTF16BE) && !is_big_endian()) {
                        uint16_t *u16 = (uint16_t *)(dest->s + dest->length);
                        int b;
index e348b1703b8bb31a43c754230cc8abd565ef0477..75ea21726fb459ec2517786cd2b49f3dbecb3f8c 100644 (file)
@@ -796,7 +796,7 @@ __la_dosmaperr(unsigned long e)
                return;
        }
 
-       for (i = 0; i < sizeof(doserrors); i++)
+       for (i = 0; i < (int)sizeof(doserrors); i++)
        {
                if (doserrors[i].winerr == e)
                {
index 2da2084e03e1a007d4f879ecf659b54f8c445514..7664960d2909297a6b12155b6f630fe674a597e2 100644 (file)
@@ -82,7 +82,7 @@ static BOOL SetFilePointerEx_perso(HANDLE hFile,
        if(lpNewFilePointer) {
                lpNewFilePointer->QuadPart = li.QuadPart;
        }
-       return li.LowPart != -1 || GetLastError() == NO_ERROR;
+       return li.LowPart != (DWORD)-1 || GetLastError() == NO_ERROR;
 }
 
 struct fixup_entry {
@@ -212,7 +212,9 @@ static struct fixup_entry *current_fixup(struct archive_write_disk *,
 static int     cleanup_pathname(struct archive_write_disk *);
 static int     create_dir(struct archive_write_disk *, wchar_t *);
 static int     create_parent_dir(struct archive_write_disk *, wchar_t *);
+static int     la_chmod(const wchar_t *, mode_t);
 static int     older(BY_HANDLE_FILE_INFORMATION *, struct archive_entry *);
+static int     permissive_name_w(struct archive_write_disk *);
 static int     restore_entry(struct archive_write_disk *);
 static int     set_acls(struct archive_write_disk *, HANDLE h,
                    const wchar_t *, struct archive_acl *);
@@ -353,7 +355,7 @@ file_information(struct archive_write_disk *a, wchar_t *path,
  * So we have to make the full-pathname in another way, which does not
  * break "../" path string.
  */
-int
+static int
 permissive_name_w(struct archive_write_disk *a)
 {
        wchar_t *wn, *wnp;
@@ -479,7 +481,7 @@ permissive_name_w(struct archive_write_disk *a)
        return (0);
 }
 
-int
+static int
 la_chmod(const wchar_t *path, mode_t mode)
 {
        DWORD attr;
@@ -2237,7 +2239,7 @@ set_times(struct archive_write_disk *a,
     time_t atime, long atime_nanos,
     time_t birthtime, long birthtime_nanos,
     time_t mtime, long mtime_nanos,
-    time_t ctime, long ctime_nanos)
+    time_t ctime_sec, long ctime_nanos)
 {
 #define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
 #define WINTIME(sec, nsec) ((Int32x32To64(sec, 10000000) + EPOC_TIME)\
@@ -2248,7 +2250,7 @@ set_times(struct archive_write_disk *a,
        FILETIME *pfbtime;
        FILETIME fatime, fbtime, fmtime;
 
-       (void)ctime; /* UNUSED */
+       (void)ctime_sec; /* UNUSED */
        (void)ctime_nanos; /* UNUSED */
 
        if (h != INVALID_HANDLE_VALUE) {
@@ -2299,11 +2301,11 @@ settimes_failed:
 static int
 set_times_from_entry(struct archive_write_disk *a)
 {
-       time_t atime, birthtime, mtime, ctime;
+       time_t atime, birthtime, mtime, ctime_sec;
        long atime_nsec, birthtime_nsec, mtime_nsec, ctime_nsec;
 
        /* Suitable defaults. */
-       atime = birthtime = mtime = ctime = a->start_time;
+       atime = birthtime = mtime = ctime_sec = a->start_time;
        atime_nsec = birthtime_nsec = mtime_nsec = ctime_nsec = 0;
 
        /* If no time was provided, we're done. */
@@ -2325,7 +2327,7 @@ set_times_from_entry(struct archive_write_disk *a)
                mtime_nsec = archive_entry_mtime_nsec(a->entry);
        }
        if (archive_entry_ctime_is_set(a->entry)) {
-               ctime = archive_entry_ctime(a->entry);
+               ctime_sec = archive_entry_ctime(a->entry);
                ctime_nsec = archive_entry_ctime_nsec(a->entry);
        }
 
@@ -2333,7 +2335,7 @@ set_times_from_entry(struct archive_write_disk *a)
                         atime, atime_nsec,
                         birthtime, birthtime_nsec,
                         mtime, mtime_nsec,
-                        ctime, ctime_nsec);
+                        ctime_sec, ctime_nsec);
 }
 
 static int
@@ -2456,7 +2458,7 @@ set_xattrs(struct archive_write_disk *a)
 }
 
 static void
-fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
+fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns)
 {
        ULARGE_INTEGER utc;
 
@@ -2465,11 +2467,11 @@ fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
        if (utc.QuadPart >= EPOC_TIME) {
                utc.QuadPart -= EPOC_TIME;
                /* milli seconds base */
-               *time = (time_t)(utc.QuadPart / 10000000);
+               *t = (time_t)(utc.QuadPart / 10000000);
                /* nano seconds base */
                *ns = (long)(utc.QuadPart % 10000000) * 100;
        } else {
-               *time = 0;
+               *t = 0;
                *ns = 0;
        }
 }
index 80b8581aef963d3a3c0e482fb3bf2fc0c2eef572..74f3d6febbb4d3cdb4464428c350838d363b1a2c 100644 (file)
@@ -1151,7 +1151,7 @@ make_time(struct archive_write *a, uint8_t type, unsigned flg, int ti)
        struct _7zip *zip = (struct _7zip *)a->format_data;
        struct file *file;
        int r;
-       uint8_t mask, byte;
+       uint8_t b, mask;
 
        /*
         * Make Time Bools.
@@ -1188,23 +1188,23 @@ make_time(struct archive_write *a, uint8_t type, unsigned flg, int ti)
                if (r < 0)
                        return (r);
 
-               byte = 0;
+               b = 0;
                mask = 0x80;
                file = zip->file_list.first;
                for (;file != NULL; file = file->next) {
                        if (file->flg & flg)
-                               byte |= mask;
+                               b |= mask;
                        mask >>= 1;
                        if (mask == 0) {
-                               r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+                               r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                                if (r < 0)
                                        return (r);
                                mask = 0x80;
-                               byte = 0;
+                               b = 0;
                        }
                }
                if (mask != 0x80) {
-                       r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+                       r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                        if (r < 0)
                                return (r);
                }
@@ -1240,7 +1240,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
        struct _7zip *zip = (struct _7zip *)a->format_data;
        struct file *file;
        int r;
-       uint8_t mask, byte;
+       uint8_t b, mask;
 
        /*
         * Make FilesInfo.
@@ -1288,23 +1288,23 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
                if (r < 0)
                        return (r);
 
-               byte = 0;
+               b = 0;
                mask = 0x80;
                file = zip->file_list.first;
                for (;file != NULL; file = file->next) {
                        if (file->size == 0)
-                               byte |= mask;
+                               b |= mask;
                        mask >>= 1;
                        if (mask == 0) {
-                               r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+                               r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                                if (r < 0)
                                        return (r);
                                mask = 0x80;
-                               byte = 0;
+                               b = 0;
                        }
                }
                if (mask != 0x80) {
-                       r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+                       r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                        if (r < 0)
                                return (r);
                }
@@ -1321,25 +1321,25 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
                if (r < 0)
                        return (r);
 
-               byte = 0;
+               b = 0;
                mask = 0x80;
                file = zip->file_list.first;
                for (;file != NULL; file = file->next) {
                        if (file->size)
                                continue;
                        if (!file->dir)
-                               byte |= mask;
+                               b |= mask;
                        mask >>= 1;
                        if (mask == 0) {
-                               r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+                               r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                                if (r < 0)
                                        return (r);
                                mask = 0x80;
-                               byte = 0;
+                               b = 0;
                        }
                }
                if (mask != 0x80) {
-                       r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+                       r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                        if (r < 0)
                                return (r);
                }
index 6b6449cd25ec18082f7d515f5aae9d568a15e0b5..28e57220f9f1b68b3c74f39d0bfb58199a2883eb 100644 (file)
@@ -389,13 +389,13 @@ dir_len(struct mtree_entry *me)
                else if (*p == '/')
                        al = p - path;
        }
-       if (l == -1)
+       if (l == (size_t)-1)
                goto alen;
        size = p - path;
        rp = p = path;
        while (*p != '\0') {
                l = mbtowc(&wc, p, size);
-               if (l == -1)
+               if (l == (size_t)-1)
                        goto alen;
                if (l == 1 && (wc == L'/' || wc == L'\\'))
                        rp = p;
@@ -404,7 +404,7 @@ dir_len(struct mtree_entry *me)
        }
        return (rp - path + 1);
 alen:
-       if (al == -1)
+       if (al == (size_t)-1)
                return (0);
        return (al + 1);
 }
index b50ecc8edcd41b690ea867fa042ceeb5c2022ea4..11f01d2d6aace6b673e836852e8f6dca9f9d305e 100644 (file)
@@ -127,7 +127,14 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/main.c 201247 2009-12-30 05:59:21Z
 #endif
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
-void *GetFunctionKernel32(const char *name)
+static void    *GetFunctionKernel32(const char *);
+static int      my_CreateSymbolicLinkA(const char *, const char *, int);
+static int      my_CreateHardLinkA(const char *, const char *);
+static int      my_GetFileInformationByName(const char *,
+                    BY_HANDLE_FILE_INFORMATION *);
+
+static void *
+GetFunctionKernel32(const char *name)
 {
        static HINSTANCE lib;
        static int set;
@@ -166,7 +173,7 @@ my_CreateHardLinkA(const char *linkname, const char *target)
        return f == NULL ? 0 : (*f)(linkname, target, NULL);
 }
 
-int
+static int
 my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
 {
        HANDLE h;
index 4d1205028f3ea943fd573ad9067b25b2a4526f59..41ce6eb78c8b8e0c7447a908dbe0f6725d5edd75 100644 (file)
@@ -283,7 +283,7 @@ __tar_dosmaperr(unsigned long e)
                return;
        }
 
-       for (i = 0; i < sizeof(doserrors); i++) {
+       for (i = 0; i < (int)sizeof(doserrors); i++) {
                if (doserrors[i].winerr == e) {
                        errno = doserrors[i].doserr;
                        return;
index 81087d92369bc4cf1c46fea5a6bc276e9c780717..45cbae0a68042c49a1db445c332e93889f242047 100644 (file)
@@ -129,7 +129,14 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/test/main.c,v 1.6 2008/11/05 06:40:53 kientz
 #endif
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
-void *GetFunctionKernel32(const char *name)
+static void    *GetFunctionKernel32(const char *);
+static int      my_CreateSymbolicLinkA(const char *, const char *, int);
+static int      my_CreateHardLinkA(const char *, const char *);
+static int      my_GetFileInformationByName(const char *,
+                    BY_HANDLE_FILE_INFORMATION *);
+
+static void *
+GetFunctionKernel32(const char *name)
 {
        static HINSTANCE lib;
        static int set;
@@ -168,7 +175,7 @@ my_CreateHardLinkA(const char *linkname, const char *target)
        return f == NULL ? 0 : (*f)(linkname, target, NULL);
 }
 
-int
+static int
 my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
 {
        HANDLE h;