Fix signed/unsigned comparison warnings.

This commit is contained in:
David E. O'Brien 2003-05-04 00:56:00 +00:00
parent 8f5f415d44
commit 78af18bd24
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114625
3 changed files with 9 additions and 8 deletions

View File

@ -178,7 +178,7 @@ malloc(nbytes)
}
bucket = 0;
amt = 8;
while (pagesz > amt) {
while ((unsigned)pagesz > amt) {
amt <<= 1;
bucket++;
}
@ -189,7 +189,7 @@ malloc(nbytes)
* stored in hash buckets which satisfies request.
* Account for space used per block for accounting.
*/
if (nbytes <= (n = pagesz - sizeof (*op) - RSLOP)) {
if (nbytes <= (unsigned long)(n = pagesz - sizeof (*op) - RSLOP)) {
#ifndef RCHECK
amt = 8; /* size of first bucket */
bucket = 0;
@ -362,7 +362,7 @@ realloc(cp, nbytes)
i = NBUCKETS;
}
onb = 1 << (i + 3);
if (onb < pagesz)
if (onb < (u_int)pagesz)
onb -= sizeof (*op) + RSLOP;
else
onb += pagesz - sizeof (*op) - RSLOP;
@ -375,7 +375,7 @@ realloc(cp, nbytes)
else
i += pagesz - sizeof (*op) - RSLOP;
}
if (nbytes <= onb && nbytes > i) {
if (nbytes <= onb && nbytes > (size_t)i) {
#ifdef RCHECK
op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1);
*(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;

View File

@ -57,7 +57,8 @@ map_object(int fd, const char *path, const struct stat *sb)
Elf_Ehdr hdr;
char buf[PAGE_SIZE];
} u;
int nbytes, i;
int i;
ssize_t nbytes;
Elf_Phdr *phdr;
Elf_Phdr *phlimit;
Elf_Phdr **segs;
@ -91,7 +92,7 @@ map_object(int fd, const char *path, const struct stat *sb)
}
/* Make sure the file is valid */
if (nbytes < sizeof(Elf_Ehdr)
if (nbytes < (ssize_t)sizeof(Elf_Ehdr)
|| u.hdr.e_ident[EI_MAG0] != ELFMAG0
|| u.hdr.e_ident[EI_MAG1] != ELFMAG1
|| u.hdr.e_ident[EI_MAG2] != ELFMAG2
@ -128,7 +129,7 @@ map_object(int fd, const char *path, const struct stat *sb)
"%s: invalid shared object: e_phentsize != sizeof(Elf_Phdr)", path);
return NULL;
}
if (u.hdr.e_phoff + u.hdr.e_phnum*sizeof(Elf_Phdr) > nbytes) {
if (u.hdr.e_phoff + u.hdr.e_phnum * sizeof(Elf_Phdr) > (size_t)nbytes) {
_rtld_error("%s: program header too large", path);
return NULL;
}

View File

@ -943,7 +943,7 @@ gethints(void)
}
p = xmalloc(hdr.dirlistlen + 1);
if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 ||
read(fd, p, hdr.dirlistlen + 1) != hdr.dirlistlen + 1) {
read(fd, p, hdr.dirlistlen + 1) != (ssize_t)hdr.dirlistlen + 1) {
free(p);
close(fd);
return NULL;