[grilo-plugins/0.2.x: 23/30] dmap: Add assertions to ensure proper db and record types



commit 6ce922053daa87729638c955cf7f0c201bb0dcc6
Author: W. Michael Petullo <mike flyn org>
Date:   Sat Sep 5 08:28:36 2015 -0400

    dmap: Add assertions to ensure proper db and record types
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746722

 src/dmap/grl-daap-db.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/dmap/grl-daap-db.c b/src/dmap/grl-daap-db.c
index 7e3f05d..1e83e36 100644
--- a/src/dmap/grl-daap-db.c
+++ b/src/dmap/grl-daap-db.c
@@ -153,6 +153,9 @@ set_insert (GHashTable *category, const char *category_name, char *set_name, Grl
 static guint
 grl_daap_db_add (DMAPDb *_db, DMAPRecord *_record)
 {
+  g_assert (IS_GRL_DAAP_DB (_db));
+  g_assert (IS_DAAP_RECORD (_record));
+
   GrlDAAPDb *db = GRL_DAAP_DB (_db);
   DAAPRecord *record = DAAP_RECORD (_record);
 
@@ -254,6 +257,8 @@ grl_daap_db_browse (GrlDAAPDb *db,
                     GrlSourceResultCb func,
                     gpointer user_data)
 {
+  g_assert (IS_GRL_DAAP_DB (db));
+
   int i;
   guint remaining;
   GHashTable *hash_table;
@@ -310,6 +315,8 @@ grl_daap_db_search (GrlDAAPDb *db,
                     GrlSourceResultCb func,
                     gpointer user_data)
 {
+  g_assert (IS_GRL_DAAP_DB (db));
+
   gint i, j, k;
   guint remaining = 0;
   gpointer key1, val1, key2, val2;
@@ -354,6 +361,8 @@ dmap_db_interface_init (gpointer iface, gpointer data)
 {
   DMAPDbIface *daap_db = iface;
 
+  g_assert (G_TYPE_FROM_INTERFACE (daap_db) == DMAP_TYPE_DB);
+
   daap_db->add = grl_daap_db_add;
   daap_db->lookup_by_id = grl_daap_db_lookup_by_id;
   daap_db->foreach = grl_daap_db_foreach;


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