Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/mkubootimage Avoid signed/unsigned comparision.



details:   https://anonhg.NetBSD.org/src/rev/509f62101d80
branches:  trunk
changeset: 777393:509f62101d80
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Feb 17 08:28:36 2012 +0000

description:
Avoid signed/unsigned comparision.

diffstat:

 usr.bin/mkubootimage/mkubootimage.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r a41d226735ef -r 509f62101d80 usr.bin/mkubootimage/mkubootimage.c
--- a/usr.bin/mkubootimage/mkubootimage.c       Fri Feb 17 08:24:30 2012 +0000
+++ b/usr.bin/mkubootimage/mkubootimage.c       Fri Feb 17 08:28:36 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.15 2012/02/17 08:11:28 matt Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.16 2012/02/17 08:28:36 matt Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: mkubootimage.c,v 1.15 2012/02/17 08:11:28 matt Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.16 2012/02/17 08:28:36 matt Exp $");
 
 #include <sys/mman.h>
 #include <sys/stat.h>
@@ -343,7 +343,8 @@
                        num = strtoull(optarg, &ep, 0);
                        if (*ep != '\0' || (errno == ERANGE &&
                            (num == ULLONG_MAX || num == 0)) ||
-                           (num != (int32_t)num && num != (uint32_t)num))
+                           ((signed long long)num != (int32_t)num &&
+                            num != (uint32_t)num))
                                errx(1, "illegal number -- %s", optarg);
                        image_loadaddr = (uint32_t)num;
                        break;
@@ -353,7 +354,8 @@
                        num = strtoull(optarg, &ep, 0);
                        if (*ep != '\0' || (errno == ERANGE &&
                            (num == ULLONG_MAX || num == 0)) ||
-                           (num != (int32_t)num && num != (uint32_t)num))
+                           ((signed long long)num != (int32_t)num &&
+                            num != (uint32_t)num))
                                errx(1, "illegal number -- %s", optarg);
                        image_entrypoint = (uint32_t)num;
                        if (ch == 'E')



Home | Main Index | Thread Index | Old Index