Commit 763b76e1 authored by W. Michael Petullo's avatar W. Michael Petullo
Browse files

Various code clean ups



Increase the reference count of the databases passed to
d[ap]ap_share_new(). dmap_db_lookup_by_id() now takes a const DMAPDb *.
Add a _dmap_share_build_filter() prototype.
Signed-off-by: W. Michael Petullo's avatarW. Michael Petullo <mike@flyn.org>
parent 0184340c
......@@ -3,6 +3,13 @@
* Fix crash upon finalizing DMAPShare that was caused by misuse of
avahi_entry_group_free().
* Increase the reference count of the databases passed to
d[ap]ap_share_new().
* dmap_db_lookup_by_id now takes a const DMAPDb *.
* Add a _dmap_share_build_filter() prototype.
25 May 2010 W. Michael Petullo <mike@flyn.org>
* Refactor build_filter into dmap_share_build_factor.
......
......@@ -191,6 +191,9 @@ daap_share_new (const char *name,
{
DAAPShare *share;
g_object_ref (db);
g_object_ref (container_db);
share = DAAP_SHARE (g_object_new (TYPE_DAAP_SHARE,
"name", name,
"password", password,
......@@ -746,7 +749,7 @@ databases_browse_xxx (DMAPShare *share,
category_items = g_hash_table_new (g_str_hash, g_str_equal);
filter = g_hash_table_lookup (query, "filter");
filter_def = dmap_share_build_filter (filter);
filter_def = _dmap_share_build_filter (filter);
g_object_get (share, "db", &db, NULL);
filtered = dmap_db_apply_filter (db, filter_def);
......
......@@ -62,7 +62,7 @@ dmap_db_get_type (void)
}
DMAPRecord *
dmap_db_lookup_by_id (DMAPDb *db, guint id)
dmap_db_lookup_by_id (const DMAPDb *db, guint id)
{
return DMAP_DB_GET_INTERFACE (db)->lookup_by_id (db, id);
}
......
......@@ -69,7 +69,7 @@ struct _DMAPDbInterface {
GTypeInterface parent;
guint (*add) (DMAPDb *db, DMAPRecord *record);
DMAPRecord *(*lookup_by_id) (DMAPDb *db, guint id);
DMAPRecord *(*lookup_by_id) (const DMAPDb *db, guint id);
void (*foreach) (const DMAPDb *db,
GHFunc func,
gpointer data);
......@@ -122,7 +122,7 @@ guint dmap_db_add (DMAPDb *db, DMAPRecord *record);
* In this case, the reference count should not be incremented before
* returning a record pointer.
*/
DMAPRecord *dmap_db_lookup_by_id (DMAPDb *db, guint id);
DMAPRecord *dmap_db_lookup_by_id (const DMAPDb *db, guint id);
/**
* dmap_db_foreach:
......
......@@ -425,6 +425,8 @@ dmap_mdns_publisher_finalize (GObject *object)
publisher->priv->entry_group = NULL;
}
avahi_client_free (publisher->priv->client);
g_free (publisher->priv->name);
g_free (publisher->priv->type_of_service);
......
......@@ -83,7 +83,8 @@ GType dmap_record_factory_get_type (void);
*
* Returns: a new DMAPRecord as read from path.
*/
DMAPRecord *dmap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data);
DMAPRecord *dmap_record_factory_create (DMAPRecordFactory *factory,
gpointer user_data);
#endif /* __DMAP_RECORD_FACTORY_H */
......
......@@ -272,7 +272,7 @@ _dmap_share_server_start (DMAPShare *share)
static gboolean
_dmap_share_server_stop (DMAPShare *share)
{
g_warning ("Stopping music sharing server on port %d", share->priv->port);
g_debug ("Stopping music sharing server on port %d", share->priv->port);
if (share->priv->server) {
soup_server_quit (share->priv->server);
......@@ -1082,7 +1082,7 @@ _dmap_share_add_playlist_to_mlcl (gpointer id, DMAPContainerRecord *record, gpoi
}
GSList *
dmap_share_build_filter (gchar *filterstr)
_dmap_share_build_filter (gchar *filterstr)
{
/* Produces a list of lists, each being a filter definition that may
* be one or more filter criteria.
......@@ -1255,7 +1255,7 @@ _dmap_share_databases (DMAPShare *share,
record_query = g_hash_table_lookup (query, "query");
if (record_query) {
GSList *filter_def;
filter_def = dmap_share_build_filter (record_query);
filter_def = _dmap_share_build_filter (record_query);
records = dmap_db_apply_filter (DMAP_DB (share->priv->db), filter_def);
g_debug ("Found %d records", g_hash_table_size (records));
num_songs = g_hash_table_size (records);
......
......@@ -219,6 +219,8 @@ void _dmap_share_add_playlist_to_mlcl (gpointer id,
DMAPContainerRecord *record,
gpointer mlcl);
GSList * _dmap_share_build_filter (gchar *filterstr);
/* Virtual methods (libsoup callbacks with default implementation): */
void _dmap_share_content_codes (DMAPShare *share,
SoupServer *server,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment