summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-08-04 02:19:49 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-08-04 02:19:49 +0000
commit877713bf04651d4ddfb7125f6894a85d8889434e (patch)
tree9bbd868f8e6ca1dd5508ec15e3fdbeb7c4fa7f4f /src
parent6abce670c2dc120edb0f5300ae3799408d395c78 (diff)
downloadxine-lib-877713bf04651d4ddfb7125f6894a85d8889434e.tar.gz
xine-lib-877713bf04651d4ddfb7125f6894a85d8889434e.tar.bz2
fallback to no conversion on iconv error
patch by Frantisek Dvorak CVS patchset: 5238 CVS date: 2003/08/04 02:19:49
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/osd.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index 45abf28dd..8c84097d6 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -749,7 +749,6 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
char *inbuf;
uint16_t unicode;
size_t inbytesleft;
- int def_charset_flag = 0;
#ifndef _MSC_VER
iconv_t cd;
@@ -793,26 +792,17 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
if ((encoding = nl_langinfo(CODESET)) == NULL) {
printf(_("osd: can't find out current locale character set\n"));
encoding = "iso-8859-1";
- def_charset_flag = 1;
}
#else
encoding = "iso-8859-1";
- def_charset_flag = 1;
#endif
}
#ifndef _MSC_VER
/* prepare conversion to UCS-2 */
if ((cd = iconv_open("UCS-2", encoding)) == (iconv_t)-1) {
- printf(_("osd: unsupported conversion %s -> UCS-2\n"), encoding);
- if (!def_charset_flag) {
- printf(_("osd: trying iso-8859-1 -> UCS-2\n"));
- if ((cd = iconv_open("UCS-2", "iso-8859-1")) == (iconv_t)-1) {
- printf(_("osd: iconv_open() failed\n"));
- pthread_mutex_unlock(&this->osd_mutex);
- return 0;
- }
- }
+ printf(_("osd: unsupported conversion %s -> UCS-2, "
+ "no conversion performed\n"), encoding);
}
#endif /* _MSC_VER */
@@ -822,16 +812,23 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
size_t count;
#ifndef _MSC_VER
- /* get unicode value */
- count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
- if (count == (size_t)-1 && errno != E2BIG) {
- /* unknown character or character wider than 16 bits, try skip one byte */
- printf(_("osd: unknown sequence starting with byte 0x%02X in encoding \"%s\", skipping\n"),
- inbuf[0] & 0xFF, encoding);
- if (!inbytesleft) break;
- inbytesleft--;
+ if (cd == (iconv_t)-1) {
+ /* direct mapping without iconv */
+ unicode = inbuf[0];
inbuf++;
- unicode = ALIAS_CHARACTER;
+ inbytesleft--;
+ } else {
+ /* get unicode value from iconv */
+ count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
+ if (count == (size_t)-1 && errno != E2BIG) {
+ /* unknown character or character wider than 16 bits, try skip one byte */
+ printf(_("osd: unknown sequence starting with byte 0x%02X"
+ " in encoding \"%s\", skipping\n"), inbuf[0] & 0xFF, encoding);
+ if (!inbytesleft) break;
+ inbytesleft--;
+ inbuf++;
+ unicode = ALIAS_CHARACTER;
+ }
}
#endif /* _MSC_VER */