From 2416fefc0adc6061212e5ccbf166c8c987385527 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Fri, 16 Jan 2009 15:40:54 +0200 Subject: ubi-utils: fix compilation warnings Signed-off-by: Artem Bityutskiy --- ubi-utils/new-utils/src/common.h | 3 ++- ubi-utils/new-utils/src/libscan.c | 4 ++-- ubi-utils/new-utils/src/libubi.c | 3 ++- ubi-utils/new-utils/src/ubiformat.c | 12 +++++------- ubi-utils/new-utils/src/ubinize.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ubi-utils/new-utils/src/common.h b/ubi-utils/new-utils/src/common.h index fdc69db..56fa020 100644 --- a/ubi-utils/new-utils/src/common.h +++ b/ubi-utils/new-utils/src/common.h @@ -55,7 +55,8 @@ extern "C" { /* System error messages */ #define sys_errmsg(fmt, ...) ({ \ - int _err = errno, _i; \ + int _err = errno; \ + size_t _i; \ fprintf(stderr, PROGRAM_NAME ": error!: " fmt "\n", ##__VA_ARGS__); \ for (_i = 0; _i < sizeof(PROGRAM_NAME) + 1; _i++) \ fprintf(stderr, " "); \ diff --git a/ubi-utils/new-utils/src/libscan.c b/ubi-utils/new-utils/src/libscan.c index 3427498..da13b1b 100644 --- a/ubi-utils/new-utils/src/libscan.c +++ b/ubi-utils/new-utils/src/libscan.c @@ -154,7 +154,7 @@ int ubi_scan(struct mtd_info *mtd, struct ubi_scan_info **info, int verbose) } } else { - if (be32_to_cpu(hdr.vid_hdr_offset) != si->vid_hdr_offs) { + if ((int)be32_to_cpu(hdr.vid_hdr_offset) != si->vid_hdr_offs) { if (pr) printf("\n"); if (v) @@ -168,7 +168,7 @@ int ubi_scan(struct mtd_info *mtd, struct ubi_scan_info **info, int verbose) si->ec[eb] = EB_CORRUPTED; continue; } - if (be32_to_cpu(hdr.data_offset) != si->data_offs) { + if ((int)be32_to_cpu(hdr.data_offset) != si->data_offs) { if (pr) printf("\n"); if (v) diff --git a/ubi-utils/new-utils/src/libubi.c b/ubi-utils/new-utils/src/libubi.c index 2c80fea..88215d0 100644 --- a/ubi-utils/new-utils/src/libubi.c +++ b/ubi-utils/new-utils/src/libubi.c @@ -1153,7 +1153,8 @@ int ubi_get_vol_info(libubi_t desc, const char *node, struct ubi_vol_info *info) int ubi_get_vol_info1_nm(libubi_t desc, int dev_num, const char *name, struct ubi_vol_info *info) { - int i, err, nlen = strlen(name); + int i, err; + unsigned int nlen = strlen(name); struct ubi_dev_info dev_info; if (nlen == 0) { diff --git a/ubi-utils/new-utils/src/ubiformat.c b/ubi-utils/new-utils/src/ubiformat.c index bf07e5e..0074c7a 100644 --- a/ubi-utils/new-utils/src/ubiformat.c +++ b/ubi-utils/new-utils/src/ubiformat.c @@ -309,8 +309,7 @@ static int drop_ffs(const struct mtd_info *mtd, const void *buf, int len) return len; } -static int open_file(const struct mtd_info *mtd, struct ubi_scan_info *si, - off_t *sz) +static int open_file(off_t *sz) { int fd; @@ -355,13 +354,12 @@ static int read_all(int fd, void *buf, size_t len) return 0; } -static int flash_image(const struct mtd_info *mtd, const struct ubigen_info *ui, - struct ubi_scan_info *si) +static int flash_image(const struct mtd_info *mtd, struct ubi_scan_info *si) { int fd, img_ebs, eb, written_ebs = 0, divisor; off_t st_size; - fd = open_file(mtd, si, &st_size); + fd = open_file(&st_size); if (fd < 0) return fd; @@ -608,7 +606,7 @@ int main(int argc, char * const argv[]) errmsg("VID header offset has to be multiple of min. I/O unit size"); goto out_close; } - if (args.vid_hdr_offs + UBI_VID_HDR_SIZE > mtd.eb_size) { + if (args.vid_hdr_offs + (int)UBI_VID_HDR_SIZE > mtd.eb_size) { errmsg("bad VID header offset"); goto out_close; } @@ -757,7 +755,7 @@ int main(int argc, char * const argv[]) } if (args.image) { - err = flash_image(&mtd, &ui, si); + err = flash_image(&mtd, si); if (err < 0) goto out_free; diff --git a/ubi-utils/new-utils/src/ubinize.c b/ubi-utils/new-utils/src/ubinize.c index 4f3e8a1..00dc508 100644 --- a/ubi-utils/new-utils/src/ubinize.c +++ b/ubi-utils/new-utils/src/ubinize.c @@ -261,7 +261,7 @@ static int parse_opt(int argc, char * const argv[]) return errmsg("output file was not specified (use -h for help)"); if (args.vid_hdr_offs) { - if (args.vid_hdr_offs + UBI_VID_HDR_SIZE >= args.peb_size) + if (args.vid_hdr_offs + (int)UBI_VID_HDR_SIZE >= args.peb_size) return errmsg("bad VID header position"); if (args.vid_hdr_offs % 8) return errmsg("VID header offset has to be multiple of min. I/O unit size"); -- cgit v1.2.3