acme, sam: handle >1GB files correctly

imported from plan9port, edfe3c016fe6ef10c55f7a17aab668214ec21efc
This commit is contained in:
Ori Bernstein 2019-12-04 11:46:42 -08:00
parent f7db45e628
commit a181f3dd3e
4 changed files with 9 additions and 3 deletions

View file

@ -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];
};

View file

@ -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;

View file

@ -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;

View file

@ -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];
};