summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-11-06 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-11-06 18:00:00 +0100
commit812ab9018c7be7feb901eface4c6431b483ca9ec (patch)
tree2032a68f87246ee2453c54cf9fc969f1f1be2da0 /tools.c
parent99e3c093f404b55683a90e38bbe74e1f51c35316 (diff)
downloadvdr-patch-lnbsharing-812ab9018c7be7feb901eface4c6431b483ca9ec.tar.gz
vdr-patch-lnbsharing-812ab9018c7be7feb901eface4c6431b483ca9ec.tar.bz2
Version 1.3.36vdr-1.3.36
- Fixed a NULL pointer access with the cUnbufferedFile when a replay session runs all the way until the end of the recording (thanks to Joachim Wilke). - A menu is no longer automatically closed when a replay ends (reported by Marko Mäkelä). - Removed '\n' from several syslog() calls (reported by Sascha Volkenandt). - Fixed missing '&' in the SetAreas() example in PLUGINS.html (reported by 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). - cSVDRP now dynamically allocates its command buffer in order to handle commands of any length. The MAXPARSEBUFFER macro is now obsolete and has been removed. If a plugin has used that macro, it should either define a buffer size of its own, or use cReadLine when reading files. - Fixed a race condition in the SPU decoder (thanks to Marco Schlüßler). - The EPG scan no longer disturbs players that have also set live PIDs (reported by Stefan Huelswitt). - Fixed setting the help key display in the Recordings menu in case of several layers of subdirectories. - Removed EPG bugfix #0, because it removed actually important data.
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c25
1 files changed, 19 insertions, 6 deletions
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;