ref: e5535fad320c9ba0e75f419117ab2ae6c0bcbb09
parent: 7cff84371d4cdf1964651fd04c60b98a0d6014a4
author: Sigrid <ftrvxmtrx@gmail.com>
date: Thu Apr 29 19:35:52 EDT 2021
libtags: modules: ignore empty title
--- a/sys/src/cmd/audio/libtags/it.c
+++ b/sys/src/cmd/audio/libtags/it.c
@@ -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
+++ b/sys/src/cmd/audio/libtags/mod.c
@@ -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
+++ b/sys/src/cmd/audio/libtags/s3m.c
@@ -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
+++ b/sys/src/cmd/audio/libtags/xm.c
@@ -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;
}