From 004f668b29549a4b4c041f6d27b15898a9d7acc5 Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Mon, 9 Dec 2019 12:05:16 +0100 Subject: Fix cppcheck [syntaxError] warnings --- backends/pulse/pulse-backend.c | 24 ++++++++++++------------ backends/pulse/pulse-connection.c | 22 +++++++++++----------- backends/pulse/pulse-device-switch.c | 4 ++-- backends/pulse/pulse-device.c | 6 +++--- backends/pulse/pulse-ext-stream.c | 6 +++--- backends/pulse/pulse-port-switch.c | 2 +- backends/pulse/pulse-sink-control.c | 2 +- backends/pulse/pulse-sink-input.c | 2 +- backends/pulse/pulse-sink.c | 2 +- backends/pulse/pulse-source-control.c | 2 +- backends/pulse/pulse-source.c | 2 +- backends/pulse/pulse-stream-control.c | 6 +++--- 12 files changed, 40 insertions(+), 40 deletions(-) (limited to 'backends/pulse') diff --git a/backends/pulse/pulse-backend.c b/backends/pulse/pulse-backend.c index 34195f7..1707b89 100644 --- a/backends/pulse/pulse-backend.c +++ b/backends/pulse/pulse-backend.c @@ -346,7 +346,7 @@ pulse_backend_open (MateMixerBackend *backend) pulse = PULSE_BACKEND (backend); - if G_UNLIKELY (pulse->priv->connection != NULL) { + if (G_UNLIKELY (pulse->priv->connection != NULL)) { g_warn_if_reached (); return TRUE; } @@ -360,7 +360,7 @@ pulse_backend_open (MateMixerBackend *backend) /* No connection attempt is made during the construction of the connection, * but it sets up the PulseAudio structures, which might fail in an * unlikely case */ - if G_UNLIKELY (connection == NULL) { + if (G_UNLIKELY (connection == NULL)) { PULSE_CHANGE_STATE (pulse, MATE_MIXER_STATE_FAILED); return FALSE; } @@ -628,7 +628,7 @@ on_connection_state_notify (PulseConnection *connection, * is reached. */ PULSE_CHANGE_STATE (pulse, MATE_MIXER_STATE_CONNECTING); - if G_UNLIKELY (pulse->priv->connect_tag != 0) + if (G_UNLIKELY (pulse->priv->connect_tag != 0)) break; if (pulse_connection_connect (connection, TRUE) == FALSE) { @@ -785,7 +785,7 @@ on_connection_card_removed (PulseConnection *connection, gchar *name; device = g_hash_table_lookup (pulse->priv->devices, GUINT_TO_POINTER (index)); - if G_UNLIKELY (device == NULL) + if (G_UNLIKELY (device == NULL)) return; name = g_strdup (mate_mixer_device_get_name (MATE_MIXER_DEVICE (device))); @@ -848,7 +848,7 @@ on_connection_sink_removed (PulseConnection *connection, PulseDevice *device; stream = g_hash_table_lookup (pulse->priv->sinks, GUINT_TO_POINTER (idx)); - if G_UNLIKELY (stream == NULL) + if (G_UNLIKELY (stream == NULL)) return; g_object_ref (stream); @@ -887,10 +887,10 @@ on_connection_sink_input_info (PulseConnection *connection, PulseSink *sink = NULL; PulseSink *prev; - if G_LIKELY (info->sink != PA_INVALID_INDEX) + if (G_LIKELY (info->sink != PA_INVALID_INDEX)) sink = g_hash_table_lookup (pulse->priv->sinks, GUINT_TO_POINTER (info->sink)); - if G_UNLIKELY (sink == NULL) { + if (G_UNLIKELY (sink == NULL)) { prev = g_hash_table_lookup (pulse->priv->sink_input_map, GUINT_TO_POINTER (info->index)); if (prev != NULL) { g_debug ("Sink input %u moved from sink %s to an unknown sink %u, removing", @@ -930,7 +930,7 @@ on_connection_sink_input_removed (PulseConnection *connection, PulseSink *sink; sink = g_hash_table_lookup (pulse->priv->sink_input_map, GUINT_TO_POINTER (idx)); - if G_UNLIKELY (sink == NULL) + if (G_UNLIKELY (sink == NULL)) return; remove_sink_input (pulse, sink, idx); @@ -985,7 +985,7 @@ on_connection_source_removed (PulseConnection *connection, PulseStream *stream; stream = g_hash_table_lookup (pulse->priv->sources, GUINT_TO_POINTER (idx)); - if G_UNLIKELY (stream == NULL) + if (G_UNLIKELY (stream == NULL)) return; g_object_ref (stream); @@ -1024,10 +1024,10 @@ on_connection_source_output_info (PulseConnection *connection, PulseSource *source = NULL; PulseSource *prev; - if G_LIKELY (info->source != PA_INVALID_INDEX) + if (G_LIKELY (info->source != PA_INVALID_INDEX)) source = g_hash_table_lookup (pulse->priv->sources, GUINT_TO_POINTER (info->source)); - if G_UNLIKELY (source == NULL) { + if (G_UNLIKELY (source == NULL)) { prev = g_hash_table_lookup (pulse->priv->source_output_map, GUINT_TO_POINTER (info->index)); if (prev != NULL) { g_debug ("Source output %u moved from source %s to an unknown source %u, removing", @@ -1067,7 +1067,7 @@ on_connection_source_output_removed (PulseConnection *connection, PulseSource *source; source = g_hash_table_lookup (pulse->priv->source_output_map, GUINT_TO_POINTER (idx)); - if G_UNLIKELY (source == NULL) + if (G_UNLIKELY (source == NULL)) return; remove_source_output (pulse, source, idx); diff --git a/backends/pulse/pulse-connection.c b/backends/pulse/pulse-connection.c index 0b429ef..b8ca8c5 100644 --- a/backends/pulse/pulse-connection.c +++ b/backends/pulse/pulse-connection.c @@ -410,7 +410,7 @@ pulse_connection_new (const gchar *app_name, PulseConnection *connection; mainloop = pa_glib_mainloop_new (g_main_context_get_thread_default ()); - if G_UNLIKELY (mainloop == NULL) { + if (G_UNLIKELY (mainloop == NULL)) { g_warning ("Failed to create PulseAudio main loop"); return NULL; } @@ -461,7 +461,7 @@ pulse_connection_connect (PulseConnection *connection, gboolean wait_for_daemon) context = pa_context_new_with_proplist (mainloop, NULL, connection->priv->proplist); - if G_UNLIKELY (context == NULL) { + if (G_UNLIKELY (context == NULL)) { g_warning ("Failed to create PulseAudio context"); return FALSE; } @@ -1224,7 +1224,7 @@ load_lists (PulseConnection *connection) GSList *ops = NULL; pa_operation *op; - if G_UNLIKELY (connection->priv->outstanding > 0) { + if (G_UNLIKELY (connection->priv->outstanding > 0)) { g_warn_if_reached (); return FALSE; } @@ -1232,7 +1232,7 @@ load_lists (PulseConnection *connection) op = pa_context_get_card_info_list (connection->priv->context, pulse_card_info_cb, connection); - if G_UNLIKELY (op == NULL) + if (G_UNLIKELY (op == NULL)) goto error; ops = g_slist_prepend (ops, op); @@ -1240,7 +1240,7 @@ load_lists (PulseConnection *connection) op = pa_context_get_sink_info_list (connection->priv->context, pulse_sink_info_cb, connection); - if G_UNLIKELY (op == NULL) + if (G_UNLIKELY (op == NULL)) goto error; ops = g_slist_prepend (ops, op); @@ -1248,7 +1248,7 @@ load_lists (PulseConnection *connection) op = pa_context_get_sink_input_info_list (connection->priv->context, pulse_sink_input_info_cb, connection); - if G_UNLIKELY (op == NULL) + if (G_UNLIKELY (op == NULL)) goto error; ops = g_slist_prepend (ops, op); @@ -1256,7 +1256,7 @@ load_lists (PulseConnection *connection) op = pa_context_get_source_info_list (connection->priv->context, pulse_source_info_cb, connection); - if G_UNLIKELY (op == NULL) + if (G_UNLIKELY (op == NULL)) goto error; ops = g_slist_prepend (ops, op); @@ -1264,7 +1264,7 @@ load_lists (PulseConnection *connection) op = pa_context_get_source_output_info_list (connection->priv->context, pulse_source_output_info_cb, connection); - if G_UNLIKELY (op == NULL) + if (G_UNLIKELY (op == NULL)) goto error; ops = g_slist_prepend (ops, op); @@ -1300,7 +1300,7 @@ load_list_finished (PulseConnection *connection) * as the final step in the connection process */ connection->priv->outstanding--; - if G_UNLIKELY (connection->priv->outstanding < 0) { + if (G_UNLIKELY (connection->priv->outstanding < 0)) { g_warn_if_reached (); connection->priv->outstanding = 0; } @@ -1308,7 +1308,7 @@ load_list_finished (PulseConnection *connection) if (connection->priv->outstanding == 0) { gboolean ret = pulse_connection_load_server_info (connection); - if G_UNLIKELY (ret == FALSE) { + if (G_UNLIKELY (ret == FALSE)) { pulse_connection_disconnect (connection); return FALSE; } @@ -1637,7 +1637,7 @@ change_state (PulseConnection *connection, PulseConnectionState state) static gboolean process_pulse_operation (PulseConnection *connection, pa_operation *op) { - if G_UNLIKELY (op == NULL) { + if (G_UNLIKELY (op == NULL)) { g_warning ("PulseAudio operation failed: %s", pa_strerror (pa_context_errno (connection->priv->context))); return FALSE; diff --git a/backends/pulse/pulse-device-switch.c b/backends/pulse/pulse-device-switch.c index 5e82e1f..2d4c7c0 100644 --- a/backends/pulse/pulse-device-switch.c +++ b/backends/pulse/pulse-device-switch.c @@ -126,7 +126,7 @@ pulse_device_switch_set_active_profile_by_name (PulseDeviceSwitch *swtch, const g_return_if_fail (name != NULL); item = g_list_find_custom (swtch->priv->profiles, name, compare_profile_name); - if G_UNLIKELY (item == NULL) { + if (G_UNLIKELY (item == NULL)) { g_debug ("Invalid device switch profile name %s", name); return; } @@ -144,7 +144,7 @@ pulse_device_switch_set_active_option (MateMixerSwitch *mms, MateMixerSwitchOpti g_return_val_if_fail (PULSE_IS_DEVICE_PROFILE (mmso), FALSE); device = mate_mixer_device_switch_get_device (MATE_MIXER_DEVICE_SWITCH (mms)); - if G_UNLIKELY (device == NULL) + if (G_UNLIKELY (device == NULL)) return FALSE; device_name = mate_mixer_device_get_name (device); diff --git a/backends/pulse/pulse-device.c b/backends/pulse/pulse-device.c index 0f11949..6f75c39 100644 --- a/backends/pulse/pulse-device.c +++ b/backends/pulse/pulse-device.c @@ -225,11 +225,11 @@ pulse_device_new (PulseConnection *connection, const pa_card_info *info) g_return_val_if_fail (info != NULL, NULL); label = pa_proplist_gets (info->proplist, PA_PROP_DEVICE_DESCRIPTION); - if G_UNLIKELY (label == NULL) + if (G_UNLIKELY (label == NULL)) label = info->name; icon = pa_proplist_gets (info->proplist, PA_PROP_DEVICE_ICON_NAME); - if G_UNLIKELY (icon == NULL) + if (G_UNLIKELY (icon == NULL)) icon = "audio-card"; /* Consider the device index as unchanging parameter */ @@ -253,7 +253,7 @@ pulse_device_update (PulseDevice *device, const pa_card_info *info) g_return_if_fail (PULSE_IS_DEVICE (device)); g_return_if_fail (info != NULL); - if G_LIKELY (info->active_profile2 != NULL) + if (G_LIKELY (info->active_profile2 != NULL)) pulse_device_switch_set_active_profile_by_name (device->priv->pswitch, info->active_profile2->name); } diff --git a/backends/pulse/pulse-ext-stream.c b/backends/pulse/pulse-ext-stream.c index 39f8f1e..beefe1a 100644 --- a/backends/pulse/pulse-ext-stream.c +++ b/backends/pulse/pulse-ext-stream.c @@ -279,7 +279,7 @@ pulse_ext_stream_new (PulseConnection *connection, suffix++; if (strstr (info->name, "-by-media-role:")) { - if G_LIKELY (suffix != NULL) + if (G_LIKELY (suffix != NULL)) media_role = pulse_convert_media_role_name (suffix); } else if (strstr (info->name, "-by-application-name:")) { @@ -291,7 +291,7 @@ pulse_ext_stream_new (PulseConnection *connection, if (app_info == NULL) app_info = _mate_mixer_app_info_new (); - if G_LIKELY (suffix != NULL) + if (G_LIKELY (suffix != NULL)) _mate_mixer_app_info_set_name (app_info, suffix); } else if (strstr (info->name, "-by-application-id:")) { @@ -303,7 +303,7 @@ pulse_ext_stream_new (PulseConnection *connection, if (app_info == NULL) app_info = _mate_mixer_app_info_new (); - if G_LIKELY (suffix != NULL) + if (G_LIKELY (suffix != NULL)) _mate_mixer_app_info_set_id (app_info, suffix); } diff --git a/backends/pulse/pulse-port-switch.c b/backends/pulse/pulse-port-switch.c index 46871a0..549c961 100644 --- a/backends/pulse/pulse-port-switch.c +++ b/backends/pulse/pulse-port-switch.c @@ -118,7 +118,7 @@ pulse_port_switch_set_active_port_by_name (PulsePortSwitch *swtch, const gchar * g_return_if_fail (name != NULL); item = g_list_find_custom (swtch->priv->ports, name, compare_port_name); - if G_UNLIKELY (item == NULL) { + if (G_UNLIKELY (item == NULL)) { g_debug ("Invalid switch port name %s", name); return; } diff --git a/backends/pulse/pulse-sink-control.c b/backends/pulse/pulse-sink-control.c index 674e09f..c5696bf 100644 --- a/backends/pulse/pulse-sink-control.c +++ b/backends/pulse/pulse-sink-control.c @@ -149,7 +149,7 @@ pulse_sink_control_create_monitor (PulseStreamControl *psc) sink = PULSE_SINK (mate_mixer_stream_control_get_stream (MATE_MIXER_STREAM_CONTROL (psc))); index = pulse_sink_get_index_monitor (sink); - if G_UNLIKELY (index == PA_INVALID_INDEX) { + if (G_UNLIKELY (index == PA_INVALID_INDEX)) { g_debug ("Monitor of stream control %s is not available", mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (psc))); return NULL; diff --git a/backends/pulse/pulse-sink-input.c b/backends/pulse/pulse-sink-input.c index c37502f..addff14 100644 --- a/backends/pulse/pulse-sink-input.c +++ b/backends/pulse/pulse-sink-input.c @@ -225,7 +225,7 @@ pulse_sink_input_create_monitor (PulseStreamControl *psc) sink = PULSE_SINK (mate_mixer_stream_control_get_stream (MATE_MIXER_STREAM_CONTROL (psc))); index = pulse_sink_get_index_monitor (sink); - if G_UNLIKELY (index == PA_INVALID_INDEX) { + if (G_UNLIKELY (index == PA_INVALID_INDEX)) { g_debug ("Monitor of stream control %s is not available", mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (psc))); return NULL; diff --git a/backends/pulse/pulse-sink.c b/backends/pulse/pulse-sink.c index c882aa0..6d05b26 100644 --- a/backends/pulse/pulse-sink.c +++ b/backends/pulse/pulse-sink.c @@ -224,7 +224,7 @@ pulse_sink_remove_input (PulseSink *sink, guint32 index) g_return_if_fail (PULSE_IS_SINK (sink)); input = g_hash_table_lookup (sink->priv->inputs, GUINT_TO_POINTER (index)); - if G_UNLIKELY (input == NULL) + if (G_UNLIKELY (input == NULL)) return; name = g_strdup (mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (input))); diff --git a/backends/pulse/pulse-source-control.c b/backends/pulse/pulse-source-control.c index 57c0b21..68e149f 100644 --- a/backends/pulse/pulse-source-control.c +++ b/backends/pulse/pulse-source-control.c @@ -142,7 +142,7 @@ pulse_source_control_create_monitor (PulseStreamControl *psc) g_return_val_if_fail (PULSE_IS_SOURCE_CONTROL (psc), NULL); index = pulse_stream_control_get_stream_index (psc); - if G_UNLIKELY (index == PA_INVALID_INDEX) { + if (G_UNLIKELY (index == PA_INVALID_INDEX)) { g_debug ("Monitor of stream control %s is not available", mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (psc))); return NULL; diff --git a/backends/pulse/pulse-source.c b/backends/pulse/pulse-source.c index 4275f9a..8b1b562 100644 --- a/backends/pulse/pulse-source.c +++ b/backends/pulse/pulse-source.c @@ -220,7 +220,7 @@ pulse_source_remove_output (PulseSource *source, guint32 index) g_return_if_fail (PULSE_IS_SOURCE (source)); output = g_hash_table_lookup (source->priv->outputs, GUINT_TO_POINTER (index)); - if G_UNLIKELY (output == NULL) + if (G_UNLIKELY (output == NULL)) return; name = g_strdup (mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (output))); diff --git a/backends/pulse/pulse-stream-control.c b/backends/pulse/pulse-stream-control.c index f0625f3..5c3b631 100644 --- a/backends/pulse/pulse-stream-control.c +++ b/backends/pulse/pulse-stream-control.c @@ -277,7 +277,7 @@ pulse_stream_control_get_stream_index (PulseStreamControl *control) g_return_val_if_fail (PULSE_IS_STREAM_CONTROL (control), PA_INVALID_INDEX); stream = mate_mixer_stream_control_get_stream (MATE_MIXER_STREAM_CONTROL (control)); - if G_UNLIKELY (stream == NULL) + if (G_UNLIKELY (stream == NULL)) return PA_INVALID_INDEX; return pulse_stream_get_index (PULSE_STREAM (stream)); @@ -322,7 +322,7 @@ pulse_stream_control_set_app_info (PulseStreamControl *control, { g_return_if_fail (PULSE_IS_STREAM_CONTROL (control)); - if G_UNLIKELY (control->priv->app_info != NULL) + if (G_UNLIKELY (control->priv->app_info != NULL)) _mate_mixer_app_info_free (control->priv->app_info); if (take == TRUE) @@ -653,7 +653,7 @@ pulse_stream_control_set_monitor_enabled (MateMixerStreamControl *mmsc, gboolean control->priv->monitor = PULSE_STREAM_CONTROL_GET_CLASS (control)->create_monitor (control); - if G_UNLIKELY (control->priv->monitor == NULL) + if (G_UNLIKELY (control->priv->monitor == NULL)) return FALSE; g_signal_connect (G_OBJECT (control->priv->monitor), -- cgit v1.2.1