amd64: Fix several "sizeof(size_t) != sizeof(int)" bugs.
authorJordan Gordeev <jgordeev@dir.bg>
Wed, 13 May 2009 17:41:06 +0000 (20:41 +0300)
committerJordan Gordeev <jgordeev@dir.bg>
Wed, 13 May 2009 17:41:06 +0000 (20:41 +0300)
The compiler warned about them.

sbin/camcontrol/modeedit.c
sbin/hammer/cmd_stats.c
usr.bin/kenv/kenv.c
usr.bin/netstat/inet.c
usr.bin/top/machine.c
usr.bin/vmstat/vmstat.c
usr.sbin/resident/resident.c

index 94384bb..071985e 100644 (file)
@@ -634,7 +634,7 @@ modepage_read(FILE *file)
        char *line;                     /* Pointer to static fgetln buffer. */
        char *name;                     /* Name portion of the line buffer. */
        char *value;                    /* Value portion of line buffer.    */
-       int length;                     /* Length of static fgetln buffer.  */
+       size_t length;                  /* Length of static fgetln buffer.  */
 
 #define        ABORT_READ(message, param) do {                                 \
        warnx(message, param);                                          \
index 5da13c8..d84f825 100644 (file)
@@ -44,7 +44,7 @@ void
 hammer_cmd_bstats(char **av, int ac)
 {
        int mibs[8][16];
-       int lens[8];
+       size_t lens[8];
        int64_t stats[8];
        int64_t copy[8];
        size_t size;
@@ -110,7 +110,7 @@ void
 hammer_cmd_iostats(char **av, int ac)
 {
        int mibs[8][16];
-       int lens[8];
+       size_t lens[8];
        int64_t stats[8];
        int64_t copy[8];
        size_t size;
index b9d6dbd..d50a24d 100644 (file)
@@ -47,8 +47,8 @@ int
 main(int argc, char **argv)
 {
        int real_oid[CTL_MAXNAME];
-       size_t oidlen;
-       int ch, error, hflag, i, slen;
+       size_t oidlen, slen;
+       int ch, error, hflag, i;
        char *env, *eq, *var, *val;
 
        hflag = 0;
index c6984ce..64fc8eb 100644 (file)
@@ -180,7 +180,7 @@ outputpcb(int proto, const char *name, struct inpcb *inp, struct xsocket *so, st
        static struct clockinfo clockinfo;
 
        if (clockinfo.hz == 0) {
-               int size = sizeof(clockinfo);
+               size_t size = sizeof(clockinfo);
                sysctlbyname("kern.clockrate", &clockinfo, &size, NULL, 0);
                if (clockinfo.hz == 0)
                        clockinfo.hz = 100;
index 733d5c7..2ece094 100644 (file)
@@ -364,8 +364,8 @@ get_system_info(struct system_info *si)
     {
        struct vmmeter vmm;
        struct vmstats vms;
-       int vms_size = sizeof(vms);
-       int vmm_size = sizeof(vmm);
+       size_t vms_size = sizeof(vms);
+       size_t vmm_size = sizeof(vmm);
        static unsigned int swap_delay = 0;
        static int swapavail = 0;
        static int swapfree = 0;
index eea2623..41da4df 100644 (file)
@@ -390,9 +390,9 @@ dovmstat(u_int interval, int reps)
        struct vmtotal total;
        time_t uptime, halfuptime;
        struct devinfo *tmp_dinfo;
-       int vmm_size = sizeof(vmm);
-       int vms_size = sizeof(vms);
-       int vmt_size = sizeof(total);
+       size_t vmm_size = sizeof(vmm);
+       size_t vms_size = sizeof(vms);
+       size_t vmt_size = sizeof(total);
 
        uptime = getuptime();
        halfuptime = uptime / 2;
@@ -554,8 +554,8 @@ static void
 dosum(void)
 {
        struct nchstats *nch_tmp, nchstats;
-       int vms_size = sizeof(vms);
-       int vmm_size = sizeof(vmm);
+       size_t vms_size = sizeof(vms);
+       size_t vmm_size = sizeof(vmm);
        int cpucnt;
        u_long nchtotal;
        size_t nch_size = sizeof(struct nchstats) * SMP_MAXCPU;
index 2bea465..827b1a5 100644 (file)
@@ -57,7 +57,7 @@ list_residents(void)
 {
        const char *mib = "vm.resident";
        struct xresident *buf;
-       int res_count, res_total;
+       size_t res_count, res_total;
        int error, i;
 
        /* get the number of resident binaries */