[asterisk-commits] kpfleming: branch 1.4 r159808 - in /branches/1.4: ./ channels/ include/ inclu...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Nov 29 10:58:32 CST 2008


Author: kpfleming
Date: Sat Nov 29 10:58:29 2008
New Revision: 159808

URL: http://svn.digium.com/view/asterisk?view=rev&rev=159808
Log:
update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors

since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them

format attributes in a consistent way


Modified:
    branches/1.4/Makefile
    branches/1.4/channels/chan_agent.c
    branches/1.4/channels/chan_iax2.c
    branches/1.4/channels/chan_misdn.c
    branches/1.4/channels/chan_sip.c
    branches/1.4/channels/chan_vpb.cc
    branches/1.4/configure
    branches/1.4/configure.ac
    branches/1.4/include/asterisk/channel.h
    branches/1.4/include/asterisk/cli.h
    branches/1.4/include/asterisk/devicestate.h
    branches/1.4/include/asterisk/dundi.h
    branches/1.4/include/asterisk/linkedlists.h
    branches/1.4/include/asterisk/lock.h
    branches/1.4/include/asterisk/logger.h
    branches/1.4/include/asterisk/manager.h
    branches/1.4/include/asterisk/module.h
    branches/1.4/include/asterisk/res_odbc.h
    branches/1.4/include/asterisk/stringfields.h
    branches/1.4/include/asterisk/strings.h
    branches/1.4/include/asterisk/threadstorage.h
    branches/1.4/include/asterisk/utils.h
    branches/1.4/include/jitterbuf.h
    branches/1.4/main/ast_expr2.c
    branches/1.4/main/dns.c
    branches/1.4/main/enum.c
    branches/1.4/main/jitterbuf.c
    branches/1.4/main/logger.c
    branches/1.4/main/srv.c
    branches/1.4/makeopts.in
    branches/1.4/res/res_agi.c
    branches/1.4/res/res_features.c
    branches/1.4/utils/astman.c
    branches/1.4/utils/check_expr.c
    branches/1.4/utils/frame.c

Modified: branches/1.4/Makefile
URL: http://svn.digium.com/view/asterisk/branches/1.4/Makefile?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/Makefile (original)
+++ branches/1.4/Makefile Sat Nov 29 10:58:29 2008
@@ -204,7 +204,14 @@
 ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
 
 ifeq ($(AST_DEVMODE),yes)
-  ASTCFLAGS+=-Werror  -Wunused $(AST_DECLARATION_AFTER_STATEMENT)
+  ASTCFLAGS+=-Werror
+  ASTCFLAGS+=-Wunused
+  ASTCFLAGS+=$(AST_DECLARATION_AFTER_STATEMENT)
+  ASTCFLAGS+=$(AST_FORTIFY_SOURCE)
+# ASTCFLAGS+=-Wundef 
+  ASTCFLAGS+=-Wformat -Wformat-security
+  ASTCFLAGS+=-Wmissing-format-attribute
+# ASTCFLAGS+=-Wformat=2
 endif
 
 ifneq ($(findstring BSD,$(OSARCH)),)

Modified: branches/1.4/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_agent.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/channels/chan_agent.c (original)
+++ branches/1.4/channels/chan_agent.c Sat Nov 29 10:58:29 2008
@@ -1035,7 +1035,7 @@
 	}
 #endif	
 	if (p->pending)
-		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/P%s-%d", p->agent, ast_random() & 0xffff);
+		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/P%s-%d", p->agent, (int) ast_random() & 0xffff);
 	else
 		tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/%s", p->agent);
 	if (!tmp) {

Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Sat Nov 29 10:58:29 2008
@@ -770,7 +770,7 @@
 	ast_log(LOG_WARNING, "%s", data);
 }
 
-static void jb_error_output(const char *fmt, ...)
+static void __attribute__((format(printf, 1, 2))) jb_error_output(const char *fmt, ...)
 {
 	va_list args;
 	char buf[1024];
@@ -782,7 +782,7 @@
 	ast_log(LOG_ERROR, "%s", buf);
 }
 
