shithub: pplay

Download patch

ref: 36e8f4aa44256951378d2240aa15e08025ba40d6
parent: 7d023edfb125fa698be9dde801c61b85c3100961
author: qwx <qwx@sciops.net>
date: Mon Sep 4 20:33:44 EDT 2023

chunk: don't clear track pointer when adding new chunks

--- a/chunk.c
+++ b/chunk.c
@@ -224,6 +224,7 @@
 	d.cur = d.from = dp->from < d.totalsz ? dp->from : 0;
 	d.to = d.totalsz;
 	d.off = -1;
+	d.t = dp->t;
 	return d;
 }
 
@@ -526,8 +527,8 @@
 		b->buf = erealloc(b->buf, c->len, b->bufsz);
 		b->bufsz = c->len;
 	}
-	memset(d, 0, sizeof *d);
 	d->norris = c;
+	d->from = 0;
 	*d = newdot(d);
 	return c;
 }
--- a/cmd.c
+++ b/cmd.c
@@ -310,13 +310,13 @@
 {
 	Dot d;
 
+	tracks = emalloc(++ntracks * sizeof *tracks);
+	d.t = tracks;
 	if(loadfile(fd, &d) == nil)
 		sysfatal("initcmd: %r");
-	tracks = emalloc(++ntracks * sizeof *tracks);
 	dots = emalloc(++ndots * sizeof *dots);
 	dots[0] = d;
 	current = dots;
 	*current = d;
-	current->t = tracks;
 	return 0;
 }