From ccad9a7338f951bdf84a95087fcc7c065ee2433a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 17 Mar 2023 16:32:45 +0200 Subject: [PATCH] plugins: Fix various trivial clang compiler warnings Part-of: --- .../gst-plugins-bad/ext/bs2b/gstbs2b.c | 36 +++++++++---------- .../gst-plugins-bad/ext/bs2b/gstbs2b.h | 3 +- .../gst-plugins-bad/ext/openal/gstopenal.c | 6 ++-- .../gst-plugins-bad/gst/mxf/mxfmetadata.c | 3 +- .../sys/v4l2codecs/gstv4l2codech264dec.c | 4 --- .../ext/gl/gstglfilterglass.c | 3 +- .../adaptivedemux2/gstadaptivedemux-stream.c | 2 +- .../gst-plugins-good/sys/oss/gstossaudio.c | 6 ++-- .../gst-plugins-good/sys/oss/gstosshelper.c | 4 --- .../tests/check/elements/x264enc.c | 4 +-- 10 files changed, 29 insertions(+), 42 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/bs2b/gstbs2b.c b/subprojects/gst-plugins-bad/ext/bs2b/gstbs2b.c index 88c2ae0e38..9f87397837 100644 --- a/subprojects/gst-plugins-bad/ext/bs2b/gstbs2b.c +++ b/subprojects/gst-plugins-bad/ext/bs2b/gstbs2b.c @@ -259,58 +259,58 @@ gst_bs2b_setup (GstAudioFilter * filter, const GstAudioInfo * audio_info) switch (GST_AUDIO_INFO_FORMAT (audio_info)) { case GST_AUDIO_FORMAT_S8: - element->func = &bs2b_cross_feed_s8; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_s8; break; case GST_AUDIO_FORMAT_U8: - element->func = &bs2b_cross_feed_u8; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_u8; break; case GST_AUDIO_FORMAT_S16BE: - element->func = &bs2b_cross_feed_s16be; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_s16be; break; case GST_AUDIO_FORMAT_S16LE: - element->func = &bs2b_cross_feed_s16le; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_s16le; break; case GST_AUDIO_FORMAT_U16BE: - element->func = &bs2b_cross_feed_u16be; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_u16be; break; case GST_AUDIO_FORMAT_U16LE: - element->func = &bs2b_cross_feed_u16le; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_u16le; break; case GST_AUDIO_FORMAT_S24BE: - element->func = &bs2b_cross_feed_s24be; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_s24be; break; case GST_AUDIO_FORMAT_S24LE: - element->func = &bs2b_cross_feed_s24le; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_s24le; break; case GST_AUDIO_FORMAT_U24BE: - element->func = &bs2b_cross_feed_u24be; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_u24be; break; case GST_AUDIO_FORMAT_U24LE: - element->func = &bs2b_cross_feed_u24le; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_u24le; break; case GST_AUDIO_FORMAT_S32BE: - element->func = &bs2b_cross_feed_s32be; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_s32be; break; case GST_AUDIO_FORMAT_S32LE: - element->func = &bs2b_cross_feed_s32le; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_s32le; break; case GST_AUDIO_FORMAT_U32BE: - element->func = &bs2b_cross_feed_u32be; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_u32be; break; case GST_AUDIO_FORMAT_U32LE: - element->func = &bs2b_cross_feed_u32le; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_u32le; break; case GST_AUDIO_FORMAT_F32BE: - element->func = &bs2b_cross_feed_fbe; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_fbe; break; case GST_AUDIO_FORMAT_F32LE: - element->func = &bs2b_cross_feed_fle; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_fle; break; case GST_AUDIO_FORMAT_F64BE: - element->func = &bs2b_cross_feed_dbe; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_dbe; break; case GST_AUDIO_FORMAT_F64LE: - element->func = &bs2b_cross_feed_dle; + element->func = (GstBs2bProcessFunc) & bs2b_cross_feed_dle; break; default: return FALSE; diff --git a/subprojects/gst-plugins-bad/ext/bs2b/gstbs2b.h b/subprojects/gst-plugins-bad/ext/bs2b/gstbs2b.h index c57fec85d0..6892d50912 100644 --- a/subprojects/gst-plugins-bad/ext/bs2b/gstbs2b.h +++ b/subprojects/gst-plugins-bad/ext/bs2b/gstbs2b.h @@ -40,6 +40,7 @@ G_BEGIN_DECLS typedef struct _GstBs2b GstBs2b; typedef struct _GstBs2bClass GstBs2bClass; +typedef void (*GstBs2bProcessFunc)(t_bs2bdp bs2bdp, void *sample, int n); struct _GstBs2b { @@ -48,7 +49,7 @@ struct _GstBs2b /*< private > */ GMutex bs2b_lock; t_bs2bdp bs2bdp; - void (*func) (); + GstBs2bProcessFunc func; guint bytes_per_sample; }; diff --git a/subprojects/gst-plugins-bad/ext/openal/gstopenal.c b/subprojects/gst-plugins-bad/ext/openal/gstopenal.c index 5ad55a720e..fa7f0fbecc 100644 --- a/subprojects/gst-plugins-bad/ext/openal/gstopenal.c +++ b/subprojects/gst-plugins-bad/ext/openal/gstopenal.c @@ -34,10 +34,8 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret = FALSE; - - ret |= GST_ELEMENT_REGISTER (openalsink, plugin); - ret |= GST_ELEMENT_REGISTER (openalsrc, plugin); + GST_ELEMENT_REGISTER (openalsink, plugin); + GST_ELEMENT_REGISTER (openalsrc, plugin); return TRUE; } diff --git a/subprojects/gst-plugins-bad/gst/mxf/mxfmetadata.c b/subprojects/gst-plugins-bad/gst/mxf/mxfmetadata.c index 6a2d8cd892..50c31299ad 100644 --- a/subprojects/gst-plugins-bad/gst/mxf/mxfmetadata.c +++ b/subprojects/gst-plugins-bad/gst/mxf/mxfmetadata.c @@ -6106,7 +6106,7 @@ mxf_metadata_multiple_descriptor_resolve (MXFMetadataBase * m, { MXFMetadataMultipleDescriptor *self = MXF_METADATA_MULTIPLE_DESCRIPTOR (m); MXFMetadataBase *current = NULL; - guint i, have_subdescriptors = 0; + guint i; #ifndef GST_DISABLE_GST_DEBUG gchar str[48]; #endif @@ -6122,7 +6122,6 @@ mxf_metadata_multiple_descriptor_resolve (MXFMetadataBase * m, if (current && MXF_IS_METADATA_GENERIC_DESCRIPTOR (current)) { if (mxf_metadata_base_resolve (current, metadata)) { self->sub_descriptors[i] = MXF_METADATA_GENERIC_DESCRIPTOR (current); - have_subdescriptors++; } else { GST_ERROR ("Couldn't resolve descriptor %s", mxf_uuid_to_string (&self->sub_descriptors_uids[i], str)); diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c index 4ae62e9dc2..5cbac666e2 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c @@ -735,16 +735,12 @@ gst_v4l2_codec_h264_dec_fill_slice_params (GstV4l2CodecH264Dec * self, GstH264Slice * slice) { gint n = self->num_slices++; - gsize slice_size = slice->nalu.size; struct v4l2_ctrl_h264_slice_params *params; /* Ensure array is large enough */ if (self->slice_params->len < self->num_slices) g_array_set_size (self->slice_params, self->slice_params->len * 2); - if (needs_start_codes (self)) - slice_size += 3; - /* *INDENT-OFF* */ params = &g_array_index (self->slice_params, struct v4l2_ctrl_h264_slice_params, n); *params = (struct v4l2_ctrl_h264_slice_params) { diff --git a/subprojects/gst-plugins-base/ext/gl/gstglfilterglass.c b/subprojects/gst-plugins-base/ext/gl/gstglfilterglass.c index 7cb1b96957..c0971e7036 100644 --- a/subprojects/gst-plugins-base/ext/gl/gstglfilterglass.c +++ b/subprojects/gst-plugins-base/ext/gl/gstglfilterglass.c @@ -75,7 +75,8 @@ static gboolean gst_gl_filter_glass_init_shader (GstGLFilter * filter); static gboolean gst_gl_filter_glass_filter_texture (GstGLFilter * filter, GstGLMemory * in_tex, GstGLMemory * out_tex); -static void gst_gl_filter_glass_draw_background_gradient (); +static void gst_gl_filter_glass_draw_background_gradient (GstGLFilterGlass * + glass); static void gst_gl_filter_glass_draw_video_plane (GstGLFilter * filter, gint width, gint height, guint texture, gfloat center_x, gfloat center_y, gfloat start_alpha, gfloat stop_alpha, gboolean reversed, gfloat rotation); diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c index df03629c2b..6a7ef5337c 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c @@ -2696,7 +2696,7 @@ gst_adaptive_demux2_stream_update_current_bitrate (GstAdaptiveDemux2Stream * * fraction of the measured download rate */ target_download_rate = CLAMP (stream->current_download_rate, 0, - G_MAXUINT) * demux->bandwidth_target_ratio; + G_MAXUINT) * (gdouble) demux->bandwidth_target_ratio; GST_DEBUG_OBJECT (stream, "Bitrate after target ratio limit (%0.2f): %u", demux->bandwidth_target_ratio, target_download_rate); diff --git a/subprojects/gst-plugins-good/sys/oss/gstossaudio.c b/subprojects/gst-plugins-good/sys/oss/gstossaudio.c index 2edf0c4ef9..9a9383fe51 100644 --- a/subprojects/gst-plugins-good/sys/oss/gstossaudio.c +++ b/subprojects/gst-plugins-good/sys/oss/gstossaudio.c @@ -32,10 +32,8 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret = FALSE; - - ret |= GST_ELEMENT_REGISTER (osssrc, plugin); - ret |= GST_ELEMENT_REGISTER (osssink, plugin); + GST_ELEMENT_REGISTER (osssrc, plugin); + GST_ELEMENT_REGISTER (osssink, plugin); return TRUE; } diff --git a/subprojects/gst-plugins-good/sys/oss/gstosshelper.c b/subprojects/gst-plugins-good/sys/oss/gstosshelper.c index 8290441e71..ff2da7578b 100644 --- a/subprojects/gst-plugins-good/sys/oss/gstosshelper.c +++ b/subprojects/gst-plugins-good/sys/oss/gstosshelper.c @@ -202,7 +202,6 @@ gst_oss_helper_rate_probe_check (GstOssProbe * probe) GQueue *ranges; int exact_rates = 0; gboolean checking_exact_rates = TRUE; - int n_checks = 0; gboolean result = TRUE; ranges = g_queue_new (); @@ -210,7 +209,6 @@ gst_oss_helper_rate_probe_check (GstOssProbe * probe) probe->rates = g_array_new (FALSE, FALSE, sizeof (int)); probe->min = gst_oss_helper_rate_check_rate (probe, 1000); - n_checks++; probe->max = gst_oss_helper_rate_check_rate (probe, 100000); /* a little bug workaround */ { @@ -223,7 +221,6 @@ gst_oss_helper_rate_probe_check (GstOssProbe * probe) probe->max = max; } } - n_checks++; if (probe->min == -1 || probe->max == -1) { /* This is a workaround for drivers that return -EINVAL (or another * error) for rates outside of [8000,48000]. If this fails, the @@ -252,7 +249,6 @@ gst_oss_helper_rate_probe_check (GstOssProbe * probe) /* FIXME ioctl returned an error. do something */ GST_DEBUG ("unexpected check_rate error"); } - n_checks++; if (mid == mid_ret && checking_exact_rates) { int max_exact_matches = 20; diff --git a/subprojects/gst-plugins-ugly/tests/check/elements/x264enc.c b/subprojects/gst-plugins-ugly/tests/check/elements/x264enc.c index 27f8fdf2f3..a26c1ff81c 100644 --- a/subprojects/gst-plugins-ugly/tests/check/elements/x264enc.c +++ b/subprojects/gst-plugins-ugly/tests/check/elements/x264enc.c @@ -276,7 +276,7 @@ test_video_profile (const gchar * profile, gint profile_id, switch (i) { case 0: { - gint nsize, npos, j, type, next_type; + gint nsize, npos, type, next_type; GstMapInfo map; const guint8 *data; gsize size; @@ -286,7 +286,6 @@ test_video_profile (const gchar * profile, gint profile_id, size = map.size; npos = 0; - j = 0; /* need SPS first */ next_type = 7; /* loop through NALs */ @@ -311,7 +310,6 @@ test_video_profile (const gchar * profile, gint profile_id, default: break; } - j++; } npos += nsize + 4; }