Fixed convertCharacterTable() in case iconv_open() fails

This commit is contained in:
Klaus Schmidinger 2020-12-19 14:41:41 +01:00
parent f4739f89bf
commit 9a650a4772
2 changed files with 6 additions and 3 deletions

View File

@ -9536,7 +9536,7 @@ Video Disk Recorder Revision History
cDvbTuner::GetSignalStats() to avoid problems with drivers that don't do this
(thanks to Helmut Binder).
2020-12-18:
2020-12-19:
- Fixed multiple recording entries in case a recording is started during the initial
reading of the video directory (reported by Claus Muus).
@ -9560,3 +9560,4 @@ Video Disk Recorder Revision History
- Fixed initializing tmpbuf in ExtendedEventDescriptors::getText() (thanks to Helmut
Binder).
- Fixed a compiler warning (thanks to Winfried Köhler).
- Fixed convertCharacterTable() in case iconv_open() fails (thanks to Helmut Binder).

View File

@ -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;