-static void jb_warning_output(const char *fmt, ...)
+static void __attribute__((format(printf, 1, 2))) jb_warning_output(const char *fmt, ...)
 {
 	va_list args;
 	char buf[1024];
@@ -794,7 +794,7 @@
 	ast_log(LOG_WARNING, "%s", buf);
 }
 
-static void jb_debug_output(const char *fmt, ...)
+static void __attribute__((format(printf, 1, 2))) jb_debug_output(const char *fmt, ...)
 {
 	va_list args;
 	char buf[1024];

Modified: branches/1.4/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_misdn.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/channels/chan_misdn.c (original)
+++ branches/1.4/channels/chan_misdn.c Sat Nov 29 10:58:29 2008
@@ -291,7 +291,7 @@
 static int *misdn_ports;
 
 static void chan_misdn_log(int level, int port, char *tmpl, ...)
-	__attribute__ ((format (printf, 3, 4)));
+	__attribute__((format(printf, 3, 4)));
 
 static struct ast_channel *misdn_new(struct chan_list *cl, int state,  char *exten, char *callerid, int format, int port, int c);
 static void send_digit_to_chan(struct chan_list *cl, char digit );

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Sat Nov 29 10:58:29 2008
@@ -1813,7 +1813,7 @@
 
 	/* z9hG4bK is a magic cookie.  See RFC 3261 section 8.1.1.7 */
 	ast_string_field_build(p, via, "SIP/2.0/UDP %s:%d;branch=z9hG4bK%08x%s",
-			 ast_inet_ntoa(p->ourip), ourport, p->branch, rport);
+			       ast_inet_ntoa(p->ourip), ourport, (int) p->branch, rport);
 }
 
 /*! \brief NAT fix - decide which IP address to use for ASterisk server?
@@ -1859,10 +1859,10 @@
 #define append_history(p, event, fmt , args... )	append_history_full(p, "%-15s " fmt, event, ## args)
 
 static void append_history_full(struct sip_pvt *p, const char *fmt, ...)
-	__attribute__ ((format (printf, 2, 3)));
+	__attribute__((format(printf, 2, 3)));
 
 /*! \brief Append to SIP dialog history with arg list  */
-static void append_history_va(struct sip_pvt *p, const char *fmt, va_list ap)
+static void __attribute__((format(printf, 2, 0))) append_history_va(struct sip_pvt *p, const char *fmt, va_list ap)
 {
 	char buf[80], *c = buf; /* max history length */
 	struct sip_history *hist;

Modified: branches/1.4/channels/chan_vpb.cc
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_vpb.cc?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/channels/chan_vpb.cc (original)
+++ branches/1.4/channels/chan_vpb.cc Sat Nov 29 10:58:29 2008
@@ -2495,7 +2495,7 @@
 	}
 	ast_verb(4, "%s: New call for context [%s]\n", me->dev, context);
 	    
-	tmp = ast_channel_alloc(1, state, 0, 0, "", me->ext, me->context, 0, me->dev);
+	tmp = ast_channel_alloc(1, state, 0, 0, "", me->ext, me->context, 0, "%s", me->dev);
 	if (tmp) {
 		if (use_ast_ind == 1){
 			tmp->tech = &vpb_tech_indicate;

Modified: branches/1.4/configure.ac
URL: http://svn.digium.com/view/asterisk/branches/1.4/configure.ac?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/configure.ac (original)
+++ branches/1.4/configure.ac Sat Nov 29 10:58:29 2008
@@ -351,18 +351,28 @@
    AC_MSG_RESULT(yes)
    AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
 else
-	AC_MSG_RESULT(no)
-	AST_DECLARATION_AFTER_STATEMENT=
+   AC_MSG_RESULT(no)
+   AST_DECLARATION_AFTER_STATEMENT=
 fi
 AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
+
+AC_MSG_CHECKING(for _FORTIFY_SOURCE support)
+if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+   AC_MSG_RESULT(yes)
+   AST_FORTIFY_SOURCE=-D_FORTIFY_SOURCE=2
+else
+   AC_MSG_RESULT(no)
+   AST_FORTIFY_SOURCE=
+fi
+AC_SUBST(AST_FORTIFY_SOURCE)
 
 AC_MSG_CHECKING(for -fno-strict-overflow)
 if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
    AC_MSG_RESULT(yes)
    AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
 else
-	AC_MSG_RESULT(no)
-	AST_NO_STRICT_OVERFLOW=
+   AC_MSG_RESULT(no)
+   AST_NO_STRICT_OVERFLOW=
 fi
 AC_SUBST(AST_NO_STRICT_OVERFLOW)
 

Modified: branches/1.4/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/channel.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/channel.h (original)
+++ branches/1.4/include/asterisk/channel.h Sat Nov 29 10:58:29 2008
@@ -627,7 +627,7 @@
 	by default set to the "default" context and
 	extension "s"
  */
-struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const int amaflag, const char *name_fmt, ...);
+struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const int amaflag, const char *name_fmt, ...) __attribute__((format(printf, 9, 10)));
 
 /*! \brief Queue an outgoing frame */
 int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f);
