From 812ab9018c7be7feb901eface4c6431b483ca9ec Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 6 Nov 2005 18:00:00 +0100 Subject: =?UTF-8?q?Version=201.3.36=20-=20Fixed=20a=20NULL=20pointer=20acc?= =?UTF-8?q?ess=20with=20the=20cUnbufferedFile=20when=20a=20replay=20sessio?= =?UTF-8?q?n=20runs=20=20=20all=20the=20way=20until=20the=20end=20of=20the?= =?UTF-8?q?=20recording=20(thanks=20to=20Joachim=20Wilke).=20-=20A=20menu?= =?UTF-8?q?=20is=20no=20longer=20automatically=20closed=20when=20a=20repla?= =?UTF-8?q?y=20ends=20(reported=20by=20=20=20Marko=20M=C3=A4kel=C3=A4).=20?= =?UTF-8?q?-=20Removed=20'\n'=20from=20several=20syslog()=20calls=20(repor?= =?UTF-8?q?ted=20by=20Sascha=20Volkenandt).=20-=20Fixed=20missing=20'&'=20?= =?UTF-8?q?in=20the=20SetAreas()=20example=20in=20PLUGINS.html=20(reported?= =?UTF-8?q?=20by=20=20=20Sascha=20Volkenandt).=20-=20Fixed=20a=20memory=20?= =?UTF-8?q?leak=20in=20cString::operator=3D()=20(reported=20by=20Sascha=20?= =?UTF-8?q?Volkenandt).=20-=20Updated=20the=20Dutch=20OSD=20texts=20(thank?= =?UTF-8?q?s=20to=20Maarten=20Wisse).=20-=20cReadLine=20now=20dynamically?= =?UTF-8?q?=20allocates=20its=20buffer,=20so=20that=20it=20can=20handle=20?= =?UTF-8?q?lines=20=20=20of=20any=20length.=20-=20Changed=20cConfig::Load(?= =?UTF-8?q?)=20to=20use=20cReadLine=20instead=20of=20a=20fixed=20buffer=20?= =?UTF-8?q?(thanks=20=20=20to=20Andreas=20Mair=20for=20reporting=20a=20pro?= =?UTF-8?q?blem=20with=20extremely=20long=20summary=20fields=20=20=20in=20?= =?UTF-8?q?timers).=20-=20cSVDRP=20now=20dynamically=20allocates=20its=20c?= =?UTF-8?q?ommand=20buffer=20in=20order=20to=20handle=20=20=20commands=20o?= =?UTF-8?q?f=20any=20length.=20The=20MAXPARSEBUFFER=20macro=20is=20now=20o?= =?UTF-8?q?bsolete=20and=20has=20=20=20been=20removed.=20If=20a=20plugin?= =?UTF-8?q?=20has=20used=20that=20macro,=20it=20should=20either=20define?= =?UTF-8?q?=20=20=20a=20buffer=20size=20of=20its=20own,=20or=20use=20cRead?= =?UTF-8?q?Line=20when=20reading=20files.=20-=20Fixed=20a=20race=20conditi?= =?UTF-8?q?on=20in=20the=20SPU=20decoder=20(thanks=20to=20Marco=20Schl?= =?UTF-8?q?=C3=BC=C3=9Fler).=20-=20The=20EPG=20scan=20no=20longer=20distur?= =?UTF-8?q?bs=20players=20that=20have=20also=20set=20live=20PIDs=20=20=20(?= =?UTF-8?q?reported=20by=20Stefan=20Huelswitt).=20-=20Fixed=20setting=20th?= =?UTF-8?q?e=20help=20key=20display=20in=20the=20Recordings=20menu=20in=20?= =?UTF-8?q?case=20of=20several=20=20=20layers=20of=20subdirectories.=20-?= =?UTF-8?q?=20Removed=20EPG=20bugfix=20#0,=20because=20it=20removed=20actu?= =?UTF-8?q?ally=20important=20data.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'tools.c') diff --git a/tools.c b/tools.c index aa20e6e..832f429 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.100 2005/10/31 12:56:15 kls Exp $ + * $Id: tools.c 1.103 2005/11/04 16:33:18 kls Exp $ */ #include "tools.h" @@ -463,7 +463,7 @@ bool SpinUpDisk(const char *FileName) gettimeofday(&tp2, NULL); double seconds = (((long long)tp2.tv_sec * 1000000 + tp2.tv_usec) - ((long long)tp1.tv_sec * 1000000 + tp1.tv_usec)) / 1000000.0; if (seconds > 0.5) - dsyslog("SpinUpDisk took %.2f seconds\n", seconds); + dsyslog("SpinUpDisk took %.2f seconds", seconds); free(buf); return true; } @@ -534,6 +534,7 @@ cString::~cString() cString &cString::operator=(const cString &String) { + free(s); s = String.s ? strdup(String.s) : NULL; return *this; } @@ -609,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; -- cgit v1.2.3