summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--config.h4
-rw-r--r--eit.c89
-rw-r--r--eit.h8
-rw-r--r--tools.c15
-rw-r--r--tools.h3
6 files changed, 48 insertions, 72 deletions
diff --git a/HISTORY b/HISTORY
index e0546753..c50dea72 100644
--- a/HISTORY
+++ b/HISTORY
@@ -773,3 +773,4 @@ Video Disk Recorder Revision History
- Supplying the new frontend parameter 'Inversion' (currently it is always
set to INVERSION_AUTO, which should work with all channels on Astra).
- Removing unnecessary double quotes from EPG Subtitle in EPGBugfixLevel >=1.
+- EPG info is now updated if the contents changes but the ID remains the same.
diff --git a/config.h b/config.h
index 194d04e2..62d198a2 100644
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.h 1.79 2001/09/16 14:54:36 kls Exp $
+ * $Id: config.h 1.80 2001/09/22 13:00:04 kls Exp $
*/
#ifndef __CONFIG_H
@@ -19,7 +19,7 @@
#include "eit.h"
#include "tools.h"
-#define VDRVERSION "0.95"
+#define VDRVERSION "0.96"
#define MAXPRIORITY 99
#define MAXLIFETIME 99
diff --git a/eit.c b/eit.c
index 70f56e9e..1fceeef1 100644
--- a/eit.c
+++ b/eit.c
@@ -16,7 +16,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: eit.c 1.23 2001/09/22 10:28:33 kls Exp $
+ * $Id: eit.c 1.24 2001/09/22 13:07:21 kls Exp $
***************************************************************************/
#include "eit.h"
@@ -279,59 +279,19 @@ unsigned short cEventInfo::GetEventID() const
return uEventID;
}
/** */
-bool cEventInfo::SetTitle(const char *string)
+void cEventInfo::SetTitle(const char *string)
{
- if (string == NULL)
- return false;
-
- pTitle = strdup(string);
- if (pTitle == NULL)
- return false;
-
- return true;
+ pTitle = strcpyrealloc(pTitle, string);
}
/** */
-bool cEventInfo::SetSubtitle(const char *string)
+void cEventInfo::SetSubtitle(const char *string)
{
- if (string == NULL)
- return false;
-
- pSubtitle = strdup(string);
- if (pSubtitle == NULL)
- return false;
-
- return true;
+ pSubtitle = strcpyrealloc(pSubtitle, string);
}
/** */
-bool cEventInfo::AddExtendedDescription(const char *string)
+void cEventInfo::SetExtendedDescription(const char *string)
{
- int size = 0;
- bool first = true;
- char *p;
-
- if (string == NULL)
- return false;
-
- if (pExtendedDescription)
- {
- first = false;
- size += strlen(pExtendedDescription);
- }
-
- size += (strlen(string) + 1);
-
- p = (char *)realloc(pExtendedDescription, size);
- if (p == NULL)
- return false;
-
- if (first)
- *p = 0;
-
- strcat(p, string);
-
- pExtendedDescription = p;
-
- return true;
+ pExtendedDescription = strcpyrealloc(pExtendedDescription, string);
}
/** */
void cEventInfo::SetTime(time_t t)
@@ -783,28 +743,29 @@ int cEIT::ProcessEIT(unsigned char *buffer)
}
pEvent = (cEventInfo *)pSchedule->GetEvent((unsigned short)VdrProgramInfo->EventID);
if (!pEvent) {
+ // If we don't have that event ID yet, we create a new one.
+ // Otherwise we copy the information into the existing event anyway, because the data might have changed.
pSchedule->Events.Add(new cEventInfo(VdrProgramInfo->ServiceID, VdrProgramInfo->EventID));
pEvent = (cEventInfo *)pSchedule->GetEvent((unsigned short)VdrProgramInfo->EventID);
if (!pEvent)
break;
- if (rEvent) {
- pEvent->SetTitle(rEvent->GetTitle());
- pEvent->SetSubtitle(rEvent->GetSubtitle());
- pEvent->SetTime(VdrProgramInfo->StartTime);
- pEvent->SetDuration(VdrProgramInfo->Duration);
- pEvent->AddExtendedDescription(rEvent->GetExtendedDescription());
- pEvent->FixEpgBugs();
- }
- else {
- pEvent->SetTitle(VdrProgramInfo->ShortName);
- pEvent->SetSubtitle(VdrProgramInfo->ShortText);
- pEvent->SetTime(VdrProgramInfo->StartTime);
- pEvent->SetDuration(VdrProgramInfo->Duration);
- pEvent->AddExtendedDescription(VdrProgramInfo->ExtendedName);
- pEvent->AddExtendedDescription(VdrProgramInfo->ExtendedText);
- pEvent->FixEpgBugs();
- }
}
+ if (rEvent) {
+ pEvent->SetTitle(rEvent->GetTitle());
+ pEvent->SetSubtitle(rEvent->GetSubtitle());
+ pEvent->SetExtendedDescription(rEvent->GetExtendedDescription());
+ }
+ else {
+ pEvent->SetTitle(VdrProgramInfo->ShortName);
+ pEvent->SetSubtitle(VdrProgramInfo->ShortText);
+ pEvent->SetExtendedDescription(VdrProgramInfo->ExtendedName);
+ //XXX kls 2001-09-22:
+ //XXX apparently this never occurred, so I have simpified ExtendedDescription handling
+ //XXX pEvent->AddExtendedDescription(VdrProgramInfo->ExtendedText);
+ }
+ pEvent->SetTime(VdrProgramInfo->StartTime);
+ pEvent->SetDuration(VdrProgramInfo->Duration);
+ pEvent->FixEpgBugs();
if (IsPresentFollowing()) {
if ((GetRunningStatus(VdrProgramInfo->Status) == RUNNING_STATUS_PAUSING) || (GetRunningStatus(VdrProgramInfo->Status) == RUNNING_STATUS_RUNNING))
pSchedule->SetPresentEvent(pEvent);
diff --git a/eit.h b/eit.h
index 8ca5f1e5..91d5b2b3 100644
--- a/eit.h
+++ b/eit.h
@@ -16,7 +16,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: eit.h 1.10 2001/08/15 15:47:31 kls Exp $
+ * $Id: eit.h 1.11 2001/09/22 11:43:21 kls Exp $
***************************************************************************/
#ifndef __EIT_H
@@ -42,13 +42,13 @@ private:
protected:
void SetFollowing(bool foll);
void SetPresent(bool pres);
- bool SetTitle(const char *string);
+ void SetTitle(const char *string);
void SetServiceID(unsigned short servid);
void SetEventID(unsigned short evid);
void SetDuration(long l);
void SetTime(time_t t);
- bool AddExtendedDescription(const char *string);
- bool SetSubtitle(const char *string);
+ void SetExtendedDescription(const char *string);
+ void SetSubtitle(const char *string);
cEventInfo(unsigned short serviceid, unsigned short eventid);
public:
~cEventInfo();
diff --git a/tools.c b/tools.c
index d6b65e55..7238137e 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.45 2001/09/15 15:41:16 kls Exp $
+ * $Id: tools.c 1.46 2001/09/22 12:13:40 kls Exp $
*/
#define _GNU_SOURCE
@@ -64,6 +64,19 @@ char *readline(FILE *f)
return NULL;
}
+char *strcpyrealloc(char *dest, const char *src)
+{
+ if (src) {
+ int l = max(dest ? strlen(dest) : 0, strlen(src)) + 1; // don't let the block get smaller!
+ dest = (char *)realloc(dest, l);
+ if (dest)
+ strcpy(dest, src);
+ else
+ esyslog(LOG_ERR, "ERROR: out of memory");
+ }
+ return dest;
+}
+
char *strn0cpy(char *dest, const char *src, size_t n)
{
char *s = dest;
diff --git a/tools.h b/tools.h
index 188adb45..cc67a806 100644
--- a/tools.h
+++ b/tools.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.h 1.34 2001/09/15 15:22:57 kls Exp $
+ * $Id: tools.h 1.35 2001/09/22 12:12:55 kls Exp $
*/
#ifndef __TOOLS_H
@@ -44,6 +44,7 @@ ssize_t safe_read(int filedes, void *buffer, size_t size);
ssize_t safe_write(int filedes, const void *buffer, size_t size);
void writechar(int filedes, char c);
char *readline(FILE *f);
+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 *skipspace(const char *s);