summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY5
-rw-r--r--config.h15
-rw-r--r--tools.c22
-rw-r--r--tools.h7
5 files changed, 36 insertions, 14 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 39eaed5e..491a0fd2 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -857,6 +857,7 @@ Christian Jacobsen <christian.jacobsen@stageholding.de>
Andreas Mair <Andreas.Mair@linogate.com>
for reporting a short display of the main menu if a plugin displays its own OSD and
is started through a user defined key macro
+ for reporting a problem with extremely long summary fields in timers
Olivier Jacques <jacquesolivier@hotmail.com>)
for translating OSD texts to the French language
diff --git a/HISTORY b/HISTORY
index 4859512e..d242c4a0 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3924,3 +3924,8 @@ Video Disk Recorder Revision History
Sascha Volkenandt).
- Fixed a memory leak in cString::operator=() (reported by Sascha Volkenandt).
- Updated the Dutch OSD texts (thanks to Maarten Wisse).
+- cReadLine now dynamically allocates its buffer, so that it can handle lines
+ of any length.
+- Changed cConfig::Load() to use cReadLine instead of a fixed buffer (thanks
+ to Andreas Mair for reporting a problem with extremely long summary fields
+ in timers).
diff --git a/config.h b/config.h
index d7022901..ef84cf97 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.233 2005/11/04 14:18:59 kls Exp $
+ * $Id: config.h 1.234 2005/11/04 15:55:05 kls Exp $
*/
#ifndef __CONFIG_H
@@ -102,20 +102,21 @@ public:
isyslog("loading %s", fileName);
FILE *f = fopen(fileName, "r");
if (f) {
+ char *s;
int line = 0;
- char buffer[MAXPARSEBUFFER];
+ cReadLine ReadLine;
result = true;
- while (fgets(buffer, sizeof(buffer), f) > 0) {
+ while ((s = ReadLine.Read(f)) != NULL) {
line++;
if (allowComments) {
- char *p = strchr(buffer, '#');
+ char *p = strchr(s, '#');
if (p)
*p = 0;
}
- stripspace(buffer);
- if (!isempty(buffer)) {
+ stripspace(s);
+ if (!isempty(s)) {
T *l = new T;
- if (l->Parse(buffer))
+ if (l->Parse(s))
Add(l);
else {
esyslog("ERROR: error in %s, line %d", fileName, line);
diff --git a/tools.c b/tools.c
index e0a9ecf5..832f4293 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.102 2005/11/04 14:26:39 kls Exp $
+ * $Id: tools.c 1.103 2005/11/04 16:33:18 kls Exp $
*/
#include "tools.h"
@@ -610,12 +610,24 @@ cString TimeString(time_t t)
// --- cReadLine -------------------------------------------------------------
+cReadLine::cReadLine(void)
+{
+ size = 0;
+ buffer = NULL;
+}
+
+cReadLine::~cReadLine()
+{
+ free(buffer);
+}
+
char *cReadLine::Read(FILE *f)
{
- if (fgets(buffer, sizeof(buffer), f) > 0) {
- int l = strlen(buffer) - 1;
- if (l >= 0 && buffer[l] == '\n')
- buffer[l] = 0;
+ int n = getline(&buffer, &size, f);
+ if (n > 0) {
+ n--;
+ if (buffer[n] == '\n')
+ buffer[n] = 0;
return buffer;
}
return NULL;
diff --git a/tools.h b/tools.h
index f348b2e5..cc4c9e30 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.81 2005/10/31 12:54:36 kls Exp $
+ * $Id: tools.h 1.82 2005/11/04 17:05:35 kls Exp $
*/
#ifndef __TOOLS_H
@@ -135,8 +135,11 @@ public:
class cReadLine {
private:
- char buffer[MAXPARSEBUFFER];
+ size_t size;
+ char *buffer;
public:
+ cReadLine(void);
+ ~cReadLine();
char *Read(FILE *f);
};