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.
This commit is contained in:
Sebastian Dröge 2014-11-28 14:28:06 +01:00
parent 72c05d1cbb
commit 90eb93c2ef
21 changed files with 32 additions and 33 deletions

View file

@ -721,8 +721,7 @@ gst_alsasrc_open (GstAudioSrc * asrc)
alsa = GST_ALSA_SRC (asrc); alsa = GST_ALSA_SRC (asrc);
CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_CAPTURE, CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_CAPTURE,
(alsa->driver_timestamps == TRUE) ? 0 : SND_PCM_NONBLOCK), (alsa->driver_timestamps) ? 0 : SND_PCM_NONBLOCK), open_error);
open_error);
return TRUE; return TRUE;

View file

@ -1994,7 +1994,7 @@ all_pads_eos (GstCollectPads * pads)
GST_DEBUG_OBJECT (oggpad->collect.pad, GST_DEBUG_OBJECT (oggpad->collect.pad,
"oggpad %p eos %d", oggpad, oggpad->eos); "oggpad %p eos %d", oggpad, oggpad->eos);
if (oggpad->eos == FALSE) if (!oggpad->eos)
return FALSE; return FALSE;
walk = g_slist_next (walk); walk = g_slist_next (walk);

View file

@ -270,7 +270,7 @@ vorbis_handle_type_packet (GstVorbisDec * vd)
{ {
gint res; gint res;
g_assert (vd->initialized == FALSE); g_assert (!vd->initialized);
#ifdef USE_TREMOLO #ifdef USE_TREMOLO
if (G_UNLIKELY ((res = vorbis_dsp_init (&vd->vd, &vd->vi)))) if (G_UNLIKELY ((res = vorbis_dsp_init (&vd->vd, &vd->vi))))

View file

@ -675,7 +675,7 @@ gst_audio_ring_buffer_release (GstAudioRingBuffer * buf)
buf->acquired = FALSE; buf->acquired = FALSE;
/* if this fails, something is wrong in this file */ /* 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); rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf);
if (G_LIKELY (rclass->release)) if (G_LIKELY (rclass->release))
@ -910,7 +910,7 @@ gst_audio_ring_buffer_start (GstAudioRingBuffer * buf)
if (G_UNLIKELY (!buf->acquired)) if (G_UNLIKELY (!buf->acquired))
goto not_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; goto may_not_start;
/* if stopped, set to started */ /* if stopped, set to started */
@ -1277,7 +1277,7 @@ wait_segment (GstAudioRingBuffer * buf)
if (G_UNLIKELY (g_atomic_int_get (&buf->state) != if (G_UNLIKELY (g_atomic_int_get (&buf->state) !=
GST_AUDIO_RING_BUFFER_STATE_STARTED)) { GST_AUDIO_RING_BUFFER_STATE_STARTED)) {
/* see if we are allowed to start it */ /* 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; goto no_start;
GST_DEBUG_OBJECT (buf, "start!"); GST_DEBUG_OBJECT (buf, "start!");

View file

@ -3868,7 +3868,7 @@ gst_rtsp_watch_set_flushing (GstRTSPWatch * watch, gboolean flushing)
g_mutex_lock (&watch->mutex); g_mutex_lock (&watch->mutex);
watch->flushing = flushing; watch->flushing = flushing;
g_cond_signal (&watch->queue_not_full); 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_foreach (watch->messages, (GFunc) gst_rtsp_rec_free, NULL);
g_queue_clear (watch->messages); g_queue_clear (watch->messages);
} }

View file

@ -455,7 +455,7 @@ gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref,
need_sub = TRUE; need_sub = TRUE;
} }
if (need_sub == TRUE) { if (need_sub) {
if (out_size != bsize || !gst_buffer_is_writable (buf)) { if (out_size != bsize || !gst_buffer_is_writable (buf)) {
GstBuffer *sub; GstBuffer *sub;

View 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); 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 */ /* As a fallback, try interpreting UTF-16 in the other endianness */
if (in_encode == utf16beenc) if (in_encode == utf16beenc)
field = g_convert (data, data_size, "UTF-8", utf16leenc, field = g_convert (data, data_size, "UTF-8", utf16leenc,

View file

@ -546,7 +546,7 @@ gst_navigation_message_parse_mouse_over (GstMessage * message,
if (active) { if (active) {
const GstStructure *s = gst_message_get_structure (message); 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; return FALSE;
} }

View file

@ -1474,7 +1474,7 @@ setup_allocators (GstVideoConverter * convert)
/* make sure only one cache frees the allocator */ /* make sure only one cache frees the allocator */
notify = NULL; notify = NULL;
if (cache->pass_alloc == FALSE) { if (!cache->pass_alloc) {
/* can't pass allocator, make new temp line allocator */ /* can't pass allocator, make new temp line allocator */
user_data = user_data =
converter_alloc_new (sizeof (guint16) * width * 4, n_lines + BACKLOG, converter_alloc_new (sizeof (guint16) * width * 4, n_lines + BACKLOG,

View file

@ -1182,7 +1182,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
if (G_UNLIKELY (adder->info.finfo->format == GST_AUDIO_FORMAT_UNKNOWN)) if (G_UNLIKELY (adder->info.finfo->format == GST_AUDIO_FORMAT_UNKNOWN))
goto not_negotiated; goto not_negotiated;
if (adder->flush_stop_pending == TRUE) { if (adder->flush_stop_pending) {
GST_INFO_OBJECT (adder->srcpad, "send pending flush stop event"); GST_INFO_OBJECT (adder->srcpad, "send pending flush stop event");
if (!gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop (TRUE))) { if (!gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop (TRUE))) {
GST_WARNING_OBJECT (adder->srcpad, "Sending flush stop event failed"); 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); inbuf = gst_collect_pads_take_buffer (pads, collect_data, outsize);
if (!GST_COLLECT_PADS_STATE_IS_SET (collect_data, if (!GST_COLLECT_PADS_STATE_IS_SET (collect_data,
GST_COLLECT_PADS_STATE_EOS)) GST_COLLECT_PADS_STATE_EOS))
is_eos = FALSE; is_eos = FALSE;
/* NULL means EOS or an empty buffer so we still need to flush in /* NULL means EOS or an empty buffer so we still need to flush in

View file

@ -2147,7 +2147,7 @@ gst_encode_bin_setup_profile (GstEncodeBin * ebin, GstEncodingProfile * profile)
/* Create elements */ /* Create elements */
res = create_elements_and_pads (ebin); res = create_elements_and_pads (ebin);
if (res == FALSE) if (!res)
gst_encode_bin_tear_down_profile (ebin); gst_encode_bin_tear_down_profile (ebin);
return res; return res;

View file

@ -2325,7 +2325,7 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad,
CHAIN_MUTEX_UNLOCK (chain); CHAIN_MUTEX_UNLOCK (chain);
/* Set connection-speed property if needed */ /* Set connection-speed property if needed */
if (chain->demuxer == TRUE) { if (chain->demuxer) {
GParamSpec *pspec; GParamSpec *pspec;
if ((pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (element), 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; wrong_type = TRUE;
} }
if (wrong_type == FALSE) { if (!wrong_type) {
GST_DEBUG_OBJECT (dbin, "setting connection-speed=%" G_GUINT64_FORMAT GST_DEBUG_OBJECT (dbin, "setting connection-speed=%" G_GUINT64_FORMAT
" to demuxer element", speed); " to demuxer element", speed);
@ -4194,7 +4194,7 @@ retry:
/* Don't expose if we're currently shutting down */ /* Don't expose if we're currently shutting down */
DYN_LOCK (dbin); DYN_LOCK (dbin);
if (G_UNLIKELY (dbin->shutdown == TRUE)) { if (G_UNLIKELY (dbin->shutdown)) {
GST_WARNING_OBJECT (dbin, "Currently, shutting down, aborting exposing"); GST_WARNING_OBJECT (dbin, "Currently, shutting down, aborting exposing");
DYN_UNLOCK (dbin); DYN_UNLOCK (dbin);
return FALSE; return FALSE;

View file

@ -2020,7 +2020,7 @@ setup_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async)
chain->chain.raw = raw; chain->chain.raw = raw;
/* if the chain was active we don't do anything */ /* 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; return TRUE;
/* try to set the sink element to READY again */ /* try to set the sink element to READY again */
@ -2951,7 +2951,7 @@ setup_audio_chain (GstPlaySink * playsink, gboolean raw)
chain->chain.raw = raw; chain->chain.raw = raw;
/* if the chain was active we don't do anything */ /* 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; return TRUE;
/* try to set the sink element to READY again */ /* try to set the sink element to READY again */

View file

@ -239,7 +239,7 @@ _is_video_pad (GstPad * pad, gboolean * hw_accelerated)
caps = gst_pad_query_caps (pad, NULL); 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)); name = gst_structure_get_name (gst_caps_get_structure (caps, i));
if (g_str_equal (name, "video/x-raw")) { if (g_str_equal (name, "video/x-raw")) {
ret = TRUE; ret = TRUE;

View file

@ -1373,7 +1373,7 @@ gen_source_element (GstURIDecodeBin * decoder)
wrong_type = TRUE; wrong_type = TRUE;
} }
if (wrong_type == FALSE) { if (!wrong_type) {
g_object_set (source, "connection-speed", speed, NULL); g_object_set (source, "connection-speed", speed, NULL);
GST_DEBUG_OBJECT (decoder, GST_DEBUG_OBJECT (decoder,
@ -2572,7 +2572,7 @@ decoder_query_latency_fold (const GValue * item, GValue * ret, QueryFold * fold)
fold->max = max; fold->max = max;
else if (max < fold->max) else if (max < fold->max)
fold->max = max; fold->max = max;
if (fold->live == FALSE) if (!fold->live)
fold->live = 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); GST_DEBUG_OBJECT (item, "got seekable %d", seekable);
if (fold->seekable == TRUE) if (fold->seekable)
fold->seekable = seekable; fold->seekable = seekable;
} }

View file

@ -1275,15 +1275,15 @@ gst_sub_parse_data_format_autodetect (gchar * match_str)
subrip_grx = (GRegex *) subrip_rx_once.retval; subrip_grx = (GRegex *) subrip_rx_once.retval;
dks_grx = (GRegex *) dks_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"); GST_LOG ("MicroDVD (frame based) format detected");
return GST_SUB_PARSE_FORMAT_MDVDSUB; 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"); GST_LOG ("SubRip (time based) format detected");
return GST_SUB_PARSE_FORMAT_SUBRIP; 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"); GST_LOG ("DKS (time based) format detected");
return GST_SUB_PARSE_FORMAT_DKS; return GST_SUB_PARSE_FORMAT_DKS;
} }

View 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, /* 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 * it means we're getting new streamheader buffers, and we should clear
* the old ones */ * the old ones */
if (in_caps && sink->previous_buffer_in_caps == FALSE) { if (in_caps && !sink->previous_buffer_in_caps) {
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"receiving new HEADER buffers, clearing old streamheader"); "receiving new HEADER buffers, clearing old streamheader");
g_slist_foreach (sink->streamheader, (GFunc) gst_mini_object_unref, NULL); g_slist_foreach (sink->streamheader, (GFunc) gst_mini_object_unref, NULL);

View 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, /* 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 * it means we're getting new streamheader buffers, and we should clear
* the old ones */ * the old ones */
if (in_caps && sink->previous_buffer_in_caps == FALSE) { if (in_caps && !sink->previous_buffer_in_caps) {
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"receiving new IN_CAPS buffers, clearing old streamheader"); "receiving new IN_CAPS buffers, clearing old streamheader");
g_slist_foreach (sink->streamheader, (GFunc) gst_mini_object_unref, NULL); g_slist_foreach (sink->streamheader, (GFunc) gst_mini_object_unref, NULL);

View file

@ -1869,7 +1869,7 @@ do_stream_buffering (PlaybackApp * app, gint percent)
} }
} else { } else {
/* buffering busy */ /* 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. */ /* we were not buffering but PLAYING, PAUSE the pipeline. */
if (!app->is_live) { if (!app->is_live) {
fprintf (stderr, "Buffering, setting pipeline to PAUSED ...\n"); fprintf (stderr, "Buffering, setting pipeline to PAUSED ...\n");

View file

@ -2352,7 +2352,7 @@ do_stream_buffering (gint percent)
} }
} else { } else {
/* buffering busy */ /* buffering busy */
if (buffering == FALSE && state == GST_STATE_PLAYING) { if (!buffering && state == GST_STATE_PLAYING) {
/* we were not buffering but PLAYING, PAUSE the pipeline. */ /* we were not buffering but PLAYING, PAUSE the pipeline. */
if (!is_live) { if (!is_live) {
fprintf (stderr, "Buffering, setting pipeline to PAUSED ...\n"); fprintf (stderr, "Buffering, setting pipeline to PAUSED ...\n");

View file

@ -487,7 +487,7 @@ process_file (GstDiscoverer * dc, const gchar * filename)
uri = g_strdup (filename); uri = g_strdup (filename);
} }
if (async == FALSE) { if (!async) {
g_print ("Analyzing %s\n", uri); g_print ("Analyzing %s\n", uri);
info = gst_discoverer_discover_uri (dc, uri, &err); info = gst_discoverer_discover_uri (dc, uri, &err);
print_info (info, err); print_info (info, err);
@ -571,7 +571,7 @@ main (int argc, char **argv)
exit (1); exit (1);
} }
if (async == FALSE) { if (!async) {
gint i; gint i;
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
process_file (dc, argv[i]); process_file (dc, argv[i]);