diff options
-rw-r--r-- | .hgignore | 1 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | include/xine.h.in | 11 | ||||
-rw-r--r-- | lib/os_internal.h | 4 | ||||
-rw-r--r-- | src/audio_out/audio_alsa_out.c | 5 | ||||
-rw-r--r-- | src/audio_out/audio_directx2_out.c | 5 | ||||
-rw-r--r-- | src/demuxers/demux_qt.c | 10 | ||||
-rw-r--r-- | src/input/input_cdda.c | 5 | ||||
-rw-r--r-- | src/input/vcd/xine-extra.h | 12 | ||||
-rw-r--r-- | src/libw32dll/wine/debugtools.h | 6 | ||||
-rw-r--r-- | src/libw32dll/wine/ext.h | 3 | ||||
-rw-r--r-- | src/libw32dll/wine/win32.c | 13 | ||||
-rw-r--r-- | src/libxineadec/nosefart/log.h | 7 | ||||
-rw-r--r-- | src/xine-engine/broadcaster.c | 10 | ||||
-rw-r--r-- | src/xine-engine/buffer_types.c | 4 | ||||
-rw-r--r-- | src/xine-engine/video_overlay.c | 4 | ||||
-rw-r--r-- | src/xine-utils/attributes.h | 12 | ||||
-rw-r--r-- | src/xine-utils/xine_check.c | 5 |
18 files changed, 48 insertions, 71 deletions
@@ -1,5 +1,6 @@ syntax: glob *~ +*.orig *.lo *.la diff --git a/configure.ac b/configure.ac index 3c256502d..fbcab0417 100644 --- a/configure.ac +++ b/configure.ac @@ -2170,6 +2170,8 @@ fi AC_SUBST([VISIBILITY_FLAG]) CC_ATTRIBUTE_SENTINEL +CC_ATTRIBUTE_FORMAT +CC_ATTRIBUTE_FORMAT_ARG AC_OPTIMIZATIONS diff --git a/include/xine.h.in b/include/xine.h.in index 67b746f4e..facee6e31 100644 --- a/include/xine.h.in +++ b/include/xine.h.in @@ -792,17 +792,10 @@ int xine_get_log_section_count(xine_t *self) XINE_PROTECTED; const char *const *xine_get_log_names(xine_t *self) XINE_PROTECTED; /* print some log information to <buf> section */ -#ifndef __GNUC__ void xine_log (xine_t *self, int buf, - const char *format, ...) XINE_PROTECTED; + const char *format, ...) XINE_FORMAT_PRINTF(3, 4) XINE_PROTECTED; void xine_vlog(xine_t *self, int buf, - const char *format, va_list args) XINE_PROTECTED; -#else -void xine_log (xine_t *self, int buf, - const char *format, ...) __attribute__ ((__format__(printf, 3, 4))) XINE_PROTECTED; -void xine_vlog(xine_t *self, int buf, - const char *format, va_list args) __attribute__ ((__format__(printf, 3, 0))) XINE_PROTECTED; -#endif + const char *format, va_list args) XINE_FORMAT_PRINTF(3, 0) XINE_PROTECTED; /* get log messages of specified section */ char *const *xine_get_log (xine_t *self, int buf) XINE_PROTECTED; diff --git a/lib/os_internal.h b/lib/os_internal.h index 8ecfbaeab..dd48e04f7 100644 --- a/lib/os_internal.h +++ b/lib/os_internal.h @@ -120,8 +120,8 @@ void xine_private_unsetenv(const char *name); #define asprintf(STRINGPP, FORMAT, ...) xine_private_asprintf((STRINGPP), FORMAT, __VA_ARGS__) #endif #define vasprintf(STRINGPP, FORMAT, VA_ARG) xine_private_vasprintf((STRINGPP), (FORMAT), (VA_ARG)) -int xine_private_asprintf(char **string, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -int xine_private_vasprintf(char **string, const char *format, va_list ap) __attribute__ ((format (printf, 2, 0))); +int xine_private_asprintf(char **string, const char *format, ...) XINE_FORMAT_PRINTF(2, 3); +int xine_private_vasprintf(char **string, const char *format, va_list ap) XINE_FORMAT_PRINTF(2, 0); #endif /* replacement of strndup */ diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index f176b7594..6ad78da2a 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -265,10 +265,7 @@ 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 -#ifdef __GNUC__ - __attribute__((format (printf, 5, 6))) -#endif +static void XINE_FORMAT_PRINTF(5, 6) error_callback(const char *file, int line, const char *function, int err, const char *fmt, ...) { #ifdef DEBUG diff --git a/src/audio_out/audio_directx2_out.c b/src/audio_out/audio_directx2_out.c index aff4412ec..7161f192d 100644 --- a/src/audio_out/audio_directx2_out.c +++ b/src/audio_out/audio_directx2_out.c @@ -151,10 +151,7 @@ static int buffer_ready(dx2_driver_t *this); /* popup a dialog with error */ -static void -#ifdef __GNUC__ - __attribute__((format (printf, 1, 2))) -#endif +static void XINE_FORMAT_PRINTF(1, 2) 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 4144f3049..6693637c7 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -417,31 +417,31 @@ typedef struct { #if DEBUG_ATOM_LOAD #define debug_atom_load printf #else -static inline void __attribute__((format (printf, 1, 2))) debug_atom_load(const char *format, ...) {} +static inline void XINE_FORMAT_PRINTF(1, 2) debug_atom_load(const char *format, ...) {} #endif #if DEBUG_EDIT_LIST #define debug_edit_list printf #else -static inline void __attribute__((format (printf, 1, 2))) debug_edit_list(const char *format, ...) {} +static inline void XINE_FORMAT_PRINTF(1, 2) debug_edit_list(const char *format, ...) {} #endif #if DEBUG_FRAME_TABLE #define debug_frame_table printf #else -static inline void __attribute__((format (printf, 1, 2))) debug_frame_table(const char *format, ...) {} +static inline void XINE_FORMAT_PRINTF(1, 2) debug_frame_table(const char *format, ...) {} #endif #if DEBUG_VIDEO_DEMUX #define debug_video_demux printf #else -static inline void __attribute__((format (printf, 1, 2))) debug_video_demux(const char *format, ...) {} +static inline void XINE_FORMAT_PRINTF(1, 2) debug_video_demux(const char *format, ...) {} #endif #if DEBUG_AUDIO_DEMUX #define debug_audio_demux printf #else -static inline void __attribute__((format (printf, 1, 2))) debug_audio_demux(const char *format, ...) {} +static inline void XINE_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 d21c8e4db..7dd9ae21a 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -988,10 +988,7 @@ static int parse_url (char *urlbuf, char** host, int *port) { } #endif -static int -#ifdef __GNUC__ -__attribute__((format (printf, 4, 5))) -#endif +static int XINE_FORMAT_PRINTF(4, 5) network_command( xine_stream_t *stream, int socket, char *data_buf, char *msg, ...) { char buf[_BUFSIZ]; diff --git a/src/input/vcd/xine-extra.h b/src/input/vcd/xine-extra.h index d0b2a0bb5..cde9a26f6 100644 --- a/src/input/vcd/xine-extra.h +++ b/src/input/vcd/xine-extra.h @@ -80,11 +80,7 @@ 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, ...) -#ifdef __GNUC__ -__attribute__((format (printf, 1, 2))) -#endif -; +bool xine_log_msg(const char *format, ...) XINE_FORMAT_PRINTF(1, 2); /*! 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 @@ -96,11 +92,7 @@ __attribute__((format (printf, 1, 2))) an error, such as logging wasn't initialized. On error, nothing is logged. */ -bool xine_log_err(const char *format, ...) -#ifdef __GNUC__ -__attribute__((format (printf, 1, 2))) -#endif -; +bool xine_log_err(const char *format, ...) XINE_FORMAT_PRINTF(1, 2); /* Free all (num_mrls) MRLS. */ void xine_free_mrls(int *num_mrls, xine_mrl_t **mrls); diff --git a/src/libw32dll/wine/debugtools.h b/src/libw32dll/wine/debugtools.h index 038c05309..3b342e10c 100644 --- a/src/libw32dll/wine/debugtools.h +++ b/src/libw32dll/wine/debugtools.h @@ -80,11 +80,7 @@ static inline LPCSTR debugstr_w( LPCWSTR s ) { return debugstr_wn( s, 80 ); } #endif #if 0 /* dbg_printf already defined as a macro */ -#ifdef __GNUC__ -extern int dbg_printf(const char *format, ...) __attribute__((format (printf,1,2))); -#else -extern int dbg_printf(const char *format, ...); -#endif +extern int dbg_printf(const char *format, ...) XINE_FORMAT_PRINTF(1,2); #endif #define TRACE_(X) TRACE diff --git a/src/libw32dll/wine/ext.h b/src/libw32dll/wine/ext.h index 7b284ca79..f0f505c4d 100644 --- a/src/libw32dll/wine/ext.h +++ b/src/libw32dll/wine/ext.h @@ -2,6 +2,7 @@ #define loader_ext_h #include "windef.h" +#include "attributes.h" extern LPVOID FILE_dommap( int unix_handle, LPVOID start, DWORD size_high, DWORD size_low, @@ -9,6 +10,6 @@ extern LPVOID FILE_dommap( int unix_handle, LPVOID start, int prot, int flags ); extern int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low ); extern int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n); -extern int __attribute__ ((format (printf, 1, 2))) __vprintf( const char *format, ... ); +extern int XINE_FORMAT_PRINTF(1, 2) __vprintf( const char *format, ... ); #endif diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c index 4fe1956b7..397779f72 100644 --- a/src/libw32dll/wine/win32.c +++ b/src/libw32dll/wine/win32.c @@ -12,6 +12,7 @@ for DLL to know too much about its environment. ************************************************************/ #include "config.h" +#include "attributes.h" #define QTX @@ -183,7 +184,7 @@ static void longcount_stub(long long* z) int LOADER_DEBUG=1; // active only if compiled with -DDETAILED_OUT //#define DETAILED_OUT -static inline void __attribute__((__format__(__printf__, 1, 2))) dbgprintf(char* fmt, ...) +static inline void XINE_FORMAT_PRINTF(1, 2) dbgprintf(char* fmt, ...) { #ifdef DETAILED_OUT if(LOADER_DEBUG) @@ -3976,7 +3977,7 @@ static void* exp__dllonexit() return NULL; } -static int __attribute__((__format__(__printf__, 2, 3))) expwsprintfA(char* string, char* format, ...) +static int XINE_FORMAT_PRINTF(2, 3) expwsprintfA(char* string, char* format, ...) { va_list va; int result; @@ -3987,7 +3988,7 @@ static int __attribute__((__format__(__printf__, 2, 3))) expwsprintfA(char* stri return result; } -static int __attribute__((__format__(__printf__, 2, 3))) expsprintf(char* str, const char* format, ...) +static int XINE_FORMAT_PRINTF(2, 3) expsprintf(char* str, const char* format, ...) { va_list args; int r; @@ -3997,7 +3998,7 @@ static int __attribute__((__format__(__printf__, 2, 3))) expsprintf(char* str, c va_end(args); return r; } -static int __attribute__((__format__(__printf__, 2, 3))) expsscanf(const char* str, const char* format, ...) +static int XINE_FORMAT_PRINTF(2, 3) expsscanf(const char* str, const char* format, ...) { va_list args; int r; @@ -4013,7 +4014,7 @@ static void* expfopen(const char* path, const char* mode) //return fopen(path, mode); return fdopen(0, mode); // everything on screen } -static int __attribute__((__format__(__printf__, 2, 3)))expfprintf(void* stream, const char* format, ...) +static int XINE_FORMAT_PRINTF(2, 3)expfprintf(void* stream, const char* format, ...) { va_list args; int r = 0; @@ -4026,7 +4027,7 @@ static int __attribute__((__format__(__printf__, 2, 3)))expfprintf(void* stream, return r; } -static int __attribute__((__format__(__printf__, 1, 2))) expprintf(const char* format, ...) +static int XINE_FORMAT_PRINTF(1, 2) expprintf(const char* format, ...) { va_list args; int r; diff --git a/src/libxineadec/nosefart/log.h b/src/libxineadec/nosefart/log.h index c3494a6c7..a12deff0a 100644 --- a/src/libxineadec/nosefart/log.h +++ b/src/libxineadec/nosefart/log.h @@ -27,15 +27,12 @@ #define _LOG_H_ #include <stdio.h> +#include "attributes.h" extern int log_init(void); extern void log_shutdown(void); extern void log_print(const char *string); -extern void log_printf(const char *format, ...) -#ifdef __GNUC__ -__attribute__ ((format (printf, 1, 2))) -#endif -; +extern void log_printf(const char *format, ...) XINE_FORMAT_PRINTF(1, 2); #endif /* _LOG_H_ */ diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index 8ab661d3e..30cdadc7c 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -137,10 +137,7 @@ static int sock_data_write(xine_t *xine, int socket, char *buf, int len) { return wlen; } -static int -#ifdef __GNUC__ -__attribute__((format (printf, 3, 4))) -#endif +static int XINE_FORMAT_PRINTF(3, 4) sock_string_write(xine_t *xine, int socket, char *msg, ...) { char buf[_BUFSIZ]; va_list args; @@ -182,10 +179,7 @@ static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { } } -static void -#ifdef __GNUC__ -__attribute__((format (printf, 2, 3))) -#endif +static void XINE_FORMAT_PRINTF(2, 3) broadcaster_string_write(broadcaster_t *this, char *msg, ...) { char buf[_BUFSIZ]; va_list args; diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index 4a71a99c2..2d455b67c 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -49,13 +49,13 @@ typedef struct video_db_s { uint32_t fourcc[20]; uint32_t buf_type; - const char name[]; + const char *name; } video_db_t; typedef struct audio_db_s { uint32_t formattag[10]; uint32_t buf_type; - const char name[]; + const char *name; } audio_db_t; diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c index 04a3034a3..7bd9292c8 100644 --- a/src/xine-engine/video_overlay.c +++ b/src/xine-engine/video_overlay.c @@ -49,10 +49,10 @@ typedef struct video_overlay_showing_s { typedef struct video_overlay_s { - xine_t *xine; - video_overlay_manager_t video_overlay; + xine_t *xine; + pthread_mutex_t events_mutex; video_overlay_events_t events[MAX_EVENTS]; pthread_mutex_t objects_mutex; diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index 4d22226ac..b533286c8 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -69,4 +69,16 @@ # endif #endif +/* Format attributes */ +#ifdef SUPPORT_ATTRIBUTE_FORMAT +# define XINE_FORMAT_PRINTF(fmt,var) __attribute__((format(printf, fmt, var))) +#else +# define XINE_FORMAT_PRINTF(fmt,var) +#endif +#ifdef SUPPORT_ATTRIBUTE_FORMAT_ARG +# define XINE_FORMAT_PRINTF_ARG(fmt) __attribute__((format_arg(fmt))) +#else +# define XINE_FORMAT_PRINTF_ARG(fmt) +#endif + #endif /* ATTRIBUTE_H_ */ diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c index 43e046a45..f6a0498e8 100644 --- a/src/xine-utils/xine_check.c +++ b/src/xine-utils/xine_check.c @@ -72,10 +72,7 @@ #endif /* !__linux__ */ -static void -#ifdef __GNUC__ -__attribute__((format (printf, 3, 4))) -#endif +static void XINE_FORMAT_PRINTF(3, 4) set_hc_result(xine_health_check_t* hc, int state, const char *format, ...) { |