From 1f16ada70ccf96fc8b2bf2f7b18b4e62afa33e9e Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 23 Mar 2018 15:47:26 +0100 Subject: Fixed some warnings from g++ 7.2.0 regarding fixed buffer sizes --- CONTRIBUTORS | 2 ++ HISTORY | 4 +++- menuitems.c | 12 +++++------- shutdown.c | 7 ++----- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f837b493..1954bbdd 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2630,6 +2630,8 @@ J for reporting a possible deadlock when quickly zapping through encrypted channels for a patch that was used to implement cStatus::MarksModified() for suggesting to no longer log unaligned marks in cMarks::Align() + for reporting some warnings from g++ 7.2.0 regarding fixed buffer sizes in + cMenuEditTimeItem::Set() and cCountdown::Update() Peter Pinnau for reporting that 'uint32_t' requires including stdint.h in font.h on some systems diff --git a/HISTORY b/HISTORY index 6297660c..e206d153 100644 --- a/HISTORY +++ b/HISTORY @@ -9317,10 +9317,12 @@ Video Disk Recorder Revision History - Modified cMenuTimers::Delete() to avoid a lengthy lock on the Timers list while prompting the user. -2018-03-19: Version 2.4.0 +2018-03-23: Version 2.4.0 - Updated the Ukrainian OSD texts (thanks to Yarema Aka Knedlyk). - Fixed processing SVDRP client responses in case the caller doesn't want the actual response strings (reported by Johann Friedrichs). - Fixed (not) saving the 'cam.data' file in case VDR stops early during startup due to some error. +- Fixed some warnings from g++ 7.2.0 regarding fixed buffer sizes in cMenuEditTimeItem::Set() + and cCountdown::Update() (reported by Jörg Wendel). diff --git a/menuitems.c b/menuitems.c index 659c1a58..d764c58c 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 4.2 2015/09/08 10:25:23 kls Exp $ + * $Id: menuitems.c 4.3 2018/03/23 15:37:02 kls Exp $ */ #include "menuitems.h" @@ -1062,14 +1062,12 @@ cMenuEditTimeItem::cMenuEditTimeItem(const char *Name, int *Value) void cMenuEditTimeItem::Set(void) { - char buf[10]; switch (pos) { - case 1: snprintf(buf, sizeof(buf), "%01d-:--", hh / 10); break; - case 2: snprintf(buf, sizeof(buf), "%02d:--", hh); break; - case 3: snprintf(buf, sizeof(buf), "%02d:%01d-", hh, mm / 10); break; - default: snprintf(buf, sizeof(buf), "%02d:%02d", hh, mm); + case 1: SetValue(cString::sprintf("%01d-:--", hh / 10)); break; + case 2: SetValue(cString::sprintf("%02d:--", hh)); break; + case 3: SetValue(cString::sprintf("%02d:%01d-", hh, mm / 10)); break; + default: SetValue(cString::sprintf("%02d:%02d", hh, mm)); } - SetValue(buf); } eOSState cMenuEditTimeItem::ProcessKey(eKeys Key) diff --git a/shutdown.c b/shutdown.c index 7b8ff804..1fb0394b 100644 --- a/shutdown.c +++ b/shutdown.c @@ -6,7 +6,7 @@ * * Original version written by Udo Richter . * - * $Id: shutdown.c 4.1 2015/07/18 11:29:26 kls Exp $ + * $Id: shutdown.c 4.2 2018/03/23 15:39:21 kls Exp $ */ #include "shutdown.h" @@ -69,10 +69,7 @@ bool cCountdown::Update(void) timedOut = true; if (counter != NewCounter) { counter = NewCounter; - char time[10]; - snprintf(time, sizeof(time), "%d:%d0", counter > 0 ? counter / 6 : 0, counter > 0 ? counter % 6 : 0); - cString Message = cString::sprintf(message, time); - Skins.Message(mtStatus, Message); + Skins.Message(mtStatus, cString::sprintf(message, *cString::sprintf("%d:%d0", counter > 0 ? counter / 6 : 0, counter > 0 ? counter % 6 : 0))); return true; } } -- cgit v1.2.3