diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2007-07-22 18:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2007-07-22 18:00:00 +0200 |
commit | 8849308cf9ad1e85ed1790aa832806ce7f74e565 (patch) | |
tree | 1de7a670996e00aa1572939e24193669745455e0 | |
parent | a9c7f0de90a44ea7c031154d47b092faed74f90b (diff) | |
download | vdr-patch-lnbsharing-8849308cf9ad1e85ed1790aa832806ce7f74e565.tar.gz vdr-patch-lnbsharing-8849308cf9ad1e85ed1790aa832806ce7f74e565.tar.bz2 |
Version 1.5.6vdr-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 Markus Hahn).
- 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).
-rw-r--r-- | CONTRIBUTORS | 14 | ||||
-rw-r--r-- | HISTORY | 23 | ||||
-rw-r--r-- | PLUGINS/src/skincurses/HISTORY | 4 | ||||
-rw-r--r-- | PLUGINS/src/skincurses/skincurses.c | 6 | ||||
-rw-r--r-- | channels.c | 13 | ||||
-rw-r--r-- | channels.h | 3 | ||||
-rw-r--r-- | config.h | 10 | ||||
-rw-r--r-- | device.h | 8 | ||||
-rw-r--r-- | eit.c | 7 | ||||
-rw-r--r-- | i18n.c | 46 | ||||
-rw-r--r-- | libsi/si.c | 6 | ||||
-rw-r--r-- | osd.c | 8 | ||||
-rw-r--r-- | osd.h | 4 | ||||
-rw-r--r-- | player.c | 5 | ||||
-rw-r--r-- | tools.c | 38 | ||||
-rw-r--r-- | tools.h | 11 | ||||
-rw-r--r-- | 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 <rahrenbe@cc.hut.fi> 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 <ralf.klueber@vodafone.com> for reporting a bug in cutting a recording if there is only a single editing mark @@ -1401,6 +1403,8 @@ Marco Schlüßler <marco@lordzodiac.de> 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 <j.schmitz@web.de> for reporting a bug in displaying the current channel when switching via the SVDRP @@ -1419,6 +1423,8 @@ Olaf Henkel <olafhenkel@t-online.de> Martin Dauskardt <md001@gmx.de> 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 <maynard.cedric@wanadoo.fr> for reporting a problem in handling the color button texts in cMenuEditStrItem @@ -1499,6 +1505,8 @@ Udo Richter <udo_richter@gmx.de> 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 <svenk@kammer.uni-hannover.de> for his help in keeping 'channels.conf.terr' up to date @@ -1955,6 +1963,8 @@ Christoph Haubrich <christoph1.haubrich@arcor.de> 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 <pekka.mauno@iki.fi> for fixing cSchedule::GetFollowingEvent() in case there is currently no present @@ -2104,3 +2114,7 @@ Jose Alberto Reguero <jareguero@telefonica.net> Patrice Staudt <staudt@engsystem.net> for adding full weekday names to i18n.c for plugins to use + +Tobias Bratfisch <tobias@reel-multimedia.com> + for improving numdigits(), isnumber() and strreplace() + for suggesting to make skipspace() an inline function @@ -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 <ncurses.h> @@ -11,7 +11,7 @@ #include <vdr/plugin.h> #include <vdr/skins.h> -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) { @@ -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) { @@ -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--; } @@ -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 @@ -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 @@ -8,7 +8,7 @@ * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>. * - * $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) { @@ -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", "ÄåõôÝñá", @@ -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 @@ -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) @@ -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 @@ -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) @@ -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; @@ -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); @@ -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 <getopt.h> @@ -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: |