Mercurial > audlegacy
changeset 1595:e6cc84e06444 trunk
[svn] - libguess update: workaround for that g_convert can't convert properly from UCS-2BE/LE trailing after BOM.
- remove "alpha test" labels from language selector for encoding detector.
author | yaz |
---|---|
date | Fri, 25 Aug 2006 01:02:18 -0700 |
parents | 44f67f556b60 |
children | 99962a017e0b |
files | ChangeLog audacious/main.c libguess/guess.c |
diffstat | 3 files changed, 48 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Aug 24 23:08:22 2006 -0700 +++ b/ChangeLog Fri Aug 25 01:02:18 2006 -0700 @@ -1,3 +1,12 @@ +2006-08-25 06:08:22 +0000 Yoshiki Yazawa <yaz@cc.rim.or.jp> + revision [2111] + - precision in title format is regarded as character count, not byte count. + + + Changes: Modified: + +11 -2 trunk/libaudacious/titlestring.c + + 2006-08-24 21:55:06 +0000 Tony Vroon <chainsaw@gentoo.org> revision [2109] Additional (PPC?) warning squashing by Joseph Jezak from Gentoo.
--- a/audacious/main.c Thu Aug 24 23:08:22 2006 -0700 +++ b/audacious/main.c Fri Aug 25 01:02:18 2006 -0700 @@ -241,9 +241,9 @@ const gchar *chardet_detector_presets[] = { "None", "Japanese", - "Taiwanese (alpha test)", - "Chinese (alpha test)", - "Korean (alpha test)", + "Taiwanese", + "Chinese", + "Korean", #ifdef HAVE_UDET "Universal" #endif
--- a/libguess/guess.c Thu Aug 24 23:08:22 2006 -0700 +++ b/libguess/guess.c Fri Aug 25 01:02:18 2006 -0700 @@ -47,6 +47,18 @@ #undef PREFER_GB18030 #undef PREFER_JOHAB +/* workaround for that glib's g_convert can't convert properly from UCS-2BE/LE trailing after BOM. */ +#define WITH_G_CONVERT 1 +/* #undef WITH_G_CONVERT */ + +#ifdef WITH_G_CONVERT +const char UCS_2BE[]="UTF-16"; +const char UCS_2LE[]="UTF-16"; +#else +const char UCS_2BE[]="UCS-2BE"; +const char UCS_2LE[]="UCS-2LE"; +#endif + /* data types */ typedef struct guess_arc_rec { unsigned int next; /* next state */ @@ -94,7 +106,7 @@ for (i=0; i<buflen; i++) { int c = (unsigned char)buf[i]; - /* special treatment of jis escape sequence */ + /* special treatment of iso-2022 escape sequence */ if (c == 0x1b) { if (i < buflen-1) { c = (unsigned char)buf[++i]; @@ -106,13 +118,13 @@ if (i==0 && c == 0xff) { if (i < buflen-1) { c = (unsigned char)buf[i+1]; - if (c == 0xfe) return "UCS2-LE"; + if (c == 0xfe) return UCS_2LE; } } if (i==0 && c == 0xfe) { if (i < buflen-1) { c = (unsigned char)buf[i+1]; - if (c == 0xff) return "UCS2-BE"; + if (c == 0xff) return UCS_2BE; } } @@ -177,7 +189,7 @@ for (i=0; i<buflen; i++) { int c = (unsigned char)buf[i]; - /* special treatment of jis escape sequence */ + /* special treatment of iso-2022 escape sequence */ if (c == 0x1b) { if (i < buflen-1) { c = (unsigned char)buf[++i]; @@ -189,13 +201,13 @@ if (i==0 && c == 0xff) { if (i < buflen-1) { c = (unsigned char)buf[i+1]; - if (c == 0xfe) return "UCS2-LE"; + if (c == 0xfe) return UCS_2LE; } } if (i==0 && c == 0xfe) { if (i < buflen-1) { c = (unsigned char)buf[i+1]; - if (c == 0xff) return "UCS2-BE"; + if (c == 0xff) return UCS_2BE; } } @@ -246,7 +258,7 @@ int c = (unsigned char)buf[i]; int c2; - /* special treatment of jis escape sequence */ + /* special treatment of iso-2022 escape sequence */ if (c == 0x1b) { if (i < buflen-1) { c = (unsigned char)buf[i+1]; @@ -255,6 +267,20 @@ } } + /* special treatment of BOM */ + if (i==0 && c == 0xff) { + if (i < buflen-1) { + c = (unsigned char)buf[i+1]; + if (c == 0xfe) return UCS_2LE; + } + } + if (i==0 && c == 0xfe) { + if (i < buflen-1) { + c = (unsigned char)buf[i+1]; + if (c == 0xff) return UCS_2BE; + } + } + if (DFA_ALIVE(gb2312)) { if (!DFA_ALIVE(utf8) && !DFA_ALIVE(gb18030)) return "GB2312"; DFA_NEXT(gb2312, c); @@ -318,7 +344,7 @@ int c = (unsigned char)buf[i]; int c2; - /* special treatment of jis escape sequence */ + /* special treatment of iso-2022 escape sequence */ if (c == 0x1b) { if (i < buflen-1) { c = (unsigned char)buf[i+1]; @@ -331,13 +357,13 @@ if (i==0 && c == 0xff) { if (i < buflen-1) { c = (unsigned char)buf[i+1]; - if (c == 0xfe) return "UCS2-LE"; + if (c == 0xfe) return UCS_2LE; } } if (i==0 && c == 0xfe) { if (i < buflen-1) { c = (unsigned char)buf[i+1]; - if (c == 0xff) return "UCS2-BE"; + if (c == 0xff) return UCS_2BE; } }