]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Avoid several warnings in libarchive_test on Borland C Compiler.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 19 May 2011 11:52:15 +0000 (07:52 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 19 May 2011 11:52:15 +0000 (07:52 -0400)
SVN-Revision: 3370

libarchive/test/main.c
libarchive/test/test_compat_mac_gnutar.c
libarchive/test/test_read_truncated_filter.c
libarchive/test/test_sparse_basic.c
libarchive/test/test_write_format_xar.c

index 75b79509a2a1662b0884042bbdf3cc6cd32c5d14..6fa54ded7eae63fe13e61e8cdf5cdf8b5b2ce552 100644 (file)
@@ -441,7 +441,7 @@ assertion_equal_int(const char *file, int line,
 static int
 _utf8_to_unicode(uint32_t *pwc, const char *s, size_t n)
 {
-       static unsigned char utf8_count[256] = {
+       static char utf8_count[256] = {
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 00 - 0F */
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 10 - 1F */
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 20 - 2F */
@@ -460,7 +460,7 @@ _utf8_to_unicode(uint32_t *pwc, const char *s, size_t n)
                 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* F0 - FF */
        };
        int ch;
-       unsigned char cnt;
+       int cnt;
        uint32_t wc;
 
        /* Sanity check. */
@@ -475,7 +475,7 @@ _utf8_to_unicode(uint32_t *pwc, const char *s, size_t n)
        cnt = utf8_count[ch];
 
        /* Invalide sequence or there are not plenty bytes. */
-       if (n < cnt)
+       if (n < (size_t)cnt)
                return (-1);
 
        /* Make a Unicode code point from a single UTF-8 sequence. */
index b9aa1f711a7541bcdb3c13a502995a7c3ce07da4..6ec80d73fee013ecd50e8da49a3fd114c72da798 100644 (file)
@@ -45,7 +45,6 @@ DEFINE_TEST(test_compat_mac_gnutar)
        struct archive *a;
        const void *attr;
        size_t attrSize;
-       int r;
 
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
@@ -53,7 +52,7 @@ DEFINE_TEST(test_compat_mac_gnutar)
        extract_reference_file(name);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
 
-       assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(TESTPATH, archive_entry_pathname(ae));
        assertEqualInt(1275688109, archive_entry_mtime(ae));
        assertEqualInt(95594, archive_entry_uid(ae));
@@ -66,7 +65,7 @@ DEFINE_TEST(test_compat_mac_gnutar)
        assert(attr == NULL);
        assertEqualInt(0, attrSize);
 
-       assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(TESTPATH "dir/", archive_entry_pathname(ae));
        assertEqualInt(1275687611, archive_entry_mtime(ae));
        assertEqualInt(95594, archive_entry_uid(ae));
@@ -79,7 +78,7 @@ DEFINE_TEST(test_compat_mac_gnutar)
        assert(attr != NULL);
        assertEqualInt(225, attrSize);
 
-       assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(TESTPATH "file", archive_entry_pathname(ae));
        assertEqualInt(1275687588, archive_entry_mtime(ae));
        assertEqualInt(95594, archive_entry_uid(ae));
@@ -92,7 +91,7 @@ DEFINE_TEST(test_compat_mac_gnutar)
        assert(attr != NULL);
        assertEqualInt(225, attrSize);
 
-       assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString("dir/", archive_entry_pathname(ae));
        assertEqualInt(1275688064, archive_entry_mtime(ae));
        assertEqualInt(95594, archive_entry_uid(ae));
@@ -105,7 +104,7 @@ DEFINE_TEST(test_compat_mac_gnutar)
        assert(attr != NULL);
        assertEqualInt(225, attrSize);
 
-       assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString("file", archive_entry_pathname(ae));
        assertEqualInt(1275625860, archive_entry_mtime(ae));
        assertEqualInt(95594, archive_entry_uid(ae));
index 582f7bae4ae340b8b9ed6bc0b31be18ba77ff9c3..cb7611ec4c82117a4c090ff3054a4e726a02a0ea 100644 (file)
@@ -107,7 +107,7 @@ test_truncation(const char *compression, int (*set_compression)(struct archive *
                }
                sprintf(path, "%s%d", compression, i);
                assertEqualString(path, archive_entry_pathname(ae));
-               if (datasize != archive_read_data(a, data, datasize)) {
+               if (datasize != (size_t)archive_read_data(a, data, datasize)) {
                        failure("Should have non-NULL error message for %s",
                            compression);
                        assert(NULL != archive_error_string(a));
index 280a9f70dcab09542a03c6bf18b3f4d0d0fbf1fd..000084b54cc3344f7cbdc680ca3661c36d489d91 100644 (file)
@@ -316,6 +316,7 @@ verify_sparse_file2(struct archive *a, const char *path,
        struct archive_entry *ae;
        int fd;
 
+       (void)sparse; /* UNUSED */
        assert((ae = archive_entry_new()) != NULL);
        archive_entry_set_pathname(ae, path);
        if (preopen)
index d1dd8e310847ccd9e97f3c080ee1a599a877d7da..449e49da1a9b6304f081c614064ac36e68fbe965 100644 (file)
@@ -35,7 +35,6 @@ test_xar(const char *option)
        struct archive_entry *ae;
        struct archive *a;
        size_t used;
-       int i;
        const char *name;
        const void *value;
        size_t size;
@@ -182,7 +181,7 @@ test_xar(const char *option)
        assert((AE_IFREG | 0755) == archive_entry_mode(ae));
        assertEqualInt(2, archive_entry_nlink(ae));
        assertEqualInt(8, archive_entry_size(ae));
-       assertEqualInt(2, i = archive_entry_xattr_reset(ae));
+       assertEqualInt(2, archive_entry_xattr_reset(ae));
        assertEqualInt(ARCHIVE_OK,
            archive_entry_xattr_next(ae, &name, &value, &size));
        assertEqualString("user.data2", name);