diff options
author | Colomban Wendling <[email protected]> | 2023-11-07 15:23:47 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-12-25 17:32:14 +0100 |
commit | cad9b11da5e2fe30f2033797075b132534ae5c3e (patch) | |
tree | 36640d465bc4cc252d9c680d2ff3da6518326d7c /mate-volume-control | |
parent | cadcbb2530d7440b9c756c37c83c30cc5748ab15 (diff) | |
download | mate-media-cad9b11da5e2fe30f2033797075b132534ae5c3e.tar.bz2 mate-media-cad9b11da5e2fe30f2033797075b132534ae5c3e.tar.xz |
Fix various instance checks
The g_return*_if_fail() calls should use PREFIX_IS_TYPE_NAME [1], which
returns whether the given instance is of the right type, not
PREFIX_TYPE_NAME [2], which checks whether the given instance if of the
right type, warns if not, and returns the passed-in instance unchanged.
Using the wrong one means the returned value is the passed-in pointer,
and thus passes the g_return*_if_fail() whenever the pointer is
non-NULL, no matter whether it's of the right type or not.
A warning would still be emitted by g_type_check_instance_cast(), but
the execution wouldn't get short-circuited.
[1] calls g_type_check_instance_is_a()
[2] calls g_type_check_instance_cast()
Diffstat (limited to 'mate-volume-control')
-rw-r--r-- | mate-volume-control/gvc-balance-bar.c | 2 | ||||
-rw-r--r-- | mate-volume-control/gvc-level-bar.c | 4 | ||||
-rw-r--r-- | mate-volume-control/gvc-stream-applet-icon.c | 4 | ||||
-rw-r--r-- | mate-volume-control/gvc-stream-status-icon.c | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/mate-volume-control/gvc-balance-bar.c b/mate-volume-control/gvc-balance-bar.c index e4fccb8..3e28345 100644 --- a/mate-volume-control/gvc-balance-bar.c +++ b/mate-volume-control/gvc-balance-bar.c @@ -242,7 +242,7 @@ find_stream_lfe_channel (MateMixerStreamControl *control) static void gvc_balance_bar_set_control (GvcBalanceBar *bar, MateMixerStreamControl *control) { - g_return_if_fail (GVC_BALANCE_BAR (bar)); + g_return_if_fail (GVC_IS_BALANCE_BAR (bar)); g_return_if_fail (MATE_MIXER_IS_STREAM_CONTROL (control)); if (bar->priv->control != NULL) { diff --git a/mate-volume-control/gvc-level-bar.c b/mate-volume-control/gvc-level-bar.c index 0d815fc..24ac1f2 100644 --- a/mate-volume-control/gvc-level-bar.c +++ b/mate-volume-control/gvc-level-bar.c @@ -295,7 +295,7 @@ void gvc_level_bar_set_peak_adjustment (GvcLevelBar *bar, GtkAdjustment *adjustment) { - g_return_if_fail (GVC_LEVEL_BAR (bar)); + g_return_if_fail (GVC_IS_LEVEL_BAR (bar)); g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); if (bar->priv->peak_adjustment != NULL) { @@ -321,7 +321,7 @@ void gvc_level_bar_set_rms_adjustment (GvcLevelBar *bar, GtkAdjustment *adjustment) { - g_return_if_fail (GVC_LEVEL_BAR (bar)); + g_return_if_fail (GVC_IS_LEVEL_BAR (bar)); g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); if (bar->priv->rms_adjustment != NULL) { diff --git a/mate-volume-control/gvc-stream-applet-icon.c b/mate-volume-control/gvc-stream-applet-icon.c index d2b7337..7c1bdb5 100644 --- a/mate-volume-control/gvc-stream-applet-icon.c +++ b/mate-volume-control/gvc-stream-applet-icon.c @@ -497,7 +497,7 @@ void gvc_stream_applet_icon_set_display_name (GvcStreamAppletIcon *icon, const gchar *name) { - g_return_if_fail (GVC_STREAM_APPLET_ICON (icon)); + g_return_if_fail (GVC_IS_STREAM_APPLET_ICON (icon)); g_free (icon->priv->display_name); @@ -511,7 +511,7 @@ void gvc_stream_applet_icon_set_control (GvcStreamAppletIcon *icon, MateMixerStreamControl *control) { - g_return_if_fail (GVC_STREAM_APPLET_ICON (icon)); + g_return_if_fail (GVC_IS_STREAM_APPLET_ICON (icon)); if (icon->priv->control == control) return; diff --git a/mate-volume-control/gvc-stream-status-icon.c b/mate-volume-control/gvc-stream-status-icon.c index 8ca2849..aac39ba 100644 --- a/mate-volume-control/gvc-stream-status-icon.c +++ b/mate-volume-control/gvc-stream-status-icon.c @@ -508,7 +508,7 @@ void gvc_stream_status_icon_set_display_name (GvcStreamStatusIcon *icon, const gchar *name) { - g_return_if_fail (GVC_STREAM_STATUS_ICON (icon)); + g_return_if_fail (GVC_IS_STREAM_STATUS_ICON (icon)); g_free (icon->priv->display_name); @@ -522,7 +522,7 @@ void gvc_stream_status_icon_set_control (GvcStreamStatusIcon *icon, MateMixerStreamControl *control) { - g_return_if_fail (GVC_STREAM_STATUS_ICON (icon)); + g_return_if_fail (GVC_IS_STREAM_STATUS_ICON (icon)); if (icon->priv->control == control) return; |