From 26c19bbee814f431f55d32d25ee441ed37650c7c Mon Sep 17 00:00:00 2001 From: wr61 Date: Sat, 4 Mar 2006 11:40:36 +0000 Subject: eliminate warnings for compilation with -Wformat=2 git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@931 e10066b5-e1e2-0310-b819-94efdf66514b --- Makefile | 2 +- vdr_menu.c | 14 +++++++++----- vdr_menu.h | 7 +++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 1de3872..2871744 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri ### The C++ compiler and options: CXX ?= g++-3.3 -CXXFLAGS ?= -fPIC -O0 -Wall -Woverloaded-virtual -Wno-deprecated -g +CXXFLAGS ?= -fPIC -O0 -Wall -Wformat=2 -Woverloaded-virtual -Wno-deprecated -g ### The directory environment: diff --git a/vdr_menu.c b/vdr_menu.c index 583b9ba..2775487 100644 --- a/vdr_menu.c +++ b/vdr_menu.c @@ -818,11 +818,15 @@ mgTree::BuildOsd () AddSelectionItems (selection()); } -void -mgMainMenu::Message1(const char *msg, const char *arg1) -{ - if (strlen(msg)==0) return; - asprintf (&m_message, tr (msg), arg1); +const char* +mgMainMenu::Message1(const char *msg, ...) +{ + if (strlen(msg)==0) return 0; + va_list ap; + va_start(ap, msg); + vasprintf(&m_message, tr(msg), ap); + va_end(ap); + return m_message; } diff --git a/vdr_menu.h b/vdr_menu.h index 08028c9..ad8c9ba 100644 --- a/vdr_menu.h +++ b/vdr_menu.h @@ -175,8 +175,11 @@ class mgMainMenu:public cOsdMenu // only be shown at the end of the next mgMainMenu::ProcessKey // because that might do forcerefresh which overwrites the message void Message (const char *msg) { m_message = strdup(msg); } - void Message1 (const char *msg, const char *arg1); - void Message1 (const char *msg, std::string arg1) { Message1(msg,arg1.c_str()); } + const char* Message1 (const char *msg, ...) + __attribute__ ((format (printf, 2, 3))); + const char* Message1 (const char *msg, std::string arg1) + __attribute_format_arg__ (2) + { return Message1(msg,arg1.c_str()); } //! \brief Actions can request a new position. -1 means none wanted int newposition; -- cgit v1.2.3