[dvblast-devel] [PATCH 1/2] Annotate functions with printf style params and use -Wformat-security

Georgi Chorbadzhiyski gf at unixsol.org
Fri Aug 19 15:02:07 CEST 2011


Annotate functions with printf style params and use -Wformat-security

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
-------------- next part --------------
From 04545d514c2f35142ebd2707e0f4a83c14f0f4c2 Mon Sep 17 00:00:00 2001
From: Georgi Chorbadzhiyski <gf at unixsol.org>
Date: Fri, 19 Aug 2011 15:57:47 +0300
Subject: [PATCH 1/2] Annotate functions with printf style params and use -Wformat-security

---
 trunk/Makefile  |    2 +-
 trunk/demux.c   |    1 +
 trunk/dvblast.h |   10 +++++-----
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/trunk/Makefile b/trunk/Makefile
index 539a16a..fc9dae9 100644
--- a/trunk/Makefile
+++ b/trunk/Makefile
@@ -4,7 +4,7 @@
 VERSION = 2.0.0
 TOPDIR = `basename ${PWD}`
 
-CFLAGS += -Wall -O3 -fomit-frame-pointer
+CFLAGS += -Wall -Wformat-security -O3 -fomit-frame-pointer
 CFLAGS += -g
 LDLIBS += -lrt
 LDLIBS_DVBLAST += -lpthread
diff --git a/trunk/demux.c b/trunk/demux.c
index 654d306..833a8f2 100644
--- a/trunk/demux.c
+++ b/trunk/demux.c
@@ -1638,6 +1638,7 @@ char *demux_Iconv(void *_unused, const char *psz_encoding,
  * This code is from biTStream's examples and is under the WTFPL (see
  * LICENSE.WTFPL).
  *****************************************************************************/
+__attribute__ ((format(printf, 2, 3)))
 static void demux_Print(void *_unused, const char *psz_format, ...)
 {
     char psz_fmt[strlen(psz_format) + 2];
diff --git a/trunk/dvblast.h b/trunk/dvblast.h
index 3b5a750..a6068aa 100644
--- a/trunk/dvblast.h
+++ b/trunk/dvblast.h
@@ -192,11 +192,11 @@ void msg_Connect( const char *ident );
 void msg_Disconnect( void );
 
 /* */
-void msg_Info( void *_unused, const char *psz_format, ... );
-void msg_Err( void *_unused, const char *psz_format, ... );
-void msg_Warn( void *_unused, const char *psz_format, ... );
-void msg_Dbg( void *_unused, const char *psz_format, ... );
-void msg_Raw( void *_unused, const char *psz_format, ... );
+__attribute__ ((format(printf, 2, 3))) void msg_Info( void *_unused, const char *psz_format, ... );
+__attribute__ ((format(printf, 2, 3))) void msg_Err( void *_unused, const char *psz_format, ... );
+__attribute__ ((format(printf, 2, 3))) void msg_Warn( void *_unused, const char *psz_format, ... );
+__attribute__ ((format(printf, 2, 3))) void msg_Dbg( void *_unused, const char *psz_format, ... );
+__attribute__ ((format(printf, 2, 3))) void msg_Raw( void *_unused, const char *psz_format, ... );
 
 /* */
 mtime_t mdate( void );
-- 
1.7.5.1


More information about the dvblast-devel mailing list