[Swfdec-commits] 4 commits - doc/Makefile.am swfdec/swfdec_as_context.c swfdec/swfdec_as_interpret.c swfdec/swfdec_url.c

Benjamin Otte company at kemper.freedesktop.org
Mon Jan 28 03:18:58 PST 2008


 doc/Makefile.am              |   12 ++++-----
 swfdec/swfdec_as_context.c   |    4 ---
 swfdec/swfdec_as_interpret.c |    3 --
 swfdec/swfdec_url.c          |   53 +++++++++++++++++++------------------------
 4 files changed, 32 insertions(+), 40 deletions(-)

New commits:
commit 1cc27fede7ca0d72a036f2434e4ecd3dc22c3d04
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 28 12:18:48 2008 +0100

    use the right jump offset here

diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 9af7700..716bbf2 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -237,7 +237,6 @@ static void
 swfdec_action_wait_for_frame2 (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
 {
   SwfdecSpriteMovie *movie;
-  guint jump;
   int frame, loaded;
 
   if (len < 1) {
@@ -257,7 +256,7 @@ swfdec_action_wait_for_frame2 (SwfdecAsContext *cx, guint action, const guint8 *
   loaded = swfdec_sprite_movie_get_frames_loaded (movie);
   if (loaded < (int) movie->n_frames &&
       loaded <= frame)
-    swfdec_script_skip_actions (cx, jump);
+    swfdec_script_skip_actions (cx, data[0]);
 }
 
 static void
commit 98b0c3d5ff054682f58266da1caa1a6481627bff
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 28 12:18:30 2008 +0100

    add/remove header files to make this current

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 37f9fb4..65a4d34 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -90,7 +90,7 @@ IGNORE_HFILES= \
 	swfdec_event.h \
 	swfdec_filter.h \
 	swfdec_flv_decoder.h \
-	swfdec_flash_security.h \
+	swfdec_function_list.h \
 	swfdec_font.h \
 	swfdec_gradient_pattern.h \
 	swfdec_graphic.h \
@@ -103,7 +103,7 @@ IGNORE_HFILES= \
 	swfdec_listener.h \
 	swfdec_load_object.h \
 	swfdec_loader_internal.h \
-	swfdec_loadertarget.h \
+	swfdec_stream_target.h \
 	swfdec_marshal.h \
 	swfdec_morph_movie.h \
 	swfdec_morphshape.h \
@@ -114,17 +114,16 @@ IGNORE_HFILES= \
 	swfdec_path.h \
 	swfdec_pattern.h \
 	swfdec_player_internal.h \
-	swfdec_policy_loader.h \
+	swfdec_policy_file.h \
 	swfdec_rect.h \
 	swfdec_resource.h \
 	swfdec_resource_request.h \
 	swfdec_ringbuffer.h \
 	swfdec_root_movie.h \
 	swfdec_root_sprite.h \
+	swfdec_sandbox.h \
 	swfdec_script.h \
 	swfdec_script_internal.h \
-	swfdec_security.h \
-	swfdec_security_allow.h \
 	swfdec_shape.h \
 	swfdec_shape_parser.h \
 	swfdec_sound.h \
@@ -142,7 +141,8 @@ IGNORE_HFILES= \
 	swfdec_video.h \
 	swfdec_video_movie.h \
 	swfdec_xml.h \
-	swfdec_xml_node.h
+	swfdec_xml_node.h \
+	swfdec_xml_socket.h
 
 if WITH_GTK
 EXTRA_HFILES = \
commit fbd95c86697a00f578cd93e9ec23c81ea129f330
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 28 12:16:55 2008 +0100

    remove version parameter from swfdec_as_context_startup() docs

diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index ccce123..a7f68e0 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -1382,11 +1382,9 @@ swfdec_as_context_run_init_script (SwfdecAsContext *context, const guint8 *data,
 /**
  * swfdec_as_context_startup:
  * @context: a #SwfdecAsContext
- * @version: Flash version to use
  *
  * Starts up the context. This function must be called before any Actionscript
- * is called on @context. The version is responsible for deciding which native
- * functions and properties are available in the context.
+ * is called on @context.
  **/
 void
 swfdec_as_context_startup (SwfdecAsContext *context)
commit 50c290c292b136082650764973a4749f2b2b9779
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 28 12:09:19 2008 +0100

    make swfdec_url_new() return NULL on failure
    
    Also handle these cases for functions that don't return NULL

diff --git a/swfdec/swfdec_url.c b/swfdec/swfdec_url.c
index c81b5a2..4372c7d 100644
--- a/swfdec/swfdec_url.c
+++ b/swfdec/swfdec_url.c
@@ -21,6 +21,7 @@
 #include "config.h"
 #endif
 
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -69,26 +70,13 @@ swfdec_url_get_type (void)
   return type;
 }
 
-static void *
-swfdec_memrchr (const void *s, int c, size_t n)
-{
-  void *cur, *next;
-
-  cur = memchr (s, c, n);
-  if (cur == NULL)
-    return NULL;
-  while ((next = memchr (cur, c, n)))
-    cur = next;
-  return cur;
-}
-
 /**
  * swfdec_url_new:
- * @string: a full-qualified URL encoded in UTF-8
+ * @string: a valid utf-8 string possibly containing an URL
  *
  * Parses the given string into a URL for use in swfdec.
  *
- * Returns: a new #SwfdecURL
+ * Returns: a new #SwfdecURL or %NULL if the URL was invalid
  **/
 SwfdecURL *
 swfdec_url_new (const char *string)
@@ -105,23 +93,26 @@ swfdec_url_new (const char *string)
   s = strstr (string, "://");
   if (s == NULL) {
     SWFDEC_INFO ("URL %s has no protocol", string);
-    return url;
+    goto error;
   }
   url->protocol = g_utf8_strdown (string, s - string);
   string = s + 3;
   s = strchr (string, '/');
-  if (s == NULL) {
-    url->host = g_ascii_strdown (string, -1);
-    return url;
-  }
   if (s != string) {
-    char *colon = swfdec_memrchr (string, ':', s - string);
+    char *colon;
+    url->host = g_ascii_strdown (string, s ? s - string : -1);
+    colon = strrchr (url->host, ':');
     if (colon) {
+      *colon = 0;
+      errno = 0;
       url->port = strtoul (colon + 1, &colon, 10);
-      url->host = g_ascii_strdown (string, colon - string);
-    } else {
-      url->host = g_ascii_strdown (string, s - string);
+      if (errno || *colon != 0) {
+	SWFDEC_INFO ("%s: invalid port number", string);
+	goto error;
+      }
     }
+    if (s == NULL)
+      return url;
   }
   string = s + 1;
   s = strchr (string, '?');
@@ -134,6 +125,10 @@ swfdec_url_new (const char *string)
   if (*s)
     url->query = g_strdup (s);
   return url;
+
+error:
+  swfdec_url_free (url);
+  return NULL;
 }
 
 /**
@@ -639,7 +634,6 @@ SwfdecURL *
 swfdec_url_new_from_input (const char *input)
 {
   SwfdecURL *url;
-  char *url_string;
 
   g_return_val_if_fail (input != NULL, NULL);
 
@@ -648,19 +642,20 @@ swfdec_url_new_from_input (const char *input)
       (url = swfdec_url_new (input)))
     return url;
 
+  /* FIXME: split at '?' for query? */
   if (g_path_is_absolute (input)) {
-    url_string = g_strconcat ("file://", input, NULL);
+    url = swfdec_url_new_components ("file", NULL, 0,
+	input, NULL);
   } else {
     char *absolute, *cur;
     cur = g_get_current_dir ();
     absolute = g_build_filename (cur, input, NULL);
     g_free (cur);
-    url_string = g_strconcat ("file://", absolute, NULL);
+    url = swfdec_url_new_components ("file", NULL, 0,
+	input, NULL);
     g_free (absolute);
   }
 
-  url = swfdec_url_new (url_string);
-  g_free (url_string);
   g_return_val_if_fail (url != NULL, NULL);
   return url;
 }


More information about the Swfdec-commits mailing list