Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst Fix some of the sign-compare fubar.



details:   https://anonhg.NetBSD.org/src/rev/c855cc38d01f
branches:  trunk
changeset: 750483:c855cc38d01f
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sat Jan 02 18:06:57 2010 +0000

description:
Fix some of the sign-compare fubar.

diffstat:

 distrib/utils/sysinst/aout2elf.c              |  6 +++---
 distrib/utils/sysinst/arch/acorn32/md.c       |  6 +++---
 distrib/utils/sysinst/arch/cobalt/md.c        |  4 ++--
 distrib/utils/sysinst/arch/hp300/md.c         |  5 +++--
 distrib/utils/sysinst/arch/i386/md.c          |  6 +++---
 distrib/utils/sysinst/arch/mac68k/md.c        |  6 +++---
 distrib/utils/sysinst/arch/mac68k/menus.md.en |  4 ++--
 distrib/utils/sysinst/disks.c                 |  6 +++---
 distrib/utils/sysinst/util.c                  |  4 ++--
 distrib/utils/sysinst/wskbd.c                 |  6 +++---
 10 files changed, 27 insertions(+), 26 deletions(-)

diffs (231 lines):

diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/aout2elf.c
--- a/distrib/utils/sysinst/aout2elf.c  Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/aout2elf.c  Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aout2elf.c,v 1.14 2009/08/16 17:12:48 pgoyette Exp $
+/*     $NetBSD: aout2elf.c,v 1.15 2010/01/02 18:06:57 dsl Exp $
  *
  * Copyright 1997 Piermont Information Systems Inc.
  * All rights reserved.
@@ -100,7 +100,7 @@
        if (fd < 0) {
                return 0;
        }
-       if (read(fd, &ex, sizeof ex) < sizeof ex) {
+       if (read(fd, &ex, sizeof ex) - sizeof ex != 0) {
                close(fd);
                return 0;
        }
@@ -116,7 +116,7 @@
 handle_aout_x_libs(const char *srcdir, const char *tgtdir)
 {
        char src[MAXPATHLEN];
-       int i;
+       unsigned int i;
 
        for (i = 0; i < (sizeof x_libs / sizeof (const char *)); i++) {
                snprintf(src, MAXPATHLEN, "%s/%s", srcdir, x_libs[i]);
diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/arch/acorn32/md.c
--- a/distrib/utils/sysinst/arch/acorn32/md.c   Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/arch/acorn32/md.c   Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.24 2009/09/19 14:57:27 abs Exp $ */
+/*     $NetBSD: md.c,v 1.25 2010/01/02 18:06:58 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -98,7 +98,7 @@
        }
 
        if (lseek(fd, (off_t)FILECORE_BOOT_SECTOR * DEV_BSIZE, SEEK_SET) < 0
-           || read(fd, bb, sizeof(bb)) < sizeof(bb)) {
+           || read(fd, bb, sizeof(bb)) - sizeof(bb) != 0) {
                endwin();
                fprintf(stderr, msg_string(MSG_badreadbb));
                close(fd);
@@ -131,7 +131,7 @@
                        int loop;
 
                        if (lseek(fd, (off_t)offset * DEV_BSIZE, SEEK_SET) < 0
-                           || read(fd, bb, sizeof(bb)) < sizeof(bb)) {
+                           || read(fd, bb, sizeof(bb)) - sizeof(bb) != 0) {
                                endwin();
                                fprintf(stderr, msg_string(MSG_badreadriscix));
                                close(fd);
diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/arch/cobalt/md.c
--- a/distrib/utils/sysinst/arch/cobalt/md.c    Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/arch/cobalt/md.c    Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.5 2009/09/19 14:57:28 abs Exp $ */
+/*     $NetBSD: md.c,v 1.6 2010/01/02 18:06:58 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -274,7 +274,7 @@
        };
        static const char *bootfile = "boot.gz";
        char bootdir[64];
-       int i;
+       unsigned int i;
 
        if (!nobootfs) {
                msg_display(msg_string(MSG_copybootloader), diskdev);
diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/arch/hp300/md.c
--- a/distrib/utils/sysinst/arch/hp300/md.c     Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/arch/hp300/md.c     Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.27 2009/09/19 14:57:28 abs Exp $ */
+/*     $NetBSD: md.c,v 1.28 2010/01/02 18:06:58 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -135,7 +135,8 @@
 md_check_partitions(void)
 {
        /* hp300 partitions must be in order of the range. */
-       int part, start, last;
+       int part, last;
+       uint32_t start;
 
        start = 0;
        last = PART_A - 1;
diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/arch/i386/md.c
--- a/distrib/utils/sysinst/arch/i386/md.c      Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/arch/i386/md.c      Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.123 2009/09/19 14:57:28 abs Exp $ */
+/*     $NetBSD: md.c,v 1.124 2010/01/02 18:06:58 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -335,7 +335,7 @@
 
        process_menu(MENU_getboottype, &boottype);
        msg_display(MSG_dobootblks, diskdev);
-       if (bp.bp_consdev == ~0)
+       if (bp.bp_consdev == ~0u)
                return 0;
 
        ret = cp_to_target("/usr/mdec/boot", "/boot");
@@ -368,7 +368,7 @@
        if (pwrite(td, bootxx, 512, 0) != 512)
                goto bad_bootxx;
        len -= 512 * 2;
-       if (pwrite(td, bootxx + 512 * 2, len, 2 * (off_t)512) != len)
+       if (pwrite(td, bootxx + 512 * 2, len, 2 * (off_t)512) - len != 0)
                goto bad_bootxx;
        ret = 0;
 
diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/arch/mac68k/md.c
--- a/distrib/utils/sysinst/arch/mac68k/md.c    Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/arch/mac68k/md.c    Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.55 2009/09/19 14:57:29 abs Exp $ */
+/*     $NetBSD: md.c,v 1.56 2010/01/02 18:06:58 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -200,7 +200,7 @@
         *  to see if the disk have a Boot Block
         */
        if (lseek(fd, (off_t)0 * blk_size, SEEK_SET) < 0 ||
-           read(fd,  &block, sizeof(block)) < sizeof(block) ||
+           read(fd,  &block, sizeof(block)) - sizeof(block) != 0 ||
            block.pmSig != 0x4552) {
              process_menu(MENU_nodiskmap, NULL);
         }
@@ -626,7 +626,7 @@
        if (part->pmSig != APPLE_PART_MAP_ENTRY_MAGIC)
            return 0;
        maxsiz = sizeof(part->pmPartType);
-       if (maxsiz > sizeof(partyp))
+       if (maxsiz > (int)sizeof(partyp))
            maxsiz = sizeof(partyp);
        strncpy(partyp, (char *)part->pmPartType, maxsiz);
        partyp[maxsiz-1] = '\0';
diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/arch/mac68k/menus.md.en
--- a/distrib/utils/sysinst/arch/mac68k/menus.md.en     Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/arch/mac68k/menus.md.en     Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menus.md.en,v 1.22 2010/01/02 17:15:07 dsl Exp $       */
+/*     $NetBSD: menus.md.en,v 1.23 2010/01/02 18:06:58 dsl Exp $       */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -89,7 +89,7 @@
                msg_display(MSG_split_part, map.blk[j].pmPartBlkCnt);
                msg_prompt_add (MSG_scratch_size, NULL, buf, sizeof(buf));
                size = atoi(buf);
-               if (size > 0 && size < map.blk[j].pmPartBlkCnt) {
+               if (size > 0 && size < (int)map.blk[j].pmPartBlkCnt) {
                    k = map.in_use_cnt+1;
                    if (k <= map.size) {
                        memcpy (&map.blk[k], &map.blk[j],
diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/disks.c
--- a/distrib/utils/sysinst/disks.c     Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/disks.c     Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.109 2009/10/18 12:09:48 ahoka Exp $ */
+/*     $NetBSD: disks.c,v 1.110 2010/01/02 18:06:57 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -518,11 +518,11 @@
 int
 make_filesystems(void)
 {
-       int i;
+       unsigned int i;
        int ptn;
        int ptn_order[nelem(bsdlabel)];
        int error = 0;
-       int maxpart = getmaxpartitions();
+       unsigned int maxpart = getmaxpartitions();
        char *newfs;
        const char *mnt_opts;
        const char *fsname;
diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/util.c
--- a/distrib/utils/sysinst/util.c      Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/util.c      Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.161 2009/10/09 21:11:31 snj Exp $   */
+/*     $NetBSD: util.c,v 1.162 2010/01/02 18:06:57 dsl Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -157,7 +157,7 @@
        static const uint8_t sets_selected_full[] = {MD_SETS_SELECTED};
        static const uint8_t sets_selected_minimal[] = {MD_SETS_SELECTED_MINIMAL};
        static const uint8_t *sets_selected;
-       int nelem_selected;
+       unsigned int nelem_selected;
        unsigned int i, len;
        const char *longest;
 
diff -r e5fbebbd7f1a -r c855cc38d01f distrib/utils/sysinst/wskbd.c
--- a/distrib/utils/sysinst/wskbd.c     Sat Jan 02 17:15:07 2010 +0000
+++ b/distrib/utils/sysinst/wskbd.c     Sat Jan 02 18:06:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wskbd.c,v 1.7 2008/09/03 08:52:36 ghen Exp $   */
+/*     $NetBSD: wskbd.c,v 1.8 2010/01/02 18:06:57 dsl Exp $    */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: wskbd.c,v 1.7 2008/09/03 08:52:36 ghen Exp $");
+__RCSID("$NetBSD: wskbd.c,v 1.8 2010/01/02 18:06:57 dsl Exp $");
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -89,7 +89,7 @@
 get_kb_encoding(void)
 {
        int fd;
-       int i;
+       unsigned int i;
        int kb_menu;
        kbd_t kbdencoding;
        menu_ent opt[nelem(kb_types)];



Home | Main Index | Thread Index | Old Index