libtags: upstream updates
This commit is contained in:
parent
b66bffe91c
commit
5e81cc48bd
5 changed files with 16 additions and 15 deletions
|
@ -3,12 +3,12 @@
|
||||||
int
|
int
|
||||||
tagit(Tagctx *ctx)
|
tagit(Tagctx *ctx)
|
||||||
{
|
{
|
||||||
char d[4+26+1], o[26*UTFmax+1];
|
uchar d[4+26+1], o[26*2+1];
|
||||||
|
|
||||||
if(ctx->read(ctx, d, 4+26) != 4+26 || memcmp(d, "IMPM", 4) != 0)
|
if(ctx->read(ctx, d, 4+26) != 4+26 || memcmp(d, "IMPM", 4) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
d[4+26] = 0;
|
d[4+26] = 0;
|
||||||
if(cp437toutf8(o, sizeof(o), d+4, 26) > 0)
|
if(iso88591toutf8(o, sizeof(o), d+4, 26) > 0)
|
||||||
txtcb(ctx, Ttitle, "", o);
|
txtcb(ctx, Ttitle, "", o);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -16,6 +16,7 @@ static char *variants[] =
|
||||||
"CD81",
|
"CD81",
|
||||||
"OCTA",
|
"OCTA",
|
||||||
"OKTA",
|
"OKTA",
|
||||||
|
"10CH",
|
||||||
"16CN",
|
"16CN",
|
||||||
"32CN",
|
"32CN",
|
||||||
nil,
|
nil,
|
||||||
|
@ -24,7 +25,7 @@ static char *variants[] =
|
||||||
int
|
int
|
||||||
tagmod(Tagctx *ctx)
|
tagmod(Tagctx *ctx)
|
||||||
{
|
{
|
||||||
char d[20], o[20*UTFmax+1];
|
uchar d[20], o[20*2+1];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(ctx->seek(ctx, 1080, 0) != 1080)
|
if(ctx->seek(ctx, 1080, 0) != 1080)
|
||||||
|
@ -41,7 +42,7 @@ tagmod(Tagctx *ctx)
|
||||||
return -1;
|
return -1;
|
||||||
if(ctx->read(ctx, d, 20) != 20)
|
if(ctx->read(ctx, d, 20) != 20)
|
||||||
return -1;
|
return -1;
|
||||||
if(cp437toutf8(o, sizeof(o), d, 20) > 0)
|
if(iso88591toutf8(o, sizeof(o), d, 20) > 0)
|
||||||
txtcb(ctx, Ttitle, "", o);
|
txtcb(ctx, Ttitle, "", o);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -41,19 +41,20 @@ tagscallcb(Tagctx *ctx, int type, const char *k, char *s, int offset, int size,
|
||||||
char *e;
|
char *e;
|
||||||
|
|
||||||
if(f == nil && size == 0){
|
if(f == nil && size == 0){
|
||||||
while(*s <= ' ' && *s)
|
while((uchar)*s <= ' ' && *s)
|
||||||
s++;
|
s++;
|
||||||
e = s + strlen(s);
|
e = s + strlen(s);
|
||||||
while(e != s && e[-1] <= ' ')
|
while(e != s && (uchar)e[-1] <= ' ')
|
||||||
e--;
|
e--;
|
||||||
*e = 0;
|
*e = 0;
|
||||||
}
|
}
|
||||||
if(type != Tunknown){
|
if(*s){
|
||||||
ctx->found |= 1<<type;
|
|
||||||
ctx->num++;
|
|
||||||
}
|
|
||||||
if(*s)
|
|
||||||
ctx->tag(ctx, type, k, s, offset, size, f);
|
ctx->tag(ctx, type, k, s, offset, size, f);
|
||||||
|
if(type != Tunknown){
|
||||||
|
ctx->found |= 1<<type;
|
||||||
|
ctx->num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -41,4 +41,4 @@ void cbvorbiscomment(Tagctx *ctx, char *k, char *v);
|
||||||
|
|
||||||
void tagscallcb(Tagctx *ctx, int type, const char *k, char *s, int offset, int size, Tagread f);
|
void tagscallcb(Tagctx *ctx, int type, const char *k, char *s, int offset, int size, Tagread f);
|
||||||
|
|
||||||
#define txtcb(ctx, type, k, s) tagscallcb(ctx, type, k, (const char*)s, 0, 0, nil)
|
#define txtcb(ctx, type, k, s) tagscallcb(ctx, type, k, (char*)s, 0, 0, nil)
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
int
|
int
|
||||||
tagxm(Tagctx *ctx)
|
tagxm(Tagctx *ctx)
|
||||||
{
|
{
|
||||||
char d[17+20+1], o[20*UTFmax+1], *s;
|
char d[17+20+1], o[20*UTFmax+1];
|
||||||
|
|
||||||
if(ctx->read(ctx, d, 17+20) != 17+20 || memcmp(d, "Extended Module: ", 17) != 0)
|
if(ctx->read(ctx, d, 17+20) != 17+20 || cistrncmp(d, "Extended Module: ", 17) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
d[17+20] = 0;
|
d[17+20] = 0;
|
||||||
for(s = d+17; *s == ' '; s++);
|
|
||||||
if(cp437toutf8(o, sizeof(o), d+17, 20) > 0)
|
if(cp437toutf8(o, sizeof(o), d+17, 20) > 0)
|
||||||
txtcb(ctx, Ttitle, "", o);
|
txtcb(ctx, Ttitle, "", o);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue