[gnome-games] libgames-support: Add safety checks on GamesPauseAction



commit 79c8a2f6851540e3eb671abc6f30b700ac65ceb8
Author: Robert Ancell <robert ancell canonical com>
Date:   Sun Jul 15 14:52:45 2012 +1200

    libgames-support: Add safety checks on GamesPauseAction

 libgames-support/games-pause-action.c |    3 +++
 libgames-support/games-pause-action.h |    5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libgames-support/games-pause-action.c b/libgames-support/games-pause-action.c
index cbe1786..986285e 100644
--- a/libgames-support/games-pause-action.c
+++ b/libgames-support/games-pause-action.c
@@ -49,6 +49,8 @@ games_pause_action_new (const char *name)
 void
 games_pause_action_set_is_paused (GamesPauseAction *action, gboolean is_paused)
 {
+    g_return_if_fail (GAMES_IS_PAUSE_ACTION (action));
+
     if ((action->priv->is_paused && is_paused) || (!action->priv->is_paused && !is_paused))
         return;
     action->priv->is_paused = is_paused;
@@ -63,6 +65,7 @@ games_pause_action_set_is_paused (GamesPauseAction *action, gboolean is_paused)
 gboolean
 games_pause_action_get_is_paused (GamesPauseAction *action)
 {
+    g_return_val_if_fail (GAMES_IS_PAUSE_ACTION (action), FALSE);
     return action->priv->is_paused;
 }
 
diff --git a/libgames-support/games-pause-action.h b/libgames-support/games-pause-action.h
index c73b42c..e98ef81 100644
--- a/libgames-support/games-pause-action.h
+++ b/libgames-support/games-pause-action.h
@@ -26,8 +26,9 @@
 
 G_BEGIN_DECLS
 
-#define GAMES_PAUSE_ACTION_TYPE  (games_pause_action_get_type ())
-#define GAMES_PAUSE_ACTION(obj)  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_PAUSE_ACTION_TYPE, GamesPauseAction))
+#define GAMES_PAUSE_ACTION_TYPE    (games_pause_action_get_type ())
+#define GAMES_PAUSE_ACTION(obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_PAUSE_ACTION_TYPE, GamesPauseAction))
+#define GAMES_IS_PAUSE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_PAUSE_ACTION_TYPE))
 
 typedef struct GamesPauseActionPrivate GamesPauseActionPrivate;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]