summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--eit.c4
-rw-r--r--libsi/descriptor.c18
-rw-r--r--libsi/descriptor.h6
4 files changed, 16 insertions, 13 deletions
diff --git a/HISTORY b/HISTORY
index 2d3e7ca9..0b209c78 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2750,3 +2750,4 @@ Video Disk Recorder Revision History
- Fixed a memory leak in thread handling when using NPTL (thanks to Jon Burgess).
- Fixed handling Setup.RecordDolbyDigital, which was broken since version 1.1.6.
+- Fixed handling text lengths for itemized EPG texts (thanks to Marcel Wiesweg).
diff --git a/eit.c b/eit.c
index a4264776..97ba5230 100644
--- a/eit.c
+++ b/eit.c
@@ -8,7 +8,7 @@
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
*
- * $Id: eit.c 1.93 2004/03/13 13:54:20 kls Exp $
+ * $Id: eit.c 1.94 2004/03/20 10:53:23 kls Exp $
*/
#include "eit.h"
@@ -197,7 +197,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
pEvent->SetShortText(ShortEventDescriptor->text.getText(buffer));
}
if (ExtendedEventDescriptors) {
- char buffer[ExtendedEventDescriptors->getMaximumTextLength()];
+ char buffer[ExtendedEventDescriptors->getMaximumTextLength(": ")];
pEvent->SetDescription(ExtendedEventDescriptors->getText(buffer, ": "));
}
}
diff --git a/libsi/descriptor.c b/libsi/descriptor.c
index 82e2a8f3..51037749 100644
--- a/libsi/descriptor.c
+++ b/libsi/descriptor.c
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: descriptor.c 1.10 2004/03/13 15:08:12 kls Exp $
+ * $Id: descriptor.c 1.11 2004/03/20 10:51:49 kls Exp $
* *
***************************************************************************/
@@ -78,12 +78,13 @@ void ExtendedEventDescriptor::Item::Parse() {
return ret;
}*/
-int ExtendedEventDescriptors::getMaximumTextLength() {
- return getMaximumTextPlainLength()+getMaximumTextItemizedLength();
+int ExtendedEventDescriptors::getMaximumTextLength(const char *separation1, const char *separation2) {
+ //add length of plain text, of itemized text with separators, and for one separator between the two fields.
+ return getMaximumTextPlainLength()+getMaximumTextItemizedLength(separation1, separation2)+strlen(separation2);
}
char *ExtendedEventDescriptors::getText(const char *separation1, const char *separation2) {
- char *text=new char[getMaximumTextLength()+strlen(separation1)+strlen(separation2)];
+ char *text=new char[getMaximumTextLength(separation1, separation2)];
return getText(text, separation1, separation2);
}
@@ -171,20 +172,21 @@ char *ExtendedEventDescriptors::getTextPlain(char *buffer) {
return buffer;
}
-int ExtendedEventDescriptors::getMaximumTextItemizedLength() {
+int ExtendedEventDescriptors::getMaximumTextItemizedLength(const char *separation1, const char *separation2) {
int ret=0;
+ int sepLength=strlen(separation1)+strlen(separation2)-2;
for (int i=0;i<length;i++) {
ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
if (!d)
continue;
- //the size for the two separating characters is included ;-)
- ret+=d->itemLoop.getLength();
+ //The length includes two 8-bit length fields which have already been subtracted from sepLength
+ ret+=d->itemLoop.getLength()+sepLength;
}
return ret;
}
char *ExtendedEventDescriptors::getTextItemized(const char *separation1, const char *separation2) {
- char *text=new char[getMaximumTextItemizedLength()+strlen(separation1)+strlen(separation2)];
+ char *text=new char[getMaximumTextItemizedLength(separation1, separation2)];
return getTextItemized(text, separation1, separation2);
}
diff --git a/libsi/descriptor.h b/libsi/descriptor.h
index 3368b0a9..692563fc 100644
--- a/libsi/descriptor.h
+++ b/libsi/descriptor.h
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: descriptor.h 1.7 2004/03/07 11:13:54 kls Exp $
+ * $Id: descriptor.h 1.8 2004/03/20 10:52:22 kls Exp $
* *
***************************************************************************/
@@ -50,7 +50,7 @@ private:
class ExtendedEventDescriptors : public DescriptorGroup {
public:
- int getMaximumTextLength();
+ int getMaximumTextLength(const char *separation1="\t", const char *separation2="\n");
//Returns a concatenated version of first the non-itemized and then the itemized text
//same semantics as with SI::String
char *getText(const char *separation1="\t", const char *separation2="\n");
@@ -66,7 +66,7 @@ public:
//Between the description and the text the separation1 character is used,
//separation2 used between two pairs. Example:
//Director\tSteven Spielberg\nActor\tMichael Mendl\n
- int getMaximumTextItemizedLength();
+ int getMaximumTextItemizedLength(const char *separation1="\t", const char *separation2="\n");
char *getTextItemized(const char *separation1="\t", const char *separation2="\n");
char *getTextItemized(char *buffer, const char *separation1="\t", const char *separation2="\n");
//returns the itemized text pair by pair. Maximum length for buffers is 256.