From e093d4c8a8d6a02404f39501e55009c1eb2f35ff Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 13 Jun 2009 10:26:37 +0200 Subject: Added a plausibility check for the OSD percentage parameters --- HISTORY | 5 ++++- config.c | 14 ++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index b0e05311..176ed0f7 100644 --- a/HISTORY +++ b/HISTORY @@ -6075,7 +6075,7 @@ Video Disk Recorder Revision History - cFrameDetector::Analyze() now syncs on the TS packet sync bytes (thanks to Oliver Endriss for reporting broken index generation after a buffer overflow). -2009-06-01: Version 1.7.8 +2009-06-13: Version 1.7.8 - The name of the function cDevice::GetVideoSize() wasn't very well chosen for its purpose of defining the optimum size of the OSD for the current @@ -6131,3 +6131,6 @@ Video Disk Recorder Revision History Ludwig Nussel). - Fixed calculating menu colum widths in case the font has a size other than the default size (reported by Reinhard Nissl). +- Added a plausibility check for the OSD percentage parameters + to avoid problems in case the values are stored in the setup.conf + file in a wrong way. diff --git a/config.c b/config.c index fe083ea9..df82baaa 100644 --- a/config.c +++ b/config.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 2.4 2009/05/21 11:10:38 kls Exp $ + * $Id: config.c 2.5 2009/06/13 10:25:05 kls Exp $ */ #include "config.h" @@ -20,6 +20,8 @@ // format characters in order to allow any number of blanks after a numeric // value! +#define ChkDoublePlausibility(Variable, Default) { if (Variable < 0.00001) Variable = Default; } + // --- cCommand -------------------------------------------------------------- char *cCommand::result = NULL; @@ -452,8 +454,8 @@ bool cSetup::Parse(const char *Name, const char *Value) else if (!strcasecmp(Name, "ChannelInfoTime")) ChannelInfoTime = atoi(Value); else if (!strcasecmp(Name, "OSDLeftP")) OSDLeftP = atof(Value); else if (!strcasecmp(Name, "OSDTopP")) OSDTopP = atof(Value); - else if (!strcasecmp(Name, "OSDWidthP")) OSDWidthP = atof(Value); - else if (!strcasecmp(Name, "OSDHeightP")) OSDHeightP = atof(Value); + else if (!strcasecmp(Name, "OSDWidthP")) { OSDWidthP = atof(Value); ChkDoublePlausibility(OSDWidthP, 0.87); } + else if (!strcasecmp(Name, "OSDHeightP")) { OSDHeightP = atof(Value); ChkDoublePlausibility(OSDHeightP, 0.84); } else if (!strcasecmp(Name, "OSDLeft")) OSDLeft = atoi(Value); else if (!strcasecmp(Name, "OSDTop")) OSDTop = atoi(Value); else if (!strcasecmp(Name, "OSDWidth")) { OSDWidth = atoi(Value); OSDWidth &= ~0x07; } // OSD width must be a multiple of 8 @@ -465,9 +467,9 @@ bool cSetup::Parse(const char *Name, const char *Value) else if (!strcasecmp(Name, "FontOsd")) Utf8Strn0Cpy(FontOsd, Value, MAXFONTNAME); else if (!strcasecmp(Name, "FontSml")) Utf8Strn0Cpy(FontSml, Value, MAXFONTNAME); else if (!strcasecmp(Name, "FontFix")) Utf8Strn0Cpy(FontFix, Value, MAXFONTNAME); - else if (!strcasecmp(Name, "FontOsdSizeP")) FontOsdSizeP = atof(Value); - else if (!strcasecmp(Name, "FontSmlSizeP")) FontSmlSizeP = atof(Value); - else if (!strcasecmp(Name, "FontFixSizeP")) FontFixSizeP = atof(Value); + else if (!strcasecmp(Name, "FontOsdSizeP")) { FontOsdSizeP = atof(Value); ChkDoublePlausibility(FontOsdSizeP, 0.038); } + else if (!strcasecmp(Name, "FontSmlSizeP")) { FontSmlSizeP = atof(Value); ChkDoublePlausibility(FontSmlSizeP, 0.035); } + else if (!strcasecmp(Name, "FontFixSizeP")) { FontFixSizeP = atof(Value); ChkDoublePlausibility(FontFixSizeP, 0.031); } else if (!strcasecmp(Name, "FontOsdSize")) FontOsdSize = atoi(Value); else if (!strcasecmp(Name, "FontSmlSize")) FontSmlSize = atoi(Value); else if (!strcasecmp(Name, "FontFixSize")) FontFixSize = atoi(Value); -- cgit v1.2.3