shithub: qk1

Download patch

ref: ac7e6ac77f7eaa31be48c79a18b28f41e6ee9c22
parent: 19687e3b456448a7650706ace7bf31f210a6dfde
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Dec 29 14:44:39 EST 2023

get rid of %r in non-plan9 code

--- a/fs.c
+++ b/fs.c
@@ -186,7 +186,7 @@
 eread(FILE *bf, void *u, long n)
 {
 	if((long)fread(u, 1, n, bf) != n)
-		fatal("eread: short read: %s", lerr());
+		fatal("eread: short read: eof=%d error=%d", feof(bf), ferror(bf));
 	return n;
 }
 
@@ -242,7 +242,7 @@
 ewrite(FILE *bf, void *u, long n)
 {
 	if((long)fwrite(u, 1, n, bf) != n)
-		fatal("eread: short write: %r");
+		fatal("ewrite: short write: %s", lerr());
 }
 
 static void
@@ -444,7 +444,7 @@
 
 	bf = openlmp(va("maps/%s.pts", sv.name), &n);
 	if(bf == nil){
-		Con_Printf(va("loadpoints: %r\n"));
+		Con_Printf(va("loadpoints: %s\n", lerr()));
 		return;
 	}
 	nv = 0;
@@ -782,9 +782,9 @@
 	n = fread(net_message.data, 1, net_message.cursize, demobf);
 	demoofs = ftell(demobf);
 	if(n < 0)
-		Con_DPrintf("readdm: bad read: %r\n");
+		Con_DPrintf("readdm: bad read: %s\n", lerr());
 	if(n != net_message.cursize){
-		Con_DPrintf("readdm: short read: %r\n");
+		Con_DPrintf("readdm: short read: %s\n", lerr());
 		n = -1;
 	}
 	return n;
@@ -889,7 +889,7 @@
 		snprint(f, sizeof f, "%s/pak%d.pak", d, n);
 		p = pak(f);
 		if(p == nil){
-			Con_DPrintf("pakdir: %r\n");
+			Con_DPrintf("pakdir: %s\n", lerr());
 			break;
 		}
 		pl = Hunk_Alloc(sizeof *pl);
@@ -935,7 +935,7 @@
 	if(bf == nil){
 		Con_DPrintf("chkreg: shareware version\n");
 		if(notid1)
-			fatal("chkreg: phase error -- %r");
+			fatal("chkreg: phase error -- %s", lerr());
 		return;
 	}
 	p = pop;
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -129,16 +129,12 @@
 	if(sc = Cache_Check(&sfx->cu), sc != nil)
 		return sc;
 	u = loadstklmp(va("sound/%s", sfx->s), buf, sizeof buf, &len);
-	if(u == nil){
-		Con_DPrintf("loadsfx: %r\n");
-		return nil;
-	}
-	if(wavinfo(u, len, &info) != 0){
+	if(u == nil || wavinfo(u, len, &info) != 0){
 		Con_Printf("loadsfx: %s: %s\n", sfx->s, lerr());
 		return nil;
 	}
 	if(info.channels != 1){
-		Con_DPrintf("loadsfx: non mono wave %s\n", sfx->s);
+		Con_DPrintf("loadsfx: %s: non mono wave\n", sfx->s);
 		return nil;
 	}
 	stepscale = (float)info.rate / Srate;