Added a plausibility check for the OSD percentage parameters

This commit is contained in:
Klaus Schmidinger 2009-06-13 10:26:37 +02:00
parent 82ed7c1723
commit e093d4c8a8
2 changed files with 12 additions and 7 deletions

View File

@ -6075,7 +6075,7 @@ Video Disk Recorder Revision History
- cFrameDetector::Analyze() now syncs on the TS packet sync bytes (thanks to - cFrameDetector::Analyze() now syncs on the TS packet sync bytes (thanks to
Oliver Endriss for reporting broken index generation after a buffer overflow). 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 - 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 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). Ludwig Nussel).
- Fixed calculating menu colum widths in case the font has a size other than the - Fixed calculating menu colum widths in case the font has a size other than the
default size (reported by Reinhard Nissl). 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.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "config.h"
@ -20,6 +20,8 @@
// format characters in order to allow any number of blanks after a numeric // format characters in order to allow any number of blanks after a numeric
// value! // value!
#define ChkDoublePlausibility(Variable, Default) { if (Variable < 0.00001) Variable = Default; }
// --- cCommand -------------------------------------------------------------- // --- cCommand --------------------------------------------------------------
char *cCommand::result = NULL; 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, "ChannelInfoTime")) ChannelInfoTime = atoi(Value);
else if (!strcasecmp(Name, "OSDLeftP")) OSDLeftP = atof(Value); else if (!strcasecmp(Name, "OSDLeftP")) OSDLeftP = atof(Value);
else if (!strcasecmp(Name, "OSDTopP")) OSDTopP = atof(Value); else if (!strcasecmp(Name, "OSDTopP")) OSDTopP = atof(Value);
else if (!strcasecmp(Name, "OSDWidthP")) OSDWidthP = atof(Value); else if (!strcasecmp(Name, "OSDWidthP")) { OSDWidthP = atof(Value); ChkDoublePlausibility(OSDWidthP, 0.87); }
else if (!strcasecmp(Name, "OSDHeightP")) OSDHeightP = atof(Value); else if (!strcasecmp(Name, "OSDHeightP")) { OSDHeightP = atof(Value); ChkDoublePlausibility(OSDHeightP, 0.84); }
else if (!strcasecmp(Name, "OSDLeft")) OSDLeft = atoi(Value); else if (!strcasecmp(Name, "OSDLeft")) OSDLeft = atoi(Value);
else if (!strcasecmp(Name, "OSDTop")) OSDTop = 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 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, "FontOsd")) Utf8Strn0Cpy(FontOsd, Value, MAXFONTNAME);
else if (!strcasecmp(Name, "FontSml")) Utf8Strn0Cpy(FontSml, Value, MAXFONTNAME); else if (!strcasecmp(Name, "FontSml")) Utf8Strn0Cpy(FontSml, Value, MAXFONTNAME);
else if (!strcasecmp(Name, "FontFix")) Utf8Strn0Cpy(FontFix, Value, MAXFONTNAME); else if (!strcasecmp(Name, "FontFix")) Utf8Strn0Cpy(FontFix, Value, MAXFONTNAME);
else if (!strcasecmp(Name, "FontOsdSizeP")) FontOsdSizeP = atof(Value); else if (!strcasecmp(Name, "FontOsdSizeP")) { FontOsdSizeP = atof(Value); ChkDoublePlausibility(FontOsdSizeP, 0.038); }
else if (!strcasecmp(Name, "FontSmlSizeP")) FontSmlSizeP = atof(Value); else if (!strcasecmp(Name, "FontSmlSizeP")) { FontSmlSizeP = atof(Value); ChkDoublePlausibility(FontSmlSizeP, 0.035); }
else if (!strcasecmp(Name, "FontFixSizeP")) FontFixSizeP = atof(Value); else if (!strcasecmp(Name, "FontFixSizeP")) { FontFixSizeP = atof(Value); ChkDoublePlausibility(FontFixSizeP, 0.031); }
else if (!strcasecmp(Name, "FontOsdSize")) FontOsdSize = atoi(Value); else if (!strcasecmp(Name, "FontOsdSize")) FontOsdSize = atoi(Value);
else if (!strcasecmp(Name, "FontSmlSize")) FontSmlSize = atoi(Value); else if (!strcasecmp(Name, "FontSmlSize")) FontSmlSize = atoi(Value);
else if (!strcasecmp(Name, "FontFixSize")) FontFixSize = atoi(Value); else if (!strcasecmp(Name, "FontFixSize")) FontFixSize = atoi(Value);