@@ -1152,8 +1152,7 @@
 
 
 /*! return a mallocd string with the result of sprintf of the fmt and following args */
-char *ast_safe_string_alloc(const char *fmt, ...);
-
+char __attribute__((format(printf, 1, 2))) *ast_safe_string_alloc(const char *fmt, ...);
 
 
 /*! Start a tone going */

Modified: branches/1.4/include/asterisk/cli.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/cli.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/cli.h (original)
+++ branches/1.4/include/asterisk/cli.h Sat Nov 29 10:58:29 2008
@@ -32,7 +32,7 @@
 #include "asterisk/linkedlists.h"
 
 void ast_cli(int fd, char *fmt, ...)
-	__attribute__ ((format (printf, 2, 3)));
+	__attribute__((format(printf, 2, 3)));
 
 #define RESULT_SUCCESS		0
 #define RESULT_SHOWUSAGE	1

Modified: branches/1.4/include/asterisk/devicestate.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/devicestate.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/devicestate.h (original)
+++ branches/1.4/include/asterisk/devicestate.h Sat Nov 29 10:58:29 2008
@@ -83,7 +83,7 @@
  * Returns 0 on success, -1 on failure
  */
 int ast_device_state_changed(const char *fmt, ...)
-	__attribute__ ((format (printf, 1, 2)));
+	__attribute__((format(printf, 1, 2)));
 
 
 /*! \brief Tells Asterisk the State for Device is changed 

Modified: branches/1.4/include/asterisk/dundi.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/dundi.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/dundi.h (original)
+++ branches/1.4/include/asterisk/dundi.h Sat Nov 29 10:58:29 2008
@@ -31,7 +31,7 @@
 /*!\brief A DUNDi Entity ID is essentially a MAC address, brief and unique */
 struct _dundi_eid {
 	unsigned char eid[6];
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 typedef struct _dundi_eid dundi_eid;
 
@@ -43,13 +43,13 @@
 	unsigned char cmdresp;			/*!< Command / Response */
 	unsigned char cmdflags;			/*!< Command / Response specific flags*/
 	unsigned char ies[0];
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 struct dundi_ie_hdr {
 	unsigned char ie;
 	unsigned char len;
 	unsigned char iedata[0];
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 #define DUNDI_FLAG_RETRANS		(1 << 16)	/*!< Applies to dtrans */
 #define DUNDI_FLAG_RESERVED		(1 << 16)	/*!< Applies to strans */
@@ -78,7 +78,7 @@
 struct dundi_encblock {				/*!< AES-128 encrypted block */
 	unsigned char iv[16];			/*!< Initialization vector of random data */
 	unsigned char encdata[0];		/*!< Encrypted / compressed data */
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 struct dundi_answer {
 	dundi_eid eid;				/*!< Original source of answer */
@@ -86,12 +86,12 @@
 	unsigned short flags;			/*!< Flags relating to answer */
 	unsigned short weight;			/*!< Weight of answers */
 	unsigned char data[0];			/*!< Protocol specific URI */
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 struct dundi_hint {
 	unsigned short flags;			/*!< Flags relating to answer */
 	unsigned char data[0];			/*!< For data for hint */
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 #define DUNDI_CAUSE_SUCCESS		0	/*!< Success */
 #define DUNDI_CAUSE_GENERAL		1	/*!< General unspecified failure */
@@ -105,14 +105,14 @@
 struct dundi_cause {			
 	unsigned char causecode;		/*!< Numerical cause (DUNDI_CAUSE_*) */
 	char desc[0];				/*!< Textual description */
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 struct dundi_peer_status {
 	unsigned int flags;
 	unsigned short netlag;
 	unsigned short querylag;
 	dundi_eid peereid;
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 #define DUNDI_PEER_PRIMARY		(1 << 0)
 #define DUNDI_PEER_SECONDARY		(1 << 1)

Modified: branches/1.4/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/linkedlists.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/linkedlists.h (original)
+++ branches/1.4/include/asterisk/linkedlists.h Sat Nov 29 10:58:29 2008
@@ -242,11 +242,11 @@
 	struct type *last;						\
 	ast_mutex_t lock;						\
 } name;									\
-static void  __attribute__ ((constructor)) init_##name(void)		\
+static void  __attribute__((constructor)) init_##name(void)		\
 {									\
         AST_LIST_HEAD_INIT(&name);					\
 }									\
-static void  __attribute__ ((destructor)) fini_##name(void)		\
+static void  __attribute__((destructor)) fini_##name(void)		\
 {									\
         AST_LIST_HEAD_DESTROY(&name);					\
 }									\
@@ -284,11 +284,11 @@
         struct type *last;                                              \
         ast_rwlock_t lock;                                              \
 } name;                                                                 \
-static void  __attribute__ ((constructor)) init_##name(void)            \
+static void  __attribute__((constructor)) init_##name(void)            \
 {                                                                       \
         AST_RWLIST_HEAD_INIT(&name);                                    \
 }                                                                       \
-static void  __attribute__ ((destructor)) fini_##name(void)             \
+static void  __attribute__((destructor)) fini_##name(void)             \
 {                                                                       \
         AST_RWLIST_HEAD_DESTROY(&name);                                 \
 }                                                                       \

Modified: branches/1.4/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/lock.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/lock.h (original)
+++ branches/1.4/include/asterisk/lock.h Sat Nov 29 10:58:29 2008
@@ -799,14 +799,14 @@
  destructors to destroy mutexes and create it on the fly.  */
 #define __AST_MUTEX_DEFINE(scope, mutex, init_val, track) \
 	scope ast_mutex_t mutex = init_val; \
-static void  __attribute__ ((constructor)) init_##mutex(void) \
+static void  __attribute__((constructor)) init_##mutex(void) \
 { \
 	if (track) \
 		ast_mutex_init(&mutex); \
 	else \
 		ast_mutex_init_notracking(&mutex); \
 } \
-static void  __attribute__ ((destructor)) fini_##mutex(void) \
+static void  __attribute__((destructor)) fini_##mutex(void) \
 { \
 	ast_mutex_destroy(&mutex); \
 }
@@ -1113,11 +1113,11 @@
 #ifndef HAVE_PTHREAD_RWLOCK_INITIALIZER
 #define __AST_RWLOCK_DEFINE(scope, rwlock) \
         scope ast_rwlock_t rwlock; \
-static void  __attribute__ ((constructor)) init_##rwlock(void) \
+static void  __attribute__((constructor)) init_##rwlock(void) \
 { \
         ast_rwlock_init(&rwlock); \
 } \
-static void  __attribute__ ((destructor)) fini_##rwlock(void) \
+static void  __attribute__((destructor)) fini_##rwlock(void) \
 { \
         ast_rwlock_destroy(&rwlock); \
 }

Modified: branches/1.4/include/asterisk/logger.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/logger.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/logger.h (original)
+++ branches/1.4/include/asterisk/logger.h Sat Nov 29 10:58:29 2008
@@ -60,7 +60,7 @@
 	\param fmt	This is what is important.  The format is the same as your favorite breed of printf.  You know how that works, right? :-)
  */
 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
-	__attribute__ ((format (printf, 5, 6)));
+	__attribute__((format(printf, 5, 6)));
 
 void ast_backtrace(void);
 
@@ -68,7 +68,7 @@
 int logger_reload(void);
 
 void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...)
-	__attribute__ ((format (printf, 5, 6)));
+	__attribute__((format(printf, 5, 6)));
 
 /*! Send a verbose message (based on verbose level)
  	\brief This works like ast_log, but prints verbose messages to the console depending on verbosity level set.
@@ -78,7 +78,7 @@
  	VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined.
  */
 void ast_verbose(const char *fmt, ...)
-	__attribute__ ((format (printf, 1, 2)));
+	__attribute__((format(printf, 1, 2)));
 
 int ast_register_verbose(void (*verboser)(const char *string));
 int ast_unregister_verbose(void (*verboser)(const char *string));

Modified: branches/1.4/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/manager.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/manager.h (original)
+++ branches/1.4/include/asterisk/manager.h Sat Nov 29 10:58:29 2008
@@ -126,7 +126,7 @@
 	\param event	Event name
 	\param contents	Contents of event
 */
-int __attribute__ ((format (printf, 3,4))) manager_event(int category, const char *event, const char *contents, ...);
+int __attribute__((format(printf, 3,4))) manager_event(int category, const char *event, const char *contents, ...);
 
 /*! Get header from mananger transaction */
 const char *astman_get_header(const struct message *m, char *var);
@@ -139,7 +139,7 @@
 void astman_send_response(struct mansession *s, const struct message *m, char *resp, char *msg);
 void astman_send_ack(struct mansession *s, const struct message *m, char *msg);
 
-void __attribute__ ((format (printf, 2, 3))) astman_append(struct mansession *s, const char *fmt, ...);
+void __attribute__((format(printf, 2, 3))) astman_append(struct mansession *s, const char *fmt, ...);
 
 /*! Called by Asterisk initialization */
 int init_manager(void);

Modified: branches/1.4/include/asterisk/module.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/module.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/module.h (original)
+++ branches/1.4/include/asterisk/module.h Sat Nov 29 10:58:29 2008
@@ -237,11 +237,11 @@
 		flags_to_set | AST_MODFLAG_BUILDSUM,	\
 		AST_BUILDOPT_SUM,			\
 	};						\
-	static void  __attribute__ ((constructor)) __reg_module(void) \
+	static void  __attribute__((constructor)) __reg_module(void) \
 	{ \
 		ast_module_register(&__mod_info); \
 	} \
-	static void  __attribute__ ((destructor)) __unreg_module(void) \
+	static void  __attribute__((destructor)) __unreg_module(void) \
 	{ \
 		ast_module_unregister(&__mod_info); \
 	} \
@@ -268,11 +268,11 @@
 		.buildopt_sum = AST_BUILDOPT_SUM,		\
 		fields						\
 	};							\
-	static void  __attribute__ ((constructor)) __reg_module(void) \
+	static void  __attribute__((constructor)) __reg_module(void) \
 	{ \
 		ast_module_register(&__mod_info); \
 	} \
-	static void  __attribute__ ((destructor)) __unreg_module(void) \
+	static void  __attribute__((destructor)) __unreg_module(void) \
 	{ \
 		ast_module_unregister(&__mod_info); \
 	} \

Modified: branches/1.4/include/asterisk/res_odbc.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/res_odbc.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/res_odbc.h (original)
+++ branches/1.4/include/asterisk/res_odbc.h Sat Nov 29 10:58:29 2008
@@ -61,7 +61,7 @@
  * This function really only ever worked with MySQL, where the statement handle is
  * not prepared on the server.  If you are not using MySQL, you should avoid it.
  */
-int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt) __attribute__ ((deprecated));
+int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt) __attribute__((deprecated));
 
 /*! \brief Retrieves a connected ODBC object
  * \param name The name of the ODBC class for which a connection is needed.

Modified: branches/1.4/include/asterisk/stringfields.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/stringfields.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/stringfields.h (original)
+++ branches/1.4/include/asterisk/stringfields.h Sat Nov 29 10:58:29 2008
@@ -165,7 +165,7 @@
 */
 void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
 				    ast_string_field *fields, int num_fields,
