diff options
author | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-02-10 00:56:49 +0900 |
---|---|---|
committer | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-02-10 01:26:49 +0900 |
commit | d2d75ef8cb78ac1a5382f4d945a974fd7562fde6 (patch) | |
tree | 7bd484fd181c2ab03428a4415ab95360c9540701 | |
parent | 82d66e035dbba623c0f2c88b6351b7649c93f986 (diff) | |
download | libarchive-d2d75ef8cb78ac1a5382f4d945a974fd7562fde6.tar.gz |
Fix build failure in aggressive warnings
-rw-r--r-- | cpio/test/main.c | 6 | ||||
-rw-r--r-- | libarchive/archive_rb.c | 4 | ||||
-rw-r--r-- | libarchive/archive_read_disk_entry_from_file.c | 6 | ||||
-rw-r--r-- | libarchive/archive_read_disk_posix.c | 6 | ||||
-rw-r--r-- | libarchive/archive_read_support_format_rar.c | 4 | ||||
-rw-r--r-- | libarchive/archive_read_support_format_zip.c | 2 | ||||
-rw-r--r-- | libarchive/archive_string.c | 8 | ||||
-rw-r--r-- | libarchive/archive_write_disk_posix.c | 15 | ||||
-rw-r--r-- | libarchive/archive_write_set_format_iso9660.c | 11 | ||||
-rw-r--r-- | libarchive/test/main.c | 6 | ||||
-rw-r--r-- | libarchive/test/test_acl_pax.c | 2 | ||||
-rw-r--r-- | libarchive/test/test_acl_posix1e.c | 2 | ||||
-rw-r--r-- | libarchive/test/test_sparse_basic.c | 2 | ||||
-rw-r--r-- | tar/test/main.c | 6 |
14 files changed, 46 insertions, 34 deletions
diff --git a/cpio/test/main.c b/cpio/test/main.c index bebd60c5..915237a7 100644 --- a/cpio/test/main.c +++ b/cpio/test/main.c @@ -1329,7 +1329,7 @@ assertion_file_nlinks(const char *file, int line, assertion_count(file, line); r = lstat(pathname, &st); - if (r == 0 && st.st_nlink == nlinks) + if (r == 0 && (int)st.st_nlink == nlinks) return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); @@ -1393,7 +1393,7 @@ assertion_is_dir(const char *file, int line, const char *pathname, int mode) /* Windows doesn't handle permissions the same way as POSIX, * so just ignore the mode tests. */ /* TODO: Can we do better here? */ - if (mode >= 0 && mode != (st.st_mode & 07777)) { + if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) { failure_start(file, line, "Dir %s has wrong mode", pathname); logprintf(" Expected: 0%3o\n", mode); logprintf(" Found: 0%3o\n", st.st_mode & 07777); @@ -1426,7 +1426,7 @@ assertion_is_reg(const char *file, int line, const char *pathname, int mode) /* Windows doesn't handle permissions the same way as POSIX, * so just ignore the mode tests. */ /* TODO: Can we do better here? */ - if (mode >= 0 && mode != (st.st_mode & 07777)) { + if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) { failure_start(file, line, "File %s has wrong mode", pathname); logprintf(" Expected: 0%3o\n", mode); logprintf(" Found: 0%3o\n", st.st_mode & 07777); diff --git a/libarchive/archive_rb.c b/libarchive/archive_rb.c index fa307be2..70bf7e6d 100644 --- a/libarchive/archive_rb.c +++ b/libarchive/archive_rb.c @@ -96,7 +96,7 @@ __archive_rb_tree_init(struct archive_rb_tree *rbt, const struct archive_rb_tree_ops *ops) { rbt->rbt_ops = ops; - *((const struct archive_rb_node **)&rbt->rbt_root) = RB_SENTINEL_NODE; + *((struct archive_rb_node **)&rbt->rbt_root) = RB_SENTINEL_NODE; } struct archive_rb_node * @@ -683,7 +683,7 @@ __archive_rb_tree_iterate(struct archive_rb_tree *rbt, */ if (RB_SENTINEL_P(self->rb_nodes[direction])) { while (!RB_ROOT_P(rbt, self)) { - if (other == RB_POSITION(self)) + if (other == (unsigned int)RB_POSITION(self)) return RB_FATHER(self); self = RB_FATHER(self); } diff --git a/libarchive/archive_read_disk_entry_from_file.c b/libarchive/archive_read_disk_entry_from_file.c index 64150084..201ea42f 100644 --- a/libarchive/archive_read_disk_entry_from_file.c +++ b/libarchive/archive_read_disk_entry_from_file.c @@ -193,7 +193,7 @@ archive_read_disk_entry_from_file(struct archive *_a, fd = open(path, O_RDONLY | O_NONBLOCK); if (fd >= 0) { unsigned long stflags; - int r = ioctl(fd, EXT2_IOC_GETFLAGS, &stflags); + r = ioctl(fd, EXT2_IOC_GETFLAGS, &stflags); if (r == 0 && stflags != 0) archive_entry_set_fflags(entry, stflags, 0); } @@ -867,12 +867,12 @@ setup_sparse(struct archive_read_disk *a, if (fm->fm_mapped_extents == 0) break; fe = fm->fm_extents; - for (i = 0; i < fm->fm_mapped_extents; i++, fe++) { + for (i = 0; i < (int)fm->fm_mapped_extents; i++, fe++) { if (!(fe->fe_flags & FIEMAP_EXTENT_UNWRITTEN)) { /* The fe_length of the last block does not * adjust itself to its size files. */ int64_t length = fe->fe_length; - if (fe->fe_logical + length > size) + if (fe->fe_logical + length > (uint64_t)size) length -= fe->fe_logical + length - size; if (fe->fe_logical == 0 && length == size) { /* This is not sparse. */ diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 3599dfd6..a1174172 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -2453,7 +2453,8 @@ tree_target_is_same_as_parent(struct tree *t, const struct stat *st) struct tree_entry *te; for (te = t->current->parent; te != NULL; te = te->parent) { - if (te->dev == st->st_dev && te->ino == st->st_ino) + if (te->dev == (int64_t)st->st_dev && + te->ino == (int64_t)st->st_ino) return (1); } return (0); @@ -2470,7 +2471,8 @@ tree_current_is_symblic_link_target(struct tree *t) lst = tree_current_lstat(t); st = tree_current_stat(t); - return (st != NULL && st->st_dev == t->current_filesystem->dev && + return (st != NULL && + (int64_t)st->st_dev == t->current_filesystem->dev && st->st_dev != lst->st_dev); } diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c index 83840795..1a8b157e 100644 --- a/libarchive/archive_read_support_format_rar.c +++ b/libarchive/archive_read_support_format_rar.c @@ -305,7 +305,7 @@ static int archive_read_format_rar_cleanup(struct archive_read *); /* Support functions */ static int read_header(struct archive_read *, struct archive_entry *, char); -static time_t get_time(int time); +static time_t get_time(int); static int read_exttime(const char *, struct rar *, const char *); static int read_symlink_stored(struct archive_read *, struct archive_entry *, struct archive_string_conv *); @@ -1047,7 +1047,7 @@ read_header(struct archive_read *a, struct archive_entry *entry, memcpy(&rar_header, p, sizeof(rar_header)); rar->file_flags = archive_le16dec(rar_header.flags); header_size = archive_le16dec(rar_header.size); - if (header_size < sizeof(file_header) + 7) { + if (header_size < (int64_t)sizeof(file_header) + 7) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Invalid header size"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index d8c1ebc7..228dff10 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -269,7 +269,7 @@ archive_read_format_zip_seekable_bid(struct archive_read *a, int best_bid) if (zip->central_directory_entries != archive_le16dec(p + 8)) return 0; /* Central directory can't extend beyond end of this file. */ - if (zip->central_directory_offset + zip->central_directory_size > filesize) + if (zip->central_directory_offset + (int64_t)zip->central_directory_size > filesize) return 0; /* This is just a tiny bit higher than the maximum returned by diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 21b02e9b..ed3b965d 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -1555,7 +1555,7 @@ make_codepage_from_charset(const char *charset) * Return ANSI Code Page of current locale set by setlocale(). */ static unsigned -get_current_codepage() +get_current_codepage(void) { char *locale, *p; unsigned cp; @@ -1630,7 +1630,7 @@ static struct { * Return OEM Code Page of current locale set by setlocale(). */ static unsigned -get_current_oemcp() +get_current_oemcp(void) { int i; char *locale, *p; @@ -1659,7 +1659,7 @@ get_current_oemcp() */ static unsigned -get_current_codepage() +get_current_codepage(void) { return (-1);/* Unknown */ } @@ -1670,7 +1670,7 @@ make_codepage_from_charset(const char *charset) return (-1);/* Unknown */ } static unsigned -get_current_oemcp() +get_current_oemcp(void) { return (-1);/* Unknown */ } diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index 6b12ed2a..37935ad5 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -1672,7 +1672,7 @@ cleanup_pathname_win(struct archive_write_disk *a) p = a->name; while (*p != '\0' && alen) { l = mbtowc(&wc, p, alen); - if (l == -1) { + if (l == (size_t)-1) { while (*p != '\0') { if (*p == '\\') *p = '/'; @@ -1979,6 +1979,7 @@ set_time(int fd, int mode, const char *name, * on fds and symlinks. */ struct timespec ts[2]; + (void)mode; /* UNUSED */ ts[0].tv_sec = atime; ts[0].tv_nsec = atime_nsec; ts[1].tv_sec = mtime; @@ -2036,6 +2037,11 @@ set_time(int fd, int mode, const char *name, /* * We don't know how to set the time on this platform. */ + (void)fd; /* UNUSED */ + (void)mode; /* UNUSED */ + (void)name; /* UNUSED */ + (void)atime_nsec; /* UNUSED */ + (void)mtime_nsec; /* UNUSED */ return (ARCHIVE_WARN); #endif } @@ -2105,6 +2111,9 @@ set_times(struct archive_write_disk *a, r1 = set_time(fd, mode, name, atime, atime_nanos, birthtime, birthtime_nanos); +#else + (void)birthtime; /* UNUSED */ + (void)birthtime_nanos; /* UNUSED */ #endif r2 = set_time(fd, mode, name, atime, atime_nanos, @@ -2537,12 +2546,12 @@ set_mac_metadata(struct archive_write_disk *a, const char *pathname, /* Default empty function body to satisfy mainline code. */ static int set_acls(struct archive_write_disk *a, int fd, const char *name, - struct archive_acl *acl) + struct archive_acl *aacl) { (void)a; /* UNUSED */ (void)fd; /* UNUSED */ (void)name; /* UNUSED */ - (void)acl; /* UNUSED */ + (void)aacl; /* UNUSED */ return (ARCHIVE_OK); } diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c index 79902620..fd4baa8c 100644 --- a/libarchive/archive_write_set_format_iso9660.c +++ b/libarchive/archive_write_set_format_iso9660.c @@ -3689,7 +3689,7 @@ wb_set_offset(struct archive_write *a, int64_t off) ext_bytes = off - iso9660->wbuff_tail; iso9660->wbuff_remaining = sizeof(iso9660->wbuff) - (iso9660->wbuff_tail - iso9660->wbuff_offset); - while (ext_bytes >= iso9660->wbuff_remaining) { + while (ext_bytes >= (int64_t)iso9660->wbuff_remaining) { if (write_null(a, (size_t)iso9660->wbuff_remaining) != ARCHIVE_OK) return (ARCHIVE_FATAL); @@ -6530,8 +6530,7 @@ isoent_traverse_tree(struct archive_write *a, struct vdd* vdd) struct idr idr; int depth; int r; - int (*genid)(struct archive_write *a, struct isoent *isoent, - struct idr *idr); + int (*genid)(struct archive_write *, struct isoent *, struct idr *); idr_init(iso9660, vdd, &idr); np = vdd->rootent; @@ -7300,7 +7299,7 @@ setup_boot_information(struct archive_write *a) size_t rsize; ssize_t i, rs; - if (size > sizeof(buff)) + if (size > (int64_t)sizeof(buff)) rsize = sizeof(buff); else rsize = (size_t)size; @@ -7483,7 +7482,7 @@ zisofs_detect_magic(struct archive_write *a, const void *buff, size_t s) int64_t entry_size; entry_size = archive_entry_size(file->entry); - if (sizeof(iso9660->zisofs.magic_buffer) > entry_size) + if ((int64_t)sizeof(iso9660->zisofs.magic_buffer) > entry_size) magic_max = entry_size; else magic_max = sizeof(iso9660->zisofs.magic_buffer); @@ -7528,7 +7527,7 @@ zisofs_detect_magic(struct archive_write *a, const void *buff, size_t s) ceil = (uncompressed_size + (ARCHIVE_LITERAL_LL(1) << log2_bs) -1) >> log2_bs; doff = (ceil + 1) * 4 + 16; - if (entry_size < doff) + if (entry_size < (int64_t)doff) return;/* Invalid data. */ /* Check every Block Pointer has valid value. */ diff --git a/libarchive/test/main.c b/libarchive/test/main.c index 7c71935d..f30018e6 100644 --- a/libarchive/test/main.c +++ b/libarchive/test/main.c @@ -1327,7 +1327,7 @@ assertion_file_nlinks(const char *file, int line, assertion_count(file, line); r = lstat(pathname, &st); - if (r == 0 && st.st_nlink == nlinks) + if (r == 0 && (int)st.st_nlink == nlinks) return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); @@ -1391,7 +1391,7 @@ assertion_is_dir(const char *file, int line, const char *pathname, int mode) /* Windows doesn't handle permissions the same way as POSIX, * so just ignore the mode tests. */ /* TODO: Can we do better here? */ - if (mode >= 0 && mode != (st.st_mode & 07777)) { + if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) { failure_start(file, line, "Dir %s has wrong mode", pathname); logprintf(" Expected: 0%3o\n", mode); logprintf(" Found: 0%3o\n", st.st_mode & 07777); @@ -1424,7 +1424,7 @@ assertion_is_reg(const char *file, int line, const char *pathname, int mode) /* Windows doesn't handle permissions the same way as POSIX, * so just ignore the mode tests. */ /* TODO: Can we do better here? */ - if (mode >= 0 && mode != (st.st_mode & 07777)) { + if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) { failure_start(file, line, "File %s has wrong mode", pathname); logprintf(" Expected: 0%3o\n", mode); logprintf(" Found: 0%3o\n", st.st_mode & 07777); diff --git a/libarchive/test/test_acl_pax.c b/libarchive/test/test_acl_pax.c index 6a7ee151..2bee4572 100644 --- a/libarchive/test/test_acl_pax.c +++ b/libarchive/test/test_acl_pax.c @@ -163,7 +163,7 @@ compare_acls(struct archive_entry *ae, struct acl_t *acls, int n, int mode) } } assertEqualInt(ARCHIVE_EOF, r); - assert((mode & 0777) == (archive_entry_mode(ae) & 0777)); + assert((mode_t)(mode & 0777) == (archive_entry_mode(ae) & 0777)); failure("Could not find match for ACL " "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')", acls[marker[0]].type, acls[marker[0]].permset, diff --git a/libarchive/test/test_acl_posix1e.c b/libarchive/test/test_acl_posix1e.c index 68e76671..2055682b 100644 --- a/libarchive/test/test_acl_posix1e.c +++ b/libarchive/test/test_acl_posix1e.c @@ -193,7 +193,7 @@ compare_acls(struct archive_entry *ae, struct acl_t *acls, int n, int mode) } } assertEqualInt(ARCHIVE_EOF, r); - assert((mode & 0777) == (archive_entry_mode(ae) & 0777)); + assert((mode_t)(mode & 0777) == (archive_entry_mode(ae) & 0777)); failure("Could not find match for ACL " "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')", acls[marker[0]].type, acls[marker[0]].permset, diff --git a/libarchive/test/test_sparse_basic.c b/libarchive/test/test_sparse_basic.c index 52d76c60..1d62e7c7 100644 --- a/libarchive/test/test_sparse_basic.c +++ b/libarchive/test/test_sparse_basic.c @@ -177,6 +177,7 @@ is_sparse_supported(const char *path) char buff[1024]; const char *testfile = "can_sparse"; + (void)path; /* UNUSED */ memset(&ut, 0, sizeof(ut)); assertEqualInt(uname(&ut), 0); p = ut.release; @@ -221,6 +222,7 @@ is_sparse_supported(const char *path) static int is_sparse_supported(const char *path) { + (void)path; /* UNUSED */ return (0); } diff --git a/tar/test/main.c b/tar/test/main.c index e066f559..da49c725 100644 --- a/tar/test/main.c +++ b/tar/test/main.c @@ -1329,7 +1329,7 @@ assertion_file_nlinks(const char *file, int line, assertion_count(file, line); r = lstat(pathname, &st); - if (r == 0 && st.st_nlink == nlinks) + if (r == 0 && (int)st.st_nlink == nlinks) return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); @@ -1393,7 +1393,7 @@ assertion_is_dir(const char *file, int line, const char *pathname, int mode) /* Windows doesn't handle permissions the same way as POSIX, * so just ignore the mode tests. */ /* TODO: Can we do better here? */ - if (mode >= 0 && mode != (st.st_mode & 07777)) { + if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) { failure_start(file, line, "Dir %s has wrong mode", pathname); logprintf(" Expected: 0%3o\n", mode); logprintf(" Found: 0%3o\n", st.st_mode & 07777); @@ -1426,7 +1426,7 @@ assertion_is_reg(const char *file, int line, const char *pathname, int mode) /* Windows doesn't handle permissions the same way as POSIX, * so just ignore the mode tests. */ /* TODO: Can we do better here? */ - if (mode >= 0 && mode != (st.st_mode & 07777)) { + if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) { failure_start(file, line, "File %s has wrong mode", pathname); logprintf(" Expected: 0%3o\n", mode); logprintf(" Found: 0%3o\n", st.st_mode & 07777); |