]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix build failure with -Wextra -Wunused GCC options since it happend on FreeBSD current.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 8 Feb 2012 22:20:28 +0000 (07:20 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 9 Feb 2012 00:24:43 +0000 (09:24 +0900)
19 files changed:
libarchive/archive_read_open_memory.c
libarchive/archive_read_support_format_7zip.c
libarchive/archive_read_support_format_cab.c
libarchive/archive_read_support_format_iso9660.c
libarchive/archive_read_support_format_lha.c
libarchive/archive_read_support_format_rar.c
libarchive/archive_read_support_format_tar.c
libarchive/archive_read_support_format_xar.c
libarchive/archive_read_support_format_zip.c
libarchive/archive_string.c
libarchive/archive_write_disk_posix.c
libarchive/archive_write_set_format_7zip.c
libarchive/archive_write_set_format_xar.c
libarchive/test/test_acl_nfs4.c
libarchive/test/test_acl_posix1e.c
libarchive/test/test_read_format_mtree.c
libarchive/test/test_write_disk_lookup.c
libarchive/test/test_write_format_iso9660_filename.c
libarchive/test/test_write_format_iso9660_zisofs.c

index 07940a2ac0fdf828874830bd07f5db77b8da84e9..bcc7d6f78e300265ca8913fe57debb165b510277 100644 (file)
@@ -149,6 +149,7 @@ memory_read_seek(struct archive *a, void *client_data, int64_t offset, int whenc
 {
        struct read_memory_data *mine = (struct read_memory_data *)client_data;
 
+       (void)a; /* UNUSED */
        switch (whence) {
        case SEEK_SET:
                mine->p = mine->start + offset;
index e211e67bedb0efe366e2517180e8f61ef40a0b5b..2ed9abc00c8baf280c5ab582c621a0727a89a1aa 100644 (file)
@@ -630,7 +630,7 @@ archive_read_format_7zip_read_header(struct archive_read *a,
        if (zip_entry->flg & ATIME_IS_SET)
                archive_entry_set_atime(entry, zip_entry->atime,
                    zip_entry->atime_ns);
-       if (zip_entry->ssIndex != -1) {
+       if (zip_entry->ssIndex != (uint32_t)-1) {
                zip->entry_bytes_remaining =
                    zip->si.ss.unpackSizes[zip_entry->ssIndex];
                archive_entry_set_size(entry, zip->entry_bytes_remaining);
@@ -1985,7 +1985,7 @@ folder_uncompressed_size(struct _7z_folder *f)
        while (--n >= 0) {
                unsigned i;
                for (i = 0; i < pairs; i++) {
-                       if (f->bindPairs[i].outIndex == n)
+                       if (f->bindPairs[i].outIndex == (uint64_t)n)
                                break;
                }
                if (i >= pairs)
@@ -2714,7 +2714,7 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip,
        }
        __archive_read_consume(a, 32);
        if (next_header_offset != 0) {
-               if (bytes_avail >= next_header_offset)
+               if (bytes_avail >= (ssize_t)next_header_offset)
                        __archive_read_consume(a, next_header_offset);
                else if (__archive_read_seek(a,
                    next_header_offset + zip->seek_base, SEEK_SET) < 0)
@@ -2827,7 +2827,7 @@ get_uncompressed_data(struct archive_read *a, const void **buff, size_t size,
        struct _7zip *zip = (struct _7zip *)a->format->data;
        ssize_t bytes_avail;
 
-       if (zip->codec == _7Z_COPY && zip->codec2 == -1) {
+       if (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {
                /* Copy mode. */
 
                /*
@@ -2886,7 +2886,7 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
        ssize_t bytes_avail;
        int r;
 
-       if (zip->codec == _7Z_COPY && zip->codec2 == -1) {
+       if (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {
                if (minimum == 0)
                        minimum = 1;
                if (__archive_read_ahead(a, minimum, &bytes_avail) == NULL
@@ -2896,10 +2896,10 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
                            "Truncated 7-Zip file body");
                        return (ARCHIVE_FATAL);
                }
-               if (bytes_avail > zip->pack_stream_inbytes_remaining)
+               if (bytes_avail > (ssize_t)zip->pack_stream_inbytes_remaining)
                        bytes_avail = zip->pack_stream_inbytes_remaining;
                zip->pack_stream_inbytes_remaining -= bytes_avail;
-               if (bytes_avail > zip->folder_outbytes_remaining)
+               if (bytes_avail > (ssize_t)zip->folder_outbytes_remaining)
                        bytes_avail = zip->folder_outbytes_remaining;
                zip->folder_outbytes_remaining -= bytes_avail;
                zip->uncompressed_buffer_bytes_remaining = bytes_avail;
@@ -3041,7 +3041,7 @@ static int
 seek_pack(struct archive_read *a)
 {
        struct _7zip *zip = (struct _7zip *)a->format->data;
-       uint64_t pack_offset;
+       int64_t pack_offset;
 
        if (zip->pack_stream_remaining <= 0) {
                archive_set_error(&(a->archive),
@@ -3321,7 +3321,7 @@ setup_decode_folder(struct archive_read *a, struct _7z_folder *folder,
                        if ((r = seek_pack(a)) < 0)
                                return (r);
 
-                       if (sunpack[i] == -1)
+                       if (sunpack[i] == (uint64_t)-1)
                                zip->folder_outbytes_remaining =
                                    zip->pack_stream_inbytes_remaining;
                        else
index 1b81ee92ce4d240810def0cc8374bb16606b9be5..685c54841631c2869d2373dfb993a88cd58ed18d 100644 (file)
@@ -349,7 +349,7 @@ static int  lzx_read_bitlen(struct lzx_stream *, struct huffman *, int);
 static int     lzx_huffman_init(struct huffman *, size_t, int);
 static void    lzx_huffman_free(struct huffman *);
 static int     lzx_make_huffman_table(struct huffman *);
-static int inline lzx_decode_huffman(struct huffman *, unsigned);
+static inline int lzx_decode_huffman(struct huffman *, unsigned);
 static int     lzx_decode_huffman_tree(struct huffman *, unsigned, int);
 
 
index 739bf91341241e84635c55b13741b69ce20cd670..499037396d8da20bf3e7518dab9d74b5e91c92f5 100644 (file)
@@ -1756,7 +1756,8 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
         */
        if (location > 0 &&
            (location + ((fsize + iso9660->logical_block_size -1)
-              / iso9660->logical_block_size)) > iso9660->volume_block) {
+              / iso9660->logical_block_size))
+                       > (uint32_t)iso9660->volume_block) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                    "Invalid location of extent of file");
                return (NULL);
@@ -2254,7 +2255,7 @@ register_CE(struct archive_read *a, int32_t location,
            offset >= file->offset) ||
            offset < iso9660->current_position ||
            (((uint64_t)file->ce_offset) + file->ce_size)
-             > iso9660->logical_block_size ||
+             > (uint64_t)iso9660->logical_block_size ||
            offset + file->ce_offset + file->ce_size
                  > iso9660->volume_size) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
index f3c7d282b4974e592e04186f32e77930bf27c424..4f0bf0ed48b6da22422f5e7320997cb665c9a3c3 100644 (file)
@@ -289,7 +289,7 @@ static void lzh_huffman_free(struct huffman *);
 static int     lzh_read_pt_bitlen(struct lzh_stream *, int start, int end);
 static int     lzh_make_fake_table(struct huffman *, uint16_t);
 static int     lzh_make_huffman_table(struct huffman *);
-static int inline lzh_decode_huffman(struct huffman *, unsigned);
+static inline int lzh_decode_huffman(struct huffman *, unsigned);
 static int     lzh_decode_huffman_tree(struct huffman *, unsigned, int);
 
 
index c70e0e5b3374312e97903feecb93892039100a9f..192697af0b776205762addb7707b99d1eedfe2f1 100644 (file)
@@ -2408,9 +2408,9 @@ expand(struct archive_read *a, int64_t end)
 
       if ((lensymbol = read_next_symbol(a, &rar->lengthcode)) < 0)
         goto bad_data;
-      if (lensymbol > sizeof(lengthbases)/sizeof(lengthbases[0]))
+      if (lensymbol > (int)(sizeof(lengthbases)/sizeof(lengthbases[0])))
         goto bad_data;
-      if (lensymbol > sizeof(lengthbits)/sizeof(lengthbits[0]))
+      if (lensymbol > (int)(sizeof(lengthbits)/sizeof(lengthbits[0])))
         goto bad_data;
       len = lengthbases[lensymbol] + 2;
       if (lengthbits[lensymbol] > 0) {
@@ -2442,9 +2442,9 @@ expand(struct archive_read *a, int64_t end)
     }
     else
     {
-      if (symbol-271 > sizeof(lengthbases)/sizeof(lengthbases[0]))
+      if (symbol-271 > (int)(sizeof(lengthbases)/sizeof(lengthbases[0])))
         goto bad_data;
-      if (symbol-271 > sizeof(lengthbits)/sizeof(lengthbits[0]))
+      if (symbol-271 > (int)(sizeof(lengthbits)/sizeof(lengthbits[0])))
         goto bad_data;
       len = lengthbases[symbol-271]+3;
       if(lengthbits[symbol-271] > 0) {
@@ -2456,9 +2456,9 @@ expand(struct archive_read *a, int64_t end)
 
       if ((offssymbol = read_next_symbol(a, &rar->offsetcode)) < 0)
         goto bad_data;
-      if (offssymbol > sizeof(offsetbases)/sizeof(offsetbases[0]))
+      if (offssymbol > (int)(sizeof(offsetbases)/sizeof(offsetbases[0])))
         goto bad_data;
-      if (offssymbol > sizeof(offsetbits)/sizeof(offsetbits[0]))
+      if (offssymbol > (int)(sizeof(offsetbits)/sizeof(offsetbits[0])))
         goto bad_data;
       offs = offsetbases[offssymbol]+1;
       if(offsetbits[offssymbol] > 0)
index 42412880f29d59f4e36f624ebd52789c0d54b7ce..eb255819c6c8e204c43254428771f8cf1f485f05 100644 (file)
@@ -2333,6 +2333,8 @@ solaris_sparse_parse(struct archive_read *a, struct tar *tar,
        int64_t start, end;
        int hole = 1;
 
+       (void)entry; /* UNUSED */
+
        end = 0;
        if (*p == ' ')
                p++;
index 3c01cbe4362b2dfb5d327f507ab8a7b94c5bf7da..92569bb64d34ec818b7d0414de834b2a1347a356 100644 (file)
@@ -2624,6 +2624,7 @@ strappend_base64(struct xar *xar,
        const unsigned char *b;
        size_t len;
 
+       (void)xar; /* UNUSED */
        len = 0;
        out = buff;
        b = (const unsigned char *)s;
index f805855fa7ad9248a6e71f984501127d58399d3b..247c2d204fbee580e29f8d4bc545838d3a011a71 100644 (file)
@@ -717,7 +717,7 @@ compression_name(int compression)
        };
 
        if (compression <
-           sizeof(compression_names)/sizeof(compression_names[0]))
+           (int)(sizeof(compression_names)/sizeof(compression_names[0])))
                return compression_names[compression];
        else
                return "??";
@@ -860,6 +860,8 @@ zip_read_data_none(struct archive_read *a, const void **_buff,
        const char *buff;
        ssize_t bytes_avail;
 
+       (void)offset; /* UNUSED */
+
        zip = (struct zip *)(a->format->data);
 
        if (zip->entry->flags & ZIP_LENGTH_AT_END) {
@@ -940,6 +942,8 @@ zip_read_data_deflate(struct archive_read *a, const void **buff,
        const void *compressed_buff;
        int r;
 
+       (void)offset; /* UNUSED */
+
        zip = (struct zip *)(a->format->data);
 
        /* If the buffer hasn't been allocated, allocate it now. */
index 550d7e7e6b6243721e42c79b58a2534bbc892d8c..49ff108ee0a34c7f105f100b96d0451e38a71af2 100644 (file)
@@ -1286,7 +1286,7 @@ create_sconv_object(const char *fc, const char *tc,
         * Check if "from charset" and "to charset" are the same.
         */
        if (strcmp(fc, tc) == 0 ||
-           (sc->from_cp != -1 && sc->from_cp == sc->to_cp))
+           (sc->from_cp != (unsigned)-1 && sc->from_cp == sc->to_cp))
                sc->same = 1;
        else
                sc->same = 0;
index 9937930dc90113827bef0f58e14e1e4363015f19..be922874902ec02a9bfc6e0cc09144baaba33dea 100644 (file)
@@ -2086,6 +2086,9 @@ set_times(struct archive_write_disk *a,
                           mtime_nanos, ctime, ctime_nanos) == 0) {
                return (ARCHIVE_OK);
        }
+#else /* Tru64 */
+       (void)ctime; /* UNUSED */
+       (void)ctime_nanos; /* UNUSED */
 #endif /* Tru64 */
 
 #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
index 3f7a45be665f98ea16a186458814d89c39bdf82a..dbfa3e93f8c4488c289aa0eda7103e9fb720ba87 100644 (file)
@@ -846,7 +846,7 @@ enc_uint64(struct archive_write *a, uint64_t val)
        int i;
 
        numdata[0] = 0;
-       for (i = 1; i < sizeof(numdata); i++) {
+       for (i = 1; i < (int)sizeof(numdata); i++) {
                if (val < mask) {
                        numdata[0] |= (uint8_t)val;
                        break;
@@ -2179,6 +2179,8 @@ compression_code_ppmd(struct archive *a,
 {
        struct ppmd_stream *strm;
 
+       (void)a; /* UNUSED */
+
        strm = (struct ppmd_stream *)lastrm->real_stream;
 
        /* Copy encoded data if there are remaining bytes from previous call. */
@@ -2219,6 +2221,8 @@ compression_end_ppmd(struct archive *a, struct la_zstream *lastrm)
 {
        struct ppmd_stream *strm;
 
+       (void)a; /* UNUSED */
+
        strm = (struct ppmd_stream *)lastrm->real_stream;
        __archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context, &g_szalloc);
        free(strm->buff);
index 8e17943700760c068929176faf1b196de4813fe5..1a567f82af0858641e34116c3f8e9fd6c45ca4f1 100644 (file)
@@ -680,7 +680,7 @@ xar_write_data(struct archive_write *a, const void *buff, size_t s)
        }
 #if !defined(_WIN32) || defined(__CYGWIN__)
        if (xar->bytes_remaining ==
-           archive_entry_size(xar->cur_file->entry)) {
+           (uint64_t)archive_entry_size(xar->cur_file->entry)) {
                /*
                 * Get the path of a shell script if so.
                 */
@@ -1942,6 +1942,8 @@ file_create_virtual_dir(struct archive_write *a, struct xar *xar,
 {
        struct file *file;
 
+       (void)xar; /* UNUSED */
+
        file = file_new(a, NULL);
        if (file == NULL)
                return (NULL);
index 820b9d60f67480135523623b99a0aa8bf53acc0a..ebf9a4656ba5252916f1a5918901255bd811c435 100644 (file)
@@ -276,7 +276,7 @@ DEFINE_TEST(test_acl_nfs4)
         * fail when added to existing NFS4 ACLs.
         */
        set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
-       for (i = 0; i < sizeof(acls_bad)/sizeof(acls_bad[0]); ++i) {
+       for (i = 0; i < (int)(sizeof(acls_bad)/sizeof(acls_bad[0])); ++i) {
                struct acl_t *p = &acls_bad[i];
                failure("Malformed ACL test #%d", i);
                assertEqualInt(ARCHIVE_FAILED,
index bbe8bcde25e4069414b90ddd51a4bbaba409711d..68e76671ba2942b28a8fe11bffbd7af4a5c7ab16 100644 (file)
@@ -263,7 +263,7 @@ DEFINE_TEST(test_acl_posix1e)
         * fail when added to existing POSIX.1e ACLs.
         */
        set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
-       for (i = 0; i < sizeof(acls_nfs4)/sizeof(acls_nfs4[0]); ++i) {
+       for (i = 0; i < (int)(sizeof(acls_nfs4)/sizeof(acls_nfs4[0])); ++i) {
                struct acl_t *p = &acls_nfs4[i];
                failure("Malformed ACL test #%d", i);
                assertEqualInt(ARCHIVE_FAILED,
index 1e5e585e742e78e71513ad12a7543d2d886159a9..0d86bd4788c7bbe7180af38ad4f1e5f3d68b06a0 100644 (file)
@@ -36,7 +36,7 @@ test_read_format_mtree1(void)
        /* Compute max 64-bit signed twos-complement value
         * without relying on overflow.  This assumes that long long
         * is at least 64 bits. */
-       const static long long max_int64 = ((((long long)1) << 62) - 1) + (((long long)1) << 62);
+       static const long long max_int64 = ((((long long)1) << 62) - 1) + (((long long)1) << 62);
        time_t min_time, t;
 
        extract_reference_file(reffile);
index 2a5ea4abb9cbcce7747e1ffca4f7e98daf2dd21b..cabdae8ddc4355b6128208dae07d4c73100e71e4 100644 (file)
@@ -37,6 +37,9 @@ static int64_t
 group_lookup(void *d, const char *name, int64_t g)
 {
        int *mp = d;
+
+       (void)g; /* UNUSED */
+
        assertEqualInt(*mp, 0x13579);
        if (strcmp(name, "FOOGROUP"))
                return (1);
@@ -55,6 +58,9 @@ static int64_t
 user_lookup(void *d, const char *name, int64_t u)
 {
        int *mp = d;
+
+       (void)u; /* UNUSED */
+
        assertEqualInt(*mp, 0x1234);
        if (strcmp("FOO", name) == 0)
                return (2);
index 337233e56179a8372c1ee5640289f66187e29735..ce3fa82ef5ba9406fefad28a364b80e8048eeab9 100644 (file)
@@ -228,11 +228,11 @@ create_iso_image(unsigned char *buff, size_t buffsize, size_t *used,
 
        sym1[0] = 'x';
        sym1[1] = '\0';
-       for (i = 0; i < sizeof(sym128)-2; i++)
+       for (i = 0; i < (int)sizeof(sym128)-2; i++)
                sym128[i] = 'a';
        sym128[sizeof(sym128)-2] = 'x';
        sym128[sizeof(sym128)-1] = '\0';
-       for (i = 0; i < sizeof(sym255)-2; i++)
+       for (i = 0; i < (int)sizeof(sym255)-2; i++)
                sym255[i] = 'a';
        sym255[sizeof(sym255)-2] = 'x';
        sym255[sizeof(sym255)-1] = '\0';
index 7db9b50131d1be2efd2a0a344ad6faaa19098715..2e3e03f15f92cd72f34c0fc10c32d1c7f8bc0762 100644 (file)
@@ -365,10 +365,10 @@ test_write_format_iso9660_zisofs_2(void)
        for (i = 0; i < 256; i++) {
                int j;
                if (i == 0) {
-                       for (j = 0; j < sizeof(data); j++)
+                       for (j = 0; j < (int)sizeof(data); j++)
                                data[j] = (i^j) & 0xff;
                } else {
-                       for (j = 0; j < sizeof(data); j++)
+                       for (j = 0; j < (int)sizeof(data); j++)
                                data[j] ^= i+j;
                }
                assertEqualIntA(a, 1024, archive_write_data(a, data, 1024));