From 65d46d7e0123cf42b5c98f633bd41c90acaa180d Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 21 Apr 2006 23:15:44 +0000 Subject: Add printf format attributes. CVS patchset: 7977 CVS date: 2006/04/21 23:15:44 --- src/audio_out/audio_alsa_out.c | 8 ++++++-- src/audio_out/audio_directx2_out.c | 8 ++++++-- src/demuxers/demux_qt.c | 16 ++++++++++------ src/input/input_cdda.c | 8 ++++++-- src/input/vcd/xine-extra.h | 14 +++++++++++--- src/libffmpeg/diff_to_ffmpeg_cvs.txt | 20 ++++++++++++++++++++ src/libffmpeg/libavcodec/interplayvideo.c | 6 +++++- src/libxineadec/nosefart/log.h | 11 +++++++++-- src/xine-engine/broadcaster.c | 16 ++++++++++++---- src/xine-utils/xine_check.c | 5 ++++- 10 files changed, 89 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 837e824d4..51dcdf59b 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton * * - * $Id: audio_alsa_out.c,v 1.158 2006/01/27 07:46:09 tmattern Exp $ + * $Id: audio_alsa_out.c,v 1.159 2006/04/21 23:15:44 dsalt Exp $ */ #ifdef HAVE_CONFIG_H @@ -272,7 +272,11 @@ static long ao_alsa_get_volume_from_percent(int val, long min, long max) { * Error callback, we need to control this, * error message should be printed only in DEBUG mode. */ -static void error_callback(const char *file, int line, +static void +#ifdef __GNUC__ + __attribute__((format (printf, 5, 6))) +#endif + error_callback(const char *file, int line, const char *function, int err, const char *fmt, ...) { #ifdef DEBUG va_list args; diff --git a/src/audio_out/audio_directx2_out.c b/src/audio_out/audio_directx2_out.c index 3f33d34d5..f5384a794 100644 --- a/src/audio_out/audio_directx2_out.c +++ b/src/audio_out/audio_directx2_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_directx2_out.c,v 1.4 2005/09/05 17:02:57 valtri Exp $ + * $Id: audio_directx2_out.c,v 1.5 2006/04/21 23:15:45 dsalt Exp $ * * * xine audio output plugin using DirectX @@ -151,7 +151,11 @@ static int buffer_ready(dx2_driver_t *this); /* popup a dialog with error */ -static void error_message(const char *fmt, ...) { +static void +#ifdef __GNUC__ + __attribute__((format (printf, 1, 2))) +#endif + error_message(const char *fmt, ...) { char message[256]; va_list ap; diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index c0155d376..c65bbd712 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -30,7 +30,7 @@ * build_frame_table * free_qt_info * - * $Id: demux_qt.c,v 1.204 2006/03/16 21:44:14 tmattern Exp $ + * $Id: demux_qt.c,v 1.205 2006/04/21 23:15:45 dsalt Exp $ * */ @@ -410,34 +410,38 @@ typedef struct { #define DEBUG_DUMP_MOOV 0 #define RAW_MOOV_FILENAME "moovatom.raw" +#ifndef __GNUC__ +#define __attribute__(x) +#endif + #if DEBUG_ATOM_LOAD #define debug_atom_load printf #else -static inline void debug_atom_load(const char *format, ...) { } +static inline void __attribute__((format (printf, 1, 2))) debug_atom_load(const char *format, ...) {} #endif #if DEBUG_EDIT_LIST #define debug_edit_list printf #else -static inline void debug_edit_list(const char *format, ...) { } +static inline void __attribute__((format (printf, 1, 2))) debug_edit_list(const char *format, ...) {} #endif #if DEBUG_FRAME_TABLE #define debug_frame_table printf #else -static inline void debug_frame_table(const char *format, ...) { } +static inline void __attribute__((format (printf, 1, 2))) debug_frame_table(const char *format, ...) {} #endif #if DEBUG_VIDEO_DEMUX #define debug_video_demux printf #else -static inline void debug_video_demux(const char *format, ...) { } +static inline void __attribute__((format (printf, 1, 2))) debug_video_demux(const char *format, ...) {} #endif #if DEBUG_AUDIO_DEMUX #define debug_audio_demux printf #else -static inline void debug_audio_demux(const char *format, ...) { } +static inline void __attribute__((format (printf, 1, 2))) debug_audio_demux(const char *format, ...) {} #endif static inline void dump_moov_atom(unsigned char *moov_atom, int moov_atom_size) { diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index d1940f831..3eba52e10 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.84 2006/02/09 09:29:55 miguelfreitas Exp $ + * $Id: input_cdda.c,v 1.85 2006/04/21 23:15:45 dsalt Exp $ */ #ifdef HAVE_CONFIG_H @@ -908,7 +908,11 @@ static int parse_url (char *urlbuf, char** host, int *port) { } #endif -static int network_command( xine_stream_t *stream, int socket, char *data_buf, char *msg, ...) +static int +#ifdef __GNUC__ +__attribute__((format (printf, 4, 5))) +#endif +network_command( xine_stream_t *stream, int socket, char *data_buf, char *msg, ...) { char buf[_BUFSIZ]; va_list args; diff --git a/src/input/vcd/xine-extra.h b/src/input/vcd/xine-extra.h index 5a2e0b127..d0b2a0bb5 100644 --- a/src/input/vcd/xine-extra.h +++ b/src/input/vcd/xine-extra.h @@ -1,5 +1,5 @@ /* - $Id: xine-extra.h,v 1.1 2003/10/13 11:47:11 f1rmb Exp $ + $Id: xine-extra.h,v 1.2 2006/04/21 23:15:45 dsalt Exp $ Copyright (C) 2002 Rocky Bernstein @@ -80,7 +80,11 @@ bool xine_log_init(xine_t *this); an error, such as logging wasn't initialized. On error, nothing is logged. */ -bool xine_log_msg(const char *format, ...); +bool xine_log_msg(const char *format, ...) +#ifdef __GNUC__ +__attribute__((format (printf, 1, 2))) +#endif +; /*! This routine is like xine_log without any xine-specific paramenters. Before calling this routine you should have set up a xine log buffer via @@ -92,7 +96,11 @@ bool xine_log_msg(const char *format, ...); an error, such as logging wasn't initialized. On error, nothing is logged. */ -bool xine_log_err(const char *format, ...); +bool xine_log_err(const char *format, ...) +#ifdef __GNUC__ +__attribute__((format (printf, 1, 2))) +#endif +; /* Free all (num_mrls) MRLS. */ void xine_free_mrls(int *num_mrls, xine_mrl_t **mrls); diff --git a/src/libffmpeg/diff_to_ffmpeg_cvs.txt b/src/libffmpeg/diff_to_ffmpeg_cvs.txt index 329714dda..3ab1779fe 100644 --- a/src/libffmpeg/diff_to_ffmpeg_cvs.txt +++ b/src/libffmpeg/diff_to_ffmpeg_cvs.txt @@ -67,6 +67,26 @@ diff -u -r1.127 dsputil.h //#define DEBUG /* dct code */ +Index: libavcodec/interplayvideo.c +=================================================================== +RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavcodec/interplayvideo.c,v +retrieving revision 1.5 +diff -u -r1.5 interplayvideo.c +--- src/libffmpeg/libavcodec/interplayvideo.c 5 Feb 2006 14:11:35 -0000 1.5 ++++ src/libffmpeg/libavcodec/interplayvideo.c 21 Apr 2006 22:48:33 -0000 +@@ -49,7 +49,11 @@ + #if DEBUG_INTERPLAY + #define debug_interplay(x,...) av_log(NULL, AV_LOG_DEBUG, x, __VA_ARGS__) + #else +-static inline void debug_interplay(const char *format, ...) { } ++static inline void ++#ifdef __GNUC__ ++__attribute__ ((__format__ (__printf__, 1, 2))) ++#endif ++debug_interplay(const char *format, ...) { } + #endif + + typedef struct IpvideoContext { Index: libavcodec/motion_est.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/motion_est.c,v diff --git a/src/libffmpeg/libavcodec/interplayvideo.c b/src/libffmpeg/libavcodec/interplayvideo.c index 73165e795..588485a0a 100644 --- a/src/libffmpeg/libavcodec/interplayvideo.c +++ b/src/libffmpeg/libavcodec/interplayvideo.c @@ -49,7 +49,11 @@ #if DEBUG_INTERPLAY #define debug_interplay(x,...) av_log(NULL, AV_LOG_DEBUG, x, __VA_ARGS__) #else -static inline void debug_interplay(const char *format, ...) { } +static inline void +#ifdef __GNUC__ +__attribute__ ((__format__ (__printf__, 1, 2))) +#endif +debug_interplay(const char *format, ...) { } #endif typedef struct IpvideoContext { diff --git a/src/libxineadec/nosefart/log.h b/src/libxineadec/nosefart/log.h index b9d282c20..c3494a6c7 100644 --- a/src/libxineadec/nosefart/log.h +++ b/src/libxineadec/nosefart/log.h @@ -20,7 +20,7 @@ ** log.h ** ** Error logging header file -** $Id: log.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ +** $Id: log.h,v 1.3 2006/04/21 23:15:45 dsalt Exp $ */ #ifndef _LOG_H_ @@ -31,12 +31,19 @@ extern int log_init(void); extern void log_shutdown(void); extern void log_print(const char *string); -extern void log_printf(const char *format, ...); +extern void log_printf(const char *format, ...) +#ifdef __GNUC__ +__attribute__ ((format (printf, 1, 2))) +#endif +; #endif /* _LOG_H_ */ /* ** $Log: log.h,v $ +** Revision 1.3 2006/04/21 23:15:45 dsalt +** Add printf format attributes. +** ** Revision 1.2 2003/12/05 15:55:01 f1rmb ** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... ** diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index 68168a80c..67180d18b 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: broadcaster.c,v 1.9 2006/01/27 07:46:15 tmattern Exp $ + * $Id: broadcaster.c,v 1.10 2006/04/21 23:15:45 dsalt Exp $ * * broadcaster.c - xine network broadcaster * @@ -136,7 +136,11 @@ static int sock_data_write(xine_t *xine, int socket, char *buf, int len) { return wlen; } -static int sock_string_write(xine_t *xine, int socket, char *msg, ...) { +static int +#ifdef __GNUC__ +__attribute__((format (printf, 3, 4))) +#endif +sock_string_write(xine_t *xine, int socket, char *msg, ...) { char buf[_BUFSIZ]; va_list args; @@ -177,7 +181,11 @@ static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { } } -static void broadcaster_string_write(broadcaster_t *this, char *msg, ...) { +static void +#ifdef __GNUC__ +__attribute__((format (printf, 2, 3))) +#endif +broadcaster_string_write(broadcaster_t *this, char *msg, ...) { char buf[_BUFSIZ]; va_list args; @@ -266,7 +274,7 @@ static void send_buf (broadcaster_t *this, char *from, buf_element_t *buf) { } } - broadcaster_string_write(this, "buffer fifo=%s size=%ld type=%lu pts=%lld disc=%lld flags=%lu", + broadcaster_string_write(this, "buffer fifo=%s size=%d type=%u pts=%lld disc=%lld flags=%u", from, buf->size, buf->type, buf->pts, buf->disc_off, buf->decoder_flags ); if( buf->size ) diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c index 2479a9887..a27052d1a 100644 --- a/src/xine-utils/xine_check.c +++ b/src/xine-utils/xine_check.c @@ -72,7 +72,10 @@ #endif /* !__linux__ */ -static void __attribute__ ((format (printf, 3, 4))) +static void +#ifdef __GNUC__ +__attribute__((format (printf, 3, 4))) +#endif set_hc_result(xine_health_check_t* hc, int state, const char *format, ...) { -- cgit v1.2.3