totem-pl-parser r234 - in branches/gnome-2-24: . plparse



Author: hadess
Date: Wed Oct  1 09:58:18 2008
New Revision: 234
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=234&view=rev

Log:
2008-10-01  Bastien Nocera  <hadess hadess net>

	* plparse/totem-pl-parser-lines.c (totem_pl_parser_write_m3u):
	* plparse/totem-pl-parser-pla.c (totem_pl_parser_write_pla):
	* plparse/totem-pl-parser-pls.c (totem_pl_parser_write_pls):
	* plparse/totem-pl-parser-xspf.c (totem_pl_parser_write_xspf):
	Always write the #EXTM3U line at the start of M3U playlists,
	Spotted by D. Grady <fehknt gmail com> (Closes: #551610)
	Don't unref streams that totem_pl_parser_write_* will unref
	on error, and make sure the streams are unref'ed and not just
	closed



Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/plparse/totem-pl-parser-lines.c
   branches/gnome-2-24/plparse/totem-pl-parser-pla.c
   branches/gnome-2-24/plparse/totem-pl-parser-pls.c
   branches/gnome-2-24/plparse/totem-pl-parser-xspf.c

Modified: branches/gnome-2-24/plparse/totem-pl-parser-lines.c
==============================================================================
--- branches/gnome-2-24/plparse/totem-pl-parser-lines.c	(original)
+++ branches/gnome-2-24/plparse/totem-pl-parser-lines.c	Wed Oct  1 09:58:18 2008
@@ -97,6 +97,12 @@
 	if (num_entries_total == 0)
 		return TRUE;
 
+	buf = g_strdup_printf ("#EXTM3U%s", cr);
+	success = totem_pl_parser_write_string (G_OUTPUT_STREAM (stream), buf, error);
+	g_free (buf);
+	if (success == FALSE)
+		return FALSE;
+
 	for (i = 1; i <= num_entries_total; i++) {
 		GtkTreeIter iter;
 		char *url, *title, *path2;
@@ -124,7 +130,6 @@
 			if (success == FALSE) {
 				g_free (title);
 				g_free (url);
-				g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, NULL);
 				return FALSE;
 			}
 		}
@@ -151,13 +156,11 @@
 		success = totem_pl_parser_write_string (G_OUTPUT_STREAM (stream), buf, error);
 		g_free (buf);
 
-		if (success == FALSE) {
-			g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, NULL);
+		if (success == FALSE)
 			return FALSE;
-		}
 	}
 
-	g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, NULL);
+	g_object_unref (stream);
 
 	return TRUE;
 }

Modified: branches/gnome-2-24/plparse/totem-pl-parser-pla.c
==============================================================================
--- branches/gnome-2-24/plparse/totem-pl-parser-pla.c	(original)
+++ branches/gnome-2-24/plparse/totem-pl-parser-pla.c	Wed Oct  1 09:58:18 2008
@@ -137,7 +137,7 @@
 	}
 
 	g_free (buffer);
-	g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, NULL);
+	g_object_unref (stream);
 
 	return ret;
 }

Modified: branches/gnome-2-24/plparse/totem-pl-parser-pls.c
==============================================================================
--- branches/gnome-2-24/plparse/totem-pl-parser-pls.c	(original)
+++ branches/gnome-2-24/plparse/totem-pl-parser-pls.c	Wed Oct  1 09:58:18 2008
@@ -118,7 +118,7 @@
 			return FALSE;
 	}
 
-	g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, NULL);
+	g_object_unref (stream);
 	return TRUE;
 }
 

Modified: branches/gnome-2-24/plparse/totem-pl-parser-xspf.c
==============================================================================
--- branches/gnome-2-24/plparse/totem-pl-parser-xspf.c	(original)
+++ branches/gnome-2-24/plparse/totem-pl-parser-xspf.c	Wed Oct  1 09:58:18 2008
@@ -151,7 +151,7 @@
 	success = totem_pl_parser_write_string (G_OUTPUT_STREAM (stream), buf, error);
 	g_free (buf);
 
-	g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, NULL);
+	g_object_unref (stream);
 
 	return success;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]