acme, sam: handle >1GB files correctly
imported from plan9port, edfe3c016fe6ef10c55f7a17aab668214ec21efc
This commit is contained in:
parent
f7db45e628
commit
a181f3dd3e
4 changed files with 9 additions and 3 deletions
|
@ -68,7 +68,7 @@ struct Range
|
|||
|
||||
struct Block
|
||||
{
|
||||
uint addr; /* disk address in bytes */
|
||||
vlong addr; /* disk address in bytes */
|
||||
union
|
||||
{
|
||||
uint n; /* number of used runes in block */
|
||||
|
@ -79,7 +79,7 @@ struct Block
|
|||
struct Disk
|
||||
{
|
||||
int fd;
|
||||
uint addr; /* length of temp file */
|
||||
vlong addr; /* length of temp file */
|
||||
Block *free[Maxblock/Blockincr+1];
|
||||
};
|
||||
|
||||
|
|
|
@ -82,6 +82,9 @@ disknewblock(Disk *d, uint n)
|
|||
b = blist;
|
||||
blist = b->next;
|
||||
b->addr = d->addr;
|
||||
if(d->addr+size < d->addr){
|
||||
error("temp file overflow");
|
||||
}
|
||||
d->addr += size;
|
||||
}
|
||||
b->n = n;
|
||||
|
|
|
@ -71,6 +71,9 @@ disknewblock(Disk *d, uint n)
|
|||
b = blist;
|
||||
blist = b->next;
|
||||
b->addr = d->addr;
|
||||
if(d->addr+size < d->addr){
|
||||
panic("temp file overflow");
|
||||
}
|
||||
d->addr += size;
|
||||
}
|
||||
b->n = n;
|
||||
|
|
|
@ -117,7 +117,7 @@ struct Block
|
|||
struct Disk
|
||||
{
|
||||
int fd;
|
||||
uint addr; /* length of temp file */
|
||||
vlong addr; /* length of temp file */
|
||||
Block *free[Maxblock/Blockincr+1];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue