fix up yet more annoying signed/unsigned and mixed type errors

This commit is contained in:
Eric Andersen 2006-01-30 22:48:39 +00:00
parent 9a58b02ec7
commit a68ea1cb93
13 changed files with 49 additions and 46 deletions

View 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);

View 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);

View 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)

View 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

View 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;

View 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);

View 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);
}

View 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;

View 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)

View 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-- */

View 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)

View 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;

View 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);