From 90eb93c2eff102e877bc3fd57c36c39490995da1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 28 Nov 2014 14:28:06 +0100 Subject: [PATCH] Don't compare booleans for equality to TRUE and FALSE TRUE is 1, but every other non-zero value is also considered true. Comparing for equality with TRUE would only consider 1 but not the others. --- ext/alsa/gstalsasrc.c | 3 +-- ext/ogg/gstoggmux.c | 2 +- ext/vorbis/gstvorbisdec.c | 2 +- gst-libs/gst/audio/gstaudioringbuffer.c | 6 +++--- gst-libs/gst/rtsp/gstrtspconnection.c | 2 +- gst-libs/gst/tag/gsttagdemux.c | 2 +- gst-libs/gst/tag/id3v2frames.c | 2 +- gst-libs/gst/video/navigation.c | 2 +- gst-libs/gst/video/video-converter.c | 2 +- gst/adder/gstadder.c | 4 ++-- gst/encoding/gstencodebin.c | 2 +- gst/playback/gstdecodebin2.c | 6 +++--- gst/playback/gstplaysink.c | 4 ++-- gst/playback/gstsubtitleoverlay.c | 2 +- gst/playback/gsturidecodebin.c | 6 +++--- gst/subparse/gstsubparse.c | 6 +++--- gst/tcp/gstmultihandlesink.c | 2 +- gst/tcp/gstmultioutputsink.c | 2 +- tests/examples/playback/playback-test.c | 2 +- tests/examples/seek/jsseek.c | 2 +- tools/gst-discoverer.c | 4 ++-- 21 files changed, 32 insertions(+), 33 deletions(-) diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index 8c6b5da..2215e39 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -721,8 +721,7 @@ gst_alsasrc_open (GstAudioSrc * asrc) alsa = GST_ALSA_SRC (asrc); CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_CAPTURE, - (alsa->driver_timestamps == TRUE) ? 0 : SND_PCM_NONBLOCK), - open_error); + (alsa->driver_timestamps) ? 0 : SND_PCM_NONBLOCK), open_error); return TRUE; diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index 6899f79..aba955a 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -1994,7 +1994,7 @@ all_pads_eos (GstCollectPads * pads) GST_DEBUG_OBJECT (oggpad->collect.pad, "oggpad %p eos %d", oggpad, oggpad->eos); - if (oggpad->eos == FALSE) + if (!oggpad->eos) return FALSE; walk = g_slist_next (walk); diff --git a/ext/vorbis/gstvorbisdec.c b/ext/vorbis/gstvorbisdec.c index 3a5a334..5741053 100644 --- a/ext/vorbis/gstvorbisdec.c +++ b/ext/vorbis/gstvorbisdec.c @@ -270,7 +270,7 @@ vorbis_handle_type_packet (GstVorbisDec * vd) { gint res; - g_assert (vd->initialized == FALSE); + g_assert (!vd->initialized); #ifdef USE_TREMOLO if (G_UNLIKELY ((res = vorbis_dsp_init (&vd->vd, &vd->vi)))) diff --git a/gst-libs/gst/audio/gstaudioringbuffer.c b/gst-libs/gst/audio/gstaudioringbuffer.c index 7f4b17b..6624d0d 100644 --- a/gst-libs/gst/audio/gstaudioringbuffer.c +++ b/gst-libs/gst/audio/gstaudioringbuffer.c @@ -675,7 +675,7 @@ gst_audio_ring_buffer_release (GstAudioRingBuffer * buf) buf->acquired = FALSE; /* if this fails, something is wrong in this file */ - g_assert (buf->open == TRUE); + g_assert (buf->open); rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf); if (G_LIKELY (rclass->release)) @@ -910,7 +910,7 @@ gst_audio_ring_buffer_start (GstAudioRingBuffer * buf) if (G_UNLIKELY (!buf->acquired)) goto not_acquired; - if (G_UNLIKELY (g_atomic_int_get (&buf->may_start) == FALSE)) + if (G_UNLIKELY (!g_atomic_int_get (&buf->may_start))) goto may_not_start; /* if stopped, set to started */ @@ -1277,7 +1277,7 @@ wait_segment (GstAudioRingBuffer * buf) if (G_UNLIKELY (g_atomic_int_get (&buf->state) != GST_AUDIO_RING_BUFFER_STATE_STARTED)) { /* see if we are allowed to start it */ - if (G_UNLIKELY (g_atomic_int_get (&buf->may_start) == FALSE)) + if (G_UNLIKELY (!g_atomic_int_get (&buf->may_start))) goto no_start; GST_DEBUG_OBJECT (buf, "start!"); diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index 23ba516..dd4986f 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -3868,7 +3868,7 @@ gst_rtsp_watch_set_flushing (GstRTSPWatch * watch, gboolean flushing) g_mutex_lock (&watch->mutex); watch->flushing = flushing; g_cond_signal (&watch->queue_not_full); - if (flushing == TRUE) { + if (flushing) { g_queue_foreach (watch->messages, (GFunc) gst_rtsp_rec_free, NULL); g_queue_clear (watch->messages); } diff --git a/gst-libs/gst/tag/gsttagdemux.c b/gst-libs/gst/tag/gsttagdemux.c index c36a75d..c478daa 100644 --- a/gst-libs/gst/tag/gsttagdemux.c +++ b/gst-libs/gst/tag/gsttagdemux.c @@ -455,7 +455,7 @@ gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref, need_sub = TRUE; } - if (need_sub == TRUE) { + if (need_sub) { if (out_size != bsize || !gst_buffer_is_writable (buf)) { GstBuffer *sub; diff --git a/gst-libs/gst/tag/id3v2frames.c b/gst-libs/gst/tag/id3v2frames.c index 3785c2a..ac9e486 100644 --- a/gst-libs/gst/tag/id3v2frames.c +++ b/gst-libs/gst/tag/id3v2frames.c @@ -1059,7 +1059,7 @@ parse_insert_string_field (guint8 encoding, gchar * data, gint data_size, field = g_convert (data, data_size, "UTF-8", in_encode, NULL, NULL, NULL); - if (field == NULL || g_utf8_validate (field, -1, NULL) == FALSE) { + if (field == NULL || !g_utf8_validate (field, -1, NULL)) { /* As a fallback, try interpreting UTF-16 in the other endianness */ if (in_encode == utf16beenc) field = g_convert (data, data_size, "UTF-8", utf16leenc, diff --git a/gst-libs/gst/video/navigation.c b/gst-libs/gst/video/navigation.c index 2fc8836..c598875 100644 --- a/gst-libs/gst/video/navigation.c +++ b/gst-libs/gst/video/navigation.c @@ -546,7 +546,7 @@ gst_navigation_message_parse_mouse_over (GstMessage * message, if (active) { const GstStructure *s = gst_message_get_structure (message); - if (gst_structure_get_boolean (s, "active", active) == FALSE) + if (!gst_structure_get_boolean (s, "active", active)) return FALSE; } diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c index 98f6553..bee22d1 100644 --- a/gst-libs/gst/video/video-converter.c +++ b/gst-libs/gst/video/video-converter.c @@ -1474,7 +1474,7 @@ setup_allocators (GstVideoConverter * convert) /* make sure only one cache frees the allocator */ notify = NULL; - if (cache->pass_alloc == FALSE) { + if (!cache->pass_alloc) { /* can't pass allocator, make new temp line allocator */ user_data = converter_alloc_new (sizeof (guint16) * width * 4, n_lines + BACKLOG, diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index 6e9298e..96d182a 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -1182,7 +1182,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data) if (G_UNLIKELY (adder->info.finfo->format == GST_AUDIO_FORMAT_UNKNOWN)) goto not_negotiated; - if (adder->flush_stop_pending == TRUE) { + if (adder->flush_stop_pending) { GST_INFO_OBJECT (adder->srcpad, "send pending flush stop event"); if (!gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop (TRUE))) { GST_WARNING_OBJECT (adder->srcpad, "Sending flush stop event failed"); @@ -1282,7 +1282,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data) inbuf = gst_collect_pads_take_buffer (pads, collect_data, outsize); if (!GST_COLLECT_PADS_STATE_IS_SET (collect_data, - GST_COLLECT_PADS_STATE_EOS)) + GST_COLLECT_PADS_STATE_EOS)) is_eos = FALSE; /* NULL means EOS or an empty buffer so we still need to flush in diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c index b98c0f6..4a2da5a 100644 --- a/gst/encoding/gstencodebin.c +++ b/gst/encoding/gstencodebin.c @@ -2147,7 +2147,7 @@ gst_encode_bin_setup_profile (GstEncodeBin * ebin, GstEncodingProfile * profile) /* Create elements */ res = create_elements_and_pads (ebin); - if (res == FALSE) + if (!res) gst_encode_bin_tear_down_profile (ebin); return res; diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index fc496d4..a6d2d82 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -2325,7 +2325,7 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad, CHAIN_MUTEX_UNLOCK (chain); /* Set connection-speed property if needed */ - if (chain->demuxer == TRUE) { + if (chain->demuxer) { GParamSpec *pspec; if ((pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (element), @@ -2357,7 +2357,7 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad, wrong_type = TRUE; } - if (wrong_type == FALSE) { + if (!wrong_type) { GST_DEBUG_OBJECT (dbin, "setting connection-speed=%" G_GUINT64_FORMAT " to demuxer element", speed); @@ -4194,7 +4194,7 @@ retry: /* Don't expose if we're currently shutting down */ DYN_LOCK (dbin); - if (G_UNLIKELY (dbin->shutdown == TRUE)) { + if (G_UNLIKELY (dbin->shutdown)) { GST_WARNING_OBJECT (dbin, "Currently, shutting down, aborting exposing"); DYN_UNLOCK (dbin); return FALSE; diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c index 8239c85..e093093 100644 --- a/gst/playback/gstplaysink.c +++ b/gst/playback/gstplaysink.c @@ -2020,7 +2020,7 @@ setup_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async) chain->chain.raw = raw; /* if the chain was active we don't do anything */ - if (GST_PLAY_CHAIN (chain)->activated == TRUE) + if (GST_PLAY_CHAIN (chain)->activated) return TRUE; /* try to set the sink element to READY again */ @@ -2951,7 +2951,7 @@ setup_audio_chain (GstPlaySink * playsink, gboolean raw) chain->chain.raw = raw; /* if the chain was active we don't do anything */ - if (GST_PLAY_CHAIN (chain)->activated == TRUE) + if (GST_PLAY_CHAIN (chain)->activated) return TRUE; /* try to set the sink element to READY again */ diff --git a/gst/playback/gstsubtitleoverlay.c b/gst/playback/gstsubtitleoverlay.c index fe1638e..23a66ff 100644 --- a/gst/playback/gstsubtitleoverlay.c +++ b/gst/playback/gstsubtitleoverlay.c @@ -239,7 +239,7 @@ _is_video_pad (GstPad * pad, gboolean * hw_accelerated) caps = gst_pad_query_caps (pad, NULL); } - for (i = 0; i < gst_caps_get_size (caps) && ret == FALSE; i++) { + for (i = 0; i < gst_caps_get_size (caps) && !ret; i++) { name = gst_structure_get_name (gst_caps_get_structure (caps, i)); if (g_str_equal (name, "video/x-raw")) { ret = TRUE; diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index 4dd4337..49ce818 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -1373,7 +1373,7 @@ gen_source_element (GstURIDecodeBin * decoder) wrong_type = TRUE; } - if (wrong_type == FALSE) { + if (!wrong_type) { g_object_set (source, "connection-speed", speed, NULL); GST_DEBUG_OBJECT (decoder, @@ -2572,7 +2572,7 @@ decoder_query_latency_fold (const GValue * item, GValue * ret, QueryFold * fold) fold->max = max; else if (max < fold->max) fold->max = max; - if (fold->live == FALSE) + if (!fold->live) fold->live = live; } @@ -2605,7 +2605,7 @@ decoder_query_seeking_fold (const GValue * item, GValue * ret, QueryFold * fold) GST_DEBUG_OBJECT (item, "got seekable %d", seekable); - if (fold->seekable == TRUE) + if (fold->seekable) fold->seekable = seekable; } diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index b565e93..11b76c3 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -1275,15 +1275,15 @@ gst_sub_parse_data_format_autodetect (gchar * match_str) subrip_grx = (GRegex *) subrip_rx_once.retval; dks_grx = (GRegex *) dks_rx_once.retval; - if (g_regex_match (mdvd_grx, match_str, 0, NULL) == TRUE) { + if (g_regex_match (mdvd_grx, match_str, 0, NULL)) { GST_LOG ("MicroDVD (frame based) format detected"); return GST_SUB_PARSE_FORMAT_MDVDSUB; } - if (g_regex_match (subrip_grx, match_str, 0, NULL) == TRUE) { + if (g_regex_match (subrip_grx, match_str, 0, NULL)) { GST_LOG ("SubRip (time based) format detected"); return GST_SUB_PARSE_FORMAT_SUBRIP; } - if (g_regex_match (dks_grx, match_str, 0, NULL) == TRUE) { + if (g_regex_match (dks_grx, match_str, 0, NULL)) { GST_LOG ("DKS (time based) format detected"); return GST_SUB_PARSE_FORMAT_DKS; } diff --git a/gst/tcp/gstmultihandlesink.c b/gst/tcp/gstmultihandlesink.c index aa1cfb2..38bd841 100644 --- a/gst/tcp/gstmultihandlesink.c +++ b/gst/tcp/gstmultihandlesink.c @@ -1911,7 +1911,7 @@ gst_multi_handle_sink_render (GstBaseSink * bsink, GstBuffer * buf) /* if we get IN_CAPS buffers, but the previous buffer was not IN_CAPS, * it means we're getting new streamheader buffers, and we should clear * the old ones */ - if (in_caps && sink->previous_buffer_in_caps == FALSE) { + if (in_caps && !sink->previous_buffer_in_caps) { GST_DEBUG_OBJECT (sink, "receiving new HEADER buffers, clearing old streamheader"); g_slist_foreach (sink->streamheader, (GFunc) gst_mini_object_unref, NULL); diff --git a/gst/tcp/gstmultioutputsink.c b/gst/tcp/gstmultioutputsink.c index e0503b5..e573d19 100644 --- a/gst/tcp/gstmultioutputsink.c +++ b/gst/tcp/gstmultioutputsink.c @@ -2392,7 +2392,7 @@ gst_multi_output_sink_render (GstBaseSink * bsink, GstBuffer * buf) /* if we get IN_CAPS buffers, but the previous buffer was not IN_CAPS, * it means we're getting new streamheader buffers, and we should clear * the old ones */ - if (in_caps && sink->previous_buffer_in_caps == FALSE) { + if (in_caps && !sink->previous_buffer_in_caps) { GST_DEBUG_OBJECT (sink, "receiving new IN_CAPS buffers, clearing old streamheader"); g_slist_foreach (sink->streamheader, (GFunc) gst_mini_object_unref, NULL); diff --git a/tests/examples/playback/playback-test.c b/tests/examples/playback/playback-test.c index 81d2824..fca116e 100644 --- a/tests/examples/playback/playback-test.c +++ b/tests/examples/playback/playback-test.c @@ -1869,7 +1869,7 @@ do_stream_buffering (PlaybackApp * app, gint percent) } } else { /* buffering busy */ - if (app->buffering == FALSE && app->state == GST_STATE_PLAYING) { + if (!app->buffering && app->state == GST_STATE_PLAYING) { /* we were not buffering but PLAYING, PAUSE the pipeline. */ if (!app->is_live) { fprintf (stderr, "Buffering, setting pipeline to PAUSED ...\n"); diff --git a/tests/examples/seek/jsseek.c b/tests/examples/seek/jsseek.c index 7d8bd29..bd1a5b9 100644 --- a/tests/examples/seek/jsseek.c +++ b/tests/examples/seek/jsseek.c @@ -2352,7 +2352,7 @@ do_stream_buffering (gint percent) } } else { /* buffering busy */ - if (buffering == FALSE && state == GST_STATE_PLAYING) { + if (!buffering && state == GST_STATE_PLAYING) { /* we were not buffering but PLAYING, PAUSE the pipeline. */ if (!is_live) { fprintf (stderr, "Buffering, setting pipeline to PAUSED ...\n"); diff --git a/tools/gst-discoverer.c b/tools/gst-discoverer.c index 636cf80..045332d 100644 --- a/tools/gst-discoverer.c +++ b/tools/gst-discoverer.c @@ -487,7 +487,7 @@ process_file (GstDiscoverer * dc, const gchar * filename) uri = g_strdup (filename); } - if (async == FALSE) { + if (!async) { g_print ("Analyzing %s\n", uri); info = gst_discoverer_discover_uri (dc, uri, &err); print_info (info, err); @@ -571,7 +571,7 @@ main (int argc, char **argv) exit (1); } - if (async == FALSE) { + if (!async) { gint i; for (i = 1; i < argc; i++) process_file (dc, argv[i]); -- 2.7.4