From e8f3bdf8207a8870ff80b9ef0cef55564b85f3b4 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 21 Apr 2008 23:44:48 +0100 Subject: Fix Xv driver debug build. --- src/video_out/video_out_xv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index f6bd1a429..65559c16f 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -851,8 +851,8 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if( factor > 1 ) { - lprintf( "%s PutImage %dX interval (%fs)\n", - log_line_prefix(), factor, elapse_time ); + lprintf( "%s PutImage %dX interval (%fs)\n", + LOG_MODULE, factor, elapse_time ); } } -- cgit v1.2.3 From ce9af0fefb2cd0dd5fe5743dcca12f17eedd1ce5 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 28 Apr 2008 14:50:53 +0100 Subject: Add xine_get_pluginroot() for win32. Completely untested. --- src/xine-utils/utils.c | 14 ++++++++++++++ src/xine-utils/xineutils.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index cc3ffdc2c..768b41da4 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -371,6 +371,20 @@ static void xine_get_rootdir(char *rootdir, size_t maxlen) { if ((s = strrchr(rootdir, XINE_DIRECTORY_SEPARATOR_CHAR))) *s = '\0'; } +const char *xine_get_pluginroot(void) { + static char pluginroot[1024] = {0, }; + + if (!pluginroot[0]) { + char *sep, *sep2; + strcpy (pluginroot, xine_get_plugindir ()); + sep = strrchr (pluginroot, '/'); + sep2 = strrchr (pluginroot, '\\'); + *(sep < sep2 ? sep : sep2) = 0; + } + + return pluginroot; +} + const char *xine_get_plugindir(void) { static char plugindir[1024] = {0, }; diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 120cb3578..aeee9e7b3 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -643,6 +643,7 @@ const char *xine_get_homedir(void) XINE_PROTECTED; /* * Get other xine directories. */ +const char *xine_get_pluginroot(void) XINE_PROTECTED; const char *xine_get_plugindir(void) XINE_PROTECTED; const char *xine_get_fontdir(void) XINE_PROTECTED; const char *xine_get_localedir(void) XINE_PROTECTED; -- cgit v1.2.3 From bdcbdde85d5ae6e8f415442d5c28251a4aad8088 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 30 Apr 2008 01:12:20 +0100 Subject: Replace calloc (n, sizeof (char)) with malloc (n) where zero init isn't needed. --- src/demuxers/demux_real.c | 6 +++--- src/input/libreal/real.c | 2 +- src/input/libreal/rmff.c | 16 ++++++++-------- src/input/libreal/sdpplin.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 5a20ac92b..6a1d24dba 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -284,17 +284,17 @@ static mdpr_t *real_parse_mdpr(const char *data) { mdpr->duration=_X_BE_32(&data[28]); mdpr->stream_name_size=data[32]; - mdpr->stream_name=calloc(mdpr->stream_name_size+1, sizeof(char)); + mdpr->stream_name=malloc(mdpr->stream_name_size+1); memcpy(mdpr->stream_name, &data[33], mdpr->stream_name_size); mdpr->stream_name[(int)mdpr->stream_name_size]=0; mdpr->mime_type_size=data[33+mdpr->stream_name_size]; - mdpr->mime_type=calloc(mdpr->mime_type_size+1, sizeof(char)); + mdpr->mime_type=malloc(mdpr->mime_type_size+1); memcpy(mdpr->mime_type, &data[34+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->mime_type[(int)mdpr->mime_type_size]=0; mdpr->type_specific_len=_X_BE_32(&data[34+mdpr->stream_name_size+mdpr->mime_type_size]); - mdpr->type_specific_data=calloc(mdpr->type_specific_len, sizeof(char)); + mdpr->type_specific_data=malloc(mdpr->type_specific_len); memcpy(mdpr->type_specific_data, &data[38+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index 472120895..fecf9a794 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -660,7 +660,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid lprintf("Stream description size: %i\n", size); - description = calloc(size+1, sizeof(char)); + description = malloc(size+1); if( rtsp_read_data(rtsp_session, description, size) <= 0) { xine_buffer_free(buf); diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 05f914782..41f85d3ae 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -351,17 +351,17 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { mdpr->duration=_X_BE_32(&data[36]); mdpr->stream_name_size=data[40]; - mdpr->stream_name = calloc(mdpr->stream_name_size+1, sizeof(char)); + mdpr->stream_name = malloc(mdpr->stream_name_size+1); memcpy(mdpr->stream_name, &data[41], mdpr->stream_name_size); mdpr->stream_name[mdpr->stream_name_size]=0; mdpr->mime_type_size=data[41+mdpr->stream_name_size]; - mdpr->mime_type = calloc(mdpr->mime_type_size+1, sizeof(char)); + mdpr->mime_type = malloc(mdpr->mime_type_size+1); memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->mime_type[mdpr->mime_type_size]=0; mdpr->type_specific_len=_X_BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]); - mdpr->type_specific_data = calloc(mdpr->type_specific_len, sizeof(char)); + mdpr->type_specific_data = malloc(mdpr->type_specific_len); memcpy(mdpr->type_specific_data, &data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); @@ -381,22 +381,22 @@ static rmff_cont_t *rmff_scan_cont(const char *data) { lprintf("warning: unknown object version in CONT: 0x%04x\n", cont->object_version); } cont->title_len=_X_BE_16(&data[10]); - cont->title = calloc((cont->title_len+1), sizeof(char)); + cont->title = malloc(cont->title_len+1); memcpy(cont->title, &data[12], cont->title_len); cont->title[cont->title_len]=0; pos=cont->title_len+12; cont->author_len=_X_BE_16(&data[pos]); - cont->author = calloc(cont->author_len+1, sizeof(char)); + cont->author = malloc(cont->author_len+1); memcpy(cont->author, &data[pos+2], cont->author_len); cont->author[cont->author_len]=0; pos=pos+2+cont->author_len; cont->copyright_len=_X_BE_16(&data[pos]); - cont->copyright = calloc(cont->copyright_len+1, sizeof(char)); + cont->copyright = malloc(cont->copyright_len+1); memcpy(cont->copyright, &data[pos+2], cont->copyright_len); cont->copyright[cont->copyright_len]=0; pos=pos+2+cont->copyright_len; cont->comment_len=_X_BE_16(&data[pos]); - cont->comment = calloc(cont->comment_len+1, sizeof(char)); + cont->comment = malloc(cont->comment_len+1); memcpy(cont->comment, &data[pos+2], cont->comment_len); cont->comment[cont->comment_len]=0; @@ -624,7 +624,7 @@ rmff_mdpr_t *rmff_new_mdpr( mdpr->mime_type_size=strlen(mime_type); } mdpr->type_specific_len=type_specific_len; - mdpr->type_specific_data = calloc(type_specific_len, sizeof(char)); + mdpr->type_specific_data = malloc(type_specific_len); memcpy(mdpr->type_specific_data,type_specific_data,type_specific_len); mdpr->mlti_data=NULL; diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index 04554c45e..9117d15a5 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -206,7 +206,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { if(filter(*data,"a=OpaqueData:buffer;",&buf)) { decoded = b64_decode(buf, decoded, &(desc->mlti_data_size)); if ( decoded != NULL ) { - desc->mlti_data = calloc(desc->mlti_data_size, sizeof(char)); + desc->mlti_data = malloc(desc->mlti_data_size); memcpy(desc->mlti_data, decoded, desc->mlti_data_size); handled=1; *data=nl(*data); -- cgit v1.2.3 From 3c4ad1fd59a3e410aeebf6e81c93ed8980fd7c4d Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 30 Apr 2008 02:35:45 +0100 Subject: Warn when using built-in ffmpeg rather than external ffmpeg. --- configure.ac | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 127e23c0d..0beac5ca7 100644 --- a/configure.ac +++ b/configure.ac @@ -360,16 +360,16 @@ if test "x$with_external_ffmpeg" = "xyes"; then dnl style for headers. The new style would be preferred actually... AC_CHECK_HEADERS([ffmpeg/avutil.h]) - AC_MSG_NOTICE([ + AC_MSG_RESULT([using external ffmpeg]) +else + AC_MSG_NOTICE([ ********************************************************************* -xine is configured with external ffmpeg. +xine-lib is configured to use internal ffmpeg. -This requires the same version of ffmpeg what is included in xine and -you should know what you do. If some problems occur, please try to -use internal ffmpeg. +This copy of ffmpeg is old. You are strongly advised to install a +newer version (including development files) and to reconfigure +xine-lib to use it. *********************************************************************]) -else - AC_MSG_RESULT([using included ffmpeg]) LIBFFMPEG_CPPFLAGS="-DHAVE_AV_CONFIG_H -DRUNTIME_CPUDETECT -DXINE_MPEG_ENCODER -D_ISOC9X_SOURCE -DCONFIG_DECODERS" AC_CHECK_TYPES(int_fast8_t, [], [LIBFFMPEG_CPPFLAGS="$LIBFFMPEG_CPPFLAGS -DEMULATE_FAST_INT"]) AC_SUBST([LIBFFMPEG_CPPFLAGS]) -- cgit v1.2.3 From 9150e5c1954b7c991a911379f21035eeeed3ccb6 Mon Sep 17 00:00:00 2001 From: Jason Tackaberry Date: Wed, 30 Apr 2008 14:19:08 +0100 Subject: Fix green smearing in h264 decoding Occasionally when playing h264-encoded files, green blocks will appear at the edges of the frame, and get smeared around (following the motion vectors, of course). This bug has existing in Xine for well over a year, and I keep hoping it will be fixed, but it never was. I recently learned that gstreamer had a similar problem and it was fixed last year. With this as a hint, I found http://bugzilla.gnome.org/show_bug.cgi?id=364139 and the patch attached to that bug. I've adapted that patch to xine, and it is attached. I have compared clips before and after applying this patch, and in all cases the green artifacts have gone away, and I have seen no negative side effects. --- src/combined/ffmpeg/ff_video_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index b18040d38..485e84afb 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -381,7 +381,7 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) /* Some codecs (eg rv10) copy flags in init so it's necessary to set * this flag here in case we are going to use direct rendering */ - if(this->codec->capabilities & CODEC_CAP_DR1) { + if(this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264) { this->context->flags |= CODEC_FLAG_EMU_EDGE; } -- cgit v1.2.3 From 8d953c5c5cac93671c779cbf9176c6115e7294fa Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Wed, 30 Apr 2008 14:41:24 +0100 Subject: fix voraw description in xine.h --- include/xine.h.in | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/xine.h.in b/include/xine.h.in index 219ec8687..eec1cce59 100644 --- a/include/xine.h.in +++ b/include/xine.h.in @@ -1314,12 +1314,9 @@ typedef struct { void *user_data; /* OR'ed frame_format - * a frontend must at least support rgb - * a frontend supporting yuv must support both yv12 and yuy2 - * then possible combinations are: - * XINE_VORAW_RGB ( rgb ) - * XINE_VORAW_YV12|XINE_VORAW_YUY2|XINE_VORAW_RGB ( yv12, yuy2 and rgb ) - * + * Unsupported frame formats are converted to rgb. + * XINE_VORAW_RGB is always assumed by the driver, even if not set. + * So a frontend must at least support rgb. * Be aware that rgb requires more cpu than yuv, * so avoid its usage for video playback. * However, it's usefull for single frame capture (e.g. thumbs) -- cgit v1.2.3 From 90bb53f8c9b7ca3db6841a5005af791b93782d96 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 3 May 2008 14:34:45 +0100 Subject: Add support for "deprecated" attribute. --- configure.ac | 1 + m4/attributes.m4 | 23 +++++++++++++++++++++++ src/xine-utils/attributes.h | 6 ++++++ 3 files changed, 30 insertions(+) diff --git a/configure.ac b/configure.ac index 0beac5ca7..bee221542 100644 --- a/configure.ac +++ b/configure.ac @@ -2215,6 +2215,7 @@ AC_SUBST([VISIBILITY_FLAG]) CC_ATTRIBUTE_SENTINEL CC_ATTRIBUTE_FORMAT CC_ATTRIBUTE_FORMAT_ARG +CC_ATTRIBUTE_DEPRECATED AC_OPTIMIZATIONS diff --git a/m4/attributes.m4 b/m4/attributes.m4 index 55f34c9f7..a74280696 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -322,3 +322,26 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ [Define the highest alignment supported]) fi ]) + +AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [ + AC_REQUIRE([CC_CHECK_WERROR]) + ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_CACHE_CHECK([if compiler supports __attribute__((deprecated))], + [cc_cv_attribute_alias], + [AC_COMPILE_IFELSE([ + void some_function(void) __attribute__((deprecated)); + ], + [cc_cv_attribute_deprecated=yes], + [cc_cv_attribute_deprecated=no]) + ]) + CFLAGS="$ac_save_CFLAGS" + + if test "x$cc_cv_attribute_deprecated" = "xyes"; then + AC_DEFINE([SUPPORT_ATTRIBUTE_DEPRECATED], 1, [Define this if the compiler supports the deprecated attribute]) + $1 + else + true + $2 + fi +]) diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index 563832e5c..2085be571 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -63,6 +63,12 @@ # define XINE_SENTINEL #endif +#ifdef SUPPORT_ATTRIBUTE_DEPRECATED +# define XINE_DEPRECATED __attribute__((__deprecated__)) +#else +# define XINE_DEPRECATED +#endif + #ifndef __attr_unused # ifdef SUPPORT_ATTRIBUTE_UNUSED # define __attr_unused __attribute__((__unused__)) -- cgit v1.2.3 From 577b73605f3ce2cd6b45e59967f24d195d1e92bf Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 3 May 2008 14:46:53 +0100 Subject: Mark some removed-in-1.2 exported/unimplemented functions as deprecated. --- include/xine.h.in | 20 ++++++++++---------- src/xine-utils/xineutils.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/xine.h.in b/include/xine.h.in index eec1cce59..8d1822441 100644 --- a/include/xine.h.in +++ b/include/xine.h.in @@ -260,7 +260,7 @@ int xine_play (xine_stream_t *stream, int start_pos, int start_time) XINE_PROTE * * returns 1 if OK, 0 on error (use xine_get_error for details) */ -int xine_trick_mode (xine_stream_t *stream, int mode, int value) XINE_PROTECTED; +int xine_trick_mode (xine_stream_t *stream, int mode, int value) XINE_PROTECTED XINE_DEPRECATED; /* trick modes */ #define XINE_TRICK_MODE_OFF 0 @@ -539,7 +539,7 @@ int xine_get_video_frame (xine_stream_t *stream, int *ratio_code, int *duration, /* msec */ int *format, - uint8_t *img) XINE_PROTECTED; + uint8_t *img) XINE_PROTECTED XINE_DEPRECATED; /* TODO: xine_get_audio_frame */ @@ -826,7 +826,7 @@ char *const *xine_get_log (xine_t *self, int buf) XINE_PROTECTED; /* log callback will be called whenever something is logged */ typedef void (*xine_log_cb_t) (void *user_data, int section); void xine_register_log_cb (xine_t *self, xine_log_cb_t cb, - void *user_data) XINE_PROTECTED; + void *user_data) XINE_PROTECTED XINE_DEPRECATED; /* * error handling / engine status @@ -1098,7 +1098,7 @@ void xine_plugins_garbage_collector(xine_t *self) XINE_PROTECTED; #ifndef XINE_DISABLE_DEPRECATED_FEATURES /* talk to video output driver - old method */ int xine_gui_send_vo_data (xine_stream_t *self, - int type, void *data) XINE_PROTECTED; + int type, void *data) XINE_PROTECTED XINE_DEPRECATED; #endif /* new (preferred) method to talk to video driver. */ @@ -2195,13 +2195,13 @@ typedef enum { } xine_tvsystem; /* connect to nvtvd server and save current TV and X settings */ -int xine_tvmode_init (xine_t *self) XINE_PROTECTED; +int xine_tvmode_init (xine_t *self) XINE_PROTECTED XINE_DEPRECATED; /* Turn tvmode on/off (1/0)*/ -int xine_tvmode_use(xine_t *self, int use_tvmode) XINE_PROTECTED; +int xine_tvmode_use(xine_t *self, int use_tvmode) XINE_PROTECTED XINE_DEPRECATED; /* Set which tv system to use: XINE_TVSYSTEM_PAL or XINE_TVSYSTEM_NTSC */ -void xine_tvmode_set_tvsystem(xine_t *self, xine_tvsystem system) XINE_PROTECTED; +void xine_tvmode_set_tvsystem(xine_t *self, xine_tvsystem system) XINE_PROTECTED XINE_DEPRECATED; /* try to change TV state if enabled * type select 'regular' (0) or 'TV' (1) state @@ -2210,16 +2210,16 @@ void xine_tvmode_set_tvsystem(xine_t *self, xine_tvsystem system) XINE_PROTECTED * fps frame rate the mode should match best or 0 if unknown * returns: finally selected state */ -int xine_tvmode_switch (xine_t *self, int type, int width, int height, double fps) XINE_PROTECTED; +int xine_tvmode_switch (xine_t *self, int type, int width, int height, double fps) XINE_PROTECTED XINE_DEPRECATED; /* adapt (maximum) output size to visible area if necessary and return pixel * aspect and real frame rate if available */ void xine_tvmode_size (xine_t *self, int *width, int *height, - double *pixelratio, double *fps) XINE_PROTECTED; + double *pixelratio, double *fps) XINE_PROTECTED XINE_DEPRECATED; /* restore old TV and X settings and close nvtvd connection */ -void xine_tvmode_exit (xine_t *self) XINE_PROTECTED; +void xine_tvmode_exit (xine_t *self) XINE_PROTECTED XINE_DEPRECATED; #endif diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index aeee9e7b3..01afc1631 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -666,7 +666,7 @@ void xine_usec_sleep(unsigned usec) XINE_PROTECTED; */ -void xine_strdupa(char *dest, char *src) XINE_PROTECTED; +void xine_strdupa(char *dest, char *src) XINE_PROTECTED XINE_DEPRECATED; #define xine_strdupa(d, s) do { \ (d) = NULL; \ if((s) != NULL) { \ -- cgit v1.2.3 From 2c6ee93fbbfc2ff754be551038eee79047d9c988 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 3 May 2008 14:54:21 +0100 Subject: Mark some removed-in-1.2 typedefs as deprecated. --- include/xine.h.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/xine.h.in b/include/xine.h.in index 8d1822441..ad79bebc6 100644 --- a/include/xine.h.in +++ b/include/xine.h.in @@ -89,8 +89,8 @@ typedef struct xine_video_port_s xine_video_port_t; #ifndef XINE_DISABLE_DEPRECATED_FEATURES /* convenience types: simple player UIs might want to call ports drivers */ -typedef xine_audio_port_t xine_ao_driver_t; -typedef xine_video_port_t xine_vo_driver_t; +typedef xine_audio_port_t xine_ao_driver_t XINE_DEPRECATED; +typedef xine_video_port_t xine_vo_driver_t XINE_DEPRECATED; #endif @@ -2192,7 +2192,7 @@ void xine_osd_free (xine_osd_t *self) XINE_PROTECTED; typedef enum { XINE_TVSYSTEM_PAL = 0, XINE_TVSYSTEM_NTSC -} xine_tvsystem; +} xine_tvsystem XINE_DEPRECATED; /* connect to nvtvd server and save current TV and X settings */ int xine_tvmode_init (xine_t *self) XINE_PROTECTED XINE_DEPRECATED; -- cgit v1.2.3 From f9c0a01322ba253bbb5aae0ce0c994bcab0d8ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 3 May 2008 19:56:58 +0200 Subject: Remove specific ID3v2 parsing funcion from the header file, always use the generic one to access them. --- src/demuxers/id3.c | 18 +++++++++--------- src/demuxers/id3.h | 23 ++++++++++------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 85b42efa8..d7d2c4725 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -337,9 +337,9 @@ static int id3v22_interp_frame(input_plugin_t *input, } -int id3v22_parse_tag(input_plugin_t *input, - xine_stream_t *stream, - int8_t *mp3_frame_header) { +static int id3v22_parse_tag(input_plugin_t *input, + xine_stream_t *stream, + int8_t *mp3_frame_header) { id3v2_header_t tag_header; id3v22_frame_header_t tag_frame_header; int pos = 0; @@ -530,9 +530,9 @@ static int id3v23_interp_frame(input_plugin_t *input, } } -int id3v23_parse_tag(input_plugin_t *input, - xine_stream_t *stream, - int8_t *mp3_frame_header) { +static int id3v23_parse_tag(input_plugin_t *input, + xine_stream_t *stream, + int8_t *mp3_frame_header) { id3v2_header_t tag_header; id3v23_frame_header_t tag_frame_header; id3v23_frame_ext_header_t tag_frame_ext_header; @@ -783,9 +783,9 @@ static int id3v24_interp_frame(input_plugin_t *input, } } -int id3v24_parse_tag(input_plugin_t *input, - xine_stream_t *stream, - int8_t *mp3_frame_header) { +static int id3v24_parse_tag(input_plugin_t *input, + xine_stream_t *stream, + int8_t *mp3_frame_header) { id3v2_header_t tag_header; id3v24_frame_header_t tag_frame_header; id3v24_frame_ext_header_t tag_frame_ext_header; diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index b4ea4b6be..9cab594a1 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -151,19 +151,16 @@ typedef struct { int id3v1_parse_tag (input_plugin_t *input, xine_stream_t *stream); -int id3v22_parse_tag(input_plugin_t *input, - xine_stream_t *stream, - int8_t *mp3_frame_header); - -int id3v23_parse_tag(input_plugin_t *input, - xine_stream_t *stream, - int8_t *mp3_frame_header); - -int id3v24_parse_tag(input_plugin_t *input, - xine_stream_t *stream, - int8_t *mp3_frame_header); - -/* Generic function that switch between the three above */ +/** + * @brief Generic function for ID3v2 tags parsing. + * @param input Pointer to the input plugin used by the demuxer, used + * to access the tag's data. + * @param stream Pointer to the xine stream currently being read. + * @param mp3_frame_header Header of the MP3 frame carrying the tag. + * + * @note This function will take care of calling the proper function for + * parsing ID3v2.2, ID3v2.3 or ID3v2.4 tags. + */ int id3v2_parse_tag(input_plugin_t *input, xine_stream_t *stream, int8_t *mp3_frame_header); -- cgit v1.2.3 From e9950f54d6935dbe60034c5a93686a5d0b45085f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 3 May 2008 19:57:27 +0200 Subject: Remove unused variables, as reported by GCC 4.3. --- src/demuxers/demux_realaudio.c | 4 ---- src/demuxers/demux_ts.c | 1 - src/demuxers/demux_wav.c | 3 --- src/libxineadec/xine_speex_decoder.c | 2 +- src/video_out/video_out_raw.c | 4 ---- src/xine-engine/scratch.c | 1 - 6 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index 5bdf13d89..87e564b8d 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -243,12 +243,10 @@ static int demux_ra_send_chunk(demux_plugin_t *this_gen) { } if (this->audio_type == BUF_AUDIO_28_8 || this->audio_type == BUF_AUDIO_SIPRO) { - int x; uint8_t * buffer; buffer = this->frame_buffer; if (this->audio_type == BUF_AUDIO_SIPRO) { - int n; int len = this->h * this->w; if(this->input->read(this->input, this->frame_buffer, len) < len) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, @@ -381,8 +379,6 @@ static int demux_ra_get_status (demux_plugin_t *this_gen) { /* return the approximate length in miliseconds */ static int demux_ra_get_stream_length (demux_plugin_t *this_gen) { - demux_ra_t *this = (demux_ra_t *) this_gen; - return 0; } diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 0fa0c971c..3049b2367 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1340,7 +1340,6 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num case ISO_13818_PES_PRIVATE: for (i = 5; i < coded_length; i += stream[i+1] + 2) { if ((stream[i] == 0x6a) && (this->audio_tracks_count < MAX_AUDIO_TRACKS)) { - uint32_t format_identifier=0; int i, found = 0; for(i = 0; i < this->audio_tracks_count; i++) { if(this->audio_tracks[i].pid == pid) { diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index eb9b9a6ed..dede27e11 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -111,9 +111,6 @@ static int find_chunk_by_tag(demux_wav_t *this, const uint32_t given_chunk_tag, /* returns 1 if the WAV file was opened successfully, 0 otherwise */ static int open_wav_file(demux_wav_t *this) { uint8_t signature[WAV_SIGNATURE_SIZE]; - uint32_t chunk_tag; - uint32_t chunk_size; - uint8_t chunk_preamble[8]; off_t wave_pos; /* check the signature */ diff --git a/src/libxineadec/xine_speex_decoder.c b/src/libxineadec/xine_speex_decoder.c index 2804b1308..dd7f988e2 100644 --- a/src/libxineadec/xine_speex_decoder.c +++ b/src/libxineadec/xine_speex_decoder.c @@ -285,7 +285,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } } else if (this->output_open) { - int i, j; + int j; audio_buffer_t *audio_buffer; diff --git a/src/video_out/video_out_raw.c b/src/video_out/video_out_raw.c index 17cbc1b4e..29d93d794 100644 --- a/src/video_out/video_out_raw.c +++ b/src/video_out/video_out_raw.c @@ -208,7 +208,6 @@ static void raw_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_ static void raw_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { raw_driver_t *this = (raw_driver_t *) this_gen; - int i; if ( !this->ovl_changed ) return; @@ -322,7 +321,6 @@ static vo_frame_t *raw_alloc_frame (vo_driver_t *this_gen) static void raw_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { - raw_driver_t *this = (raw_driver_t *) this_gen; raw_frame_t *frame = (raw_frame_t *) frame_gen; /* Check frame size and format and reallocate if necessary */ @@ -429,8 +427,6 @@ static void raw_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) static int raw_get_property (vo_driver_t *this_gen, int property) { - raw_driver_t *this = (raw_driver_t *) this_gen; - switch (property) { case VO_PROP_ASPECT_RATIO: return XINE_VO_ASPECT_AUTO; diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c index c73ab3525..065f8fa0a 100644 --- a/src/xine-engine/scratch.c +++ b/src/xine-engine/scratch.c @@ -105,7 +105,6 @@ static void scratch_dispose (scratch_buffer_t *this) { scratch_buffer_t *_x_new_scratch_buffer (int num_lines) { scratch_buffer_t *this; - int i; this = xine_xmalloc (sizeof (scratch_buffer_t)); -- cgit v1.2.3 From 2afde80a0515b931ec7a00326e0c5501739b40f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 3 May 2008 19:57:50 +0200 Subject: Fix configure when -Wunused-parameter is used. --- m4/pthreads.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/pthreads.m4 b/m4/pthreads.m4 index 65d3a9756..ecc580e9a 100644 --- a/m4/pthreads.m4 +++ b/m4/pthreads.m4 @@ -47,7 +47,7 @@ AC_DEFUN([CC_PTHREAD_FLAGS], [ AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include - void *fakethread(void *arg) { return NULL; } + void *fakethread(void *arg) { (void)arg; return NULL; } pthread_t fakevariable; ]], [[pthread_create(&fakevariable, NULL, &fakethread, NULL);]] -- cgit v1.2.3 From fa7657a3928c9035f0e6a4aec0827bd9fe4697f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 3 May 2008 19:58:32 +0200 Subject: Run check for unused attribute. --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index bee221542..de176fc9e 100644 --- a/configure.ac +++ b/configure.ac @@ -2216,6 +2216,7 @@ CC_ATTRIBUTE_SENTINEL CC_ATTRIBUTE_FORMAT CC_ATTRIBUTE_FORMAT_ARG CC_ATTRIBUTE_DEPRECATED +CC_ATTRIBUTE_UNUSED AC_OPTIMIZATIONS -- cgit v1.2.3 From 0f2790e0acce3d7d012ed1c6abdff2d88f301454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 3 May 2008 20:01:50 +0200 Subject: Remove deprecated functions from net_buf_ctrl.c. --- src/input/net_buf_ctrl.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index 624af4081..df7dbadce 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -113,10 +113,6 @@ static void nbc_set_speed_normal (nbc_t *this) { stream->xine->clock->set_option (stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 1); } -void nbc_check_buffers (nbc_t *this) { - /* Deprecated */ -} - static void display_stats (nbc_t *this) { const char *buffering[2] = {" ", "buf"}; const char *enabled[2] = {"off", "on "}; @@ -564,22 +560,3 @@ void nbc_close (nbc_t *this) { free (this); xprintf(xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_close: done\n"); } - - -void nbc_set_high_water_mark(nbc_t *this, int value) { -/* - Deprecated - this->high_water_mark = value; -*/ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); -} - -void nbc_set_low_water_mark(nbc_t *this, int value) { -/* - Deprecated - this->low_water_mark = value; -*/ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); -} -- cgit v1.2.3 From a137210fc317764d2f84b0e4009bb269e3b1abac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 3 May 2008 20:02:00 +0200 Subject: Make two arrays of string become arrays of arrays of characters. --- src/input/net_buf_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index df7dbadce..1a8ae388e 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -114,8 +114,8 @@ static void nbc_set_speed_normal (nbc_t *this) { } static void display_stats (nbc_t *this) { - const char *buffering[2] = {" ", "buf"}; - const char *enabled[2] = {"off", "on "}; + const char buffering[2][4] = {" ", "buf"}; + const char enabled[2][4] = {"off", "on "}; printf("bufing: %d, enb: %d\n", this->buffering, this->enabled); printf("net_buf_ctrl: vid %3d%% %4.1fs %4" PRId64 "kbps %1d, "\ -- cgit v1.2.3 From d4f5f454a786859baf1006d563211fa5bdca6223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 3 May 2008 20:02:14 +0200 Subject: Don't define flac_metadata_callback if we're not going to use it. It's only used for legacy flac. --- src/combined/decoder_flac.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/combined/decoder_flac.c b/src/combined/decoder_flac.c index 2230056cd..e9c9e6ea1 100644 --- a/src/combined/decoder_flac.c +++ b/src/combined/decoder_flac.c @@ -166,6 +166,7 @@ flac_write_callback (const FLAC__StreamDecoder *decoder, return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } +#ifdef LEGACY_FLAC static void flac_metadata_callback (const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, @@ -188,6 +189,7 @@ flac_metadata_callback (const FLAC__StreamDecoder *decoder, return; } +#endif static void flac_error_callback (const FLAC__StreamDecoder *decoder, -- cgit v1.2.3 From a1b263e7153e33eb54c53d9dfe288fb092f7a042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 3 May 2008 20:02:30 +0200 Subject: Define print_command only when actually logging. --- src/input/mms.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/input/mms.c b/src/input/mms.c index f11a89cf3..4a073f0ae 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -202,9 +202,9 @@ static void mms_buffer_put_64 (mms_buffer_t *mms_buffer, uint64_t value) { } +#ifdef LOG static void print_command (char *data, int len) { -#ifdef LOG int i; int dir = _X_LE_32 (data + 36) >> 16; int comm = _X_LE_32 (data + 36) & 0xFFFF; @@ -240,8 +240,10 @@ static void print_command (char *data, int len) { if (len > CMD_HEADER_LEN) printf ("\n"); printf ("----------------------------------------------\n"); +} +#else +# define print_command(data, len) #endif -} -- cgit v1.2.3 From ac8886fbc94069026f5ad921145d0c9007df7411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 5 May 2008 21:53:03 +0200 Subject: Generalise attributes checking, so that the same code is not copy-pasted for all attributes. --- m4/attributes.m4 | 276 +++++++++++++++++-------------------------------------- 1 file changed, 82 insertions(+), 194 deletions(-) diff --git a/m4/attributes.m4 b/m4/attributes.m4 index a74280696..436c36b87 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -65,94 +65,99 @@ AC_DEFUN([CC_CHECK_WERROR], [ ]) ]) +AC_DEFUN([CC_CHECK_ATTRIBUTE], [ + AC_REQUIRE([CC_CHECK_WERROR]) + ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))], + AS_TR_SH([cc_cv_attribute_$1]), + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_COMPILE_IFELSE([$3], + [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"], + [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"]) + CFLAGS="$ac_save_CFLAGS" + ]) + + if eval test [x$]AS_TR_SH([cc_cv_attribute_$1]) = xyes; then + AC_DEFINE(AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1, [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))]) + ifelse([$4], , [:], [$4]) + else + ifelse([$5], , [:], [$5]) + fi +]) + AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports __attribute__((constructor))], - [cc_cv_attribute_constructor], - [AC_COMPILE_IFELSE([ - void ctor() __attribute__((constructor)); - void ctor() { int a; }; - ], - [cc_cv_attribute_constructor=yes], - [cc_cv_attribute_constructor=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_attribute_constructor" = "xyes"; then - AC_DEFINE([SUPPORT_ATTRIBUTE_CONSTRUCTOR], 1, [Define this if the compiler supports the constructor attribute]) - $1 - else - true - $2 - fi + CC_CHECK_ATTRIBUTE( + [constructor],, + [void __attribute__((constructor)) ctor() { int a; }], + [$1], + [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_FORMAT], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports __attribute__((format(printf, n, n)))], - [cc_cv_attribute_format], - [AC_COMPILE_IFELSE([ - void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; } - ], - [cc_cv_attribute_format=yes], - [cc_cv_attribute_format=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_attribute_format" = "xyes"; then - AC_DEFINE([SUPPORT_ATTRIBUTE_FORMAT], 1, [Define this if the compiler supports the format attribute]) - $1 - else - true - $2 - fi + CC_CHECK_ATTRIBUTE( + [format], [format(printf, n, n)], + [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }], + [$1], + [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports __attribute__((format_arg(printf)))], - [cc_cv_attribute_format_arg], - [AC_COMPILE_IFELSE([ - char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; } - ], - [cc_cv_attribute_format_arg=yes], - [cc_cv_attribute_format_arg=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_attribute_format_arg" = "xyes"; then - AC_DEFINE([SUPPORT_ATTRIBUTE_FORMAT_ARG], 1, [Define this if the compiler supports the format_arg attribute]) - $1 - else - true - $2 - fi + CC_CHECK_ATTRIBUTE( + [format_arg], [format_arg(printf)], + [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }], + [$1], + [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [ - AC_REQUIRE([CC_CHECK_WERROR]) - AC_CACHE_CHECK([if $CC supports __attribute__((visibility("$1")))], - AS_TR_SH([cc_cv_attribute_visibility_$1]), - [ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_COMPILE_IFELSE([void __attribute__((visibility("$1"))) $1_function() { }], - [eval "AS_TR_SH([cc_cv_attribute_visibility_$1])='yes'"], - [eval "AS_TR_SH([cc_cv_attribute_visibility_$1])='no'"]) - CFLAGS="$ac_save_CFLAGS" - ]) + CC_CHECK_ATTRIBUTE( + [visibility_$1], [visibility("$1")], + [void __attribute__((visibility("$1"))) $1_function() { }], + [$2], + [$3]) +]) - if eval test [x$]AS_TR_SH([cc_cv_attribute_visibility_$1]) = xyes; then - AC_DEFINE(AS_TR_CPP([SUPPORT_ATTRIBUTE_VISIBILITY_$1]), 1, [Define this if the compiler supports __attribute__((visibility("$1")))]) - ifelse([$2], , [:], [$2]) - else - ifelse([$3], , [:], [$3]) - fi +AC_DEFUN([CC_ATTRIBUTE_NONNULL], [ + CC_CHECK_ATTRIBUTE( + [nonnull], [nonnull()], + [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }], + [$1], + [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_UNUSED], [ + CC_CHECK_ATTRIBUTE( + [unused], , + [void some_function(void *foo, __attribute__((unused)) void *bar);], + [$1], + [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [ + CC_CHECK_ATTRIBUTE( + [sentinel], , + [void some_function(void *foo, ...) __attribute__((sentinel));], + [$1], + [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [ + CC_CHECK_ATTRIBUTE( + [deprecated], , + [void some_function(void *foo, ...) __attribute__((deprecated));], + [$1], + [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ + CC_CHECK_ATTRIBUTE( + [alias], [weak, alias], + [void other_function(void *foo) { } + void some_function(void *foo) __attribute__((weak, alias("other_function")));], + [$1], + [$2]) ]) AC_DEFUN([CC_FLAG_VISIBILITY], [ @@ -180,53 +185,6 @@ AC_DEFUN([CC_FLAG_VISIBILITY], [ fi ]) -AC_DEFUN([CC_ATTRIBUTE_NONNULL], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports __attribute__((nonnull()))], - [cc_cv_attribute_nonnull], - [AC_COMPILE_IFELSE([ - void some_function(void *foo, void *bar) __attribute__((nonnull())); - void some_function(void *foo, void *bar) { foo = (void *)0; bar = (void *)0; } - ], - [cc_cv_attribute_nonnull=yes], - [cc_cv_attribute_nonnull=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_attribute_nonnull" = "xyes"; then - AC_DEFINE([SUPPORT_ATTRIBUTE_NONNULL], 1, [Define this if the compiler supports the nonnull attribute]) - $1 - else - true - $2 - fi -]) - -AC_DEFUN([CC_ATTRIBUTE_UNUSED], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports __attribute__((unused))], - [cc_cv_attribute_unused], - [AC_COMPILE_IFELSE([ - void some_function(void *foo, __attribute__((unused)) void *bar); - ], - [cc_cv_attribute_unused=yes], - [cc_cv_attribute_unused=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_attribute_unused" = "xyes"; then - AC_DEFINE([SUPPORT_ATTRIBUTE_UNUSED], 1, [Define this if the compiler supports the unused attribute]) - $1 - else - true - $2 - fi -]) - AC_DEFUN([CC_FUNC_EXPECT], [ AC_REQUIRE([CC_CHECK_WERROR]) ac_save_CFLAGS="$CFLAGS" @@ -254,53 +212,6 @@ AC_DEFUN([CC_FUNC_EXPECT], [ fi ]) -AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports __attribute__((sentinel))], - [cc_cv_attribute_sentinel], - [AC_COMPILE_IFELSE([ - void some_function(void *foo, ...) __attribute__((sentinel)); - ], - [cc_cv_attribute_sentinel=yes], - [cc_cv_attribute_sentinel=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_attribute_sentinel" = "xyes"; then - AC_DEFINE([SUPPORT_ATTRIBUTE_SENTINEL], 1, [Define this if the compiler supports the sentinel attribute]) - $1 - else - true - $2 - fi -]) - -AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports __attribute__((weak, alias))], - [cc_cv_attribute_alias], - [AC_COMPILE_IFELSE([ - void other_function(void *foo) { } - void some_function(void *foo) __attribute__((weak, alias("other_function"))); - ], - [cc_cv_attribute_alias=yes], - [cc_cv_attribute_alias=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_attribute_alias" = "xyes"; then - AC_DEFINE([SUPPORT_ATTRIBUTE_ALIAS], 1, [Define this if the compiler supports the alias attribute]) - $1 - else - true - $2 - fi -]) - AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported], @@ -322,26 +233,3 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ [Define the highest alignment supported]) fi ]) - -AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports __attribute__((deprecated))], - [cc_cv_attribute_alias], - [AC_COMPILE_IFELSE([ - void some_function(void) __attribute__((deprecated)); - ], - [cc_cv_attribute_deprecated=yes], - [cc_cv_attribute_deprecated=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_attribute_deprecated" = "xyes"; then - AC_DEFINE([SUPPORT_ATTRIBUTE_DEPRECATED], 1, [Define this if the compiler supports the deprecated attribute]) - $1 - else - true - $2 - fi -]) -- cgit v1.2.3 From cfd7b72175341d19baf7a76cc3e66960df0012cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 5 May 2008 21:59:42 +0200 Subject: Check for malloc attribute and define XINE_MALLOC for use in xineutils.h, rather than just checking for GCC 3. --- configure.ac | 1 + m4/attributes.m4 | 8 ++++++++ src/xine-utils/attributes.h | 6 ++++++ src/xine-utils/xineutils.h | 6 +----- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index de176fc9e..0c9168c7b 100644 --- a/configure.ac +++ b/configure.ac @@ -2217,6 +2217,7 @@ CC_ATTRIBUTE_FORMAT CC_ATTRIBUTE_FORMAT_ARG CC_ATTRIBUTE_DEPRECATED CC_ATTRIBUTE_UNUSED +CC_ATTRIBUTE_MALLOC AC_OPTIMIZATIONS diff --git a/m4/attributes.m4 b/m4/attributes.m4 index 436c36b87..d7fc94b12 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -160,6 +160,14 @@ AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ [$2]) ]) +AC_DEFUN([CC_ATTRIBUTE_MALLOC], [ + CC_CHECK_ATTRIBUTE( + [malloc], , + [void * __attribute__((malloc)) my_alloc(int n);], + [$1], + [$2]) +]) + AC_DEFUN([CC_FLAG_VISIBILITY], [ AC_REQUIRE([CC_CHECK_WERROR]) ac_save_CFLAGS="$CFLAGS" diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index 2085be571..3d6e66359 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -89,4 +89,10 @@ # define XINE_FORMAT_PRINTF_ARG(fmt) #endif +#ifdef SUPPORT_ATTRIBUTE_MALLOC +# define XINE_MALLOC __attribute__((__malloc__)) +#else +# define XINE_MALLOC +#endif + #endif /* ATTRIBUTE_H_ */ diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 01afc1631..2099bf7f3 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -621,11 +621,7 @@ void xine_profiler_print_results (void) XINE_PROTECTED; * Allocate and clean memory size_t 'size', then return the pointer * to the allocated memory. */ -#if !defined(__GNUC__) || __GNUC__ < 3 -void *xine_xmalloc(size_t size) XINE_PROTECTED; -#else -void *xine_xmalloc(size_t size) __attribute__ ((__malloc__)) XINE_PROTECTED; -#endif +void *xine_xmalloc(size_t size) XINE_MALLOC XINE_PROTECTED; /* * Same as above, but memory is aligned to 'alignement'. -- cgit v1.2.3 From 00cb0d590c59a409efb73f7efbb7c72dd4bd2ffc Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 5 May 2008 22:14:22 +0100 Subject: Make open_internal static again. --- src/xine-engine/xine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index d58b4ea55..4b228304c 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -795,7 +795,7 @@ static inline int _x_path_looks_like_mrl (const char *path) return path[0] == ':' && path[1] == '/'; } -/*static*/ int open_internal (xine_stream_t *stream, const char *mrl) { +static int open_internal (xine_stream_t *stream, const char *mrl) { const char *stream_setup = NULL; const char *mrl_proto = NULL; -- cgit v1.2.3 From d5be45ea2436cdc45f086b54516157b5b2394715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 5 May 2008 23:27:59 +0200 Subject: CFLAGS are saved and changed inside the check cache. --- m4/attributes.m4 | 2 -- 1 file changed, 2 deletions(-) diff --git a/m4/attributes.m4 b/m4/attributes.m4 index d7fc94b12..393ee0ba7 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -67,8 +67,6 @@ AC_DEFUN([CC_CHECK_WERROR], [ AC_DEFUN([CC_CHECK_ATTRIBUTE], [ AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))], AS_TR_SH([cc_cv_attribute_$1]), [ac_save_CFLAGS="$CFLAGS" -- cgit v1.2.3