Use g_strstr_len() instead of GNU extension memmem.

from upstream git.
This commit is contained in:
ajacoutot 2009-12-14 11:49:51 +00:00
parent c7e398e0c6
commit c84c57a7b0
2 changed files with 14 additions and 37 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.14 2009/12/11 12:40:51 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.15 2009/12/14 11:49:51 ajacoutot Exp $
SHARED_ONLY= Yes
@ -6,6 +6,7 @@ COMMENT= GObject-based parsing library
GNOME_PROJECT= totem-pl-parser
GNOME_VERSION= 2.28.2
PKGNAME= ${DISTNAME}p0
SHARED_LIBS += totem-plparser 2.0 # .16.4
SHARED_LIBS += totem-plparser-mini 2.0 # .16.4

View File

@ -1,41 +1,17 @@
$OpenBSD: patch-plparse_totem-pl-parser_c,v 1.1 2009/12/13 13:46:53 ajacoutot Exp $
$OpenBSD: patch-plparse_totem-pl-parser_c,v 1.2 2009/12/14 11:49:51 ajacoutot Exp $
XXX
For now as we don't have memmem, revert 5e76577f299436cac38260012db37fb1fe475484:
Fixed parsing of http://www.davidco.com/podcast.php
https://bugzilla.gnome.org/show_bug.cgi?id=585407
Use g_strstr_len() instead of GNU extension memmem.
git fc603d2f98802ae20f4902f2b1dd589b891595b6
--- plparse/totem-pl-parser.c.orig Fri Dec 4 16:10:52 2009
+++ plparse/totem-pl-parser.c Sun Dec 13 14:42:05 2009
@@ -1660,21 +1660,17 @@ totem_pl_parser_cleanup_xml (char *contents)
needle = contents;
while ((needle = strstr (needle, "<!--")) != NULL) {
- char *end;
-
- /* Find end of comments */
- end = strstr (needle, "-->");
- /* Broken file? */
- if (end == NULL)
- return;
+++ plparse/totem-pl-parser.c Mon Dec 14 12:39:00 2009
@@ -1667,8 +1667,7 @@ totem_pl_parser_cleanup_xml (char *contents)
/* Broken file? */
if (end == NULL)
return;
- if (memmem (needle, end - needle,
- "]]>", strlen ("]]>")) != NULL) {
- /* Advance 3 and skip */
- needle += 3;
- continue;
+ while (strncmp (needle, "-->", 3) != 0) {
+ *needle = ' ';
+ needle++;
+ if (*needle == '\0')
+ break;
}
- /* Empty the comment */
- memset (needle, ' ', end + 3 - needle);
+ if (strncmp (needle, "-->", 3) == 0) {
+ guint i;
+ for (i = 0; i < 3; i++)
+ *(needle + i) = ' ';
+ }
}
}
+ if (g_strstr_len (needle, end - needle, "]]>") != NULL) {
/* Advance 3 and skip */
needle += 3;
continue;