-				    int index, const char *format, ...);
+				    int index, const char *format, ...) __attribute__((format(printf, 5, 6)));
 
 /*!
   \internal
@@ -181,7 +181,7 @@
 */
 void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr,
 				       ast_string_field *fields, int num_fields,
-				       int index, const char *format, va_list a1, va_list a2);
+				       int index, const char *format, va_list a1, va_list a2)  __attribute__((format(printf, 5, 0)));
 
 /*!
   \brief Declare a string field

Modified: branches/1.4/include/asterisk/strings.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/strings.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/strings.h (original)
+++ branches/1.4/include/asterisk/strings.h Sat Nov 29 10:58:29 2008
@@ -190,7 +190,7 @@
   \param fmt printf-style format string
   \return 0 on success, non-zero on failure.
 */
-int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
+int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
 
 /*!
   \brief Build a string in a buffer, designed to be called repeatedly
@@ -204,7 +204,7 @@
   \param fmt printf-style format string
   \param ap varargs list of arguments for format
 */
-int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap);
+int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap) __attribute__((format(printf, 3, 0)));
 
 /*! Make sure something is true */
 /*!

Modified: branches/1.4/include/asterisk/threadstorage.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/threadstorage.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/threadstorage.h (original)
+++ branches/1.4/include/asterisk/threadstorage.h Sat Nov 29 10:58:29 2008
@@ -364,7 +364,7 @@
  * writing over it.
  */
 int ast_dynamic_str_thread_build_va(struct ast_dynamic_str **buf, size_t max_len,
-	struct ast_threadstorage *ts, int append, const char *fmt, va_list ap);
+				    struct ast_threadstorage *ts, int append, const char *fmt, va_list ap)  __attribute__((format(printf, 5, 0)));
 
 /*!
  * \brief Set a thread locally stored dynamic string using variable arguments
@@ -406,7 +406,7 @@
  * \endcode
  */
 AST_INLINE_API(
-int __attribute__ ((format (printf, 4, 5))) ast_dynamic_str_thread_set(
+int __attribute__((format(printf, 4, 5))) ast_dynamic_str_thread_set(
 	struct ast_dynamic_str **buf, size_t max_len, 
 	struct ast_threadstorage *ts, const char *fmt, ...),
 {
@@ -429,7 +429,7 @@
  * the string, this function appends to the current value.
  */
 AST_INLINE_API(
-int __attribute__ ((format (printf, 4, 5))) ast_dynamic_str_thread_append(
+int __attribute__((format(printf, 4, 5))) ast_dynamic_str_thread_append(
 	struct ast_dynamic_str **buf, size_t max_len, 
 	struct ast_threadstorage *ts, const char *fmt, ...),
 {
@@ -457,7 +457,7 @@
  *         family of functions.
  */
 AST_INLINE_API(
-int __attribute__ ((format (printf, 3, 4))) ast_dynamic_str_set(
+int __attribute__((format(printf, 3, 4))) ast_dynamic_str_set(
 	struct ast_dynamic_str **buf, size_t max_len,
 	const char *fmt, ...),
 {
@@ -480,7 +480,7 @@
  * of setting a new value.
  */
 AST_INLINE_API(
-int __attribute__ ((format (printf, 3, 4))) ast_dynamic_str_append(
+int __attribute__((format(printf, 3, 4))) ast_dynamic_str_append(
 	struct ast_dynamic_str **buf, size_t max_len,
 	const char *fmt, ...),
 {

Modified: branches/1.4/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/utils.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/asterisk/utils.h (original)
+++ branches/1.4/include/asterisk/utils.h Sat Nov 29 10:58:29 2008
@@ -474,7 +474,7 @@
 #define ast_asprintf(ret, fmt, ...) \
 	_ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
 
-int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...) __attribute__ ((format (printf, 5, 6)));
+int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...) __attribute__((format(printf, 5, 6)));
 
 /*!
  * \brief A wrapper for vasprintf()
@@ -488,7 +488,7 @@
 	_ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
 
 AST_INLINE_API(
-int _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
+int __attribute__((format(printf, 5, 0))) _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
 {
 	int res;
 

Modified: branches/1.4/include/jitterbuf.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/jitterbuf.h?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/include/jitterbuf.h (original)
+++ branches/1.4/include/jitterbuf.h Sat Nov 29 10:58:29 2008
@@ -151,8 +151,8 @@
 /* set jitterbuf conf */
 enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf);
 
-typedef 		void (*jb_output_function_t)(const char *fmt, ...);
-void 			jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg);
+typedef void __attribute__((format(printf, 1, 2))) (*jb_output_function_t)(const char *fmt, ...);
+void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg);
 
 #ifdef __cplusplus
 }

Modified: branches/1.4/main/ast_expr2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/ast_expr2.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/main/ast_expr2.c (original)
+++ branches/1.4/main/ast_expr2.c Sat Nov 29 10:58:29 2008
@@ -179,7 +179,7 @@
 } ;
 
 #ifdef STANDALONE
-void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
+void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__((format(printf,5,6)));
 #endif
 
 struct val {

Modified: branches/1.4/main/dns.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/dns.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/main/dns.c (original)
+++ branches/1.4/main/dns.c Sat Nov 29 10:58:29 2008
@@ -148,7 +148,7 @@
 	unsigned short class;
 	unsigned int ttl;
 	unsigned short size;
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 static int skip_name(unsigned char *s, int len)
 {

Modified: branches/1.4/main/enum.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/enum.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/main/enum.c (original)
+++ branches/1.4/main/enum.c Sat Nov 29 10:58:29 2008
@@ -92,7 +92,7 @@
 struct naptr {
 	unsigned short order;
 	unsigned short pref;
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 /*! \brief Parse NAPTR record information elements */
 static unsigned int parse_ie(char *data, unsigned int maxdatalen, unsigned char *src, unsigned int srclen)

Modified: branches/1.4/main/jitterbuf.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/jitterbuf.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/main/jitterbuf.c (original)
+++ branches/1.4/main/jitterbuf.c Sat Nov 29 10:58:29 2008
@@ -565,7 +565,7 @@
 
 	/* if a hard clamp was requested, use it */
 	if ((jb->info.conf.max_jitterbuf) && ((jb->info.target - jb->info.min) > jb->info.conf.max_jitterbuf)) {
-		jb_dbg("clamping target from %d to %d\n", (jb->info.target - jb->info.min), jb->info.conf.max_jitterbuf);
+		jb_dbg("clamping target from %ld to %ld\n", (jb->info.target - jb->info.min), jb->info.conf.max_jitterbuf);
 		jb->info.target = jb->info.min + jb->info.conf.max_jitterbuf;
 	}
 

Modified: branches/1.4/main/logger.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/logger.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/main/logger.c (original)
+++ branches/1.4/main/logger.c Sat Nov 29 10:58:29 2008
@@ -655,7 +655,7 @@
 	return;
 }
 
-static void ast_log_vsyslog(int level, const char *file, int line, const char *function, const char *fmt, va_list args) 
+static void __attribute__((format(printf, 5, 0))) ast_log_vsyslog(int level, const char *file, int line, const char *function, const char *fmt, va_list args) 
 {
 	char buf[BUFSIZ];
 	char *s;

Modified: branches/1.4/main/srv.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/srv.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/main/srv.c (original)
+++ branches/1.4/main/srv.c Sat Nov 29 10:58:29 2008
@@ -77,7 +77,7 @@
 		unsigned short priority;
 		unsigned short weight;
 		unsigned short port;
-	} __attribute__ ((__packed__)) *srv = (struct srv *) answer;
+	} __attribute__((__packed__)) *srv = (struct srv *) answer;
 
 	int res = 0;
 	char repl[256] = "";

Modified: branches/1.4/makeopts.in
URL: http://svn.digium.com/view/asterisk/branches/1.4/makeopts.in?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/makeopts.in (original)
+++ branches/1.4/makeopts.in Sat Nov 29 10:58:29 2008
@@ -63,6 +63,7 @@
 
 AST_DECLARATION_AFTER_STATEMENT=@AST_DECLARATION_AFTER_STATEMENT@
 AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@
+AST_FORTIFY_SOURCE=@AST_FORTIFY_SOURCE@
 
 ASOUND_INCLUDE=@ALSA_INCLUDE@
 ASOUND_LIB=@ALSA_LIB@

Modified: branches/1.4/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_agi.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/res/res_agi.c (original)
+++ branches/1.4/res/res_agi.c Sat Nov 29 10:58:29 2008
@@ -119,7 +119,7 @@
 	AGI_RESULT_HANGUP
 };
 
-static int agi_debug_cli(int fd, char *fmt, ...)
+static int __attribute__((format(printf, 2, 3))) agi_debug_cli(int fd, char *fmt, ...)
 {
 	char *stuff;
 	int res = 0;
@@ -1815,7 +1815,7 @@
 		switch(res) {
 		case RESULT_SHOWUSAGE:
 			fdprintf(agi->fd, "520-Invalid command syntax.  Proper usage follows:\n");
-			fdprintf(agi->fd, c->usage);
+			fdprintf(agi->fd, "%s", c->usage);
 			fdprintf(agi->fd, "520 End of proper usage.\n");
 			break;
 		case AST_PBX_KEEPALIVE:

Modified: branches/1.4/res/res_features.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_features.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/res/res_features.c (original)
+++ branches/1.4/res/res_features.c Sat Nov 29 10:58:29 2008
@@ -198,7 +198,7 @@
 
 	goto_on_transfer = ast_strdupa(val);
 
-	if (!(xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, chan->name)))
+	if (!(xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "%s", chan->name)))
 		return;
 
 	for (x = goto_on_transfer; x && *x; x++) {

Modified: branches/1.4/utils/astman.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/utils/astman.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/utils/astman.c (original)
+++ branches/1.4/utils/astman.c Sat Nov 29 10:58:29 2008
@@ -140,7 +140,7 @@
 	AST_LIST_TRAVERSE_SAFE_END
 }
 
-static void fdprintf(int fd, char *fmt, ...)
+static void __attribute__((format(printf, 2, 3))) fdprintf(int fd, char *fmt, ...)
 {
 	char stuff[4096];
 	va_list ap;
@@ -397,7 +397,7 @@
 	return NULL;
 }
 
-static int manager_action(char *action, char *fmt, ...)
+static int __attribute__((format(printf, 2, 3))) manager_action(char *action, char *fmt, ...)
 {
 	struct ast_mansession *s;
 	char tmp[4096];
@@ -459,7 +459,7 @@
 static void try_status(void)
 {
 	struct message *m;
-	manager_action("Status", "");
+	manager_action("Status", "%s", "");
 	m = wait_for_response(10000);
 	if (!m) {
 		show_message("Status Failed", "Timeout waiting for response");

Modified: branches/1.4/utils/check_expr.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/utils/check_expr.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/utils/check_expr.c (original)
+++ branches/1.4/utils/check_expr.c Sat Nov 29 10:58:29 2008
@@ -41,7 +41,7 @@
 
 /* Our own version of ast_log, since the expr parser uses it. */
 
-void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
+void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__((format(printf,5,6)));
 
 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
 {

Modified: branches/1.4/utils/frame.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/utils/frame.c?view=diff&rev=159808&r1=159807&r2=159808
==============================================================================
--- branches/1.4/utils/frame.c (original)
+++ branches/1.4/utils/frame.c Sat Nov 29 10:58:29 2008
@@ -968,7 +968,7 @@
   return TRUE;      /* Input file done with, no errors. */
 }
 
-int chat( const char *format, ...)
+int __attribute__((format(printf, 1, 2))) chat( const char *format, ...)
 {
     va_list ap;
     int result = 0;
@@ -983,7 +983,7 @@
 }
 
 
-int inform( const char *format, ...)
+int __attribute__((format(printf, 1, 2))) inform( const char *format, ...)
 {
     va_list ap;
     int result = 0;
@@ -997,7 +997,7 @@
     return result;
 }
 
-int error( const char *format, ...)
+int __attribute__((format(printf, 1, 2))) error( const char *format, ...)
 {
     va_list ap;
     int result;
@@ -1008,7 +1008,7 @@
     return result;
 }
 
-void fatalerror( const char *format, ...)
+void __attribute__((format(printf, 1, 2))) fatalerror( const char *format, ...)
 {
     va_list ap;
 
@@ -1024,7 +1024,7 @@
   myexit( 1);
 }
 
-int say( const char *format, ...)
+int __attribute__((format(printf, 1, 2))) say( const char *format, ...)
 {
     va_list ap;
     int result;




More information about the asterisk-commits mailing list