hythmbox-2.98/plugins/daap/rb-rhythmdb-query-model-dmap-db-adapter.c

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found rb-rhythmdb-query-model-dmap-db-adapter.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
  1 /*
  2  *  Database adapter class for DMAP sharing
  3  *
  4  *  Copyright (C) 2008 W. Michael Petullo <mike@flyn.org>
  5  *
  6  *  This program is free software; you can redistribute it and/or modify
  7  *  it under the terms of the GNU General Public License as published by
  8  *  the Free Software Foundation; either version 2 of the License, or
  9  *  (at your option) any later version.
 10  *
 11  *  The Rhythmbox authors hereby grant permission for non-GPL compatible
 12  *  GStreamer plugins to be used and distributed together with GStreamer
 13  *  and Rhythmbox. This permission is above and beyond the permissions granted
 14  *  by the GPL license by which Rhythmbox is covered. If you modify this code
 15  *  you may extend this exception to your version of the code, but you are not
 16  *  obligated to do so. If you do not wish to do so, delete this exception
 17  *  statement from your version.
 18  *
 19  *  This program is distributed in the hope that it will be useful,
 20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 22  *  GNU General Public License for more details.
 23  *
 24  *  You should have received a copy of the GNU General Public License
 25  *  along with this program; if not, write to the Free Software
 26  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 27  *
 28  */
 29 
 30 #include "rhythmdb-query-model.h"
 31 #include "rb-rhythmdb-query-model-dmap-db-adapter.h"
 32 #include "rb-daap-record.h"
 33 
 34 #include <gtk/gtk.h>
 35 #include <glib/gi18n.h>
 36 #include <libdmapsharing/dmap.h>
 37 
 38 struct RBRhythmDBQueryModelDMAPDbAdapterPrivate {
 39 	RhythmDBQueryModel *model;
 40 };
 41 
 42 typedef struct ForeachAdapterData {
 43 	gpointer data;
 44 	GHFunc func;
 45 } ForeachAdapterData;
 46 
 47 static DMAPRecord *
 48 rb_rhythmdb_query_model_dmap_db_adapter_lookup_by_id (const DMAPDb *db,
 49 						      guint id)
 50 {
 51 	g_error ("Not implemented");
 52 	return NULL;
 53 }
 54 
 55 static gboolean
 56 foreach_adapter (GtkTreeModel *model,
 57 		 GtkTreePath *path,
 58 		 GtkTreeIter *iter,
 59 		 gpointer data)
 60 {
 61 	gulong id;
 62 	DMAPRecord *record;
 63 	RhythmDBEntry *entry;
 64 	ForeachAdapterData *foreach_adapter_data;
 65 
 66 	gtk_tree_model_get (model, iter, 0, &entry, -1);
 67 	
 68 	id = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_ENTRY_ID);
 69 	foreach_adapter_data = data;
 70 	record = DMAP_RECORD (rb_daap_record_new (entry));
 71 
 72 	foreach_adapter_data->func (GUINT_TO_POINTER (id),
 73 				    record,
 74 				    foreach_adapter_data->data);
 75 
 76 	g_object_unref (record);
 77 	rhythmdb_entry_unref (entry);
 78 
 79 	return FALSE;
 80 }
 81 
 82 static void
 83 rb_rhythmdb_query_model_dmap_db_adapter_foreach	(const DMAPDb *db,
 84 					 GHFunc func,
 85 				         gpointer data)
 86 {
 87 	ForeachAdapterData *foreach_adapter_data;
 88 
 89 	g_assert (RB_RHYTHMDB_QUERY_MODEL_DMAP_DB_ADAPTER (db)->priv->model != NULL);
 90 
 91 	foreach_adapter_data = g_new (ForeachAdapterData, 1);
 92 	foreach_adapter_data->data = data;
 93 	foreach_adapter_data->func = func;
 94 
 95 	gtk_tree_model_foreach (GTK_TREE_MODEL (RB_RHYTHMDB_QUERY_MODEL_DMAP_DB_ADAPTER (db)->priv->model),
 96 			       (GtkTreeModelForeachFunc) foreach_adapter,
 97 				foreach_adapter_data);
 98 
 99 	g_free (foreach_adapter_data);
100 }
101 
102 static gint64
103 rb_rhythmdb_query_model_dmap_db_adapter_count (const DMAPDb *db)
104 {
105 	g_assert (RB_RHYTHMDB_QUERY_MODEL_DMAP_DB_ADAPTER (db)->priv->model != NULL); 
106 	return gtk_tree_model_iter_n_children (
107 		GTK_TREE_MODEL (RB_RHYTHMDB_QUERY_MODEL_DMAP_DB_ADAPTER (db)->priv->model), NULL);
108 }
109 
110 static guint
111 rb_rhythmdb_query_model_dmap_db_adapter_add (DMAPDb *db, DMAPRecord *record)
112 {
113 	g_error ("Not implemented");
114 	return 0;
115 }
116 
117 static void
118 rb_rhythmdb_query_model_dmap_db_adapter_init (RBRhythmDBQueryModelDMAPDbAdapter *db)
119 {
120 	db->priv = RB_RHYTHMDB_QUERY_MODEL_DMAP_DB_ADAPTER_GET_PRIVATE (db);
121 }
122 
123 static void
124 rb_rhythmdb_query_model_dmap_db_adapter_class_init (RBRhythmDBQueryModelDMAPDbAdapterClass *klass)
125 {
126 	g_type_class_add_private (klass, sizeof (RBRhythmDBQueryModelDMAPDbAdapterPrivate));
127 }
128 
129 static void
130 rb_rhythmdb_query_model_dmap_db_adapter_class_finalize (RBRhythmDBQueryModelDMAPDbAdapterClass *klass)
131 {
132 }
133 
134 static void
135 rb_rhythmdb_query_model_dmap_db_adapter_interface_init (gpointer iface, gpointer data)
136 {
137 	DMAPDbIface *dmap_db = iface;
138 
139 	g_assert (G_TYPE_FROM_INTERFACE (dmap_db) == DMAP_TYPE_DB);
140 
141 	dmap_db->add = rb_rhythmdb_query_model_dmap_db_adapter_add;
142 	dmap_db->lookup_by_id = rb_rhythmdb_query_model_dmap_db_adapter_lookup_by_id;
143 	dmap_db->foreach = rb_rhythmdb_query_model_dmap_db_adapter_foreach;
144 	dmap_db->count = rb_rhythmdb_query_model_dmap_db_adapter_count;
145 }
146 
147 G_DEFINE_DYNAMIC_TYPE_EXTENDED (RBRhythmDBQueryModelDMAPDbAdapter,
148 				rb_rhythmdb_query_model_dmap_db_adapter,
149 				G_TYPE_OBJECT,
150 				0,
151 				G_IMPLEMENT_INTERFACE_DYNAMIC (DMAP_TYPE_DB,
152 							       rb_rhythmdb_query_model_dmap_db_adapter_interface_init))
153 
154 RBRhythmDBQueryModelDMAPDbAdapter *
155 rb_rhythmdb_query_model_dmap_db_adapter_new (RhythmDBQueryModel *model)
156 {
157 	RBRhythmDBQueryModelDMAPDbAdapter *db;
158 
159 	db = RB_RHYTHMDB_QUERY_MODEL_DMAP_DB_ADAPTER (g_object_new (RB_TYPE_RHYTHMDB_QUERY_MODEL_DMAP_DB_ADAPTER,
160 					       NULL));
161 
162 	db->priv->model = model;
163 
164 	return db;
165 }
166 
167 void
168 _rb_rhythmdb_query_model_dmap_db_adapter_register_type (GTypeModule *module)
169 {
170 	rb_rhythmdb_query_model_dmap_db_adapter_register_type (module);
171 }