From d8d65c7536c2569854483cb8af7cdc94afea9b44 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 23 Dec 2009 15:25:05 +0100 Subject: [PATCH] Modified cCharSetConv so that it can be used to convert from "whatever VDR uses" to a given code --- CONTRIBUTORS | 2 ++ HISTORY | 5 ++++- tools.c | 6 +++--- tools.h | 5 +++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c178a30a..93ede449 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1688,6 +1688,8 @@ Joachim Wilke for reporting a problem with cStatus::MsgOsdTextItem() being called without a text for reporting a missing install-i18n in the install target in the Makefile for adding a missing 'const' to cRecording::FramesPerSecond() + for modifying cCharSetConv so that it can be used to convert from "whatever VDR uses" + to a given code Sascha Klek for reporting a problem with the '0' key in the "Day" item of the "Timers" menu diff --git a/HISTORY b/HISTORY index 6e0e53ba..b15ca417 100644 --- a/HISTORY +++ b/HISTORY @@ -6197,7 +6197,7 @@ Video Disk Recorder Revision History - Fixed the default value for "Pause key handling" in the MANUAL (reported by Diego Pierotto). -2009-12-20: Version 1.7.11 +2009-12-23: Version 1.7.11 - Fixed resetting the file size when regenerating the index file. - The new function cDevice::PatPmtParser() can be used in derived devices to access @@ -6220,3 +6220,6 @@ Video Disk Recorder Revision History - Some fixes to dvbspu.[hc] (thanks to Johann Friedrichs). - Fixed a busy loop when moving editing marks (thanks to Johann Friedrichs). - Updated sources.conf (thanks to Derek Kelly). +- Modified cCharSetConv so that it can be used to convert from "whatever VDR uses" + to a given code (thanks to Joachim Wilke). + diff --git a/tools.c b/tools.c index 683dd080..39c17e2b 100644 --- a/tools.c +++ b/tools.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 2.5 2009/12/06 12:19:56 kls Exp $ + * $Id: tools.c 2.6 2009/12/23 15:12:15 kls Exp $ */ #include "tools.h" @@ -769,10 +769,10 @@ char *cCharSetConv::systemCharacterTable = NULL; cCharSetConv::cCharSetConv(const char *FromCode, const char *ToCode) { if (!FromCode) - FromCode = systemCharacterTable; + FromCode = systemCharacterTable ? systemCharacterTable : "UTF-8"; if (!ToCode) ToCode = "UTF-8"; - cd = (FromCode && ToCode) ? iconv_open(ToCode, FromCode) : (iconv_t)-1; + cd = iconv_open(ToCode, FromCode); result = NULL; length = 0; } diff --git a/tools.h b/tools.h index 4fbb27fb..95c35ff3 100644 --- a/tools.h +++ b/tools.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 2.3 2009/12/06 11:24:12 kls Exp $ + * $Id: tools.h 2.4 2009/12/23 15:14:39 kls Exp $ */ #ifndef __TOOLS_H @@ -142,7 +142,8 @@ private: public: cCharSetConv(const char *FromCode = NULL, const char *ToCode = NULL); ///< Sets up a character set converter to convert from FromCode to ToCode. - ///< If FromCode is NULL, the previously set systemCharacterTable is used. + ///< If FromCode is NULL, the previously set systemCharacterTable is used + ///< (or "UTF-8" if no systemCharacterTable has been set). ///< If ToCode is NULL, "UTF-8" is used. ~cCharSetConv(); const char *Convert(const char *From, char *To = NULL, size_t ToLength = 0);