[totem-pl-parser] Don't zero comments that start withing CDATA
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [totem-pl-parser] Don't zero comments that start withing CDATA
- Date: Fri, 4 Dec 2009 15:19:11 +0000 (UTC)
commit 5e76577f299436cac38260012db37fb1fe475484
Author: Bastien Nocera <hadess hadess net>
Date: Fri Dec 4 15:18:04 2009 +0000
Don't zero comments that start withing CDATA
Fixed parsing of http://www.davidco.com/podcast.php
https://bugzilla.gnome.org/show_bug.cgi?id=585407
plparse/totem-pl-parser.c | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/plparse/totem-pl-parser.c b/plparse/totem-pl-parser.c
index 872d63a..bc50b87 100644
--- a/plparse/totem-pl-parser.c
+++ b/plparse/totem-pl-parser.c
@@ -1660,17 +1660,21 @@ totem_pl_parser_cleanup_xml (char *contents)
needle = contents;
while ((needle = strstr (needle, "<!--")) != NULL) {
- while (strncmp (needle, "-->", 3) != 0) {
- *needle = ' ';
- needle++;
- if (*needle == '\0')
- break;
- }
- if (strncmp (needle, "-->", 3) == 0) {
- guint i;
- for (i = 0; i < 3; i++)
- *(needle + i) = ' ';
+ char *end;
+
+ /* Find end of comments */
+ end = strstr (needle, "-->");
+ /* Broken file? */
+ if (end == NULL)
+ return;
+ if (memmem (needle, end - needle,
+ "]]>", strlen ("]]>")) != NULL) {
+ /* Advance 3 and skip */
+ needle += 3;
+ continue;
}
+ /* Empty the comment */
+ memset (needle, ' ', end + 3 - needle);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]