summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-11-28 14:17:54 +0100
committerSebastian Dröge <sebastian@centricular.com>2014-12-01 09:51:37 +0100
commit154eefecc93b69c6af8040ceef5f004e595a827f (patch)
treefdda1093ac700aa2ac17268ba37c69aa8ac2b209
parentf2e4c255880b199bd3b3b41286a41f6c14a02f51 (diff)
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. Also normalize booleans in a few places.
-rw-r--r--docs/manual/advanced-buffering.xml6
-rw-r--r--gst/gstbin.c2
-rw-r--r--gst/gstbus.c2
-rw-r--r--gst/gstcontrolbinding.c2
-rw-r--r--gst/gstdevicemonitor.c2
-rw-r--r--gst/gstghostpad.c3
-rw-r--r--gst/gstinfo.c2
-rw-r--r--gst/gstplugin.c2
-rw-r--r--gst/gststructure.c10
-rw-r--r--gst/gstsystemclock.c8
-rw-r--r--libs/gst/base/gstbasesink.c2
-rw-r--r--libs/gst/base/gstbasetransform.c2
-rw-r--r--libs/gst/base/gstcollectpads.c8
-rw-r--r--libs/gst/check/gstcheck.c14
-rw-r--r--libs/gst/check/gstcheck.h2
-rw-r--r--libs/gst/check/gsttestclock.c4
-rw-r--r--plugins/elements/gstfunnel.c2
-rw-r--r--plugins/elements/gstidentity.c2
-rw-r--r--plugins/elements/gstinputselector.c2
-rw-r--r--tools/gst-launch.c4
20 files changed, 42 insertions, 39 deletions
diff --git a/docs/manual/advanced-buffering.xml b/docs/manual/advanced-buffering.xml
index 72fc96f22..7facd8543 100644
--- a/docs/manual/advanced-buffering.xml
+++ b/docs/manual/advanced-buffering.xml
@@ -73,7 +73,7 @@
}
} else {
/* buffering busy */
- if (buffering == FALSE && target_state == GST_STATE_PLAYING) {
+ if (!buffering && target_state == GST_STATE_PLAYING) {
/* we were not buffering but PLAYING, PAUSE the pipeline. */
gst_element_set_state (pipeline, GST_STATE_PAUSED);
}
@@ -349,7 +349,7 @@ on_message_buffering (GstBus *bus, GstMessage *message, gpointer user_data)
if (percent < 100) {
/* buffering busy */
- if (is_buffering == FALSE) {
+ if (!is_buffering) {
is_buffering = TRUE;
if (target_state == GST_STATE_PLAYING) {
/* we were not buffering but PLAYING, PAUSE the pipeline. */
@@ -364,7 +364,7 @@ on_message_async_done (GstBus *bus, GstMessage *message, gpointer user_data)
{
GstElement *pipeline = user_data;
- if (is_buffering == FALSE)
+ if (!is_buffering)
gst_element_set_state (pipeline, target_state);
else
g_timeout_add (500, buffer_timeout, pipeline);
diff --git a/gst/gstbin.c b/gst/gstbin.c
index 0adc0e04a..2d95070b4 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -3888,7 +3888,7 @@ bin_query_latency_fold (const GValue * vitem, 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;
}
} else {
diff --git a/gst/gstbus.c b/gst/gstbus.c
index f0ef60066..ff458cd54 100644
--- a/gst/gstbus.c
+++ b/gst/gstbus.c
@@ -505,7 +505,7 @@ gst_bus_timed_pop_filtered (GstBus * bus, GstClockTime timeout,
if ((GST_MESSAGE_TYPE (message) & types) != 0) {
/* Extra check to ensure extended types don't get matched unless
* asked for */
- if ((GST_MESSAGE_TYPE_IS_EXTENDED (message) == FALSE)
+ if ((!GST_MESSAGE_TYPE_IS_EXTENDED (message))
|| (types & GST_MESSAGE_EXTENDED)) {
/* exit the loop, we have a message */
goto beach;
diff --git a/gst/gstcontrolbinding.c b/gst/gstcontrolbinding.c
index 9e02a473e..11bd65d62 100644
--- a/gst/gstcontrolbinding.c
+++ b/gst/gstcontrolbinding.c
@@ -468,5 +468,5 @@ gboolean
gst_control_binding_is_disabled (GstControlBinding * binding)
{
g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), TRUE);
- return (binding->disabled == TRUE);
+ return ! !binding->disabled;
}
diff --git a/gst/gstdevicemonitor.c b/gst/gstdevicemonitor.c
index a1394a2d9..a1b11805b 100644
--- a/gst/gstdevicemonitor.c
+++ b/gst/gstdevicemonitor.c
@@ -223,7 +223,7 @@ gst_device_monitor_dispose (GObject * object)
{
GstDeviceMonitor *self = GST_DEVICE_MONITOR (object);
- g_return_if_fail (self->priv->started == FALSE);
+ g_return_if_fail (!self->priv->started);
if (self->priv->providers) {
while (self->priv->providers->len)
diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c
index 082aa158d..22644fc19 100644
--- a/gst/gstghostpad.c
+++ b/gst/gstghostpad.c
@@ -533,8 +533,7 @@ gst_ghost_pad_construct (GstGhostPad * gpad)
GstPad *pad, *internal;
g_return_val_if_fail (GST_IS_GHOST_PAD (gpad), FALSE);
- g_return_val_if_fail (GST_GHOST_PAD_PRIVATE (gpad)->constructed == FALSE,
- FALSE);
+ g_return_val_if_fail (!GST_GHOST_PAD_PRIVATE (gpad)->constructed, FALSE);
g_object_get (gpad, "direction", &dir, "template", &templ, NULL);
diff --git a/gst/gstinfo.c b/gst/gstinfo.c
index 2c3f01c53..ffff06d6d 100644
--- a/gst/gstinfo.c
+++ b/gst/gstinfo.c
@@ -1799,7 +1799,7 @@ gst_debug_set_threshold_from_string (const gchar * list, gboolean reset)
g_assert (list);
- if (reset == TRUE)
+ if (reset)
gst_debug_set_default_threshold (0);
split = g_strsplit (list, ",", 0);
diff --git a/gst/gstplugin.c b/gst/gstplugin.c
index c9c286a8b..d0318ce38 100644
--- a/gst/gstplugin.c
+++ b/gst/gstplugin.c
@@ -706,7 +706,7 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "attempt to load plugin \"%s\"",
filename);
- if (g_module_supported () == FALSE) {
+ if (!g_module_supported ()) {
GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "module loading not supported");
g_set_error (error,
GST_PLUGIN_ERROR,
diff --git a/gst/gststructure.c b/gst/gststructure.c
index ad42d3aad..378161534 100644
--- a/gst/gststructure.c
+++ b/gst/gststructure.c
@@ -1970,7 +1970,7 @@ gst_structure_parse_range (gchar * s, gchar ** after, GValue * value,
s++;
ret = gst_structure_parse_value (s, &s, &value1, type);
- if (ret == FALSE)
+ if (!ret)
return FALSE;
while (g_ascii_isspace (*s))
@@ -1984,7 +1984,7 @@ gst_structure_parse_range (gchar * s, gchar ** after, GValue * value,
s++;
ret = gst_structure_parse_value (s, &s, &value2, type);
- if (ret == FALSE)
+ if (!ret)
return FALSE;
while (g_ascii_isspace (*s))
@@ -2000,7 +2000,7 @@ gst_structure_parse_range (gchar * s, gchar ** after, GValue * value,
s++;
ret = gst_structure_parse_value (s, &s, &value3, type);
- if (ret == FALSE)
+ if (!ret)
return FALSE;
while (g_ascii_isspace (*s))
@@ -2084,7 +2084,7 @@ gst_structure_parse_any_list (gchar * s, gchar ** after, GValue * value,
}
ret = gst_structure_parse_value (s, &s, &list_value, type);
- if (ret == FALSE)
+ if (!ret)
return FALSE;
g_array_append_val (array, list_value);
@@ -2102,7 +2102,7 @@ gst_structure_parse_any_list (gchar * s, gchar ** after, GValue * value,
memset (&list_value, 0, sizeof (list_value));
ret = gst_structure_parse_value (s, &s, &list_value, type);
- if (ret == FALSE)
+ if (!ret)
return FALSE;
g_array_append_val (array, list_value);
diff --git a/gst/gstsystemclock.c b/gst/gstsystemclock.c
index 3071926a7..0527af29a 100644
--- a/gst/gstsystemclock.c
+++ b/gst/gstsystemclock.c
@@ -339,7 +339,7 @@ gst_system_clock_obtain (void)
if (clock == NULL) {
GST_CAT_DEBUG (GST_CAT_CLOCK, "creating new static system clock");
- g_assert (_external_default_clock == FALSE);
+ g_assert (!_external_default_clock);
clock = g_object_new (GST_TYPE_SYSTEM_CLOCK,
"name", "GstSystemClock", NULL);
@@ -738,8 +738,10 @@ gst_system_clock_id_wait_jitter_unlocked (GstClock * clock,
if (diff <= 0) {
/* timeout, this is fine, we can report success now */
- if (G_UNLIKELY (!CAS_ENTRY_STATUS (entry, GST_CLOCK_DONE, GST_CLOCK_OK))) {
- GST_CAT_DEBUG (GST_CAT_CLOCK, "unexpected status for entry %p", entry);
+ if (G_UNLIKELY (!CAS_ENTRY_STATUS (entry, GST_CLOCK_DONE,
+ GST_CLOCK_OK))) {
+ GST_CAT_DEBUG (GST_CAT_CLOCK, "unexpected status for entry %p",
+ entry);
status = GET_ENTRY_STATUS (entry);
goto done;
} else {
diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c
index 6fff96f16..60aaa3ad5 100644
--- a/libs/gst/base/gstbasesink.c
+++ b/libs/gst/base/gstbasesink.c
@@ -4434,7 +4434,7 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
/* assume we will use the clock for getting the current position */
with_clock = TRUE;
- if (basesink->sync == FALSE)
+ if (!basesink->sync)
with_clock = FALSE;
/* and we need a clock */
diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c
index 3b1bfa8db..6d45a5267 100644
--- a/libs/gst/base/gstbasetransform.c
+++ b/libs/gst/base/gstbasetransform.c
@@ -2464,7 +2464,7 @@ gst_base_transform_set_passthrough (GstBaseTransform * trans,
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
GST_OBJECT_LOCK (trans);
- if (passthrough == FALSE) {
+ if (!passthrough) {
if (bclass->transform_ip || bclass->transform)
trans->priv->passthrough = FALSE;
} else {
diff --git a/libs/gst/base/gstcollectpads.c b/libs/gst/base/gstcollectpads.c
index 637e3b4af..45e31d90d 100644
--- a/libs/gst/base/gstcollectpads.c
+++ b/libs/gst/base/gstcollectpads.c
@@ -1315,7 +1315,7 @@ gst_collect_pads_check_collected (GstCollectPads * pads)
pads->priv->numpads, GST_DEBUG_FUNCPTR_NAME (func));
if (G_UNLIKELY (g_atomic_int_compare_and_exchange (&pads->priv->seeking,
- TRUE, FALSE) == TRUE)) {
+ TRUE, FALSE))) {
GST_INFO_OBJECT (pads, "finished seeking");
}
do {
@@ -1333,7 +1333,7 @@ gst_collect_pads_check_collected (GstCollectPads * pads)
GST_DEBUG_FUNCPTR_NAME (func));
if (G_UNLIKELY (g_atomic_int_compare_and_exchange (&pads->priv->seeking,
- TRUE, FALSE) == TRUE)) {
+ TRUE, FALSE))) {
GST_INFO_OBJECT (pads, "finished seeking");
}
flow_ret = func (pads, user_data);
@@ -1664,8 +1664,8 @@ gst_collect_pads_event_default (GstCollectPads * pads, GstCollectData * data,
{
if (g_atomic_int_get (&pads->priv->seeking)) {
/* drop all but the first FLUSH_STARTs when seeking */
- if (g_atomic_int_compare_and_exchange (&pads->priv->pending_flush_start,
- TRUE, FALSE) == FALSE)
+ if (!g_atomic_int_compare_and_exchange (&pads->
+ priv->pending_flush_start, TRUE, FALSE))
goto eat;
/* unblock collect pads */
diff --git a/libs/gst/check/gstcheck.c b/libs/gst/check/gstcheck.c
index 7427f17e9..9e43165fe 100644
--- a/libs/gst/check/gstcheck.c
+++ b/libs/gst/check/gstcheck.c
@@ -954,7 +954,8 @@ weak_notify (DestroyedObjectStruct * destroyed, GObject ** object)
* Since: 1.6
*/
void
-gst_check_objects_destroyed_on_unref (gpointer object_to_unref, gpointer first_object, ...)
+gst_check_objects_destroyed_on_unref (gpointer object_to_unref,
+ gpointer first_object, ...)
{
GObject *object;
GList *objs = NULL, *tmp;
@@ -984,12 +985,13 @@ gst_check_objects_destroyed_on_unref (gpointer object_to_unref, gpointer first_o
for (tmp = objs; tmp; tmp = tmp->next) {
DestroyedObjectStruct *destroyed = tmp->data;
- if (destroyed->destroyed == FALSE) {
- fail_unless (destroyed->destroyed == TRUE,
+ if (!destroyed->destroyed) {
+ fail_unless (destroyed->destroyed,
"%s_%p is not destroyed, %d refcounts left!",
- GST_IS_OBJECT (destroyed->object) ? GST_OBJECT_NAME (destroyed->object) :
- G_OBJECT_TYPE_NAME (destroyed),
- destroyed->object, destroyed->object->ref_count);
+ GST_IS_OBJECT (destroyed->
+ object) ? GST_OBJECT_NAME (destroyed->object) :
+ G_OBJECT_TYPE_NAME (destroyed), destroyed->object,
+ destroyed->object->ref_count);
}
g_slice_free (DestroyedObjectStruct, tmp->data);
}
diff --git a/libs/gst/check/gstcheck.h b/libs/gst/check/gstcheck.h
index e33e006fb..c2c34e17d 100644
--- a/libs/gst/check/gstcheck.h
+++ b/libs/gst/check/gstcheck.h
@@ -500,7 +500,7 @@ G_STMT_START { \
g_usleep (1); \
} G_STMT_END;
-#define THREAD_TEST_RUNNING() (_gst_check_threads_running == TRUE)
+#define THREAD_TEST_RUNNING() (!!_gst_check_threads_running)
/* additional assertions */
#define ASSERT_CRITICAL(code) \
diff --git a/libs/gst/check/gsttestclock.c b/libs/gst/check/gsttestclock.c
index 0981b0b0f..2fb30bc22 100644
--- a/libs/gst/check/gsttestclock.c
+++ b/libs/gst/check/gsttestclock.c
@@ -139,7 +139,7 @@
* g_assert_cmpint (GST_BUFFER_TIMESTAMP (buf), ==, latency);
* gst_buffer_unref (buf);
* GST_INFO ("Check that element does not wait for any clock notification\n");
- * g_assert (gst_test_clock_peek_next_pending_id (test_clock, NULL) == FALSE);
+ * g_assert (!gst_test_clock_peek_next_pending_id (test_clock, NULL));
*
* GST_INFO ("Set time, create and push the second buffer\n");
* gst_test_clock_advance_time (test_clock, 10 * GST_SECOND);
@@ -164,7 +164,7 @@
* 10 * GST_SECOND + latency + 7 * GST_MSECOND);
* gst_buffer_unref (buf);
* GST_INFO ("Check that element does not wait for any clock notification\n");
- * g_assert (gst_test_clock_peek_next_pending_id (test_clock, NULL) == FALSE);
+ * g_assert (!gst_test_clock_peek_next_pending_id (test_clock, NULL));
* ...
* </programlisting>
* </example>
diff --git a/plugins/elements/gstfunnel.c b/plugins/elements/gstfunnel.c
index 19de206d2..f5dedcca8 100644
--- a/plugins/elements/gstfunnel.c
+++ b/plugins/elements/gstfunnel.c
@@ -210,7 +210,7 @@ gst_funnel_all_sinkpads_eos_unlocked (GstFunnel * funnel, GstPad * pad)
for (item = element->sinkpads; item != NULL; item = g_list_next (item)) {
GstFunnelPad *sinkpad = GST_FUNNEL_PAD_CAST (item->data);
- if (sinkpad->got_eos == FALSE) {
+ if (!sinkpad->got_eos) {
return FALSE;
}
}
diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c
index 94f6db710..f31599f5b 100644
--- a/plugins/elements/gstidentity.c
+++ b/plugins/elements/gstidentity.c
@@ -299,7 +299,7 @@ gst_identity_sink_event (GstBaseTransform * trans, GstEvent * event)
}
if (identity->single_segment && (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT)) {
- if (trans->have_segment == FALSE) {
+ if (!trans->have_segment) {
GstEvent *news;
GstSegment segment;
diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index 70e7cb105..304827c5b 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -1591,7 +1591,7 @@ gst_input_selector_query (GstPad * pad, GstObject * parent, GstQuery * query)
resmax = max;
else if (max < resmax)
resmax = max;
- if (reslive == FALSE)
+ if (!reslive)
reslive = live;
}
}
diff --git a/tools/gst-launch.c b/tools/gst-launch.c
index d4ef359a2..59f5fff74 100644
--- a/tools/gst-launch.c
+++ b/tools/gst-launch.c
@@ -492,7 +492,7 @@ intr_handler (gpointer user_data)
return FALSE;
}
-#if defined(G_OS_WIN32) /* G_OS_UNIX */
+#if defined(G_OS_WIN32) /* G_OS_UNIX */
static BOOL WINAPI
w32_intr_handler (DWORD dwCtrlType)
{
@@ -732,7 +732,7 @@ event_loop (GstElement * pipeline, gboolean blocking, gboolean do_progress,
goto exit;
} else {
/* buffering busy */
- if (buffering == FALSE && target_state == GST_STATE_PLAYING) {
+ if (!buffering && target_state == GST_STATE_PLAYING) {
/* we were not buffering but PLAYING, PAUSE the pipeline. */
PRINT (_("Buffering, setting pipeline to PAUSED ...\n"));
gst_element_set_state (pipeline, GST_STATE_PAUSED);