changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: acme, sam: handle >1GB files correctly

changeset 7480: 12d47c29977c
parent 7479: f4f9414878e1
child 7481: 94daa09298cb
author: Ori Bernstein <ori@eigenstate.org>
date: Wed, 04 Dec 2019 11:46:42 -0800
files: sys/src/cmd/acme/dat.h sys/src/cmd/acme/disk.c sys/src/cmd/sam/disk.c sys/src/cmd/sam/sam.h
description: acme, sam: handle >1GB files correctly

imported from plan9port, edfe3c016fe6ef10c55f7a17aab668214ec21efc
     1.1--- a/sys/src/cmd/acme/dat.h
     1.2+++ b/sys/src/cmd/acme/dat.h
     1.3@@ -68,7 +68,7 @@ struct Range
     1.4 
     1.5 struct Block
     1.6 {
     1.7-	uint		addr;	/* disk address in bytes */
     1.8+	vlong		addr;	/* disk address in bytes */
     1.9 	union
    1.10 	{
    1.11 		uint	n;		/* number of used runes in block */
    1.12@@ -79,7 +79,7 @@ struct Block
    1.13 struct Disk
    1.14 {
    1.15 	int		fd;
    1.16-	uint		addr;	/* length of temp file */
    1.17+	vlong		addr;	/* length of temp file */
    1.18 	Block	*free[Maxblock/Blockincr+1];
    1.19 };
    1.20 
     2.1--- a/sys/src/cmd/acme/disk.c
     2.2+++ b/sys/src/cmd/acme/disk.c
     2.3@@ -82,6 +82,9 @@ disknewblock(Disk *d, uint n)
     2.4 		b = blist;
     2.5 		blist = b->next;
     2.6 		b->addr = d->addr;
     2.7+		if(d->addr+size < d->addr){
     2.8+			error("temp file overflow");
     2.9+		}
    2.10 		d->addr += size;
    2.11 	}
    2.12 	b->n = n;
     3.1--- a/sys/src/cmd/sam/disk.c
     3.2+++ b/sys/src/cmd/sam/disk.c
     3.3@@ -71,6 +71,9 @@ disknewblock(Disk *d, uint n)
     3.4 		b = blist;
     3.5 		blist = b->next;
     3.6 		b->addr = d->addr;
     3.7+		if(d->addr+size < d->addr){
     3.8+			panic("temp file overflow");
     3.9+		}
    3.10 		d->addr += size;
    3.11 	}
    3.12 	b->n = n;
     4.1--- a/sys/src/cmd/sam/sam.h
     4.2+++ b/sys/src/cmd/sam/sam.h
     4.3@@ -117,7 +117,7 @@ struct Block
     4.4 struct Disk
     4.5 {
     4.6 	int		fd;
     4.7-	uint		addr;	/* length of temp file */
     4.8+	vlong		addr;	/* length of temp file */
     4.9 	Block		*free[Maxblock/Blockincr+1];
    4.10 };
    4.11