fix up yet more annoying signed/unsigned and mixed type errors
authorEric Andersen <andersen@codepoet.org>
Mon, 30 Jan 2006 22:48:39 +0000 (22:48 -0000)
committerEric Andersen <andersen@codepoet.org>
Mon, 30 Jan 2006 22:48:39 +0000 (22:48 -0000)
13 files changed:
editors/vi.c
loginutils/login.c
miscutils/devfsd.c
miscutils/hdparm.c
networking/udhcp/dhcpc.c
networking/udhcp/packet.c
networking/udhcp/serverpacket.c
procps/fuser.c
procps/sysctl.c
shell/ash.c
shell/hush.c
shell/lash.c
shell/msh.c

index 553561b2161af8ea6cab3012a8b94bc7ba63d1f9..bf537ee62078c3c7fe5cc97929c03529b28daed1 100644 (file)
@@ -347,7 +347,7 @@ extern int vi_main(int argc, char **argv)
        (void) srand((long) my_pid);
 #endif                                                 /* CONFIG_FEATURE_VI_CRASHME */
 
-       status_buffer = STATUS_BUFFER;
+       status_buffer = (Byte *)STATUS_BUFFER;
        last_status_cksum = 0;
 
 #ifdef CONFIG_FEATURE_VI_READONLY
@@ -729,7 +729,7 @@ static void colon(Byte * buf)
        while (isblnk(*buf))
                buf++;
        strcpy((char *) args, (char *) buf);
-       buf1 = last_char_is((char *)cmd, '!');
+       buf1 = (Byte*)last_char_is((char *)cmd, '!');
        if (buf1) {
                useforce = TRUE;
                *buf1 = '\0';   // get rid of !
@@ -763,7 +763,7 @@ static void colon(Byte * buf)
                place_cursor(rows - 1, 0, FALSE);       // go to Status line
                clear_to_eol();                 // clear the line
                cookmode();
-               system(orig_buf+1);             // run the cmd
+               system((char*)(orig_buf+1));            // run the cmd
                rawmode();
                Hit_Return();                   // let user see results
                (void) alarm(3);                // done waiting for input
@@ -787,10 +787,10 @@ static void colon(Byte * buf)
                        psbs("No write since last change (:edit! overrides)");
                        goto vc1;
                }
