shithub: plan9front

Download patch

ref: e5535fad320c9ba0e75f419117ab2ae6c0bcbb09
parent: 7cff84371d4cdf1964651fd04c60b98a0d6014a4
author: Sigrid <ftrvxmtrx@gmail.com>
date: Thu Apr 29 17:35:52 EDT 2021

libtags: modules: ignore empty title

--- a/sys/src/cmd/audio/libtags/it.c	Thu Apr 29 15:44:06 2021
+++ b/sys/src/cmd/audio/libtags/it.c	Thu Apr 29 17:35:52 2021
@@ -8,8 +8,8 @@
 	if(ctx->read(ctx, d, 4+26) != 4+26 || memcmp(d, "IMPM", 4) != 0)
 		return -1;
 	d[4+26] = 0;
-	cp437toutf8(o, sizeof(o), d+4, 26);
-	txtcb(ctx, Ttitle, "", o);
+	if(cp437toutf8(o, sizeof(o), d+4, 26) > 0)
+		txtcb(ctx, Ttitle, "", o);
 
 	return 0;
 }
--- a/sys/src/cmd/audio/libtags/mod.c	Thu Apr 29 15:44:06 2021
+++ b/sys/src/cmd/audio/libtags/mod.c	Thu Apr 29 17:35:52 2021
@@ -41,8 +41,8 @@
 		return -1;
 	if(ctx->read(ctx, d, 20) != 20)
 		return -1;
-	cp437toutf8(o, sizeof(o), d, 20);
-	txtcb(ctx, Ttitle, "", o);
+	if(cp437toutf8(o, sizeof(o), d, 20) > 0)
+		txtcb(ctx, Ttitle, "", o);
 
 	return 0;
 }
--- a/sys/src/cmd/audio/libtags/s3m.c	Thu Apr 29 15:44:06 2021
+++ b/sys/src/cmd/audio/libtags/s3m.c	Thu Apr 29 17:35:52 2021
@@ -10,8 +10,8 @@
 	d[28] = 0;
 	for(s = d+27; s != d-1 && (*s == ' ' || *s == 0); s--);
 	s[1] = 0;
-	cp437toutf8(o, sizeof(o), d, s+1-d);
-	txtcb(ctx, Ttitle, "", o);
+	if(cp437toutf8(o, sizeof(o), d, s+1-d) > 0)
+		txtcb(ctx, Ttitle, "", o);
 
 	return 0;
 }
--- a/sys/src/cmd/audio/libtags/xm.c	Thu Apr 29 15:44:06 2021
+++ b/sys/src/cmd/audio/libtags/xm.c	Thu Apr 29 17:35:52 2021
@@ -9,8 +9,8 @@
 		return -1;
 	d[17+20] = 0;
 	for(s = d+17; *s == ' '; s++);
-	cp437toutf8(o, sizeof(o), d+17, 20);
-	txtcb(ctx, Ttitle, "", o);
+	if(cp437toutf8(o, sizeof(o), d+17, 20) > 0)
+		txtcb(ctx, Ttitle, "", o);
 
 	return 0;
 }