From 8849308cf9ad1e85ed1790aa832806ce7f74e565 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 22 Jul 2007 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.5.6=20-=20Fixed=20a=20buffer=20overflow=20i?= =?UTF-8?q?n=20initializing=20the=20system=20character=20table=20(thanks?= =?UTF-8?q?=20=20=20to=20Marco=20Schl=C3=BC=C3=9Fler).=20-=20Updated=20the?= =?UTF-8?q?=20Russian=20OSD=20texts=20(thanks=20to=20Oleg=20Roitburd).=20-?= =?UTF-8?q?=20Fixed=20handling=20single=20byte=20characters=20>0x7F=20in?= =?UTF-8?q?=20Utf8ToArray()=20(thanks=20to=20Udo=20=20=20Richter).=20-=20I?= =?UTF-8?q?mproved=20numdigits(),=20isnumber()=20and=20strreplace()=20(tha?= =?UTF-8?q?nks=20to=20Tobias=20Bratfisch).=20-=20Fixed=20clearing=20color?= =?UTF-8?q?=20buttons=20in=20the=20'curses'=20skin=20(thanks=20to=20Udo=20?= =?UTF-8?q?Richter).=20-=20Fixed=20a=20typo=20in=20the=20function=20name?= =?UTF-8?q?=20of=20cOsd::SetOsdPosition()=20and=20added=20a=20range=20=20?= =?UTF-8?q?=20check=20to=20it=20(thanks=20to=20Christoph=20Haubrich).=20-?= =?UTF-8?q?=20Updated=20the=20Finnish=20OSD=20texts=20(thanks=20to=20Rolf?= =?UTF-8?q?=20Ahrenberg).=20-=20Improved=20cControl::Launch()=20to=20keep?= =?UTF-8?q?=20'control'=20from=20pointing=20to=20uninitialized=20=20=20mem?= =?UTF-8?q?ory=20(thanks=20to=20Rolf=20Ahrenberg).=20-=20Made=20skipspace(?= =?UTF-8?q?)=20an=20inline=20function=20(suggested=20by=20Tobias=20Bratfis?= =?UTF-8?q?ch)=20and=20changed=20=20=20it=20to=20handle=20the=20most=20com?= =?UTF-8?q?mon=20case=20of=20'no=20leading=20space'=20very=20fast,=20and?= =?UTF-8?q?=20avoid=20=20=20calling=20isspace(),=20which=20made=20the=20wh?= =?UTF-8?q?ole=20function=20a=20lot=20faster.=20-=20Fixed=20detection=20of?= =?UTF-8?q?=20Premiere=20NVOD=20channel=20links=20(thanks=20to=20Markus=20?= =?UTF-8?q?Hahn).=20-=20Added=20a=20table=20of=20the=20used=20trick=20spee?= =?UTF-8?q?d=20values=20to=20the=20description=20of=20=20=20cDevice::Trick?= =?UTF-8?q?Speed()=20(suggested=20by=20Martin=20Dauskardt).=20-=20Added=20?= =?UTF-8?q?a=20missing=20'P'=20to=20vdr.c's=20SHUTDOWNCANCELROMPT=20macro?= =?UTF-8?q?=20(reported=20by=20Marco=20=20=20Schl=C3=BC=C3=9Fler).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTORS | 14 +++++++++++ HISTORY | 23 +++++++++++++++++++ PLUGINS/src/skincurses/HISTORY | 4 ++++ PLUGINS/src/skincurses/skincurses.c | 6 ++--- channels.c | 13 ++++++++++- channels.h | 3 ++- config.h | 10 ++++---- device.h | 8 ++++++- eit.c | 7 ++++-- i18n.c | 46 ++++++++++++++++++------------------- libsi/si.c | 6 ++--- osd.c | 8 +++---- osd.h | 4 ++-- player.c | 5 ++-- tools.c | 38 ++++++++++++++---------------- tools.h | 11 +++++++-- vdr.c | 36 ++++++++++++++--------------- 17 files changed, 153 insertions(+), 89 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 30abdf9..7a4daaa 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1015,6 +1015,8 @@ Rolf Ahrenberg the plugins for increasing the maximum number of DVB devices to 8 for suggesting to change the parameter "OSD font" to "Default font" in "Setup/OSD" + for improving cControl::Launch() to keep 'control' from pointing to uninitialized + memory Ralf Klueber for reporting a bug in cutting a recording if there is only a single editing mark @@ -1401,6 +1403,8 @@ Marco Schl for removing 'assert(0)' from cDvbSpuDecoder::setTime() for adapting 'libsi' to DVB-S2 for fixing handling ChannelUp/Down keys if there is currently a replay running + for fixing a buffer overflow in initializing the system character table + for reporting a missing 'P' in vdr.c's SHUTDOWNCANCELROMPT macro Jќrgen Schmitz for reporting a bug in displaying the current channel when switching via the SVDRP @@ -1419,6 +1423,8 @@ Olaf Henkel Martin Dauskardt for reporting a problem with switching channels while an encrypted channel is being recorded + for suggesting to add a table of the used trick speed values to the description of + cDevice::TrickSpeed() Maynard Cedric for reporting a problem in handling the color button texts in cMenuEditStrItem @@ -1499,6 +1505,8 @@ Udo Richter for making the HUP signal force a restart of VDR for fixing a race condition with signal handlers at program exit for fixing handling detached processes in SystemExec() + for fixing handling single byte characters >0x7F in Utf8ToArray() + for fixing clearing color buttons in the 'curses' skin Sven Kreiensen for his help in keeping 'channels.conf.terr' up to date @@ -1955,6 +1963,8 @@ Christoph Haubrich calling "vdr --help" for fixing cDevice::ToggleMute() for suggestions that led to implementing cOsd::SetOsdPosition() etc. + for fixing a typo in the function name of cOsd::SetOsdPosition() and adding a range + check to it Pekka Mauno for fixing cSchedule::GetFollowingEvent() in case there is currently no present @@ -2104,3 +2114,7 @@ Jose Alberto Reguero Patrice Staudt for adding full weekday names to i18n.c for plugins to use + +Tobias Bratfisch + for improving numdigits(), isnumber() and strreplace() + for suggesting to make skipspace() an inline function diff --git a/HISTORY b/HISTORY index 6168579..a4d0c2d 100644 --- a/HISTORY +++ b/HISTORY @@ -5275,3 +5275,26 @@ Video Disk Recorder Revision History - Fixed stripping i18n stuff from font names (reported by Anssi Hannula). - Improved performance of the SVDRP commands LSTC and CHAN when used with a channel name. + +2007-07-22: Version 1.5.6 + +- Fixed a buffer overflow in initializing the system character table (thanks + to Marco Schlќпler). +- Updated the Russian OSD texts (thanks to Oleg Roitburd). +- Fixed handling single byte characters >0x7F in Utf8ToArray() (thanks to Udo + Richter). +- Improved numdigits(), isnumber() and strreplace() (thanks to Tobias Bratfisch). +- Fixed clearing color buttons in the 'curses' skin (thanks to Udo Richter). +- Fixed a typo in the function name of cOsd::SetOsdPosition() and added a range + check to it (thanks to Christoph Haubrich). +- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). +- Improved cControl::Launch() to keep 'control' from pointing to uninitialized + memory (thanks to Rolf Ahrenberg). +- Made skipspace() an inline function (suggested by Tobias Bratfisch) and changed + it to handle the most common case of 'no leading space' very fast, and avoid + calling isspace(), which made the whole function a lot faster. +- Fixed detection of Premiere NVOD channel links (thanks to anonymous). +- Added a table of the used trick speed values to the description of + cDevice::TrickSpeed() (suggested by Martin Dauskardt). +- Added a missing 'P' to vdr.c's SHUTDOWNCANCELROMPT macro (reported by Marco + Schlќпler). diff --git a/PLUGINS/src/skincurses/HISTORY b/PLUGINS/src/skincurses/HISTORY index 8e34bc8..60f4839 100644 --- a/PLUGINS/src/skincurses/HISTORY +++ b/PLUGINS/src/skincurses/HISTORY @@ -47,3 +47,7 @@ VDR Plugin 'skincurses' Revision History 2007-06-23: Version 0.1.1 - Fixed a name clash with the new cOsd position functions. + +2007-07-20: Version 0.1.2 + +- Fixed clearing color buttons. diff --git a/PLUGINS/src/skincurses/skincurses.c b/PLUGINS/src/skincurses/skincurses.c index fd20b4d..9324210 100644 --- a/PLUGINS/src/skincurses/skincurses.c +++ b/PLUGINS/src/skincurses/skincurses.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: skincurses.c 1.14 2007/06/23 09:08:01 kls Exp $ + * $Id: skincurses.c 1.15 2007/07/20 14:45:07 kls Exp $ */ #include @@ -11,7 +11,7 @@ #include #include -static const char *VERSION = "0.1.1"; +static const char *VERSION = "0.1.2"; static const char *DESCRIPTION = "A text only skin"; static const char *MAINMENUENTRY = NULL; @@ -133,8 +133,6 @@ void cCursesOsd::RestoreRegion(void) void cCursesOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment) { - if (!s) - return; int w = Font->Width(s); int h = Font->Height(); if (Width || Height) { diff --git a/channels.c b/channels.c index 67cf3c9..d725ac7 100644 --- a/channels.c +++ b/channels.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 1.53 2006/05/28 15:03:40 kls Exp $ + * $Id: channels.c 1.54 2007/07/21 14:55:01 kls Exp $ */ #include "channels.h" @@ -1007,6 +1007,17 @@ cChannel *cChannels::GetByChannelID(tChannelID ChannelID, bool TryWithoutRid, bo } return NULL; } +cChannel *cChannels::GetByTransponderID(tChannelID ChannelID) +{ + int source = ChannelID.Source(); + int nid = ChannelID.Nid(); + int tid = ChannelID.Tid(); + for (cChannel *channel = First(); channel; channel = Next(channel)) { + if (channel->Tid() == tid && channel->Nid() == nid && channel->Source() == source) + return channel; + } + return NULL; +} bool cChannels::HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel) { diff --git a/channels.h b/channels.h index 143bb47..6381a20 100644 --- a/channels.h +++ b/channels.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.h 1.43 2007/01/05 10:37:35 kls Exp $ + * $Id: channels.h 1.44 2007/07/21 14:58:36 kls Exp $ */ #ifndef __CHANNELS_H @@ -239,6 +239,7 @@ public: cChannel *GetByNumber(int Number, int SkipGap = 0); cChannel *GetByServiceID(int Source, int Transponder, unsigned short ServiceID); cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false, bool TryWithoutPolarization = false); + cChannel *GetByTransponderID(tChannelID ChannelID); int BeingEdited(void) { return beingEdited; } void IncBeingEdited(void) { beingEdited++; } void DecBeingEdited(void) { beingEdited--; } diff --git a/config.h b/config.h index aa4cfe8..edc5123 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.292 2007/06/23 09:06:24 kls Exp $ + * $Id: config.h 1.294 2007/07/20 14:52:05 kls Exp $ */ #ifndef __CONFIG_H @@ -22,13 +22,13 @@ // VDR's own version number: -#define VDRVERSION "1.5.5" -#define VDRVERSNUM 10505 // Version * 10000 + Major * 100 + Minor +#define VDRVERSION "1.5.6" +#define VDRVERSNUM 10506 // Version * 10000 + Major * 100 + Minor // The plugin API's version number: -#define APIVERSION "1.5.5" -#define APIVERSNUM 10505 // Version * 10000 + Major * 100 + Minor +#define APIVERSION "1.5.6" +#define APIVERSNUM 10506 // Version * 10000 + Major * 100 + Minor // When loading plugins, VDR searches them by their APIVERSION, which // may be smaller than VDRVERSION in case there have been no changes to diff --git a/device.h b/device.h index 60dc73e..e74c884 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.81 2007/01/13 11:33:57 kls Exp $ + * $Id: device.h 1.82 2007/07/22 11:20:13 kls Exp $ */ #ifndef __DEVICE_H @@ -468,6 +468,12 @@ public: ///< Sets the device into a mode where replay is done slower. ///< Every single frame shall then be displayed the given number of ///< times. + ///< The cDvbPlayer uses the following values for the various speeds: + ///< 1x 2x 3x + ///< Fast Forward 6 3 1 + ///< Fast Reverse 6 3 1 + ///< Slow Forward 8 4 2 + ///< Slow Reverse 63 48 24 virtual void Clear(void); ///< Clears all video and audio data from the device. ///< A derived class must call the base class function to make sure diff --git a/eit.c b/eit.c index e1e47f4..cc2d086 100644 --- a/eit.c +++ b/eit.c @@ -8,7 +8,7 @@ * Robert Schneider and Rolf Hakenes . * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg . * - * $Id: eit.c 1.123 2007/06/10 12:51:05 kls Exp $ + * $Id: eit.c 1.124 2007/07/21 14:58:04 kls Exp $ */ #include "eit.h" @@ -197,7 +197,10 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo link->SetName(linkName, "", ""); } else if (Setup.UpdateChannels >= 4) { - link = Channels.NewChannel(channel, linkName, "", "", ld->getOriginalNetworkId(), ld->getTransportStreamId(), ld->getServiceId()); + cChannel *transponder = channel; + if (channel->Tid() != ld->getTransportStreamId()) + channel = Channels.GetByTransponderID(linkID); + link = Channels.NewChannel(transponder, linkName, "", "", ld->getOriginalNetworkId(), ld->getTransportStreamId(), ld->getServiceId()); //XXX patFilter->Trigger(); } if (link) { diff --git a/i18n.c b/i18n.c index 22aae61..db784ca 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.300 2007/06/23 13:28:32 kls Exp $ + * $Id: i18n.c 1.302 2007/07/20 15:04:37 kls Exp $ * * Translations provided by: * @@ -1415,7 +1415,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "Процесс монтажа - действительно перезапустить?", "",//TODO "",//TODO "",//TODO @@ -1506,7 +1506,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "Нажмите любую кнопку для отмены перезагрузки", "",//TODO "",//TODO "",//TODO @@ -1528,7 +1528,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "VDR выключится позже - нажмите Power для ускорения", "",//TODO "",//TODO "",//TODO @@ -1550,7 +1550,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "VDR выключится через %s минут", "",//TODO "",//TODO "",//TODO @@ -1572,7 +1572,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "Идет монтаж - действительно выключить?", "",//TODO "",//TODO "",//TODO @@ -1594,7 +1594,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "Plugin %s проснется через %ld минут - продолжить?", "",//TODO "",//TODO "",//TODO @@ -2861,7 +2861,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "CAM используется - действительно перегрузить?", "",//TODO "",//TODO "",//TODO @@ -2906,7 +2906,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "CAM перегружен", "",//TODO "",//TODO "",//TODO @@ -2928,7 +2928,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "CAM присутствует", "",//TODO "",//TODO "",//TODO @@ -2950,7 +2950,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "CAM готов", "",//TODO "",//TODO "",//TODO @@ -2972,7 +2972,7 @@ const tI18nPhrase Phrases[] = { "",//TODO "",//TODO "",//TODO - "",//TODO + "CAM не отвечает", "",//TODO "",//TODO "",//TODO @@ -3341,7 +3341,7 @@ const tI18nPhrase Phrases[] = { "Temу", "Tщma", "",// TODO - "Палитра", + "Тема", "Tema", "Teema", "Tema", @@ -3525,7 +3525,7 @@ const tI18nPhrase Phrases[] = { "dep. de skin", "Menќ nщzetщtѕl fќggѕen", "",// TODO - "согласно теме", + "согласно стиля", "ovisno o povrЙini", "kestast sѕltuv", "skin afhцngig", @@ -3571,7 +3571,7 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO "",// TODO - "",// TODO + "Сглаживание шрифтов", "",// TODO "",// TODO "",// TODO @@ -3594,7 +3594,7 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO "",// TODO - "",// TODO + "Стандартный фонт", "",// TODO "",// TODO "",// TODO @@ -3617,7 +3617,7 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO "",// TODO - "",// TODO + "Мелкий фонт", "",// TODO "",// TODO "",// TODO @@ -3640,7 +3640,7 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO "",// TODO - "",// TODO + "Фиксированный фонт", "",// TODO "",// TODO "",// TODO @@ -3663,7 +3663,7 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO "",// TODO - "",// TODO + "Размер фонта для меню (pixel)", "",// TODO "",// TODO "",// TODO @@ -3686,7 +3686,7 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO "",// TODO - "",// TODO + "Размер мелкого фонта (pixel)", "",// TODO "",// TODO "",// TODO @@ -3709,7 +3709,7 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO "",// TODO - "",// TODO + "Размер фиксированного фонта (pixel)", "",// TODO "",// TODO "",// TODO @@ -5020,7 +5020,7 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO "",// TODO - "",// TODO + "Предел времени для ввода канала (ms)", "",// TODO "",// TODO "",// TODO @@ -5150,7 +5150,7 @@ const tI18nPhrase Phrases[] = { "Segunda", "Lundi", "Manday", - "maanantai", + "Maanantai", "poniedziaГek", "Lunes", "Фхѕєнёс", diff --git a/libsi/si.c b/libsi/si.c index 8895090..c75f19a 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 1.21 2007/06/15 13:08:31 kls Exp $ + * $Id: si.c 1.22 2007/07/21 13:49:48 kls Exp $ * * ***************************************************************************/ @@ -287,7 +287,7 @@ static const char *CharacterTables1[] = { #define SingleByteLimit 0x0B static const char *CharacterTables2[] = { - NULL, // 0x00 + NULL, // 0x00 "ISO-8859-1", // 0x01 "ISO-8859-2", // 0x02 "ISO-8859-3", // 0x03 @@ -299,7 +299,7 @@ static const char *CharacterTables2[] = { "ISO-8859-9", // 0x09 "ISO-8859-10", // 0x0A "ISO-8859-11", // 0x0B - NULL, // 0x0C + NULL, // 0x0C "ISO-8859-13", // 0x0D "ISO-8859-14", // 0x0E "ISO-8859-15", // 0x0F diff --git a/osd.c b/osd.c index 188ee9d..c60518c 100644 --- a/osd.c +++ b/osd.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.c 1.70 2007/06/17 13:54:34 kls Exp $ + * $Id: osd.c 1.71 2007/07/20 14:51:36 kls Exp $ */ #include "osd.h" @@ -668,12 +668,12 @@ cOsd::~cOsd() isOpen--; } -void cOsd::SetOsdPostion(int Left, int Top, int Width, int Height) +void cOsd::SetOsdPosition(int Left, int Top, int Width, int Height) { osdLeft = Left; osdTop = Top; - osdWidth = Width; - osdHeight = Height; + osdWidth = min(max(Width, MINOSDWIDTH), MAXOSDWIDTH); + osdHeight = min(max(Height, MINOSDHEIGHT), MAXOSDHEIGHT); } void cOsd::SetAntiAliasGranularity(uint FixedColors, uint BlendColors) diff --git a/osd.h b/osd.h index 0753058..08bc418 100644 --- a/osd.h +++ b/osd.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.h 1.55 2007/06/17 13:59:22 kls Exp $ + * $Id: osd.h 1.56 2007/07/20 14:50:17 kls Exp $ */ #ifndef __OSD_H @@ -276,7 +276,7 @@ public: static int OsdTop(void) { return osdTop ? osdTop : Setup.OSDTop; } static int OsdWidth(void) { return osdWidth ? osdWidth : Setup.OSDWidth; } static int OsdHeight(void) { return osdHeight ? osdHeight : Setup.OSDHeight; } - static void SetOsdPostion(int Left, int Top, int Width, int Height); + static void SetOsdPosition(int Left, int Top, int Width, int Height); ///< Sets the position and size of the OSD to the given values. ///< This may be useful for plugins that determine the scaling of the ///< video image and need to scale the OSD accordingly to fit on the diff --git a/player.c b/player.c index f293020..c96fc1a 100644 --- a/player.c +++ b/player.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: player.c 1.11 2006/01/06 11:30:07 kls Exp $ + * $Id: player.c 1.12 2007/07/20 15:25:24 kls Exp $ */ #include "player.h" @@ -69,8 +69,9 @@ cControl *cControl::Control(void) void cControl::Launch(cControl *Control) { cMutexLock MutexLock(&mutex); - delete control; + cControl *c = control; // keeps control from pointing to uninitialized memory control = Control; + delete c; } void cControl::Attach(void) diff --git a/tools.c b/tools.c index edff762..0d471bb 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 1.130 2007/06/23 13:38:30 kls Exp $ + * $Id: tools.c 1.134 2007/07/21 13:02:45 kls Exp $ */ #include "tools.h" @@ -158,21 +158,15 @@ char *strreplace(char *s, const char *s1, const char *s2) int l1 = strlen(s1); int l2 = strlen(s2); if (l2 > l1) - s = (char *)realloc(s, strlen(s) + l2 - l1 + 1); + s = (char *)realloc(s, l + l2 - l1 + 1); + char *sof = s + of; if (l2 != l1) - memmove(s + of + l2, s + of + l1, l - of - l1 + 1); - strncpy(s + of, s2, l2); + memmove(sof + l2, sof + l1, l - of - l1 + 1); + strncpy(sof, s2, l2); } return s; } -char *skipspace(const char *s) -{ - while (*s && isspace(*s)) - s++; - return (char *)s; -} - char *stripspace(char *s) { if (s && *s) { @@ -252,20 +246,22 @@ bool isempty(const char *s) int numdigits(int n) { - char buf[16]; - snprintf(buf, sizeof(buf), "%d", n); - return strlen(buf); + int res = 1; + while (n >= 10) { + n /= 10; + res++; + } + return res; } bool isnumber(const char *s) { if (!*s) return false; - while (*s) { - if (!isdigit(*s)) - return false; - s++; - } + do { + if (!isdigit(*s)) + return false; + } while (*++s); return true; } @@ -685,7 +681,7 @@ int Utf8ToArray(const char *s, uint *a, int Size) int n = 0; while (*s && --Size > 0) { if (cCharSetConv::SystemCharacterTable()) - *a++ = *s++; + *a++ = (uchar)(*s++); else { int sl = Utf8CharLen(s); *a++ = Utf8CharGet(s, sl); @@ -756,7 +752,7 @@ void cCharSetConv::SetSystemCharacterTable(const char *CharacterTable) char buf[129]; for (int i = 0; i < 128; i++) buf[i] = i + 128; - buf[129] = 0; + buf[128] = 0; cCharSetConv csc(CharacterTable); const char *s = csc.Convert(buf); int i = 0; diff --git a/tools.h b/tools.h index fc9c87b..a0c5a52 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 1.103 2007/06/23 13:34:28 kls Exp $ + * $Id: tools.h 1.104 2007/07/21 13:35:45 kls Exp $ */ #ifndef __TOOLS_H @@ -173,7 +173,14 @@ char *strcpyrealloc(char *dest, const char *src); char *strn0cpy(char *dest, const char *src, size_t n); char *strreplace(char *s, char c1, char c2); char *strreplace(char *s, const char *s1, const char *s2); ///< re-allocates 's' and deletes the original string if necessary! -char *skipspace(const char *s); +inline char *skipspace(const char *s) +{ + if (*s > ' ') // most strings don't have any leading space, so handle this case as fast as possible + return (char *)s; + while (*s && *s <= ' ') // avoiding isspace() here, because it is much slower + s++; + return (char *)s; +} char *stripspace(char *s); char *compactspace(char *s); cString strescape(const char *s, const char *chars); diff --git a/vdr.c b/vdr.c index e28c728..54814a7 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/vdr * - * $Id: vdr.c 1.293 2007/06/17 11:23:08 kls Exp $ + * $Id: vdr.c 1.294 2007/07/22 11:40:01 kls Exp $ */ #include @@ -65,22 +65,22 @@ #include "transfer.h" #include "videodir.h" -#define MINCHANNELWAIT 10 // seconds to wait between failed channel switchings -#define ACTIVITYTIMEOUT 60 // seconds before starting housekeeping -#define SHUTDOWNWAIT 300 // seconds to wait in user prompt before automatic shutdown -#define SHUTDOWNRETRY 360 // seconds before trying again to shut down -#define SHUTDOWNFORCEPROMPT 5 // seconds to wait in user prompt to allow forcing shutdown -#define SHUTDOWNCANCELROMPT 5 // seconds to wait in user prompt to allow canceling shutdown -#define RESTARTCANCELPROMPT 5 // seconds to wait in user prompt before restarting on SIGHUP -#define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start -#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications -#define DEVICEREADYTIMEOUT 30 // seconds to wait until all devices are ready -#define MENUTIMEOUT 120 // seconds of user inactivity after which an OSD display is closed -#define TIMERCHECKDELTA 10 // seconds between checks for timers that need to see their channel -#define TIMERDEVICETIMEOUT 8 // seconds before a device used for timer check may be reused -#define TIMERLOOKAHEADTIME 60 // seconds before a non-VPS timer starts and the channel is switched if possible -#define VPSLOOKAHEADTIME 24 // hours within which VPS timers will make sure their events are up to date -#define VPSUPTODATETIME 3600 // seconds before the event or schedule of a VPS timer needs to be refreshed +#define MINCHANNELWAIT 10 // seconds to wait between failed channel switchings +#define ACTIVITYTIMEOUT 60 // seconds before starting housekeeping +#define SHUTDOWNWAIT 300 // seconds to wait in user prompt before automatic shutdown +#define SHUTDOWNRETRY 360 // seconds before trying again to shut down +#define SHUTDOWNFORCEPROMPT 5 // seconds to wait in user prompt to allow forcing shutdown +#define SHUTDOWNCANCELPROMPT 5 // seconds to wait in user prompt to allow canceling shutdown +#define RESTARTCANCELPROMPT 5 // seconds to wait in user prompt before restarting on SIGHUP +#define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start +#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications +#define DEVICEREADYTIMEOUT 30 // seconds to wait until all devices are ready +#define MENUTIMEOUT 120 // seconds of user inactivity after which an OSD display is closed +#define TIMERCHECKDELTA 10 // seconds between checks for timers that need to see their channel +#define TIMERDEVICETIMEOUT 8 // seconds before a device used for timer check may be reused +#define TIMERLOOKAHEADTIME 60 // seconds before a non-VPS timer starts and the channel is switched if possible +#define VPSLOOKAHEADTIME 24 // hours within which VPS timers will make sure their events are up to date +#define VPSUPTODATETIME 3600 // seconds before the event or schedule of a VPS timer needs to be refreshed #define EXIT(v) { ShutdownHandler.Exit(v); goto Exit; } @@ -1037,7 +1037,7 @@ int main(int argc, char *argv[]) break; } // Ask the final question: - if (!Interface->Confirm(tr("Press any key to cancel shutdown"), SHUTDOWNCANCELROMPT, true)) + if (!Interface->Confirm(tr("Press any key to cancel shutdown"), SHUTDOWNCANCELPROMPT, true)) // If final question was canceled, continue to be active: break; // Ok, now call the shutdown script: -- cgit v1.2.3