M 437.c => 437.c +9 -0
@@ 1,6 1,14 @@
/* https://en.wikipedia.org/wiki/Code_page_437 */
#include "tagspriv.h"
+#ifdef __unix__
+int
+cp437toutf8(char *o, int osz, const char *s, int sz)
+{
+ /* FIXME somebody come up with portable code */
+ return snprint(o, osz, "%.*s", sz, s);
+}
+#else
static Rune rh[] =
L"ΔÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧"
L"ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│d┤╡╢╖╕╣║╗╝╜"
@@ 32,3 40,4 @@ cp437toutf8(char *o, int osz, const char *s, int sz)
*o = 0;
return i;
}
+#endif
M tagspriv.h => tagspriv.h +3 -1
@@ 7,6 7,8 @@
#define snprint snprintf
#define cistrcmp strcasecmp
#define nil NULL
+#define UTFmax 4
+#define nelem(x) (int)(sizeof(x)/sizeof((x)[0]))
typedef unsigned char uchar;
typedef unsigned long long uvlong;
#else
@@ 54,4 56,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);
-#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)
M wav.c => wav.c +3 -3
@@ 1,6 1,6 @@
#include "tagspriv.h"
-#define le16u(d) (u16int)((d)[0] | (d)[1]<<8)
+#define le16u(d) ((d)[0] | (d)[1]<<8)
static struct {
char *s;
@@ 17,10 17,10 @@ static struct {
int
tagwav(Tagctx *ctx)
{
- uchar *d;
int i, n, info;
- u32int csz;
uvlong sz;
+ uchar *d;
+ uint csz;
d = (uchar*)ctx->buf;