summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--epg.c15
-rw-r--r--epg.h4
3 files changed, 11 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index 5472efdb..19e6cbe9 100644
--- a/HISTORY
+++ b/HISTORY
@@ -9021,3 +9021,4 @@ Video Disk Recorder Revision History
DVBC_ANNEX_C and DVBC2.
- Added a Status parameter to the interface of cDevice::SignalStats() and
cDvbDevice::SignalStats() (thanks to Rolf Ahrenberg).
+- Fixed handling line numbers in error messages when reading EPG data.
diff --git a/epg.c b/epg.c
index b451fcf7..7cbb0116 100644
--- a/epg.c
+++ b/epg.c
@@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
- * $Id: epg.c 4.5 2017/05/03 08:58:19 kls Exp $
+ * $Id: epg.c 4.6 2017/05/09 12:16:36 kls Exp $
*/
#include "epg.h"
@@ -529,15 +529,14 @@ bool cEvent::Parse(char *s)
return true;
}
-bool cEvent::Read(FILE *f, cSchedule *Schedule)
+bool cEvent::Read(FILE *f, cSchedule *Schedule, int &Line)
{
if (Schedule) {
cEvent *Event = NULL;
char *s;
- int line = 0;
cReadLine ReadLine;
while ((s = ReadLine.Read(f)) != NULL) {
- line++;
+ Line++;
char *t = skipspace(s + 1);
switch (*s) {
case 'E': if (!Event) {
@@ -573,7 +572,7 @@ bool cEvent::Read(FILE *f, cSchedule *Schedule)
case 'c': // to keep things simple we react on 'c' here
return true;
default: if (Event && !Event->Parse(s)) {
- esyslog("ERROR: EPG data problem in line %d", line);
+ esyslog("ERROR: EPG data problem in line %d", Line);
return false;
}
}
@@ -1141,9 +1140,11 @@ void cSchedule::Dump(FILE *f, const char *Prefix, eDumpMode DumpMode, time_t AtT
bool cSchedule::Read(FILE *f, cSchedules *Schedules)
{
if (Schedules) {
+ int Line = 0;
cReadLine ReadLine;
char *s;
while ((s = ReadLine.Read(f)) != NULL) {
+ Line++;
if (*s == 'C') {
s = skipspace(s + 1);
char *p = strchr(s, ' ');
@@ -1153,7 +1154,7 @@ bool cSchedule::Read(FILE *f, cSchedules *Schedules)
tChannelID channelID = tChannelID::FromString(s);
if (channelID.Valid()) {
if (cSchedule *p = Schedules->AddSchedule(channelID)) {
- if (!cEvent::Read(f, p))
+ if (!cEvent::Read(f, p, Line))
return false;
p->Sort();
}
@@ -1165,7 +1166,7 @@ bool cSchedule::Read(FILE *f, cSchedules *Schedules)
}
}
else {
- esyslog("ERROR: unexpected tag while reading EPG data: %s", s);
+ esyslog("ERROR: unexpected tag in line %d while reading EPG data: %s", Line, s);
return false;
}
}
diff --git a/epg.h b/epg.h
index 949cd444..fe536a7d 100644
--- a/epg.h
+++ b/epg.h
@@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
- * $Id: epg.h 4.5 2017/05/09 09:16:29 kls Exp $
+ * $Id: epg.h 4.6 2017/05/09 12:15:14 kls Exp $
*/
#ifndef __EPG_H
@@ -141,7 +141,7 @@ public:
cString ToDescr(void) const;
void Dump(FILE *f, const char *Prefix = "", bool InfoOnly = false) const;
bool Parse(char *s);
- static bool Read(FILE *f, cSchedule *Schedule);
+ static bool Read(FILE *f, cSchedule *Schedule, int &Line);
void FixEpgBugs(void);
};