diff --git a/HISTORY b/HISTORY index 930bc906..4cf03d27 100644 --- a/HISTORY +++ b/HISTORY @@ -739,3 +739,6 @@ Video Disk Recorder Revision History (thanks to Stefan Huelswitt). - Implemented replay mode display (thanks to Stefan Huelswitt, with a few rewrites by kls). +- Changed the size of all input buffers used to parse config files or receive + SVDRP commands to the same value of 10KB. This allows long strings to be + used in the 'summary' field of a timer, for instance. diff --git a/config.c b/config.c index 8cf69110..dee8eccb 100644 --- a/config.c +++ b/config.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.69 2001/09/09 13:52:48 kls Exp $ + * $Id: config.c 1.70 2001/09/14 14:35:30 kls Exp $ */ #include "config.h" @@ -72,7 +72,7 @@ bool cKeys::Load(const char *FileName) FILE *f = fopen(fileName, "r"); if (f) { int line = 0; - char buffer[MaxBuffer]; + char buffer[MAXPARSEBUFFER]; result = true; while (fgets(buffer, sizeof(buffer), f) > 0) { line++; @@ -869,7 +869,7 @@ bool cSetup::Load(const char *FileName) FILE *f = fopen(fileName, "r"); if (f) { int line = 0; - char buffer[MaxBuffer]; + char buffer[MAXPARSEBUFFER]; bool result = true; while (fgets(buffer, sizeof(buffer), f) > 0) { line++; diff --git a/config.h b/config.h index 328d39ab..2e039548 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.76 2001/09/09 13:51:45 kls Exp $ + * $Id: config.h 1.77 2001/09/14 14:35:32 kls Exp $ */ #ifndef __CONFIG_H @@ -21,8 +21,6 @@ #define VDRVERSION "0.95" -#define MaxBuffer 10000 - #define MAXPRIORITY 99 #define MAXLIFETIME 99 @@ -192,7 +190,7 @@ public: FILE *f = fopen(fileName, "r"); if (f) { int line = 0; - char buffer[MaxBuffer]; + char buffer[MAXPARSEBUFFER]; result = true; while (fgets(buffer, sizeof(buffer), f) > 0) { line++; diff --git a/dvbapi.c b/dvbapi.c index b8d46cf8..208bcb92 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -7,7 +7,7 @@ * DVD support initially written by Andreas Schultz * based on dvdplayer-0.5 by Matjaz Thaler * - * $Id: dvbapi.c 1.116 2001/09/14 14:19:37 kls Exp $ + * $Id: dvbapi.c 1.117 2001/09/14 14:25:33 kls Exp $ */ //#define DVDDEBUG 1 @@ -50,9 +50,6 @@ extern "C" { #define DEV_OST_VIDEO "/dev/ost/video" #define DEV_OST_AUDIO "/dev/ost/audio" -#define KILOBYTE(n) ((n) * 1024) -#define MEGABYTE(n) ((n) * 1024 * 1024) - // The size of the array used to buffer video data: // (must be larger than MINVIDEODATA - see remux.h) #define VIDEOBUFSIZE MEGABYTE(1) diff --git a/svdrp.c b/svdrp.c index 5f8aad40..d1833612 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 1.22 2001/09/01 09:50:03 kls Exp $ + * $Id: svdrp.c 1.23 2001/09/14 14:31:22 kls Exp $ */ #define _GNU_SOURCE @@ -262,7 +262,7 @@ void cSVDRP::Close(bool Timeout) { if (file.IsOpen()) { //TODO how can we get the *full* hostname? - char buffer[MAXCMDBUFFER]; + char buffer[BUFSIZ]; gethostname(buffer, sizeof(buffer)); Reply(221, "%s closing connection%s", buffer, Timeout ? " (timeout)" : ""); isyslog(LOG_INFO, "closing SVDRP connection"); //TODO store IP#??? @@ -944,7 +944,7 @@ void cSVDRP::Process(void) if (file.IsOpen() || file.Open(socket.Accept())) { if (SendGreeting) { //TODO how can we get the *full* hostname? - char buffer[MAXCMDBUFFER]; + char buffer[BUFSIZ]; gethostname(buffer, sizeof(buffer)); time_t now = time(NULL); Reply(220, "%s SVDRP VideoDiskRecorder %s; %s", buffer, VDRVERSION, ctime(&now)); diff --git a/svdrp.h b/svdrp.h index 503439a4..1c16f88b 100644 --- a/svdrp.h +++ b/svdrp.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: svdrp.h 1.10 2001/09/01 09:24:50 kls Exp $ + * $Id: svdrp.h 1.11 2001/09/14 14:35:34 kls Exp $ */ #ifndef __SVDRP_H @@ -26,15 +26,13 @@ public: int Accept(void); }; -#define MAXCMDBUFFER 1024 - class cSVDRP { private: cSocket socket; cFile file; CRect ovlClipRects[MAXCLIPRECTS]; uint numChars; - char cmdLine[MAXCMDBUFFER]; + char cmdLine[MAXPARSEBUFFER]; char *message; time_t lastActivity; void Close(bool Timeout = false); diff --git a/tools.c b/tools.c index f51bc85d..0adf03e2 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.43 2001/08/26 15:45:41 kls Exp $ + * $Id: tools.c 1.44 2001/09/14 14:35:37 kls Exp $ */ #define _GNU_SOURCE @@ -21,8 +21,6 @@ #include #include "i18n.h" -#define MaxBuffer 1000 - int SysLogLevel = 3; ssize_t safe_read(int filedes, void *buffer, size_t size) @@ -56,7 +54,7 @@ void writechar(int filedes, char c) char *readline(FILE *f) { - static char buffer[MaxBuffer]; + static char buffer[MAXPARSEBUFFER]; if (fgets(buffer, sizeof(buffer), f) > 0) { int l = strlen(buffer) - 1; if (l >= 0 && buffer[l] == '\n') diff --git a/tools.h b/tools.h index 50ea74cc..6e945e18 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.32 2001/09/14 13:40:35 kls Exp $ + * $Id: tools.h 1.33 2001/09/14 14:35:40 kls Exp $ */ #ifndef __TOOLS_H @@ -29,6 +29,11 @@ extern int SysLogLevel; #define SECSINDAY 86400 +#define KILOBYTE(n) ((n) * 1024) +#define MEGABYTE(n) ((n) * 1024 * 1024) + +#define MAXPARSEBUFFER KILOBYTE(10) + #define DELETENULL(p) (delete (p), p = NULL) template inline T min(T a, T b) { return a <= b ? a : b; }