mkimage: Fix strict-aliasing compiler warning
authorPeter Tyser <ptyser@xes-inc.com>
Mon, 5 Apr 2010 03:36:03 +0000 (22:36 -0500)
committerWolfgang Denk <wd@denx.de>
Fri, 9 Apr 2010 22:30:26 +0000 (00:30 +0200)
Version 4.2.4 of gcc produces the following warnings without this change:
  mkimage.c: In function ‘main’:
  mkimage.c:204: warning: dereferencing type-punned pointer will break strict-aliasing rules
  mkimage.c:222: warning: dereferencing type-punned pointer will break strict-aliasing rules

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
tools/mkimage.c

index 5c3e872906b6e1f27895dd41e11e911473d475f8..f5859d77642152a78751d4b7ce79255c485e6e5b 100644 (file)
@@ -145,7 +145,7 @@ main (int argc, char **argv)
 {
        int ifd = -1;
        struct stat sbuf;
-       unsigned char *ptr;
+       char *ptr;
        int retval = 0;
        struct image_type_params *tparams = NULL;
 
@@ -201,8 +201,7 @@ main (int argc, char **argv)
                        case 'a':
                                if (--argc <= 0)
                                        usage ();
-                               params.addr = strtoul (*++argv,
-                                       (char **)&ptr, 16);
+                               params.addr = strtoul (*++argv, &ptr, 16);
                                if (*ptr) {
                                        fprintf (stderr,
                                                "%s: invalid load address %s\n",
@@ -219,8 +218,7 @@ main (int argc, char **argv)
                        case 'e':
                                if (--argc <= 0)
                                        usage ();
-                               params.ep = strtoul (*++argv,
-                                               (char **)&ptr, 16);
+                               params.ep = strtoul (*++argv, &ptr, 16);
                                if (*ptr) {
                                        fprintf (stderr,
                                                "%s: invalid entry point %s\n",