From 3df53d76b5aeccd29ed7d50d5c798d50fd37ea3e Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 10 Feb 2021 12:18:55 +0100 Subject: Always use the correct data type for realloc return value This commit mainly serves the static analysis tooling. Signed-off-by: David Oberhollenzer --- bin/rdsquashfs/fill_files.c | 2 +- bin/sqfs2tar/options.c | 2 +- lib/sqfs/block_processor/common.c | 2 +- lib/sqfs/block_writer.c | 2 +- lib/sqfs/frag_table.c | 2 +- lib/sqfs/id_table.c | 2 +- lib/sqfs/read_inode.c | 3 +-- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/rdsquashfs/fill_files.c b/bin/rdsquashfs/fill_files.c index 63ad640..1afe6b8 100644 --- a/bin/rdsquashfs/fill_files.c +++ b/bin/rdsquashfs/fill_files.c @@ -64,9 +64,9 @@ order_by_start: static int add_file(const sqfs_tree_node_t *node) { + struct file_ent *new; size_t new_sz; char *path; - void *new; if (num_files == max_files) { new_sz = max_files ? max_files * 2 : 256; diff --git a/bin/sqfs2tar/options.c b/bin/sqfs2tar/options.c index a84fcd4..1b652b5 100644 --- a/bin/sqfs2tar/options.c +++ b/bin/sqfs2tar/options.c @@ -82,7 +82,7 @@ void process_args(int argc, char **argv) size_t idx, new_count; const char *name; int i, ret; - void *new; + char **new; for (;;) { i = getopt_long(argc, argv, short_opts, long_opts, NULL); diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c index d6c0889..f1aca1e 100644 --- a/lib/sqfs/block_processor/common.c +++ b/lib/sqfs/block_processor/common.c @@ -12,8 +12,8 @@ static int set_block_size(sqfs_inode_generic_t **inode, { size_t min_size = (index + 1) * sizeof(sqfs_u32); size_t avail = (*inode)->payload_bytes_available; + sqfs_inode_generic_t *new; size_t newsz; - void *new; if (avail < min_size) { newsz = avail ? avail : (sizeof(sqfs_u32) * 4); diff --git a/lib/sqfs/block_writer.c b/lib/sqfs/block_writer.c index 17d045f..f6dea26 100644 --- a/lib/sqfs/block_writer.c +++ b/lib/sqfs/block_writer.c @@ -52,8 +52,8 @@ typedef struct { static int store_block_location(block_writer_default_t *wr, sqfs_u64 offset, sqfs_u32 size, sqfs_u32 chksum) { + blk_info_t *new; size_t new_sz; - void *new; if (wr->num_blocks == wr->max_blocks) { new_sz = wr->max_blocks * 2; diff --git a/lib/sqfs/frag_table.c b/lib/sqfs/frag_table.c index f0b01da..5d919b8 100644 --- a/lib/sqfs/frag_table.c +++ b/lib/sqfs/frag_table.c @@ -169,8 +169,8 @@ int sqfs_frag_table_lookup(sqfs_frag_table_t *tbl, sqfs_u32 index, int sqfs_frag_table_append(sqfs_frag_table_t *tbl, sqfs_u64 location, sqfs_u32 size, sqfs_u32 *index) { + sqfs_fragment_t *new; size_t new_sz, total; - void *new; if (tbl->used == tbl->capacity) { new_sz = tbl->capacity ? tbl->capacity * 2 : 128; diff --git a/lib/sqfs/id_table.c b/lib/sqfs/id_table.c index e3d386e..12f2f20 100644 --- a/lib/sqfs/id_table.c +++ b/lib/sqfs/id_table.c @@ -75,8 +75,8 @@ sqfs_id_table_t *sqfs_id_table_create(sqfs_u32 flags) int sqfs_id_table_id_to_index(sqfs_id_table_t *tbl, sqfs_u32 id, sqfs_u16 *out) { + sqfs_u32 *ptr; size_t i, sz; - void *ptr; for (i = 0; i < tbl->num_ids; ++i) { if (tbl->ids[i] == id) { diff --git a/lib/sqfs/read_inode.c b/lib/sqfs/read_inode.c index 6ca61d5..4f9fd3c 100644 --- a/lib/sqfs/read_inode.c +++ b/lib/sqfs/read_inode.c @@ -227,10 +227,9 @@ static int read_inode_dir_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base, sqfs_inode_generic_t **result) { size_t i, new_sz, index_max, index_used; - sqfs_inode_generic_t *out; + sqfs_inode_generic_t *out, *new; sqfs_inode_dir_ext_t dir; sqfs_dir_index_t ent; - void *new; int err; err = sqfs_meta_reader_read(ir, &dir, sizeof(dir)); -- cgit v1.2.3