shithub: gefs

Download patch

ref: 160c570e6cdcb244cfcd5b2a45387e31fdc21bc4
parent: c3940ef523467eebae22614859bad0d71da39ab7
author: Michael Forney <mforney@mforney.org>
date: Thu Sep 29 22:57:40 EDT 2022

tree: fix typos in message address calculation

Since Blksz - Pivhdsz is even, Pivspc and Bufspc are equal, but
logically these two uses were backwards.

--- a/tree.c
+++ b/tree.c
@@ -167,10 +167,10 @@
 	b->bufsz += msgsz(m)-2;
 
 	p = b->data + Pivspc + 2*b->nbuf;
-	o = Pivspc - b->bufsz;
+	o = Bufspc - b->bufsz;
 	PBIT16(p, o);
 
-	p = b->data + Bufspc + o;
+	p = b->data + Pivspc + o;
 	*p = m->op;		p += 1;
 	PBIT16(p, m->nk);	p += 2;
 	memcpy(p, m->k, m->nk);	p += m->nk;