1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed handling empty strings in cSource::FromString()

This commit is contained in:
Klaus Schmidinger 2010-02-28 15:18:31 +01:00
parent 9424ab26a6
commit 44fdf30170
3 changed files with 39 additions and 33 deletions

View File

@ -6383,3 +6383,7 @@ Video Disk Recorder Revision History
- The option "Setup/DVB/Use Dolby Digital" now only controls whether Dolby Digital - The option "Setup/DVB/Use Dolby Digital" now only controls whether Dolby Digital
tracks appear in the "Audio" menu. Dolby Digital is always recorded. tracks appear in the "Audio" menu. Dolby Digital is always recorded.
This obsoletes the DOLBYINREC patch. This obsoletes the DOLBYINREC patch.
2010-02-28: Version 1.7.14
- Fixed handling empty strings in cSource::FromString().

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.h 2.22 2010/02/05 15:38:32 kls Exp $ * $Id: config.h 2.23 2010/02/28 15:18:31 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -22,13 +22,13 @@
// VDR's own version number: // VDR's own version number:
#define VDRVERSION "1.7.13" #define VDRVERSION "1.7.14"
#define VDRVERSNUM 10713 // Version * 10000 + Major * 100 + Minor #define VDRVERSNUM 10714 // Version * 10000 + Major * 100 + Minor
// The plugin API's version number: // The plugin API's version number:
#define APIVERSION "1.7.13" #define APIVERSION "1.7.14"
#define APIVERSNUM 10713 // Version * 10000 + Major * 100 + Minor #define APIVERSNUM 10714 // Version * 10000 + Major * 100 + Minor
// When loading plugins, VDR searches them by their APIVERSION, which // When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to // may be smaller than VDRVERSION in case there have been no changes to

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: sources.c 2.1 2010/02/28 12:00:31 kls Exp $ * $Id: sources.c 2.2 2010/02/28 15:15:39 kls Exp $
*/ */
#include "sources.h" #include "sources.h"
@ -55,35 +55,37 @@ cString cSource::ToString(int Code)
int cSource::FromString(const char *s) int cSource::FromString(const char *s)
{ {
if ('A' <= *s && *s <= 'Z') { if (!isempty(s)) {
int code = int(*s) << 24; if ('A' <= *s && *s <= 'Z') {
if (code == stSat) { int code = int(*s) << 24;
int pos = 0; if (code == stSat) {
bool dot = false; int pos = 0;
bool neg = false; bool dot = false;
while (*++s) { bool neg = false;
switch (*s) { while (*++s) {
case '0' ... '9': pos *= 10; switch (*s) {
pos += *s - '0'; case '0' ... '9': pos *= 10;
break; pos += *s - '0';
case '.': dot = true; break;
break; case '.': dot = true;
case 'E': neg = true; // fall through to 'W' break;
case 'W': if (!dot) case 'E': neg = true; // fall through to 'W'
pos *= 10; case 'W': if (!dot)
break; pos *= 10;
default: esyslog("ERROR: unknown source character '%c'", *s); break;
return stNone; default: esyslog("ERROR: unknown source character '%c'", *s);
} return stNone;
} }
if (neg) }
pos = -pos; if (neg)
code |= (pos & st_Pos); pos = -pos;
code |= (pos & st_Pos);
}
return code;
} }
return code; else
esyslog("ERROR: unknown source key '%c'", *s);
} }
else
esyslog("ERROR: unknown source key '%c'", *s);
return stNone; return stNone;
} }