Add casts to get rid of compiler warning about signed/unsigned issues.
This commit is contained in:
parent
8caa4e87f5
commit
6d894fd45b
@ -7,6 +7,7 @@ sysvinit (2.88dsf) UNRELEASED; urgency=low
|
||||
before files are copied into them.
|
||||
* Fix minor bug in optimizing of argument parsing. Based on
|
||||
report from jakemus on freshmeat.
|
||||
* Add casts to get rid of compiler warning about signed/unsigned issues.
|
||||
|
||||
-- Petter Reinholdtsen <pere@hungry.com> Sun, 12 Jul 2009 19:58:10 +0200
|
||||
|
||||
|
@ -135,7 +135,7 @@ int findtty(char *res, int rlen, dev_t dev)
|
||||
fprintf(stderr, "bootlogd: cannot find console device "
|
||||
"%d:%d in /dev\n", major(dev), minor(dev));
|
||||
r = -1;
|
||||
} else if (strlen(ent->d_name) + 5 >= rlen) {
|
||||
} else if ((int)strlen(ent->d_name) + 5 >= rlen) {
|
||||
fprintf(stderr, "bootlogd: console device name too long\n");
|
||||
r = -1;
|
||||
} else
|
||||
@ -351,7 +351,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
|
||||
break;
|
||||
case '\t':
|
||||
line.pos += (line.pos / 8 + 1) * 8;
|
||||
if (line.pos >= sizeof(line.buf))
|
||||
if (line.pos >= (int)sizeof(line.buf))
|
||||
line.pos = sizeof(line.buf) - 1;
|
||||
break;
|
||||
case 32 ... 127:
|
||||
@ -367,7 +367,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
|
||||
len--;
|
||||
|
||||
tlen = strlen(tmp);
|
||||
if (tlen && (line.pos + tlen < sizeof(line.buf))) {
|
||||
if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) {
|
||||
memcpy(line.buf + line.pos, tmp, tlen);
|
||||
line.pos += tlen;
|
||||
}
|
||||
@ -640,7 +640,7 @@ int main(int argc, char **argv)
|
||||
else
|
||||
todo = endptr - outptr;
|
||||
if (fp && todo)
|
||||
writelog(fp, outptr, todo);
|
||||
writelog(fp, (unsigned char *)outptr, todo);
|
||||
}
|
||||
|
||||
if (fp) {
|
||||
|
12
src/hddown.c
12
src/hddown.c
@ -111,11 +111,11 @@ static char *list_disks(DIR* blk, unsigned int* flags)
|
||||
}
|
||||
|
||||
ret = snprintf(buf, sizeof(buf), SYS_BLK "/%s/device", d->d_name);
|
||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
||||
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||
goto empty; /* error */
|
||||
|
||||
ret = readlink(buf, lnk, sizeof(lnk));
|
||||
if (ret >= sizeof(lnk))
|
||||
if (ret >= (int)sizeof(lnk))
|
||||
goto empty; /* error */
|
||||
if (ret < 0) {
|
||||
if (errno != ENOENT)
|
||||
@ -129,7 +129,7 @@ static char *list_disks(DIR* blk, unsigned int* flags)
|
||||
continue; /* should not happen */
|
||||
|
||||
ret = snprintf(buf, sizeof(buf), SYS_CLASS "/%s/manage_start_stop", ptr);
|
||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
||||
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||
goto empty; /* error */
|
||||
|
||||
ret = stat(buf, &st);
|
||||
@ -200,7 +200,7 @@ static int do_standby_idedisk(char *device, unsigned int flags)
|
||||
int fd, ret;
|
||||
|
||||
ret = snprintf(buf, sizeof(buf), DEV_BASE "/%s", device);
|
||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
||||
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||
return -1;
|
||||
|
||||
if ((fd = open(buf, O_RDWR)) < 0)
|
||||
@ -271,7 +271,7 @@ static FILE *hdopen(const char* const format, const char* const name)
|
||||
int fd, ret;
|
||||
|
||||
ret = snprintf(buf, sizeof(buf), format, name);
|
||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
||||
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||
goto error; /* error */
|
||||
|
||||
fd = open(buf, O_RDONLY|O_NOCTTY);
|
||||
@ -324,7 +324,7 @@ static int flush_cache_ext(const char *device)
|
||||
goto out; /* small disk */
|
||||
|
||||
ret = snprintf(buf, sizeof(buf), DEV_BASE "/%s", device);
|
||||
if ((ret >= sizeof(buf)) || (ret < 0))
|
||||
if ((ret >= (int)sizeof(buf)) || (ret < 0))
|
||||
return -1; /* error */
|
||||
|
||||
if ((fd = open(buf, O_RDONLY|O_NONBLOCK)) < 0)
|
||||
|
@ -1254,7 +1254,7 @@ void read_inittab(void)
|
||||
strncpy(ch->id, id, sizeof(utproto.ut_id) + 1); /* Hack for different libs. */
|
||||
strncpy(ch->process, process, sizeof(ch->process) - 1);
|
||||
if (rlevel[0]) {
|
||||
for(f = 0; f < sizeof(rlevel) - 1 && rlevel[f]; f++) {
|
||||
for(f = 0; f < (int)sizeof(rlevel) - 1 && rlevel[f]; f++) {
|
||||
ch->rlevel[f] = rlevel[f];
|
||||
if (ch->rlevel[f] == 's') ch->rlevel[f] = 'S';
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ int dns_lookup(char *result, int size, int useip, int32_t *a)
|
||||
*
|
||||
* Ugly.
|
||||
*/
|
||||
if (a[0] == 0 && a[1] == 0 && a[2] == htonl (0xffff))
|
||||
if (a[0] == 0 && a[1] == 0 && a[2] == (int32_t)htonl (0xffff))
|
||||
mapped = 1;
|
||||
topnibble = ntohl((unsigned int)a[0]) >> 28;
|
||||
|
||||
@ -462,7 +462,7 @@ int list(struct utmp *p, time_t t, int what)
|
||||
r = dns_lookup(domain, sizeof(domain), useip, p->ut_addr_v6);
|
||||
if (r < 0) {
|
||||
len = UT_HOSTSIZE;
|
||||
if (len >= sizeof(domain)) len = sizeof(domain) - 1;
|
||||
if (len >= (int)sizeof(domain)) len = sizeof(domain) - 1;
|
||||
domain[0] = 0;
|
||||
strncat(domain, p->ut_host, len);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ int init_setenv(char *name, char *value)
|
||||
nl = strlen(name);
|
||||
vl = value ? strlen(value) : 0;
|
||||
|
||||
if (nl + vl + 3 >= sizeof(request.i.data))
|
||||
if (nl + vl + 3 >= (int)sizeof(request.i.data))
|
||||
return -1;
|
||||
|
||||
memcpy(request.i.data, name, nl);
|
||||
|
@ -298,7 +298,7 @@ char *getpasswd(char *crypted)
|
||||
if (read(0, pass, sizeof(pass) - 1) <= 0)
|
||||
ret = NULL;
|
||||
else {
|
||||
for(i = 0; i < sizeof(pass) && pass[i]; i++)
|
||||
for(i = 0; i < (int)sizeof(pass) && pass[i]; i++)
|
||||
if (pass[i] == '\r' || pass[i] == '\n') {
|
||||
pass[i] = 0;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user