diff options
author | Pablo Barciela <[email protected]> | 2019-12-09 12:05:16 +0100 |
---|---|---|
committer | lukefromdc <[email protected]> | 2019-12-10 18:39:02 +0000 |
commit | 004f668b29549a4b4c041f6d27b15898a9d7acc5 (patch) | |
tree | 35e5e5936f1089e427fc0156ed0a679f7c8de36b /backends/alsa | |
parent | 8138877b8f12881deec7e40aad9ebbf39e8826a8 (diff) | |
download | libmatemixer-004f668b29549a4b4c041f6d27b15898a9d7acc5.tar.bz2 libmatemixer-004f668b29549a4b4c041f6d27b15898a9d7acc5.tar.xz |
Fix cppcheck [syntaxError] warnings
Diffstat (limited to 'backends/alsa')
-rw-r--r-- | backends/alsa/alsa-device.c | 6 | ||||
-rw-r--r-- | backends/alsa/alsa-stream-control.c | 12 | ||||
-rw-r--r-- | backends/alsa/alsa-stream-input-control.c | 20 | ||||
-rw-r--r-- | backends/alsa/alsa-stream-output-control.c | 20 | ||||
-rw-r--r-- | backends/alsa/alsa-switch.c | 6 | ||||
-rw-r--r-- | backends/alsa/alsa-toggle.c | 6 |
6 files changed, 35 insertions, 35 deletions
diff --git a/backends/alsa/alsa-device.c b/backends/alsa/alsa-device.c index 34612b9..50509cf 100644 --- a/backends/alsa/alsa-device.c +++ b/backends/alsa/alsa-device.c @@ -563,7 +563,7 @@ add_switch (AlsaDevice *device, AlsaStream *stream, snd_mixer_elem_t *el) MateMixerStreamSwitchRole role; count = snd_mixer_selem_get_enum_items (el); - if G_UNLIKELY (count <= 0) { + if (G_UNLIKELY (count <= 0)) { g_debug ("Skipping mixer switch %s with %d items", snd_mixer_selem_get_name (el), count); @@ -573,7 +573,7 @@ add_switch (AlsaDevice *device, AlsaStream *stream, snd_mixer_elem_t *el) for (i = 0; i < count; i++) { gint ret = snd_mixer_selem_get_enum_item_name (el, i, sizeof (item), item); - if G_LIKELY (ret == 0) { + if (G_LIKELY (ret == 0)) { gint j; AlsaSwitchOption *option = NULL; @@ -594,7 +594,7 @@ add_switch (AlsaDevice *device, AlsaStream *stream, snd_mixer_elem_t *el) g_warning ("Failed to read switch item name: %s", snd_strerror (ret)); } - if G_UNLIKELY (options == NULL) + if (G_UNLIKELY (options == NULL)) return; get_switch_info (el, &name, &label, &role); diff --git a/backends/alsa/alsa-stream-control.c b/backends/alsa/alsa-stream-control.c index f39e9f9..ea067f4 100644 --- a/backends/alsa/alsa-stream-control.c +++ b/backends/alsa/alsa-stream-control.c @@ -396,7 +396,7 @@ alsa_stream_control_has_channel_position (MateMixerStreamControl *mmsc, control = ALSA_STREAM_CONTROL (mmsc); - if MATE_MIXER_CHANNEL_MASK_HAS_CHANNEL (control->priv->channel_mask, position) + if (MATE_MIXER_CHANNEL_MASK_HAS_CHANNEL (control->priv->channel_mask, position)) return TRUE; else return FALSE; @@ -455,7 +455,7 @@ alsa_stream_control_set_channel_volume (MateMixerStreamControl *mmsc, guint chan /* Convert channel index to ALSA channel position and make sure it is valid */ snd_mixer_selem_channel_id_t c = alsa_channel_map_to[control->priv->data.c[channel]]; - if G_UNLIKELY (c == SND_MIXER_SCHN_UNKNOWN) { + if (G_UNLIKELY (c == SND_MIXER_SCHN_UNKNOWN)) { g_warn_if_reached (); return FALSE; } @@ -682,11 +682,11 @@ control_data_get_average_left_right (AlsaControlData *data, guint *left, guint * guint channel; for (channel = 0; channel < data->channels; channel++) - if MATE_MIXER_IS_LEFT_CHANNEL (data->c[channel]) { + if (MATE_MIXER_IS_LEFT_CHANNEL (data->c[channel])) { l += data->v[channel]; nl++; } - else if MATE_MIXER_IS_RIGHT_CHANNEL (data->c[channel]) { + else if (MATE_MIXER_IS_RIGHT_CHANNEL (data->c[channel])) { r += data->v[channel]; nr++; } @@ -705,11 +705,11 @@ control_data_get_average_front_back (AlsaControlData *data, guint *front, guint guint channel; for (channel = 0; channel < data->channels; channel++) - if MATE_MIXER_IS_FRONT_CHANNEL (data->c[channel]) { + if (MATE_MIXER_IS_FRONT_CHANNEL (data->c[channel])) { f += data->v[channel]; nf++; } - else if MATE_MIXER_IS_BACK_CHANNEL (data->c[channel]) { + else if (MATE_MIXER_IS_BACK_CHANNEL (data->c[channel])) { b += data->v[channel]; nb++; } diff --git a/backends/alsa/alsa-stream-input-control.c b/backends/alsa/alsa-stream-input-control.c index 103d2a7..eb7dc10 100644 --- a/backends/alsa/alsa-stream-input-control.c +++ b/backends/alsa/alsa-stream-input-control.c @@ -102,11 +102,11 @@ alsa_stream_input_control_load (AlsaStreamControl *control) g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; - if G_UNLIKELY (snd_mixer_selem_has_capture_volume (el) == 0 && - snd_mixer_selem_has_common_volume (el) == 0) { + if (G_UNLIKELY (snd_mixer_selem_has_capture_volume (el) == 0 && + snd_mixer_selem_has_common_volume (el) == 0)) { g_warn_if_reached (); return FALSE; } @@ -139,7 +139,7 @@ alsa_stream_input_control_set_mute (AlsaStreamControl *control, gboolean mute) g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; /* Set the switch for all channels */ @@ -160,7 +160,7 @@ alsa_stream_input_control_set_volume (AlsaStreamControl *control, guint volume) g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; /* Set the volume for all channels */ @@ -183,7 +183,7 @@ alsa_stream_input_control_set_channel_volume (AlsaStreamControl *contr g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; /* Set the volume for a single channel */ @@ -208,7 +208,7 @@ alsa_stream_input_control_get_volume_from_decibel (AlsaStreamControl *control, g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; ret = snd_mixer_selem_ask_capture_dB_vol (el, (glong) (decibel * 100), 0, &value); @@ -237,7 +237,7 @@ alsa_stream_input_control_get_decibel_from_volume (AlsaStreamControl *control, g_return_val_if_fail (ALSA_IS_STREAM_INPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; ret = snd_mixer_selem_ask_capture_vol_dB (el, (glong) volume, &value); @@ -264,7 +264,7 @@ read_volume_data (snd_mixer_elem_t *el, AlsaControlData *data) /* Read volume ranges, this call should never fail on valid input */ #if SND_LIB_VERSION >= ALSA_PACK_VERSION (1, 0, 10) ret = snd_mixer_selem_get_capture_volume_range (el, &min, &max); - if G_UNLIKELY (ret < 0) { + if (G_UNLIKELY (ret < 0)) { g_warning ("Failed to read capture volume range: %s", snd_strerror (ret)); return; } @@ -311,7 +311,7 @@ read_volume_data (snd_mixer_elem_t *el, AlsaControlData *data) gint value; ret = snd_mixer_selem_get_capture_switch (el, SND_MIXER_SCHN_MONO, &value); - if G_LIKELY (ret == 0) + if (G_LIKELY (ret == 0)) data->m[0] = !value; } } else { diff --git a/backends/alsa/alsa-stream-output-control.c b/backends/alsa/alsa-stream-output-control.c index 362a247..8b5d385 100644 --- a/backends/alsa/alsa-stream-output-control.c +++ b/backends/alsa/alsa-stream-output-control.c @@ -101,11 +101,11 @@ alsa_stream_output_control_load (AlsaStreamControl *control) g_return_val_if_fail (ALSA_IS_STREAM_OUTPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; - if G_UNLIKELY (snd_mixer_selem_has_playback_volume (el) == 0 && - snd_mixer_selem_has_common_volume (el) == 0) { + if (G_UNLIKELY (snd_mixer_selem_has_playback_volume (el) == 0 && + snd_mixer_selem_has_common_volume (el) == 0)) { g_warn_if_reached (); return FALSE; } @@ -138,7 +138,7 @@ alsa_stream_output_control_set_mute (AlsaStreamControl *control, gboolean mute) g_return_val_if_fail (ALSA_IS_STREAM_OUTPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; /* Set the switch for all channels */ @@ -159,7 +159,7 @@ alsa_stream_output_control_set_volume (AlsaStreamControl *control, guint volume) g_return_val_if_fail (ALSA_IS_STREAM_OUTPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; /* Set the volume for all channels */ @@ -182,7 +182,7 @@ alsa_stream_output_control_set_channel_volume (AlsaStreamControl *cont g_return_val_if_fail (ALSA_IS_STREAM_OUTPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; /* Set the volume for a single channel */ @@ -207,7 +207,7 @@ alsa_stream_output_control_get_volume_from_decibel (AlsaStreamControl *control, g_return_val_if_fail (ALSA_IS_STREAM_OUTPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; ret = snd_mixer_selem_ask_playback_dB_vol (el, (glong) (decibel * 100), 0, &value); @@ -236,7 +236,7 @@ alsa_stream_output_control_get_decibel_from_volume (AlsaStreamControl *control, g_return_val_if_fail (ALSA_IS_STREAM_OUTPUT_CONTROL (control), FALSE); el = alsa_element_get_snd_element (ALSA_ELEMENT (control)); - if G_UNLIKELY (el == NULL) + if (G_UNLIKELY (el == NULL)) return FALSE; ret = snd_mixer_selem_ask_playback_vol_dB (el, (glong) volume, &value); @@ -263,7 +263,7 @@ read_volume_data (snd_mixer_elem_t *el, AlsaControlData *data) /* Read volume ranges, this call should never fail on valid input */ #if SND_LIB_VERSION >= ALSA_PACK_VERSION (1, 0, 10) ret = snd_mixer_selem_get_playback_volume_range (el, &min, &max); - if G_UNLIKELY (ret < 0) { + if (G_UNLIKELY (ret < 0)) { g_warning ("Failed to read playback volume range: %s", snd_strerror (ret)); return; } @@ -310,7 +310,7 @@ read_volume_data (snd_mixer_elem_t *el, AlsaControlData *data) gint value; ret = snd_mixer_selem_get_playback_switch (el, SND_MIXER_SCHN_MONO, &value); - if G_LIKELY (ret == 0) + if (G_LIKELY (ret == 0)) data->m[0] = !value; } } else { diff --git a/backends/alsa/alsa-switch.c b/backends/alsa/alsa-switch.c index 1f5f92f..a1dfeea 100644 --- a/backends/alsa/alsa-switch.c +++ b/backends/alsa/alsa-switch.c @@ -136,12 +136,12 @@ alsa_switch_set_active_option (MateMixerSwitch *mms, MateMixerSwitchOption *mmso swtch = ALSA_SWITCH (mms); - if G_UNLIKELY (swtch->priv->element == NULL) + if (G_UNLIKELY (swtch->priv->element == NULL)) return FALSE; /* The channel mask is created when reading the active option the first * time, so a successful load must be done before changing the option */ - if G_UNLIKELY (swtch->priv->channel_mask == 0) { + if (G_UNLIKELY (swtch->priv->channel_mask == 0)) { g_debug ("Not setting active switch option, channel mask unknown"); return FALSE; } @@ -203,7 +203,7 @@ alsa_switch_load (AlsaElement *element) swtch = ALSA_SWITCH (element); - if G_UNLIKELY (swtch->priv->element == NULL) + if (G_UNLIKELY (swtch->priv->element == NULL)) return FALSE; /* When reading the first time we try all the channels, otherwise only the diff --git a/backends/alsa/alsa-toggle.c b/backends/alsa/alsa-toggle.c index d7dd46e..9c15885 100644 --- a/backends/alsa/alsa-toggle.c +++ b/backends/alsa/alsa-toggle.c @@ -115,14 +115,14 @@ alsa_toggle_set_active_option (MateMixerSwitch *mms, MateMixerSwitchOption *mmso toggle = ALSA_TOGGLE (mms); - if G_UNLIKELY (toggle->priv->element == NULL) + if (G_UNLIKELY (toggle->priv->element == NULL)) return FALSE; /* For toggles the 0/1 value is stored as the switch option id, there is not really * a need to validate that the option belong to the switch, just make sure it * contains the value 0 or 1 */ value = alsa_switch_option_get_id (ALSA_SWITCH_OPTION (mmso)); - if G_UNLIKELY (value != 0 && value != 1) { + if (G_UNLIKELY (value != 0 && value != 1)) { g_warn_if_reached (); return FALSE; } @@ -170,7 +170,7 @@ alsa_toggle_load (AlsaElement *element) toggle = ALSA_TOGGLE (element); - if G_UNLIKELY (toggle->priv->element == NULL) + if (G_UNLIKELY (toggle->priv->element == NULL)) return FALSE; /* When reading the first time we try all the channels, otherwise only the |