summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorW. Michael Petullo <mike@flyn.org>2015-09-05 08:28:36 -0400
committerJuan A. Suarez Romero <jasuarez@igalia.com>2015-09-06 16:13:54 +0200
commit6ce922053daa87729638c955cf7f0c201bb0dcc6 (patch)
tree3cf9b0841183edbe6715cfb888cac90dadb5ca9a
parent55a0edbff2bcb55bd2436b38ccdb86589ac4edcb (diff)
downloadgrilo-plugins-6ce922053daa87729638c955cf7f0c201bb0dcc6.tar.gz
dmap: Add assertions to ensure proper db and record types
https://bugzilla.gnome.org/show_bug.cgi?id=746722
-rw-r--r--src/dmap/grl-daap-db.c9
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;