summaryrefslogtreecommitdiff
path: root/libsi/si.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2020-12-19 14:41:41 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2020-12-19 14:41:41 +0100
commit9a650a47727562cc493e63c8f211179e72def7aa (patch)
treeab308a7aa413e2c0c1f8a366ebf965a669158a1c /libsi/si.c
parentf4739f89bf0eec9cef668b82eb3dfc70a1dc826c (diff)
downloadvdr-9a650a47727562cc493e63c8f211179e72def7aa.tar.gz
vdr-9a650a47727562cc493e63c8f211179e72def7aa.tar.bz2
Fixed convertCharacterTable() in case iconv_open() fails
Diffstat (limited to 'libsi/si.c')
-rw-r--r--libsi/si.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libsi/si.c b/libsi/si.c
index e3d58cac..ee789bb1 100644
--- a/libsi/si.c
+++ b/libsi/si.c
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: si.c 4.2 2020/05/15 11:31:40 kls Exp $
+ * $Id: si.c 4.3 2020/12/19 14:41:41 kls Exp $
* *
***************************************************************************/
@@ -413,6 +413,7 @@ static int Utf8CharLen(const char *s)
size_t convertCharacterTable(const char *from, size_t fromLength, char *to, size_t toLength, const char *fromCode)
{
+ bool converted = false;
char *result = to;
if (SystemCharacterTable && fromCode) {
iconv_t cd = iconv_open(SystemCharacterTable, fromCode);
@@ -433,9 +434,10 @@ size_t convertCharacterTable(const char *from, size_t fromLength, char *to, size
}
*to = 0;
iconv_close(cd);
+ converted = true;
}
}
- else {
+ if (!converted) {
size_t len = fromLength;
if (len >= toLength)
len = toLength - 1;