[rygel] media-export: Use ref for argument modification
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] media-export: Use ref for argument modification
- Date: Sun, 28 Mar 2010 19:07:57 +0000 (UTC)
commit 31b2d09371895e421815ead6a6ba0681d1698256
Author: Jens Georg <mail jensge org>
Date: Sun Mar 28 13:57:15 2010 +0200
media-export: Use ref for argument modification
.../rygel-media-export-query-container.vala | 6 ++--
.../rygel-media-export-root-container.vala | 26 ++++++++++---------
2 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-query-container.vala b/src/plugins/media-export/rygel-media-export-query-container.vala
index 3130c87..2a7ceae 100644
--- a/src/plugins/media-export/rygel-media-export-query-container.vala
+++ b/src/plugins/media-export/rygel-media-export-query-container.vala
@@ -207,7 +207,7 @@ internal class Rygel.MediaExportQueryContainer : Rygel.MediaDBContainer {
// pattern contains URL escaped text. This means it might
// contain '%' chars which will makes sprintf crash
new_id = this.pattern.replace ("%s", new_id);
- new_id = register_id (new_id);
+ register_id (ref new_id);
var container = new MediaExportQueryContainer (this.media_db,
new_id,
meta_data);
@@ -219,7 +219,7 @@ internal class Rygel.MediaExportQueryContainer : Rygel.MediaDBContainer {
return children;
}
- public static string register_id (string id) {
+ public static void register_id (ref string id) {
var md5 = Checksum.compute_for_string (ChecksumType.MD5, id);
if (virtual_container_map == null) {
virtual_container_map = new HashMap<string,string> ();
@@ -229,7 +229,7 @@ internal class Rygel.MediaExportQueryContainer : Rygel.MediaDBContainer {
debug ("registering %s for %s", md5, id);
}
- return PREFIX + md5;
+ id = PREFIX + md5;
}
public static string? get_virtual_container_definition (string hash) {
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala b/src/plugins/media-export/rygel-media-export-root-container.vala
index f1a264a..e808b3a 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -106,18 +106,20 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
exp.op == SearchCriteriaOp.EQ) {
switch (exp.operand2) {
case "object.container.album.musicAlbum":
- return new MediaExportQueryContainer (
- this.media_db,
- MediaExportQueryContainer.register_id
- ("virtual-container:upnp:album,?"),
- "Albums");
+ string id = "virtual-container:upnp:album,?";
+ MediaExportQueryContainer.register_id (ref id);
+
+ return new MediaExportQueryContainer (this.media_db,
+ id,
+ "Albums");
case "object.container.person.musicArtist":
- return new MediaExportQueryContainer (
- this.media_db,
- MediaExportQueryContainer.register_id
- ("virtual-container:dc:creator,?,upnp:album,?"),
- "Artists");
+ string id = "virtual-container:dc:creator,?,upnp:album,?";
+ MediaExportQueryContainer.register_id (ref id);
+
+ return new MediaExportQueryContainer (this.media_db,
+ id,
+ "Artists");
default:
return null;
}
@@ -199,7 +201,7 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
Uri.escape_string (exp_.operand2, "", true) +
last_argument;
debug ("Translated search request to %s", new_id);
- new_id = MediaExportQueryContainer.register_id (new_id);
+ MediaExportQueryContainer.register_id (ref new_id);
query_container = new MediaExportQueryContainer (
this.media_db,
new_id,
@@ -303,7 +305,7 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
continue;
}
- id = MediaExportQueryContainer.register_id (id);
+ MediaExportQueryContainer.register_id (ref id);
var virtual_container = new MediaExportQueryContainer (
this.media_db,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]