[totem-pl-parser/gnome-2-26] Fix parsing of iTunes Podcast feeds



commit 8bbc3241c3c949d319648a411713022089dcea38
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Apr 29 00:58:39 2009 +0100

    Fix parsing of iTunes Podcast feeds
    
    2009-04-29  Bastien Nocera  <hadess hadess net>
    
    	* plparse/totem-pl-parser-podcast.c (check_header),
    	(decompress_gzip), (totem_pl_parser_is_itms_feed):
    	Fix parsing of:
    	itms://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=271121520&ign-mscache=1
    	and
    	http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=271121520
    
    	The same podcast, as launched from the web browser, and by
    	hand, respectively
    
    	Fix simple warning
---
 ChangeLog                         |   12 ++++++++++++
 plparse/totem-pl-parser-podcast.c |   25 ++++++++++++++-----------
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 25a39b1..a18c327 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-04-29  Bastien Nocera  <hadess hadess net>
+
+	* plparse/totem-pl-parser-podcast.c (check_header),
+	(decompress_gzip), (totem_pl_parser_is_itms_feed):
+	Fix parsing of:
+	itms://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=271121520&ign-mscache=1
+	and
+	http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=271121520
+
+	The same podcast, as launched from the web browser, and by
+	hand, respectively
+
 2009-04-24  Bastien Nocera  <hadess hadess net>
 
 	* plparse/totem-pl-parser.c (totem_pl_parser_parse_xml_relaxed):
diff --git a/plparse/totem-pl-parser-podcast.c b/plparse/totem-pl-parser-podcast.c
index e57e0c7..42a0d96 100644
--- a/plparse/totem-pl-parser-podcast.c
+++ b/plparse/totem-pl-parser-podcast.c
@@ -570,16 +570,16 @@ check_header (char *data, gsize len)
 	unsigned flags;
 
 	if (len < 2 + 1 + 1 + 6)
-		return -1;
+		return 0;
 
 	/* Check signature */
 	if (memcmp (data, signature, sizeof (signature)) != 0)
-		return -1;
+		return 0;
 
 	/* verify flags and compression type */
 	flags  = data[3];
 	if (data[2] != Z_DEFLATED || (flags & ~GZIP_HEADER_FLAGS) != 0)
-		return -1;
+		return 0;
 
 	/* Get the uncompressed size */
 	/* FIXME, but how?  The size read here is modulo 2^32.  */
@@ -595,8 +595,8 @@ decompress_gzip (char *data, gsize len)
 	z_stream  stream;
 
 	retlen = check_header (data, len);
-	if (retlen < 0)
-		return NULL;
+	if (retlen == 0)
+		return g_strdup (data);
 
 	stream.zalloc    = (alloc_func)0;
 	stream.zfree     = (free_func)0;
@@ -657,7 +657,7 @@ totem_pl_parser_parse_itms_doc (xml_node_t *item)
 }
 
 static GFile *
-totem_pl_parser_get_feed_uri (const char *data, gsize len)
+totem_pl_parser_get_feed_uri (char *data, gsize len)
 {
 	xml_node_t* doc;
 	const char *uri;
@@ -778,11 +778,14 @@ totem_pl_parser_is_itms_feed (GFile *file)
 
 	uri = g_file_get_uri (file);
 
-	if (g_file_has_uri_scheme (file, "itms") != FALSE
-	    && strstr (uri, "phobos.apple.com") != NULL
-	    && strstr (uri, "viewPodcast") != NULL) {
-	    	g_free (uri);
-		return TRUE;
+	if (g_file_has_uri_scheme (file, "itms") != FALSE) {
+		if (strstr (uri, "phobos.apple.com") != NULL ||
+		    strstr (uri, "itunes.apple.com") != NULL) {
+			if (strstr (uri, "viewPodcast") != NULL) {
+				g_free (uri);
+				return TRUE;
+			}
+		}
 	}
 
 	if (strstr (uri, "phobos.apple.com/") != NULL



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