From 0cfcbe2bf6531b70c7213dbb4893d6333b61e7ed Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Sun, 5 Jan 2014 17:49:52 +0100 Subject: invalid cuesheet lines are replaced with placeholders; added shift-jis recoding to cuesheet parser --- junklib.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'junklib.c') diff --git a/junklib.c b/junklib.c index b4962c2d..1c57ba6e 100644 --- a/junklib.c +++ b/junklib.c @@ -483,7 +483,7 @@ junk_iconv (const char *in, int inlen, char *out, int outlen, const char *cs_in, int err = errno; iconv_close (cd); - //trace ("iconv -f %s -t %s '%s': returned %d, inbytes %d/%d, outbytes %d/%d, errno=%d\n", cs_in, cs_out, in, res, inlen, inbytesleft, outlen, outbytesleft, err); + //trace ("iconv -f %s -t %s '%s': returned %d, inbytes %d/%d, outbytes %d/%d, errno=%d\n", cs_in, cs_out, in, (int)res, inlen, (int)inbytesleft, outlen, (int)outbytesleft, err); if (res == -1) { return -1; } @@ -3522,18 +3522,21 @@ junk_id3v2_read (playItem_t *it, DB_FILE *fp) { const char * junk_detect_charset (const char *s) { + size_t len = strlen (s); + // check if that's already utf8 - if (u8_valid (s, strlen (s), NULL)) { + if (u8_valid (s, len, NULL)) { return NULL; // means no recoding required } // hack to add cp936 support - if (can_be_chinese (s, strlen (s))) { + if (can_be_chinese (s, len)) { return "cp936"; } // check if that could be non-latin1 (too many nonascii chars) - if (can_be_russian (s, strlen (s))) { + if (can_be_russian (s, len)) { return "cp1251"; } + return "cp1252"; } -- cgit v1.2.3