changeset 115:2e77e3fdd3c1 trunk

[svn] - make sure the tuple data is copied, not referenced (oops)
author nenolod
date Tue, 24 Oct 2006 19:50:04 -0700
parents 9bb02321f986
children a578bf9b2851
files ChangeLog src/wavpack/libwavpack.cxx
diffstat 2 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 24 19:43:30 2006 -0700
+++ b/ChangeLog	Tue Oct 24 19:50:04 2006 -0700
@@ -1,3 +1,11 @@
+2006-10-25 02:43:30 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [228]
+  - tuple support
+  
+  trunk/src/wavpack/libwavpack.cxx |   66 +++++++++++++++++++++++++++------------
+  1 file changed, 46 insertions(+), 20 deletions(-)
+
+
 2006-10-25 02:34:36 +0000  William Pitcock <nenolod@nenolod.net>
   revision [226]
   - fix a pango warning
--- a/src/wavpack/libwavpack.cxx	Tue Oct 24 19:43:30 2006 -0700
+++ b/src/wavpack/libwavpack.cxx	Tue Oct 24 19:50:04 2006 -0700
@@ -307,18 +307,18 @@
 
     load_tag(&tag, ctx);
 
-    ti->track_name = tag.title;
-    ti->performer = tag.artist;
-    ti->album_name = tag.album;
-    ti->date = tag.year;
+    ti->track_name = g_strdup(tag.title);
+    ti->performer = g_strdup(tag.artist);
+    ti->album_name = g_strdup(tag.album);
+    ti->date = g_strdup(tag.year);
     ti->track_number = atoi(tag.track);
     if (ti->track_number < 0)
         ti->track_number = 0;
     ti->year = atoi(tag.year);
     if (ti->year < 0)
         ti->year = 0;
-    ti->genre = tag.genre;
-    ti->comment = tag.comment;
+    ti->genre = g_strdup(tag.genre);
+    ti->comment = g_strdup(tag.comment);
     ti->length = (int)(WavpackGetNumSamples(ctx) / sample_rate) * 1000;
 
     return ti;
@@ -328,15 +328,13 @@
 generate_title(const char *fn, WavpackContext *ctx)
 {
     static char *displaytitle = NULL;
-    ape_tag tag;
     TitleInput *ti;
 
     ti = tuple_from_WavpackContext(fn, ctx);
 
     displaytitle = xmms_get_titlestring(xmms_get_gentitle_format(), ti);
-    if (!displaytitle || *displaytitle == '\0'
-        || (strlen(tag.title) == 0 && strlen(tag.artist) == 0))
-        displaytitle = ti->file_name;
+    if (!displaytitle || *displaytitle == '\0')
+        displaytitle = g_strdup(fn);
 
     bmp_title_input_free(ti);