From f21807946f74c4f58a5f77755a13261cdea19e29 Mon Sep 17 00:00:00 2001 From: renxudong Date: Sun, 11 Aug 2019 01:19:46 -0400 Subject: [PATCH 7/8] unsquashfs-Make-some-variables-long-long-rather-than --- squashfs-tools/unsquash-4.c | 4 ++-- squashfs-tools/unsquashfs.c | 12 ++++++++---- squashfs-tools/unsquashfs.h | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/squashfs-tools/unsquash-4.c b/squashfs-tools/unsquash-4.c index b501871..211a796 100644 --- a/squashfs-tools/unsquash-4.c +++ b/squashfs-tools/unsquash-4.c @@ -104,7 +104,7 @@ struct inode *read_inode_4(unsigned int start_block, unsigned int offset) { static union squashfs_inode_header header; long long start = sBlk.s.inode_table_start + start_block; - int bytes = lookup_entry(inode_table_hash, start); + long long bytes = lookup_entry(inode_table_hash, start); char *block_ptr = inode_table + bytes + offset; static struct inode i; @@ -261,7 +261,7 @@ struct dir *squashfs_opendir_4(unsigned int block_start, unsigned int offset, __attribute__((aligned)); struct squashfs_dir_entry *dire = (struct squashfs_dir_entry *) buffer; long long start; - int bytes; + long long bytes; int dir_count, size; struct dir_ent *new_dir; struct dir *dir; diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c index 875a6cd..5ba9454 100644 --- a/squashfs-tools/unsquashfs.c +++ b/squashfs-tools/unsquashfs.c @@ -592,7 +592,7 @@ int print_filename(char *pathname, struct inode *inode) void add_entry(struct hash_table_entry *hash_table[], long long start, - int bytes) + long long bytes) { int hash = CALCULATE_HASH(start); struct hash_table_entry *hash_table_entry; @@ -608,7 +608,7 @@ void add_entry(struct hash_table_entry *hash_table[], long long start, } -int lookup_entry(struct hash_table_entry *hash_table[], long long start) +long long lookup_entry(struct hash_table_entry *hash_table[], long long start) { int hash = CALCULATE_HASH(start); struct hash_table_entry *hash_table_entry; @@ -769,7 +769,9 @@ failed: int read_inode_table(long long start, long long end) { - int size = 0, bytes = 0, res; + int res; + long long size = 0; + long long bytes = 0; TRACE("read_inode_table: start %lld, end %lld\n", start, end); @@ -1179,7 +1181,9 @@ int create_inode(char *pathname, struct inode *i) int read_directory_table(long long start, long long end) { - int bytes = 0, size = 0, res; + int res; + long long bytes = 0; + long long size = 0; TRACE("read_directory_table: start %lld, end %lld\n", start, end); diff --git a/squashfs-tools/unsquashfs.h b/squashfs-tools/unsquashfs.h index f9c49ac..aeca4b7 100644 --- a/squashfs-tools/unsquashfs.h +++ b/squashfs-tools/unsquashfs.h @@ -74,7 +74,7 @@ struct super_block { struct hash_table_entry { long long start; - int bytes; + long long bytes; struct hash_table_entry *next; }; @@ -241,7 +241,7 @@ extern struct cache *fragment_cache, *data_cache; /* unsquashfs.c */ extern int read_inode_table(long long, long long); extern int read_directory_table(long long, long long); -extern int lookup_entry(struct hash_table_entry **, long long); +extern long long lookup_entry(struct hash_table_entry **, long long); extern int read_fs_bytes(int fd, long long, int, void *); extern int read_block(int, long long, long long *, int, void *); extern void enable_progress_bar(); -- 1.8.3.1