totem-pl-parser r119 - in trunk: . plparse



Author: hadess
Date: Thu May  8 16:16:28 2008
New Revision: 119
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=119&view=rev

Log:
2008-05-08  Bastien Nocera  <hadess hadess net>

	* plparse/totem-pl-parser-podcast.c (totem_pl_parser_add_rss):
	Remove debug

	* plparse/totem-pl-parser-smil.c (parse_smil_entry):
	* plparse/totem-pl-parser-xspf.c (parse_xspf_track):
	* plparse/totem-pl-parser-wm.c (parse_asx_entry),
	(parse_asx_entryref): Fix use of g_file_resolve_relative_path
	when there's no base_file

	* plparse/totem-pl-parser.c
	(my_g_file_info_get_mime_type_with_data),
	(totem_pl_parser_add_url_valist),
	(totem_pl_parser_ignore_from_mimetype):
	Only unref the info we get from the file if there's actually info
	(ie. don't warn on non-existant files)

	Don't unref file and base_file in _add_url_valist, as those
	aren't ref'ed for us

	Don't ignore files for which we can't get a mime-type

	Fixes warning running the test-parser test-suite



Modified:
   trunk/ChangeLog
   trunk/plparse/totem-pl-parser-podcast.c
   trunk/plparse/totem-pl-parser-smil.c
   trunk/plparse/totem-pl-parser-wm.c
   trunk/plparse/totem-pl-parser-xspf.c
   trunk/plparse/totem-pl-parser.c

Modified: trunk/plparse/totem-pl-parser-podcast.c
==============================================================================
--- trunk/plparse/totem-pl-parser-podcast.c	(original)
+++ trunk/plparse/totem-pl-parser-podcast.c	Thu May  8 16:16:28 2008
@@ -244,7 +244,6 @@
 
 	xml_parser_init (contents, size, XML_PARSER_CASE_INSENSITIVE);
 	if (xml_parser_build_tree_with_options (&doc, XML_PARSER_RELAXED | XML_PARSER_MULTI_TEXT) < 0) {
-		g_message ("can't parse the file");
 		g_free (contents);
 		return TOTEM_PL_PARSER_RESULT_ERROR;
 	}

Modified: trunk/plparse/totem-pl-parser-smil.c
==============================================================================
--- trunk/plparse/totem-pl-parser-smil.c	(original)
+++ trunk/plparse/totem-pl-parser-smil.c	Thu May  8 16:16:28 2008
@@ -73,7 +73,11 @@
 			if (url != NULL) {
 				GFile *resolved;
 
-				resolved = g_file_resolve_relative_path (base_file, url);
+				if (base_file != NULL)
+					resolved = g_file_resolve_relative_path (base_file, url);
+				else
+					resolved = g_file_new_for_uri (url);
+
 				totem_pl_parser_add_url (parser,
 							 TOTEM_PL_PARSER_FIELD_FILE, resolved,
 							 TOTEM_PL_PARSER_FIELD_TITLE, title ? title : parent_title,

Modified: trunk/plparse/totem-pl-parser-wm.c
==============================================================================
--- trunk/plparse/totem-pl-parser-wm.c	(original)
+++ trunk/plparse/totem-pl-parser-wm.c	Thu May  8 16:16:28 2008
@@ -260,7 +260,10 @@
 		return TOTEM_PL_PARSER_RESULT_ERROR;
 
 
-	resolved = g_file_resolve_relative_path (base_file, url);
+	if (base_file != NULL)
+		resolved = g_file_resolve_relative_path (base_file, url);
+	else
+		resolved = g_file_new_for_uri (url);
 
 	/* .asx files can contain references to other .asx files */
 	retval = totem_pl_parser_parse_internal (parser, resolved, NULL);
@@ -295,7 +298,10 @@
 	if (url == NULL)
 		return TOTEM_PL_PARSER_RESULT_ERROR;
 
-	resolved = g_file_resolve_relative_path (base_file, url);
+	if (base_file != NULL)
+		resolved = g_file_resolve_relative_path (base_file, url);
+	else
+		resolved = g_file_new_for_uri (url);
 
 	/* .asx files can contain references to other .asx files */
 	retval = totem_pl_parser_parse_internal (parser, resolved, NULL);

Modified: trunk/plparse/totem-pl-parser-xspf.c
==============================================================================
--- trunk/plparse/totem-pl-parser-xspf.c	(original)
+++ trunk/plparse/totem-pl-parser-xspf.c	Thu May  8 16:16:28 2008
@@ -214,7 +214,10 @@
 		goto bail;
 	}
 
-	resolved = g_file_resolve_relative_path (base_file, (const char *) url);
+	if (base_file != NULL)
+		resolved = g_file_resolve_relative_path (base_file, (const char *) url);
+	else
+		resolved = g_file_new_for_uri ((const char *) url);
 	totem_pl_parser_add_url (parser,
 				 TOTEM_PL_PARSER_FIELD_FILE, resolved,
 				 TOTEM_PL_PARSER_FIELD_TITLE, title,

Modified: trunk/plparse/totem-pl-parser.c
==============================================================================
--- trunk/plparse/totem-pl-parser.c	(original)
+++ trunk/plparse/totem-pl-parser.c	Thu May  8 16:16:28 2008
@@ -647,7 +647,8 @@
 			g_object_unref (info);
 			return g_strdup (BLOCK_DEVICE_TYPE);
 		}
-		g_object_unref (info);
+		if (info != NULL)
+			g_object_unref (info);
 	}
 
 	/* Open the file. */
@@ -1115,7 +1116,6 @@
 
 			file = g_value_get_object (&value);
 			url = g_file_get_uri (file);
-			g_object_unref (file);
 
 			g_value_unset (&value);
 			name = va_arg (var_args, char*);
@@ -1126,7 +1126,6 @@
 
 			file = g_value_get_object (&value);
 			base_url = g_file_get_uri (file);
-			g_object_unref (file);
 
 			g_hash_table_insert (metadata,
 					     g_strdup (TOTEM_PL_PARSER_FIELD_BASE),
@@ -1359,6 +1358,9 @@
 {
 	guint i;
 
+	if (mimetype == NULL)
+		return FALSE;
+
 	for (i = 0; i < G_N_ELEMENTS (ignore_types); i++) {
 		if (g_content_type_is_a (mimetype, ignore_types[i].mimetype) != FALSE)
 			return TRUE;



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