From e760b14f646004a7fe99e4561156a132a0572cdb Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 20 Mar 2005 10:10:38 +0100 Subject: [PATCH] Some fixes to avoid compiler warnings in gcc 4.0 --- CONTRIBUTORS | 3 +++ HISTORY | 2 ++ channels.c | 11 +++++++---- dvbdevice.c | 4 ++-- font.h | 3 ++- svdrp.c | 5 +++-- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 08f6ccfc..5193476e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1299,3 +1299,6 @@ Mikko Salo Roman Krenický for a patch that was used a a basis for changing a timer's day handling to full date + +Ville Skyttä + for reporting several compiler warnings in gcc 4.0 diff --git a/HISTORY b/HISTORY index 8c6ad821..ec504642 100644 --- a/HISTORY +++ b/HISTORY @@ -3464,3 +3464,5 @@ Video Disk Recorder Revision History - The day of a timer is now stored as a full date in ISO notation ("YYYY-MM-DD") in 'timers.conf' and for the result of the SVDRP command LSTT (based in parts on a patch by Roman Krenický). +- Some fixes to avoid compiler warnings in gcc 4.0 (thanks to Ville Skyttä for reporting + these). diff --git a/channels.c b/channels.c index dd230dae..3392d9aa 100644 --- a/channels.c +++ b/channels.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 1.35 2005/02/06 09:44:53 kls Exp $ + * $Id: channels.c 1.36 2005/03/19 15:56:38 kls Exp $ */ #include "channels.h" @@ -694,9 +694,12 @@ bool cChannel::Parse(const char *s, bool AllowNonUniqueID) char *p = strchr(vpidbuf, '+'); if (p) *p++ = 0; - sscanf(vpidbuf, "%d", &vpid); - if (p) - sscanf(p, "%d", &ppid); + if (sscanf(vpidbuf, "%d", &vpid) != 1) + return false; + if (p) { + if (sscanf(p, "%d", &ppid) != 1) + return false; + } else ppid = vpid; diff --git a/dvbdevice.c b/dvbdevice.c index ce23f76d..9c8a0ac4 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 1.126 2005/03/13 12:34:00 kls Exp $ + * $Id: dvbdevice.c 1.127 2005/03/20 10:10:38 kls Exp $ */ #include "dvbdevice.h" @@ -577,7 +577,7 @@ bool cDvbDevice::GrabImage(const char *FileName, bool Jpeg, int Quality, int Siz else { // write PNM file: if (fprintf(f, "P6\n%d\n%d\n255\n", vm.width, vm.height) < 0 || - fwrite(mem, vm.width * vm.height * 3, 1, f) < 0) { + fwrite(mem, vm.width * vm.height * 3, 1, f) != 1) { LOG_ERROR_STR(FileName); result |= 1; } diff --git a/font.h b/font.h index 012f6c54..b5a21a3a 100644 --- a/font.h +++ b/font.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: font.h 1.10 2005/01/14 13:25:35 kls Exp $ + * $Id: font.h 1.11 2005/03/19 15:51:19 kls Exp $ */ #ifndef __FONT_H @@ -44,6 +44,7 @@ private: int height; public: cFont(void *Data); + virtual ~cFont() {} void SetData(void *Data); virtual int Width(unsigned char c) const { return data[c]->width; } ///< Returns the width of the given character. diff --git a/svdrp.c b/svdrp.c index 1981f6e8..be7d161b 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.67 2004/12/26 12:23:55 kls Exp $ + * $Id: svdrp.c 1.68 2005/03/19 16:05:33 kls Exp $ */ #include "svdrp.h" @@ -111,7 +111,8 @@ int cSocket::Accept(void) bool accepted = SVDRPhosts.Acceptable(clientname.sin_addr.s_addr); if (!accepted) { const char *s = "Access denied!\n"; - write(newsock, s, strlen(s)); + if (write(newsock, s, strlen(s)) < 0) + LOG_ERROR; close(newsock); newsock = -1; }