Don't compare booleans for equality to TRUE and FALSE
authorSebastian Dröge <sebastian@centricular.com>
Fri, 28 Nov 2014 13:28:06 +0000 (14:28 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 1 Dec 2014 08:51:12 +0000 (09:51 +0100)
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.

21 files changed:
ext/alsa/gstalsasrc.c
ext/ogg/gstoggmux.c
ext/vorbis/gstvorbisdec.c
gst-libs/gst/audio/gstaudioringbuffer.c
gst-libs/gst/rtsp/gstrtspconnection.c
gst-libs/gst/tag/gsttagdemux.c
gst-libs/gst/tag/id3v2frames.c
gst-libs/gst/video/navigation.c
gst-libs/gst/video/video-converter.c
gst/adder/gstadder.c
gst/encoding/gstencodebin.c
gst/playback/gstdecodebin2.c
gst/playback/gstplaysink.c
gst/playback/gstsubtitleoverlay.c
gst/playback/gsturidecodebin.c
gst/subparse/gstsubparse.c
gst/tcp/gstmultihandlesink.c
gst/tcp/gstmultioutputsink.c
tests/examples/playback/playback-test.c
tests/examples/seek/jsseek.c
tools/gst-discoverer.c

index 8c6b5da..2215e39 100644 (file)
@@ -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;
 
index 6899f79..aba955a 100644 (file)
@@ -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);
index 3a5a334..5741053 100644 (file)
@@ -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))))
index 7f4b17b..6624d0d 100644 (file)
@@ -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!");
index 23ba516..dd4986f 100644 (file)
@@ -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);
   }
index c36a75d..c478daa 100644 (file)
@@ -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;
 
index 3785c2a..ac9e486 100644 (file)
@@ -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,
index 2fc8836..c598875 100644 (file)
@@ -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;
   }
 
index 98f6553..bee22d1 100644 (file)
@@ -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,
index 6e9298e..96d182a 100644 (file)
@@ -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
index b98c0f6..4a2da5a 100644 (file)
@@ -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;
index fc496d4..a6d2d82 100644 (file)
@@ -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;
index 8239c85..e093093 100644 (file)
@@ -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 */
index fe1638e..23a66ff 100644 (file)
@@ -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;
index 4dd4337..49ce818 100644 (file)
@@ -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;
   }
 
index b565e93..11b76c3 100644 (file)
@@ -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;
   }
index aa1cfb2..38bd841 100644 (file)
@@ -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);
index e0503b5..e573d19 100644 (file)
@@ -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);
index 81d2824..fca116e 100644 (file)
@@ -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");
index 7d8bd29..bd1a5b9 100644 (file)
@@ -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");
index 636cf80..045332d 100644 (file)
@@ -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]);