diff src/scrobbler/scrobbler.c @ 2315:8f3476f7a696

prevent segfault
author Tomasz Mon <desowin@gmail.com>
date Mon, 14 Jan 2008 19:20:57 +0100
parents 6eef090b5114
children 447dce6f59f3
line wrap: on
line diff
--- a/src/scrobbler/scrobbler.c	Mon Jan 14 18:54:56 2008 +0100
+++ b/src/scrobbler/scrobbler.c	Mon Jan 14 19:20:57 2008 +0100
@@ -56,16 +56,12 @@
 #define I_TITLE(i) i->title
 #define I_TIME(i) i->utctime
 #define I_LEN(i) i->len
-#define I_MB(i) i->mb
 #define I_ALBUM(i) i->album
 
 typedef struct {
-	char *artist,
-		*title,
-		*mb,
-		*album;
+	char *artist, *title, *album;
 	int utctime, track, len;
-int timeplayed;
+	int timeplayed;
 	int numtries;
 	void *next;
 } item_t;
@@ -126,7 +122,6 @@
 		return;
 	curl_free(item->artist);
 	curl_free(item->title);
-	curl_free(item->mb);
 	curl_free(item->album);
 	free(item);
 }
@@ -150,15 +145,6 @@
             item->utctime = t;
         }
 
-#ifdef NOTYET
-	if(tuple->mb == NULL)
-#endif
-		item->mb = fmt_escape("");
-#ifdef NOTYET
-	else
-		item->mb = fmt_escape((char*)tuple->mb);
-#endif
-
 	album = aud_tuple_get_string(tuple, FIELD_ALBUM, NULL);
 	if (album)
 		item->album = fmt_escape((char*) album);
@@ -653,7 +639,7 @@
                 tmp = g_strdup_printf("%d",I_TIME(item));
                 g_string_append(submission,sc_itemtag('i',i,tmp));
                 g_free(tmp);
-                g_string_append(submission,sc_itemtag('m',i,I_MB(item)));
+                g_string_append(submission,sc_itemtag('m',i,""));
                 g_string_append(submission,sc_itemtag('b',i,I_ALBUM(item)));
                 g_string_append(submission,sc_itemtag('o',i,"P"));
                 tmp = g_strdup_printf("%d",item->track);
@@ -661,12 +647,11 @@
                 g_free(tmp);
                 g_string_append(submission,sc_itemtag('r',i,""));
 
-		pdebug(fmt_vastr("a[%d]=%s t[%d]=%s l[%d]=%d i[%d]=%d m[%d]=%s b[%d]=%s",
+		pdebug(fmt_vastr("a[%d]=%s t[%d]=%s l[%d]=%d i[%d]=%d b[%d]=%s",
 				i, I_ARTIST(item),
 				i, I_TITLE(item),
 				i, I_LEN(item),
 				i, I_TIME(item),
-				i, I_MB(item),
 				i, I_ALBUM(item)), DEBUG);
 #ifdef ALLOW_MULTIPLE
 		i++;
@@ -903,15 +888,15 @@
                 item = q_put(tuple, t, len);
 
                 aud_tuple_free(tuple);
+
+                pdebug(fmt_vastr("a[%d]=%s t[%d]=%s l[%d]=%d i[%d]=%d b[%d]=%s",
+                                 i, I_ARTIST(item),
+                                 i, I_TITLE(item),
+                                 i, I_LEN(item),
+                                 i, I_TIME(item),
+                                 i, I_ALBUM(item)), DEBUG);
             }
 
-            pdebug(fmt_vastr("a[%d]=%s t[%d]=%s l[%d]=%d i[%d]=%d m[%d]=%s b[%d]=%s",
-                             i, I_ARTIST(item),
-                             i, I_TITLE(item),
-                             i, I_LEN(item),
-                             i, I_TIME(item),
-                             i, I_MB(item),
-                             i, I_ALBUM(item)), DEBUG);
             free(artist);
             free(title);
             free(album);