[Swfdec-commits] 2 commits - swfdec/swfdec_load_object.c swfdec/swfdec_url.c swfdec/swfdec_url.h

Benjamin Otte company at kemper.freedesktop.org
Wed Apr 9 13:04:49 PDT 2008


 swfdec/swfdec_load_object.c |    5 +++++
 swfdec/swfdec_url.c         |   37 ++++++++++++++++++++++++++++++-------
 swfdec/swfdec_url.h         |    2 ++
 3 files changed, 37 insertions(+), 7 deletions(-)

New commits:
commit d033a6bb5698cd36628f64971ec27b7f9ec29504
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Apr 9 22:02:27 2008 +0200

    fix memleak

diff --git a/swfdec/swfdec_load_object.c b/swfdec/swfdec_load_object.c
index 1481451..59ff143 100644
--- a/swfdec/swfdec_load_object.c
+++ b/swfdec/swfdec_load_object.c
@@ -200,8 +200,9 @@ swfdec_load_object_request (gpointer objectp, gpointer playerp)
     case SWFDEC_SANDBOX_REMOTE:
       if (swfdec_url_host_equal(url, swfdec_player_get_url (player))) {
 	swfdec_load_object_load (player, TRUE, load);
-	return;
+	break;
       }
+      /* fall through */
     case SWFDEC_SANDBOX_LOCAL_NETWORK:
     case SWFDEC_SANDBOX_LOCAL_TRUSTED:
       if (swfdec_url_is_local (url)) {
commit 6193ef9248aa8b2e06d44543e4410a73baf4df49
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Tue Apr 8 17:38:23 2008 -0400

    Allow loading streams from the same domain as the flash file.
    
    Some flash files don't use relative URLs to load files on the same
    server. This should be allowed without looking for the crossdomain.xml
    file.

diff --git a/swfdec/swfdec_load_object.c b/swfdec/swfdec_load_object.c
index 8be8acc..1481451 100644
--- a/swfdec/swfdec_load_object.c
+++ b/swfdec/swfdec_load_object.c
@@ -198,6 +198,10 @@ swfdec_load_object_request (gpointer objectp, gpointer playerp)
   }
   switch (load->sandbox->type) {
     case SWFDEC_SANDBOX_REMOTE:
+      if (swfdec_url_host_equal(url, swfdec_player_get_url (player))) {
+	swfdec_load_object_load (player, TRUE, load);
+	return;
+      }
     case SWFDEC_SANDBOX_LOCAL_NETWORK:
     case SWFDEC_SANDBOX_LOCAL_TRUSTED:
       if (swfdec_url_is_local (url)) {
diff --git a/swfdec/swfdec_url.c b/swfdec/swfdec_url.c
index 3a041d3..14476a6 100644
--- a/swfdec/swfdec_url.c
+++ b/swfdec/swfdec_url.c
@@ -525,19 +525,18 @@ swfdec_url_is_local (const SwfdecURL *url)
 }
 
 /**
- * swfdec_url_equal:
+ * swfdec_url_host_equal:
  * @a: a #SwfdecURL
  * @b: a #SwfdecURL
  *
- * Compares the 2 given URLs for equality. 2 URLs are considered equal, when
- * they point to the same resource. This function is intended to be 
- * used together with swfdec_url_hash() in a #GHashtable.
- *
- * Returns: %TRUE if the 2 given urls point to the same resource, %FALSE 
+ * Compares the 2 given URLs for equality, ignoring path. 2 URLs are
+ * considered to have equal hosts when they have the same protocol,
+ * host, and port.
+ * Returns: %TRUE if the 2 given urls point to the same host, %FALSE
  *          otherwise.
  **/
 gboolean
-swfdec_url_equal (gconstpointer a, gconstpointer b)
+swfdec_url_host_equal (gconstpointer a, gconstpointer b)
 {
   const SwfdecURL *urla = a;
   const SwfdecURL *urlb = b;
@@ -557,6 +556,30 @@ swfdec_url_equal (gconstpointer a, gconstpointer b)
   if (urla->port != urlb->port)
     return FALSE;
 
+  return TRUE;
+}
+
+/**
+ * swfdec_url_equal:
+ * @a: a #SwfdecURL
+ * @b: a #SwfdecURL
+ *
+ * Compares the 2 given URLs for equality. 2 URLs are considered equal, when
+ * they point to the same resource. This function is intended to be
+ * used together with swfdec_url_hash() in a #GHashtable.
+ *
+ * Returns: %TRUE if the 2 given urls point to the same resource, %FALSE
+ *          otherwise.
+ **/
+gboolean
+swfdec_url_equal (gconstpointer a, gconstpointer b)
+{
+  const SwfdecURL *urla = a;
+  const SwfdecURL *urlb = b;
+
+  if (!swfdec_url_host_equal (urla, urlb))
+    return FALSE;
+
   if (urla->path == NULL) {
     if (urlb->path != NULL)
       return FALSE;
diff --git a/swfdec/swfdec_url.h b/swfdec/swfdec_url.h
index a7d8c13..eb26bfc 100644
--- a/swfdec/swfdec_url.h
+++ b/swfdec/swfdec_url.h
@@ -57,6 +57,8 @@ gboolean		swfdec_url_is_parent		(const SwfdecURL *	parent,
 							 const SwfdecURL *	child);
 gboolean		swfdec_url_is_local		(const SwfdecURL *	url);
 
+gboolean		swfdec_url_host_equal		(gconstpointer		a,
+							 gconstpointer		b);
 gboolean		swfdec_url_equal		(gconstpointer		a,
 							 gconstpointer		b);
 guint			swfdec_url_hash			(gconstpointer		url);


More information about the Swfdec-commits mailing list