unsigned -> unsigned int
This commit is contained in:
parent
c9ef94469d
commit
db898c555a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: alloc.c,v 1.22 2007/11/24 13:20:53 isaki Exp $ */
|
||||
/* $NetBSD: alloc.c,v 1.23 2007/12/02 04:59:24 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993
|
||||
@ -119,27 +119,28 @@
|
||||
#include "stand.h"
|
||||
|
||||
/*
|
||||
* Each block actually has ALIGN(unsigned) + ALIGN(size) bytes allocated
|
||||
* Each block actually has ALIGN(unsigned int) + ALIGN(size) bytes allocated
|
||||
* to it, as follows:
|
||||
*
|
||||
* 0 ... (sizeof(unsigned) - 1)
|
||||
* 0 ... (sizeof(unsigned int) - 1)
|
||||
* allocated or unallocated: holds size of user-data part of block.
|
||||
*
|
||||
* sizeof(unsigned) ... (ALIGN(sizeof(unsigned)) - 1)
|
||||
* sizeof(unsigned int) ... (ALIGN(sizeof(unsigned int)) - 1)
|
||||
* allocated: unused
|
||||
* unallocated: depends on packing of struct fl
|
||||
*
|
||||
* ALIGN(sizeof(unsigned)) ... (ALIGN(sizeof(unsigned)) + ALIGN(data size) - 1)
|
||||
* ALIGN(sizeof(unsigned int)) ...
|
||||
* (ALIGN(sizeof(unsigned int)) + ALIGN(data size) - 1)
|
||||
* allocated: user data
|
||||
* unallocated: depends on packing of struct fl
|
||||
*
|
||||
* 'next' is only used when the block is unallocated (i.e. on the free list).
|
||||
* However, note that ALIGN(sizeof(unsigned)) + ALIGN(data size) must
|
||||
* However, note that ALIGN(sizeof(unsigned int)) + ALIGN(data size) must
|
||||
* be at least 'sizeof(struct fl)', so that blocks can be used as structures
|
||||
* when on the free list.
|
||||
*/
|
||||
struct fl {
|
||||
unsigned size;
|
||||
unsigned int size;
|
||||
struct fl *next;
|
||||
} *freelist;
|
||||
|
||||
@ -166,7 +167,7 @@ alloc(size_t size)
|
||||
{
|
||||
struct fl **f = &freelist, **bestf = NULL;
|
||||
#ifndef ALLOC_FIRST_FIT
|
||||
unsigned bestsize = 0xffffffff; /* greater than any real size */
|
||||
unsigned int bestsize = 0xffffffff; /* greater than any real size */
|
||||
#endif
|
||||
char *help;
|
||||
int failed;
|
||||
@ -210,16 +211,16 @@ alloc(size_t size)
|
||||
/* make _sure_ the region can hold a struct fl. */
|
||||
if (size < ALIGN(sizeof (struct fl *)))
|
||||
size = ALIGN(sizeof (struct fl *));
|
||||
top += ALIGN(sizeof(unsigned)) + ALIGN(size);
|
||||
top += ALIGN(sizeof(unsigned int)) + ALIGN(size);
|
||||
#ifdef HEAP_LIMIT
|
||||
if (top > (char *)HEAP_LIMIT)
|
||||
panic("heap full (0x%lx+%zu)", help, size);
|
||||
#endif
|
||||
*(unsigned *)(void *)help = (unsigned)ALIGN(size);
|
||||
*(unsigned int *)(void *)help = (unsigned int)ALIGN(size);
|
||||
#ifdef ALLOC_TRACE
|
||||
printf("=%lx\n", (u_long)help + ALIGN(sizeof(unsigned)));
|
||||
printf("=%lx\n", (u_long)help + ALIGN(sizeof(unsigned int)));
|
||||
#endif
|
||||
return help + ALIGN(sizeof(unsigned));
|
||||
return help + ALIGN(sizeof(unsigned int));
|
||||
}
|
||||
|
||||
/* we take the best fit */
|
||||
@ -232,10 +233,10 @@ found:
|
||||
help = (char *)(void *)*f;
|
||||
*f = (*f)->next;
|
||||
#ifdef ALLOC_TRACE
|
||||
printf("=%lx (origsize %u)\n", (u_long)help + ALIGN(sizeof(unsigned)),
|
||||
*(unsigned *)help);
|
||||
printf("=%lx (origsize %u)\n",
|
||||
(u_long)help + ALIGN(sizeof(unsigned int)), *(unsigned int *)help);
|
||||
#endif
|
||||
return help + ALIGN(sizeof(unsigned));
|
||||
return help + ALIGN(sizeof(unsigned int));
|
||||
}
|
||||
|
||||
void
|
||||
@ -243,7 +244,8 @@ void
|
||||
dealloc(void *ptr, size_t size)
|
||||
{
|
||||
struct fl *f =
|
||||
(struct fl *)(void *)((char *)(void *)ptr - ALIGN(sizeof(unsigned)));
|
||||
(struct fl *)(void *)((char *)(void *)ptr -
|
||||
ALIGN(sizeof(unsigned int)));
|
||||
#ifdef ALLOC_TRACE
|
||||
printf("dealloc(%lx, %zu) (origsize %u)\n", (u_long)ptr, size, f->size);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: close.c,v 1.13 2007/11/24 13:20:54 isaki Exp $ */
|
||||
/* $NetBSD: close.c,v 1.14 2007/12/02 04:59:25 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -73,7 +73,7 @@ oclose(int fd)
|
||||
int err1 = 0, err2 = 0;
|
||||
|
||||
#if !defined(LIBSA_NO_FD_CHECKING)
|
||||
if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
|
||||
if ((unsigned int)fd >= SOPEN_MAX || f->f_flags == 0) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cread.c,v 1.19 2007/11/24 13:20:54 isaki Exp $ */
|
||||
/* $NetBSD: cread.c,v 1.20 2007/12/02 04:59:25 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -266,7 +266,7 @@ close(int fd)
|
||||
struct sd *s;
|
||||
|
||||
#if !defined(LIBSA_NO_FD_CHECKING)
|
||||
if ((unsigned)fd >= SOPEN_MAX) {
|
||||
if ((unsigned int)fd >= SOPEN_MAX) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
@ -381,7 +381,7 @@ lseek(int fd, off_t offset, int where)
|
||||
struct sd *s;
|
||||
|
||||
#if !defined(LIBSA_NO_FD_CHECKING)
|
||||
if ((unsigned)fd >= SOPEN_MAX) {
|
||||
if ((unsigned int)fd >= SOPEN_MAX) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fstat.c,v 1.6 2007/11/24 13:20:55 isaki Exp $ */
|
||||
/* $NetBSD: fstat.c,v 1.7 2007/12/02 04:59:25 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -39,7 +39,7 @@ fstat(int fd, struct stat *sb)
|
||||
struct open_file *f = &files[fd];
|
||||
|
||||
#if !defined(LIBSA_NO_FD_CHECKING)
|
||||
if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
|
||||
if ((unsigned int)fd >= SOPEN_MAX || f->f_flags == 0) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ioctl.c,v 1.10 2007/11/24 13:20:55 isaki Exp $ */
|
||||
/* $NetBSD: ioctl.c,v 1.11 2007/12/02 04:59:25 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -70,7 +70,7 @@ ioctl(int fd, u_long cmd, char *arg)
|
||||
#endif
|
||||
|
||||
#if !defined(LIBSA_NO_FD_CHECKING)
|
||||
if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
|
||||
if ((unsigned int)fd >= SOPEN_MAX || f->f_flags == 0) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: loadfile_elf32.c,v 1.18 2007/11/23 04:32:14 isaki Exp $ */
|
||||
/* $NetBSD: loadfile_elf32.c,v 1.19 2007/12/02 04:59:26 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -423,7 +423,7 @@ ELFNAMEEND(loadfile)(fd, elf, marks, flags)
|
||||
case SHT_STRTAB:
|
||||
for (j = 0; j < elf->e_shnum; j++)
|
||||
if (shp[j].sh_type == SHT_SYMTAB &&
|
||||
shp[j].sh_link == (unsigned)i)
|
||||
shp[j].sh_link == (unsigned int)i)
|
||||
goto havesym;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lseek.c,v 1.10 2007/11/24 13:20:55 isaki Exp $ */
|
||||
/* $NetBSD: lseek.c,v 1.11 2007/12/02 04:59:26 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -72,7 +72,7 @@ olseek(int fd, off_t offset, int where)
|
||||
struct open_file *f = &files[fd];
|
||||
|
||||
#if !defined(LIBSA_NO_FD_CHECKING)
|
||||
if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
|
||||
if ((unsigned int)fd >= SOPEN_MAX || f->f_flags == 0) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: read.c,v 1.14 2007/11/24 13:20:57 isaki Exp $ */
|
||||
/* $NetBSD: read.c,v 1.15 2007/12/02 04:59:26 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -74,7 +74,7 @@ oread(int fd, void *dest, size_t bcount)
|
||||
size_t resid;
|
||||
|
||||
#if !defined(LIBSA_NO_FD_CHECKING)
|
||||
if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_READ)) {
|
||||
if ((unsigned int)fd >= SOPEN_MAX || !(f->f_flags & F_READ)) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tftp.c,v 1.23 2007/11/24 13:20:57 isaki Exp $ */
|
||||
/* $NetBSD: tftp.c,v 1.24 2007/12/02 04:59:26 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -129,7 +129,7 @@ recvtftp(struct iodesc *d, void *pkt, size_t len, time_t tleft)
|
||||
} /* else check uh_sport has not changed??? */
|
||||
return (n - (t->th_data - (char *)t));
|
||||
case ERROR:
|
||||
if ((unsigned) ntohs(t->th_code) >= 8) {
|
||||
if ((unsigned int)ntohs(t->th_code) >= 8) {
|
||||
printf("illegal tftp error %d\n", ntohs(t->th_code));
|
||||
errno = EIO;
|
||||
} else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: write.c,v 1.14 2007/11/24 13:20:58 isaki Exp $ */
|
||||
/* $NetBSD: write.c,v 1.15 2007/12/02 04:59:26 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -71,7 +71,7 @@ write(int fd, const void *destp, size_t bcount)
|
||||
void *dest = __UNCONST(destp);
|
||||
|
||||
#if !defined(LIBSA_NO_FD_CHECKING)
|
||||
if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_WRITE)) {
|
||||
if ((unsigned int)fd >= SOPEN_MAX || !(f->f_flags & F_WRITE)) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user