]> git.gag.com Git - fw/stlink/commitdiff
Quell compiler warning.
authorTheodore A. Roth <troth@openavr.org>
Tue, 15 Apr 2014 15:46:26 +0000 (09:46 -0600)
committerTheodore A. Roth <troth@openavr.org>
Tue, 15 Apr 2014 15:46:26 +0000 (09:46 -0600)
Building on a 32-bit linux system was generating the following:

  src/st-info.c: In function ‘print_data’:
  src/st-info.c:25:3: warning: format ‘%lx’ expects argument of type \
       ‘long unsigned int’, but argument 2 has type ‘size_t’ [-Wformat]
  src/st-info.c:27:3: warning: format ‘%lx’ expects argument of type \
       ‘long unsigned int’, but argument 2 has type ‘size_t’ [-Wformat]
  src/st-info.c:29:3: warning: format ‘%lx’ expects argument of type \
       ‘long unsigned int’, but argument 2 has type ‘size_t’ [-Wformat]

Using '%zx' eliminates the warning in a platform agnostic way.

src/st-info.c

index e28a4f12cf9d16952c98b440627d1252d4aa6708..28f3fb823572266350970cdd321f259caef2f055 100644 (file)
@@ -22,11 +22,11 @@ static int print_data(stlink_t* sl, char** av)
 {
        int ret = 0;
        if (strcmp(av[1], "--flash") == 0) 
-               printf("0x%lx\n", sl->flash_size);
+               printf("0x%zx\n", sl->flash_size);
        else if (strcmp(av[1], "--sram") == 0)
-               printf("0x%lx\n", sl->sram_size);
+               printf("0x%zx\n", sl->sram_size);
        else if (strcmp(av[1], "--pagesize") == 0)
-               printf("0x%lx\n", sl->flash_pgsz);
+               printf("0x%zx\n", sl->flash_pgsz);
        else if (strcmp(av[1], "--chipid") == 0)
                printf("0x%.4x\n", sl->chip_id);
        else if (strcmp(av[1], "--descr")==0) {