-               if (strlen(args) > 0) {
+               if (strlen((char*)args) > 0) {
                        // the user supplied a file name
                        fn= args;
-               } else if (cfn != 0 && strlen(cfn) > 0) {
+               } else if (cfn != 0 && strlen((char*)cfn) > 0) {
                        // no user supplied name- use the current filename
                        fn= cfn;
                        goto vc5;
@@ -2397,7 +2397,7 @@ static Byte *get_input_line(Byte * prompt) // get input line- use "status line"
        last_status_cksum = 0;  // force status update
        place_cursor(rows - 1, 0, FALSE);       // go to Status line, bottom of screen
        clear_to_eol();         // clear the line
-       write1(prompt);      // write out the :, /, or ? prompt
+       write1((char *) prompt);      // write out the :, /, or ? prompt
 
        for (i = strlen((char *) buf); i < BUFSIZ;) {
                c = get_one_char();     // read user input
@@ -2430,7 +2430,7 @@ static int file_size(const Byte * fn) // what is the byte size of "fn"
        struct stat st_buf;
        int cnt, sr;
 
-       if (fn == 0 || strlen(fn) <= 0)
+       if (fn == 0 || strlen((char *)fn) <= 0)
                return (-1);
        cnt = -1;
        sr = stat((char *) fn, &st_buf);        // see if file exists
@@ -2586,7 +2586,7 @@ static void place_cursor(int row, int col, int opti)
        strcat(cm2, "\r");                      // start at col 0
        // just send out orignal source char to get to correct place
        screenp = &screen[row * columns];       // start of screen line
-       strncat(cm2, screenp, col);
+       strncat(cm2, (char* )screenp, col);
 
        //----- 3.  Try some other way of moving cursor
        //---------------------------------------------
@@ -2657,10 +2657,10 @@ static void screen_erase(void)
        memset(screen, ' ', screensize);        // clear new screen
 }
 
-static int bufsum(char *buf, int count)
+static int bufsum(unsigned char *buf, int count)
 {
        int sum = 0;
-       char *e = buf + count;
+       unsigned char *e = buf + count;
        while (buf < e)
                sum += *buf++;
        return sum;
@@ -2680,10 +2680,10 @@ static void show_status_line(void)
        if (have_status_msg || ((cnt > 0 && last_status_cksum != cksum))) {
                last_status_cksum= cksum;               // remember if we have seen this line
                place_cursor(rows - 1, 0, FALSE);       // put cursor on status line
-               write1(status_buffer);
+               write1((char*)status_buffer);
                clear_to_eol();
                if (have_status_msg) {
-                       if (((int)strlen(status_buffer) - (have_status_msg - 1)) >
+                       if (((int)strlen((char*)status_buffer) - (have_status_msg - 1)) >
                                        (columns - 1) ) {
                                have_status_msg = 0;
                                Hit_Return();
@@ -2937,7 +2937,7 @@ static void refresh(int full_screen)
                        // write line out to terminal
                        {
                                int nic = ce-cs+1;
-                               char *out = sp+cs;
+                               char *out = (char*)sp+cs;
 
                                while(nic-- > 0) {
                                        putchar(*out);
index b2f3166e23f8336d9bc485ef37cecbfa39a7967e..4d513dcb239225ba33e8ccc4a31635f2441df1eb 100644 (file)
@@ -450,7 +450,7 @@ static void checkutmp(int picky)
                /* XXX - assumes /dev/tty?? */
                strncpy(utent.ut_id, utent.ut_line + 3, sizeof utent.ut_id);
                strncpy(utent.ut_user, "LOGIN", sizeof utent.ut_user);
-               time(&utent.ut_time);
+               time((time_t*)&utent.ut_time);
        }
 }
 
@@ -465,7 +465,7 @@ static void setutmp(const char *name, const char *line)
 {
        utent.ut_type = USER_PROCESS;
        strncpy(utent.ut_user, name, sizeof utent.ut_user);
-       time(&utent.ut_time);
+       time((time_t*)&utent.ut_time);
        /* other fields already filled in by checkutmp above */
        setutent();
        pututline(&utent);
index d8a630c043e7310b45d16d368cf97611d682a6d5..fce63e54dd1f0c048160430db187b773153938d1 100644 (file)
@@ -476,7 +476,8 @@ int devfsd_main (int argc, char **argv)
        if (fcntl (fd, F_SETFD, FD_CLOEXEC) != 0)
                devfsd_perror_msg_and_die("FD_CLOEXEC");
 
-       do_ioctl_and_die(fd, DEVFSDIOC_GET_PROTO_REV,(int )&proto_rev);
+       if (ioctl (fd, DEVFSDIOC_GET_PROTO_REV, &proto_rev) == -1)
+               msg_logger_and_die(LOG_ERR, "ioctl");
 
        /*setup initial entries */
     for (curr = initial_symlinks; curr->dest != NULL; ++curr)
index 4bf0d45cef4f8bffd70786563cd6043a8a972915..750cb499bd3ae29f2dad256e70d22d713fae8a0a 100644 (file)
@@ -1945,7 +1945,7 @@ static void process_dev (char *devname)
        {
                no_scsi();
                printf(" attempting to unregister hwif#%u\n", hwif);
-               bb_ioctl(fd, HDIO_UNREGISTER_HWIF,(int *)hwif,"HDIO_UNREGISTER_HWIF");
+               bb_ioctl(fd, HDIO_UNREGISTER_HWIF,(int *)(unsigned long)hwif,"HDIO_UNREGISTER_HWIF");
        }
 #endif
 #ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
@@ -1977,7 +1977,7 @@ static void process_dev (char *devname)
                        else
                                printf("set UDMA mode to %d\n", (piomode-200));
                }
-               bb_ioctl(fd, HDIO_SET_PIO_MODE, (int *)piomode, "HDIO_SET_PIO_MODE");
+               bb_ioctl(fd, HDIO_SET_PIO_MODE, (int *)(unsigned long)piomode, "HDIO_SET_PIO_MODE");
        }
        if (set_io32bit)
        {
@@ -2435,7 +2435,7 @@ identify_abort:
                        printf(" setting bus state to %d", busstate);
                        bus_state_value(busstate);
                }
-               bb_ioctl(fd, HDIO_SET_BUSSTATE, (int *)busstate, "HDIO_SET_BUSSTATE");
+               bb_ioctl(fd, HDIO_SET_BUSSTATE, (int *)(unsigned long)busstate, "HDIO_SET_BUSSTATE");
        }
 #endif
 #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
index a4afb0c46f5481a616c1c55fea0c2c319c939a23..8568ac1e75aac39d563186577bbe3c2e9784aa59 100644 (file)
@@ -220,7 +220,7 @@ int main(int argc, char *argv[])
                        client_config.clientid[OPT_CODE] = DHCP_CLIENT_ID;
                        client_config.clientid[OPT_LEN] = len;
                        client_config.clientid[OPT_DATA] = '\0';
-                       strncpy(client_config.clientid + OPT_DATA, optarg, len);
+                       strncpy((char*)client_config.clientid + OPT_DATA, optarg, len);
                        break;
                case 'C':
                        if (client_config.clientid) show_usage();
@@ -232,7 +232,7 @@ int main(int argc, char *argv[])
                        client_config.vendorclass = xmalloc(len + 2);
                        client_config.vendorclass[OPT_CODE] = DHCP_VENDOR;
                        client_config.vendorclass[OPT_LEN] = len;
-                       strncpy(client_config.vendorclass + OPT_DATA, optarg, len);
+                       strncpy((char*)client_config.vendorclass + OPT_DATA, optarg, len);
                        break;
                case 'f':
                        client_config.foreground = 1;
@@ -247,7 +247,7 @@ int main(int argc, char *argv[])
                        client_config.hostname = xmalloc(len + 2);
                        client_config.hostname[OPT_CODE] = DHCP_HOST_NAME;
                        client_config.hostname[OPT_LEN] = len;
-                       strncpy(client_config.hostname + 2, optarg, len);
+                       strncpy((char*)client_config.hostname + 2, optarg, len);
                        break;
                case 'F':
                        len = strlen(optarg) > 255 ? 255 : strlen(optarg);
@@ -264,7 +264,7 @@ int main(int argc, char *argv[])
                        client_config.fqdn[OPT_LEN + 1] = 0x1;
                        client_config.fqdn[OPT_LEN + 2] = 0;
                        client_config.fqdn[OPT_LEN + 3] = 0;
-                       strncpy(client_config.fqdn + 5, optarg, len);
+                       strncpy((char*)client_config.fqdn + 5, optarg, len);
                        break;
                case 'i':
                        client_config.interface =  optarg;
index 64a910031fbd9df1dd6e602483482199713690f7..1baec55e2be743b6e6be1f85253c0f896ec4c6f6 100644 (file)
@@ -70,7 +70,7 @@ int get_packet(struct dhcpMessage *packet, int fd)
        if (packet->op == BOOTREQUEST && (vendor = get_option(packet, DHCP_VENDOR))) {
                for (i = 0; broken_vendors[i][0]; i++) {
                        if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) &&
-                           !strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2])) {
+                           !strncmp((char*)vendor, broken_vendors[i], vendor[OPT_LEN - 2])) {
                                DEBUG(LOG_INFO, "broken client (%s), forcing broadcast",
                                        broken_vendors[i]);
                                packet->flags |= htons(BROADCAST_FLAG);
index 1b89862b2ef79212a95493698e6505395262b99d..fe880b4a03ac1ac82af7bc7a4a4b1aee19d3d254 100644 (file)
@@ -98,9 +98,9 @@ static void add_bootp_options(struct dhcpMessage *packet)
 {
        packet->siaddr = server_config.siaddr;
        if (server_config.sname)
-               strncpy(packet->sname, server_config.sname, sizeof(packet->sname) - 1);
+               strncpy((char*)packet->sname, server_config.sname, sizeof(packet->sname) - 1);
        if (server_config.boot_file)
-               strncpy(packet->file, server_config.boot_file, sizeof(packet->file) - 1);
+               strncpy((char*)packet->file, server_config.boot_file, sizeof(packet->file) - 1);
 }
 
 
index 7ee56fbd9ea1e857f09cdf8f98ce94620ca1990b..c0101e6355c82d2af969c9a09154e74d7045de64 100644 (file)
@@ -143,7 +143,7 @@ static int fuser_scan_proc_net(int opts, const char *proto,
        char addr[128];
        ino_t tmp_inode;
        dev_t tmp_dev;
-       uint64_t  uint64_inode;
+       long long  uint64_inode;
        int tmp_port;
        FILE *f;
 
@@ -194,7 +194,7 @@ static int fuser_scan_pid_maps(int opts, const char *fname, pid_t pid,
        char line[FUSER_MAX_LINE + 1];
        int major, minor;
        ino_t inode;
-       uint64_t uint64_inode;
+       long long uint64_inode;
        dev_t dev;
 
        if (!(file = fopen(fname, "r"))) return 0;
index dbb82e69ce488db4043e86f6a905fbeaac791951..b8835c0d89c315b42b71dc6849cf2f39661657dd 100644 (file)
@@ -209,7 +209,7 @@ int sysctl_write_setting(const char *setting, int output)
                return -2;
        }
 
-       tmpname = bb_xasprintf("%s%.*s", PROC_PATH, (equals - name), name);
+       tmpname = bb_xasprintf("%s%.*s", PROC_PATH, (int)(equals - name), name);
        outname = bb_xstrdup(tmpname + strlen(PROC_PATH));
 
        while ((cptr = strchr(tmpname, '.')) != NULL)
index 3564d850be3a7da137f94fea2cb816f206c4da6d..e9e6def22e73b390281d721763c1248e3cf5b93d 100644 (file)
@@ -1402,8 +1402,10 @@ static void unsetfunc(const char *);
 
 #ifdef CONFIG_ASH_MATH_SUPPORT_64
 typedef int64_t arith_t;
+#define arith_t_type (long long)
 #else
 typedef long arith_t;
+#define arith_t_type (long)
 #endif
 
 #ifdef CONFIG_ASH_MATH_SUPPORT
@@ -10132,15 +10134,15 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
        char *out;
        int len;
        char line[EOFMARKLEN + 1];
-       struct nodelist *bqlist;
-       int quotef;
-       int dblquote;
-       int varnest;    /* levels of variables expansion */
-       int arinest;    /* levels of arithmetic expansion */
-       int parenlevel; /* levels of parens in arithmetic */
-       int dqvarnest;  /* levels of variables expansion within double quotes */
-       int oldstyle;
-       int prevsyntax; /* syntax before arithmetic */
+       struct nodelist *bqlist = 0;
+       int quotef = 0;
+       int dblquote = 0;
+       int varnest = 0;    /* levels of variables expansion */
+       int arinest = 0;    /* levels of arithmetic expansion */
+       int parenlevel = 0; /* levels of parens in arithmetic */
+       int dqvarnest = 0;  /* levels of variables expansion within double quotes */
+       int oldstyle = 0;
+       int prevsyntax = 0; /* syntax before arithmetic */
 #if __GNUC__
        /* Avoid longjmp clobbering */
        (void) &out;
@@ -10563,7 +10565,7 @@ parsebackq: {
        struct jmploc jmploc;
        struct jmploc *volatile savehandler;
        size_t savelen;
-       int saveprompt;
+       int saveprompt = 0;
 #ifdef __GNUC__
        (void) &saveprompt;
 #endif
@@ -13380,9 +13382,9 @@ arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr)
                }
                /* save to shell variable */
 #ifdef CONFIG_ASH_MATH_SUPPORT_64
-               snprintf(buf, sizeof(buf), "%lld", rez);
+               snprintf(buf, sizeof(buf), "%lld", arith_t_type rez);
 #else
-               snprintf(buf, sizeof(buf), "%ld", rez);
+               snprintf(buf, sizeof(buf), "%ld", arith_t_type rez);
 #endif
                setvar(numptr_m1->var, buf, 0);
                /* after saving, make previous value for v++ or v-- */
index ff29974b6558dd371f8a9fd731f22e6154263d69..096b40251bc946b1ac77e0bc0c72def63997767b 100644 (file)
@@ -2614,10 +2614,10 @@ int parse_stream(o_string *dest, struct p_context *ctx,
        return 0;
 }
 
-static void mapset(const unsigned char *set, int code)
+static void mapset(const char *set, int code)
 {
-       const unsigned char *s;
-       for (s=set; *s; s++) map[*s] = code;
+       const char *s;
+       for (s=set; *s; s++) map[(int)*s] = code;
 }
 
 static void update_ifs_map(void)
index 56a3a23dd9bb8089e19e10f4f00a7dac2b0836c2..1b8aca506a4fdb1c43136bccb0fc76273b28e5d4 100644 (file)
@@ -1440,7 +1440,7 @@ static int busy_loop(FILE * input)
        char *next_command = NULL;
        struct job newjob;
        int i;
-       int inbg;
+       int inbg = 0;
        int status;
 #ifdef CONFIG_LASH_JOB_CONTROL
        pid_t  parent_pgrp;
index 08ca792fae793c253317eec518b079869ec1b0d5..d56db571431b3fa251a38a4a8d9a31af8b19b634 100644 (file)
@@ -1622,7 +1622,7 @@ static void initarea()
        brkaddr = malloc(AREASIZE);
        brktop = brkaddr + AREASIZE;
 
-       while ((int) sbrk(0) & ALIGN)
+       while ((long) sbrk(0) & ALIGN)
                sbrk(1);
        areabot = (struct region *) sbrk(REGSIZE);