fixes from Peter Froehlich
This commit is contained in:
parent
a6cd7509c4
commit
c5f5387351
3 changed files with 8 additions and 8 deletions
12
console.c
12
console.c
|
@ -23,24 +23,24 @@ static struct {
|
||||||
} cons;
|
} cons;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
printint(int xx, int base, int sgn)
|
printint(int xx, int base, int sign)
|
||||||
{
|
{
|
||||||
static char digits[] = "0123456789abcdef";
|
static char digits[] = "0123456789abcdef";
|
||||||
char buf[16];
|
char buf[16];
|
||||||
int i, neg;
|
int i;
|
||||||
uint x;
|
uint x;
|
||||||
|
|
||||||
if(sgn && (neg = xx < 0)){
|
if(sign && (sign = xx < 0))
|
||||||
neg = 1;
|
|
||||||
x = -xx;
|
x = -xx;
|
||||||
} else
|
else
|
||||||
x = xx;
|
x = xx;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
do{
|
do{
|
||||||
buf[i++] = digits[x % base];
|
buf[i++] = digits[x % base];
|
||||||
}while((x /= base) != 0);
|
}while((x /= base) != 0);
|
||||||
if(neg)
|
|
||||||
|
if(sign)
|
||||||
buf[i++] = '-';
|
buf[i++] = '-';
|
||||||
|
|
||||||
while(--i >= 0)
|
while(--i >= 0)
|
||||||
|
|
2
mkfs.c
2
mkfs.c
|
@ -229,7 +229,7 @@ balloc(int used)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printf("balloc: first %d blocks have been allocated\n", used);
|
printf("balloc: first %d blocks have been allocated\n", used);
|
||||||
assert(used < 512);
|
assert(used < 512*8);
|
||||||
bzero(buf, 512);
|
bzero(buf, 512);
|
||||||
for(i = 0; i < used; i++){
|
for(i = 0; i < used; i++){
|
||||||
buf[i/8] = buf[i/8] | (0x1 << (i%8));
|
buf[i/8] = buf[i/8] | (0x1 << (i%8));
|
||||||
|
|
|
@ -57,7 +57,7 @@ argptr(int n, char **pp, int size)
|
||||||
|
|
||||||
if(argint(n, &i) < 0)
|
if(argint(n, &i) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if((uint)i >= proc->sz || (uint)i+size >= proc->sz)
|
if((uint)i >= proc->sz || (uint)i+size > proc->sz)
|
||||||
return -1;
|
return -1;
|
||||||
*pp = (char*)i;
|
*pp = (char*)i;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue