firmware-utils: fix all -Wformat warnings
authorRafał Miłecki <rafal@milecki.pl>
Thu, 8 Apr 2021 22:10:53 +0000 (00:10 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Fri, 9 Apr 2021 08:46:15 +0000 (10:46 +0200)
1. Use %hhu for uint8_t
2. Use %z for size_t

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
tools/firmware-utils/src/asustrx.c
tools/firmware-utils/src/dns313-header.c

index 67f2680b31b6c4465abe8919bfe84c410a223d06..b3daeedcfd00b6be1c759b30d1ff60bca1a67d3a 100644 (file)
@@ -132,7 +132,7 @@ static void parse_options(int argc, char **argv) {
                        productid = optarg;
                        break;
                case 'v':
-                       if (sscanf(optarg, "%hu.%hu.%hu.%hu", &version[0], &version[1], &version[2], &version[3]) != 4)
+                       if (sscanf(optarg, "%hhu.%hhu.%hhu.%hhu", &version[0], &version[1], &version[2], &version[3]) != 4)
                                fprintf(stderr, "Version %s doesn't match suppored 4-digits format\n", optarg);
                        break;
                }
index 3c72b09bfb234cf73661e87db7066a085df4527b..ab34dd6d024e6c2c10965b041d6b3d8e81e53221 100644 (file)
@@ -155,7 +155,7 @@ int main(int argc, char **argv)
        /* File + extended header size */
        bufsize = filesize + HEADER_SIZE;
 
-       printf("Allocate %08x bytes\n", bufsize);
+       printf("Allocate %08zx bytes\n", bufsize);
        buffer = malloc(bufsize);
        if (!buffer) {
                printf("OOM: could not allocate buffer\n");
@@ -223,7 +223,7 @@ int main(int argc, char **argv)
        be_wr(buffer + OFFSET_HCRC, sum);
        printf("header checksum: 0x%08x\n", sum);
 
-       printf("OUTFILE: %s, size: %08x bytes\n", pathout, bufsize);
+       printf("OUTFILE: %s, size: %08zx bytes\n", pathout, bufsize);
        fdout = open(pathout, O_RDWR|O_CREAT|O_TRUNC,S_IRWXU|S_IRGRP);
        if (!fdout) {
                printf("ERROR: could not open output file\n");