From: Hauke Mehrtens Date: Sun, 11 Oct 2015 19:00:41 +0000 (+0000) Subject: tools: firmware-utils: fix compiler warnings X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3d1a65adb41db2758827fe81f36d92ab61618ea3;p=openwrt%2Fstaging%2Fstintel.git tools: firmware-utils: fix compiler warnings This just fixes a lot of compiler warnings. Signed-off-by: Hauke Mehrtens SVN-Revision: 47181 --- diff --git a/tools/firmware-utils/src/airlink.c b/tools/firmware-utils/src/airlink.c index 560a58df59..06c83a0fbb 100644 --- a/tools/firmware-utils/src/airlink.c +++ b/tools/firmware-utils/src/airlink.c @@ -293,7 +293,7 @@ int main(int argc, char **argv) *((uint32_t *) & b[0x18]) = 0x0L; sum = crc32(b, 0x400); - printf("CRC32 sum0 - (%x, %x, %x)\n", sum, sum0, 0x400); + printf("CRC32 sum0 - (%x, %lx, %x)\n", sum, sum0, 0x400); if (EHDR) lseek(fd, 0x20, SEEK_SET); else @@ -305,7 +305,7 @@ int main(int argc, char **argv) write(fd, &buf[0x18], 0x4); sum = crc32(buf, l0); - printf("CRC32 sum1 - (%x, %x, %x)\n", sum, sum1, l0); + printf("CRC32 sum1 - (%x, %lx, %x)\n", sum, sum1, l0); if (EHDR) lseek(fd, 0xC, SEEK_SET); else @@ -319,7 +319,7 @@ int main(int argc, char **argv) unsigned long sum2 = buf[-0x8] | ((uint32_t)buf[-0x7] << 8) | ((uint32_t)buf[-0x6] << 16) | ((uint32_t)buf[-0x5] << 24); *((uint32_t *) & buf[-0x8]) = 0L; sum = crc32(buf - 0x4, len - 0x4); - printf("CRC32 sum2 - (%x, %x, %x)\n", sum, sum2, + printf("CRC32 sum2 - (%x, %lx, %lx)\n", sum, sum2, len - 0x4); lseek(fd, 0, SEEK_SET); *((uint32_t *) & buf[-0x8]) = htonl(sum); diff --git a/tools/firmware-utils/src/asustrx.c b/tools/firmware-utils/src/asustrx.c index 80b6b1dfcc..67f2680b31 100644 --- a/tools/firmware-utils/src/asustrx.c +++ b/tools/firmware-utils/src/asustrx.c @@ -197,7 +197,7 @@ int main(int argc, char **argv) { } for (i = 0; i < bytes; i++) { if (buf[i]) { - fprintf(stderr, "Input TRX doesn't have last 64 B empty %s\n"); + fprintf(stderr, "Input TRX doesn't have last 64 B empty %s\n", out_path); err = -ENOSPC; goto err; } @@ -217,7 +217,7 @@ int main(int argc, char **argv) { bytes = sizeof(tail); fseek(out, -bytes, SEEK_CUR); if (fwrite(&tail, 1, bytes, out) != bytes) { - fprintf(stderr, "Couldn't write %zu B to %s\n", bytes); + fprintf(stderr, "Couldn't write %zu B to %s\n", bytes, out_path); err = -EIO; goto err; } @@ -242,7 +242,7 @@ int main(int argc, char **argv) { hdr.crc32 = cpu_to_le32(crc32); rewind(out); if (fwrite(&hdr, 1, bytes, out) != bytes) { - fprintf(stderr, "Couldn't write %zu B to %s\n", bytes); + fprintf(stderr, "Couldn't write %zu B to %s\n", bytes, out_path); err = -EIO; goto err; } diff --git a/tools/firmware-utils/src/imagetag.c b/tools/firmware-utils/src/imagetag.c index f04f98d560..6a46a7ebd9 100644 --- a/tools/firmware-utils/src/imagetag.c +++ b/tools/firmware-utils/src/imagetag.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "bcm_tag.h" #include "imagetag_cmdline.h" @@ -304,7 +305,7 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \ sprintf(tag.totalLength, "%lu", imagelen); if (args->cfe_given) { - sprintf(tag.cfeAddress, "%lu", flash_start); + sprintf(tag.cfeAddress, "%" PRIu32, flash_start); sprintf(tag.cfeLength, "%lu", cfelen); } else { /* We don't include CFE */ @@ -345,7 +346,7 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \ } if (args->altinfo_given) { - strncpy(&tag.information1[0], args->altinfo_arg, ALTTAGINFO_LEN); + strncpy(tag.information1, args->altinfo_arg, TAGINFO1_LEN); } if (args->second_image_flag_given) { diff --git a/tools/firmware-utils/src/mkbrnimg.c b/tools/firmware-utils/src/mkbrnimg.c index fde30b2ea5..b7a73ff59d 100644 --- a/tools/firmware-utils/src/mkbrnimg.c +++ b/tools/firmware-utils/src/mkbrnimg.c @@ -142,7 +142,7 @@ static void appendfile(int outfd, char *path, int kernel) { // write padding padded_len = ((len + sizeof(footer) + sizeof(padding) - 1) & ~(sizeof(padding) - 1)) - sizeof(footer); - fprintf(stderr, "len=%08x padded_len=%08x\n", len, padded_len); + fprintf(stderr, "len=%08zx padded_len=%08zx\n", len, padded_len); write(outfd, padding, padded_len - len); // write footer diff --git a/tools/firmware-utils/src/mkcasfw.c b/tools/firmware-utils/src/mkcasfw.c index 626e77d4c4..5655bf1894 100644 --- a/tools/firmware-utils/src/mkcasfw.c +++ b/tools/firmware-utils/src/mkcasfw.c @@ -258,7 +258,7 @@ static struct board_info boards[] = { #define ERRS(fmt, ...) do { \ int save = errno; \ fflush(0); \ - fprintf(stderr, "[%s] *** error: " fmt "\n", \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \ progname, ## __VA_ARGS__, strerror(save)); \ } while (0) @@ -708,7 +708,7 @@ image_writeout(FILE *outfile, struct image_desc *desc) /* write padding data if neccesary */ padlen = desc->out_size - desc->file_size; - DBG(1,"padding desc, length=%d", padlen); + DBG(1,"padding desc, length=%zu", padlen); res = write_out_padding(outfile, padlen, desc->padc, &css); desc->csum = csum_get(&css); @@ -985,11 +985,11 @@ main(int argc, char *argv[]) res = ERR_FATAL; if (keep_invalid_images == 0) { - WARN("generation of invalid images disabled", ofname); + WARN("generation of invalid images \"%s\" disabled", ofname); goto out; } - WARN("generating invalid image", ofname); + WARN("generating invalid image: \"%s\"", ofname); } outfile = fopen(ofname, "w"); diff --git a/tools/firmware-utils/src/mkcsysimg.c b/tools/firmware-utils/src/mkcsysimg.c index c00096f87d..77fbbaa57f 100644 --- a/tools/firmware-utils/src/mkcsysimg.c +++ b/tools/firmware-utils/src/mkcsysimg.c @@ -199,7 +199,7 @@ static struct board_info boards[] = { #define ERRS(fmt, ...) do { \ int save = errno; \ fflush(0); \ - fprintf(stderr, "[%s] *** error: " fmt "\n", progname, ## __VA_ARGS__ \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", progname, ## __VA_ARGS__ \ , strerror(save)); \ } while (0) @@ -647,7 +647,7 @@ block_writeout_data(FILE *outfile, struct csys_block *block) /* write padding data if neccesary */ padlen = block->size_avail - block->file_size; - DBG(1,"padding block, length=%d", padlen); + DBG(1,"padding block, length=%zu", padlen); res = write_out_padding(outfile, padlen, block->padc, block->css); return res; @@ -1122,11 +1122,11 @@ main(int argc, char *argv[]) res = ERR_FATAL; if (keep_invalid_images == 0) { - WARN("generation of invalid images disabled", ofname); + WARN("generation of invalid images \"%s\" disabled", ofname); goto out; } - WARN("generating invalid image", ofname); + WARN("generating invalid image: \"%s\"", ofname); } outfile = fopen(ofname, "w"); diff --git a/tools/firmware-utils/src/mkdniimg.c b/tools/firmware-utils/src/mkdniimg.c index 7230f09d49..852b07dd9f 100644 --- a/tools/firmware-utils/src/mkdniimg.c +++ b/tools/firmware-utils/src/mkdniimg.c @@ -43,7 +43,7 @@ static char *board_id; #define ERRS(fmt, ...) do { \ int save = errno; \ fflush(0); \ - fprintf(stderr, "[%s] *** error: " fmt "\n", \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \ progname, ## __VA_ARGS__, strerror(save)); \ } while (0) diff --git a/tools/firmware-utils/src/mkplanexfw.c b/tools/firmware-utils/src/mkplanexfw.c index 1bdccb7c02..0b71f80438 100644 --- a/tools/firmware-utils/src/mkplanexfw.c +++ b/tools/firmware-utils/src/mkplanexfw.c @@ -82,7 +82,7 @@ static struct board_info boards[] = { #define ERRS(fmt, ...) do { \ int save = errno; \ fflush(0); \ - fprintf(stderr, "[%s] *** error: " fmt "\n", \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \ progname, ## __VA_ARGS__, strerror(save)); \ } while (0) diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c index 1302d467e1..96fd6a00cd 100644 --- a/tools/firmware-utils/src/mktplinkfw.c +++ b/tools/firmware-utils/src/mktplinkfw.c @@ -450,7 +450,7 @@ static struct board_info boards[] = { #define ERRS(fmt, ...) do { \ int save = errno; \ fflush(0); \ - fprintf(stderr, "[%s] *** error: " fmt "\n", \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \ progname, ## __VA_ARGS__, strerror(save)); \ } while (0) diff --git a/tools/firmware-utils/src/mktplinkfw2.c b/tools/firmware-utils/src/mktplinkfw2.c index 25915e68bf..92775290f8 100644 --- a/tools/firmware-utils/src/mktplinkfw2.c +++ b/tools/firmware-utils/src/mktplinkfw2.c @@ -189,7 +189,7 @@ static struct board_info boards[] = { #define ERRS(fmt, ...) do { \ int save = errno; \ fflush(0); \ - fprintf(stderr, "[%s] *** error: " fmt "\n", \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \ progname, ## __VA_ARGS__, strerror(save)); \ } while (0) diff --git a/tools/firmware-utils/src/mkzcfw.c b/tools/firmware-utils/src/mkzcfw.c index 7674e706c9..2326f1ff5c 100644 --- a/tools/firmware-utils/src/mkzcfw.c +++ b/tools/firmware-utils/src/mkzcfw.c @@ -100,7 +100,7 @@ static struct board_info boards[] = { #define ERRS(fmt, ...) do { \ int save = errno; \ fflush(0); \ - fprintf(stderr, "[%s] *** error: " fmt "\n", \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \ progname, ## __VA_ARGS__, strerror(save)); \ } while (0) diff --git a/tools/firmware-utils/src/mkzynfw.c b/tools/firmware-utils/src/mkzynfw.c index 36c176f432..ccbabfe7f2 100644 --- a/tools/firmware-utils/src/mkzynfw.c +++ b/tools/firmware-utils/src/mkzynfw.c @@ -27,6 +27,7 @@ #if defined(__CYGWIN__) # include #endif +#include #include "zynos.h" @@ -687,7 +688,7 @@ write_out_file(FILE *outfile, char *name, size_t len, struct csum_state *css) FILE *f; int res; - DBG(2, "writing out file, name=%s, len=%d", + DBG(2, "writing out file, name=%s, len=%zu", name, len); errno = 0; @@ -988,7 +989,7 @@ calc_block_offsets(int type, uint32_t *offset) uint32_t avail; int i, res; - DBG(1,"calculating block offsets, starting with %lu", + DBG(1,"calculating block offsets, starting with %" PRIu32, *offset); res = 0; diff --git a/tools/firmware-utils/src/osbridge-crc.c b/tools/firmware-utils/src/osbridge-crc.c index f2e3920a48..5fd236a074 100644 --- a/tools/firmware-utils/src/osbridge-crc.c +++ b/tools/firmware-utils/src/osbridge-crc.c @@ -51,7 +51,7 @@ static char *ofname; #define ERRS(fmt, ...) do { \ int save = errno; \ fflush(0); \ - fprintf(stderr, "[%s] *** error: " fmt "\n", \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \ progname, ## __VA_ARGS__, strerror(save)); \ } while (0) diff --git a/tools/firmware-utils/src/pc1crypt.c b/tools/firmware-utils/src/pc1crypt.c index 9c2eb83f66..fe41b3dab5 100644 --- a/tools/firmware-utils/src/pc1crypt.c +++ b/tools/firmware-utils/src/pc1crypt.c @@ -208,7 +208,7 @@ static int decrypt; #define ERRS(fmt, ...) do { \ int save = errno; \ fflush(0); \ - fprintf(stderr, "[%s] *** error: " fmt "\n", \ + fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \ progname, ## __VA_ARGS__, strerror(save)); \ } while (0) diff --git a/tools/firmware-utils/src/seama.c b/tools/firmware-utils/src/seama.c index 944ed3a444..05aee8e76a 100644 --- a/tools/firmware-utils/src/seama.c +++ b/tools/firmware-utils/src/seama.c @@ -235,10 +235,10 @@ static int verify_seama(const char * fname, int msg) { printf("SEAMA ==========================================\n"); printf(" magic : %08x\n", ntohl(shdr.magic)); - printf(" meta size : %d bytes\n", msize); + printf(" meta size : %zu bytes\n", msize); for (i=0; i