Unified · Split
| @@ -36,13 +36,24 @@ static const Getter g[] = · 35 unmodified lines | ||
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | void |
| 39 | −tagscallcb(Tagctx *ctx, int type, const char *k, const char *s, int offset, int size, Tagread f) | |
| 39 | +tagscallcb(Tagctx *ctx, int type, const char *k, char *s, int offset, int size, Tagread f) | |
| 40 | 40 | { |
| 41 | + char *e; | |
| 42 | + | |
| 43 | + if(f == nil && size == 0){ | |
| 44 | + while(*s <= ' ' && *s) | |
| 45 | + s++; | |
| 46 | + e = s + strlen(s); | |
| 47 | + while(e != s && e[-1] <= ' ') | |
| 48 | + e--; | |
| 49 | + *e = 0; | |
| 50 | + } | |
| 41 | 51 | if(type != Tunknown){ |
| 42 | 52 | ctx->found |= 1<<type; |
| 43 | 53 | ctx->num++; |
| 44 | 54 | } |
| 45 | − ctx->tag(ctx, type, k, s, offset, size, f); | |
| 55 | + if(*s) | |
| 56 | + ctx->tag(ctx, type, k, s, offset, size, f); | |
| 46 | 57 | } |
| 47 | 58 | |
| 48 | 59 | int |
| @@ -52,6 +52,6 @@ int cp437toutf8(char *o, int osz, const char *s, int sz); · 51 unmodified lines | ||
| 52 | 52 | */ |
| 53 | 53 | void cbvorbiscomment(Tagctx *ctx, char *k, char *v); |
| 54 | 54 | |
| 55 | −void tagscallcb(Tagctx *ctx, int type, const char *k, const char *s, int offset, int size, Tagread f); | |
| 55 | +void tagscallcb(Tagctx *ctx, int type, const char *k, char *s, int offset, int size, Tagread f); | |
| 56 | 56 | |
| 57 | 57 | #define txtcb(ctx, type, k, s) tagscallcb(ctx, type, k, (const char*)s, 0, 0, nil) |
| @@ -3,12 +3,11 @@ · 2 unmodified lines | ||
| 3 | 3 | int |
| 4 | 4 | tagxm(Tagctx *ctx) |
| 5 | 5 | { |
| 6 | − char d[17+20+1], o[20*UTFmax+1], *s; | |
| 6 | + char d[17+20+1], o[20*UTFmax+1]; | |
| 7 | 7 | |
| 8 | 8 | if(ctx->read(ctx, d, 17+20) != 17+20 || memcmp(d, "Extended Module: ", 17) != 0) |
| 9 | 9 | return -1; |
| 10 | 10 | d[17+20] = 0; |
| 11 | − for(s = d+17; *s == ' '; s++); | |
| 12 | 11 | if(cp437toutf8(o, sizeof(o), d+17, 20) > 0) |
| 13 | 12 | txtcb(ctx, Ttitle, "", o); |
| 14 | 13 | |