diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-11-29 16:43:33 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-11-29 16:43:33 +0100 |
commit | 9b2a9f0210f13f1c59c0b954c4aa0eeb0a66efd1 (patch) | |
tree | a950fa73740d345e11ba1ce90f4fc39ee12516e6 /e2fsprogs/old_e2fsprogs | |
parent | 1a7256ac38284caffd2a0de2250364369059be69 (diff) |
fix assorted unused code and wrong format specs found by cppchekc (bug 6716)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'e2fsprogs/old_e2fsprogs')
-rw-r--r-- | e2fsprogs/old_e2fsprogs/blkid/blkidP.h | 4 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/blkid/cache.c | 2 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/blkid/dev.c | 4 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/blkid/read.c | 2 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/blkid/tag.c | 6 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/e2fsck.c | 10 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/ext2fs/initialize.c | 2 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/ext2fs/unix_io.c | 4 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/fsck.c | 1 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/mke2fs.c | 6 | ||||
-rw-r--r-- | e2fsprogs/old_e2fsprogs/util.c | 2 |
11 files changed, 16 insertions, 27 deletions
diff --git a/e2fsprogs/old_e2fsprogs/blkid/blkidP.h b/e2fsprogs/old_e2fsprogs/blkid/blkidP.h index d6b2b42cc..bbadc8eb5 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/blkidP.h +++ b/e2fsprogs/old_e2fsprogs/blkid/blkidP.h @@ -179,8 +179,4 @@ extern int blkid_set_tag(blkid_dev dev, const char *name, extern blkid_dev blkid_new_dev(void); extern void blkid_free_dev(blkid_dev dev); -#ifdef __cplusplus -} -#endif - #endif diff --git a/e2fsprogs/old_e2fsprogs/blkid/cache.c b/e2fsprogs/old_e2fsprogs/blkid/cache.c index d1d29146b..251e49900 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/cache.c +++ b/e2fsprogs/old_e2fsprogs/blkid/cache.c @@ -115,7 +115,7 @@ int main(int argc, char** argv) argv[0], ret); exit(1); } - if ((ret = blkid_probe_all(cache) < 0)) + if ((ret = blkid_probe_all(cache)) < 0) fprintf(stderr, "error probing devices\n"); blkid_put_cache(cache); diff --git a/e2fsprogs/old_e2fsprogs/blkid/dev.c b/e2fsprogs/old_e2fsprogs/blkid/dev.c index bb0cc914a..260e49c65 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/dev.c +++ b/e2fsprogs/old_e2fsprogs/blkid/dev.c @@ -153,7 +153,7 @@ extern int optind; void usage(char *prog) { fprintf(stderr, "Usage: %s [-f blkid_file] [-m debug_mask]\n", prog); - fprintf(stderr, "\tList all devices and exit\n", prog); + fprintf(stderr, "\tList all devices and exit\n"); exit(1); } @@ -176,7 +176,7 @@ int main(int argc, char **argv) case 'm': blkid_debug_mask = strtoul (optarg, &tmp, 0); if (*tmp) { - fprintf(stderr, "Invalid debug mask: %d\n", + fprintf(stderr, "Invalid debug mask: %s\n", optarg); exit(1); } diff --git a/e2fsprogs/old_e2fsprogs/blkid/read.c b/e2fsprogs/old_e2fsprogs/blkid/read.c index f795a5d14..feeda518b 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/read.c +++ b/e2fsprogs/old_e2fsprogs/blkid/read.c @@ -385,7 +385,7 @@ void blkid_read_cache(blkid_cache cache) continue; end = strlen(buf) - 1; /* Continue reading next line if it ends with a backslash */ - while (buf[end] == '\\' && end < sizeof(buf) - 2 && + while (end < sizeof(buf) - 2 && buf[end] == '\\' && fgets(buf + end, sizeof(buf) - end, file)) { end = strlen(buf) - 1; lineno++; diff --git a/e2fsprogs/old_e2fsprogs/blkid/tag.c b/e2fsprogs/old_e2fsprogs/blkid/tag.c index 8337b46b6..7424edeb8 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/tag.c +++ b/e2fsprogs/old_e2fsprogs/blkid/tag.c @@ -356,7 +356,7 @@ void usage(char *prog) fprintf(stderr, "Usage: %s [-f blkid_file] [-m debug_mask] device " "[type value]\n", prog); - fprintf(stderr, "\tList all tags for a device and exit\n", prog); + fprintf(stderr, "\tList all tags for a device and exit\n"); exit(1); } @@ -382,7 +382,7 @@ int main(int argc, char **argv) case 'm': blkid_debug_mask = strtoul (optarg, &tmp, 0); if (*tmp) { - fprintf(stderr, "Invalid debug mask: %d\n", + fprintf(stderr, "Invalid debug mask: %s\n", optarg); exit(1); } @@ -407,7 +407,7 @@ int main(int argc, char **argv) dev = blkid_get_dev(cache, devname, flags); if (!dev) { - fprintf(stderr, "%s: cannot find device in blkid cache\n"); + fprintf(stderr, "%s: cannot find device in blkid cache\n", devname); exit(1); } if (search_type) { diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index 373e8ce91..8400a92ce 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c @@ -1050,7 +1050,7 @@ static errcode_t ea_refcount_create(int size, ext2_refcount_t *ret) refcount->size = size; bytes = (size_t) (size * sizeof(struct ea_refcount_el)); #ifdef DEBUG - printf("Refcount allocated %d entries, %d bytes.\n", + printf("Refcount allocated %d entries, %lu bytes.\n", refcount->size, bytes); #endif retval = ext2fs_get_mem(bytes, &refcount->list); @@ -3424,7 +3424,7 @@ static void e2fsck_pass1(e2fsck_t ctx) continue; } if ((inode->i_links_count || inode->i_blocks || - inode->i_blocks || inode->i_block[0]) && + inode->i_block[0]) && fix_problem(ctx, PR_1_JOURNAL_INODE_NOT_CLEAR, &pctx)) { memset(inode, 0, inode_size); @@ -12195,11 +12195,7 @@ static void swap_filesys(e2fsck_t ctx) void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned int size, const char *description) { - void *ret; - char buf[256]; - - ret = xzalloc(size); - return ret; + return xzalloc(size); } static char *string_copy(const char *str, int len) diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/initialize.c b/e2fsprogs/old_e2fsprogs/ext2fs/initialize.c index da2d15137..240335b32 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/initialize.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/initialize.c @@ -83,7 +83,7 @@ static int calc_reserved_gdt_blocks(ext2_filsys fs) if (rsv_gdb > EXT2_ADDR_PER_BLOCK(sb)) rsv_gdb = EXT2_ADDR_PER_BLOCK(sb); #ifdef RES_GDT_DEBUG - printf("max_blocks %lu, rsv_groups = %lu, rsv_gdb = %lu\n", + printf("max_blocks %lu, rsv_groups = %lu, rsv_gdb = %u\n", max_blocks, rsv_groups, rsv_gdb); #endif diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/unix_io.c b/e2fsprogs/old_e2fsprogs/ext2fs/unix_io.c index 474f07340..3c95829f0 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/unix_io.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/unix_io.c @@ -544,7 +544,7 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block, /* If it's in the cache, use it! */ if ((cache = find_cached_block(data, block, &reuse[0]))) { #ifdef DEBUG - printf("Using cached block %d\n", block); + printf("Using cached block %lu\n", block); #endif memcpy(cp, cache->buf, channel->block_size); count--; @@ -560,7 +560,7 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block, if (find_cached_block(data, block+i, &reuse[i])) break; #ifdef DEBUG - printf("Reading %d blocks starting at %d\n", i, block); + printf("Reading %d blocks starting at %lu\n", i, block); #endif if ((retval = raw_read_blk(channel, data, block, i, cp))) return retval; diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c index 3a0743bb1..91cce970c 100644 --- a/e2fsprogs/old_e2fsprogs/fsck.c +++ b/e2fsprogs/old_e2fsprogs/fsck.c @@ -1239,7 +1239,6 @@ static void PRS(int argc, char **argv) progress_fd = 0; else { goto next_arg; - i++; } } break; diff --git a/e2fsprogs/old_e2fsprogs/mke2fs.c b/e2fsprogs/old_e2fsprogs/mke2fs.c index 35d717a55..e44d9865c 100644 --- a/e2fsprogs/old_e2fsprogs/mke2fs.c +++ b/e2fsprogs/old_e2fsprogs/mke2fs.c @@ -385,7 +385,7 @@ static errcode_t zero_blocks(ext2_filsys fs, blk_t blk, int num, struct progress_struct *progress, blk_t *ret_blk, int *ret_count) { - int j, count, next_update, next_update_incr; + int j, count, next_update; static char *buf; errcode_t retval; @@ -403,9 +403,7 @@ static errcode_t zero_blocks(ext2_filsys fs, blk_t blk, int num, } /* OK, do the write loop */ next_update = 0; - next_update_incr = num / 100; - if (next_update_incr < 1) - next_update_incr = 1; + for (j=0; j < num; j += STRIDE_LENGTH, blk += STRIDE_LENGTH) { count = num - j; if (count > STRIDE_LENGTH) diff --git a/e2fsprogs/old_e2fsprogs/util.c b/e2fsprogs/old_e2fsprogs/util.c index a61abc2c6..e6758e093 100644 --- a/e2fsprogs/old_e2fsprogs/util.c +++ b/e2fsprogs/old_e2fsprogs/util.c @@ -117,7 +117,7 @@ void parse_journal_opts(char **journal_device, int *journal_flags, } if (strcmp(token, "device") == 0) { *journal_device = blkid_get_devname(NULL, arg, NULL); - if (!journal_device) { + if (!*journal_device) { journal_usage++; continue; } |