[Swfdec] 4 commits - libswfdec-gtk/swfdec_gtk_loader.c libswfdec/swfdec_url.c test/trace
Benjamin Otte
company at kemper.freedesktop.org
Tue Jul 31 11:42:01 PDT 2007
libswfdec-gtk/swfdec_gtk_loader.c | 6 +--
libswfdec/swfdec_url.c | 13 +++++---
test/trace/register-count.swf |binary
test/trace/register-count.swf.trace | 5 +++
test/trace/register-count.xml | 55 ++++++++++++++++++++++++++++++++++++
5 files changed, 71 insertions(+), 8 deletions(-)
New commits:
diff-tree e9b685648bc358610b38344ba67897401670f46c (from 126b24899c6561130f878bfd34cb678f1a9d8458)
Author: Benjamin Otte <otte at gnome.org>
Date: Tue Jul 31 20:42:23 2007 +0200
forgot to git add these
diff --git a/test/trace/register-count.swf b/test/trace/register-count.swf
new file mode 100644
index 0000000..78ba284
Binary files /dev/null and b/test/trace/register-count.swf differ
diff --git a/test/trace/register-count.swf.trace b/test/trace/register-count.swf.trace
new file mode 100644
index 0000000..d66a293
--- /dev/null
+++ b/test/trace/register-count.swf.trace
@@ -0,0 +1,5 @@
+Determine register count
+42
+undefined
+42
+42
diff --git a/test/trace/register-count.xml b/test/trace/register-count.xml
new file mode 100644
index 0000000..4dd0350
--- /dev/null
+++ b/test/trace/register-count.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<swf version="7" compressed="1">
+ <!-- swfmill xml2swf register-count.xml register-count.swf -->
+ <Header framerate="25" frames="1">
+ <size>
+ <Rectangle left="0" right="4000" top="0" bottom="3000"/>
+ </size>
+ <tags>
+ <DoAction>
+ <actions>
+ <PushData>
+ <items>
+ <StackString value="Determine register count"/>
+ </items>
+ </PushData>
+ <Trace/>
+ <DeclareFunction2 name="foo" argc="0" regc="2" reserved="0">
+ <actions>
+ <PushData>
+ <items>
+ <StackInteger value="42"/>
+ </items>
+ </PushData>
+ <StoreRegister reg="0"/>
+ <StoreRegister reg="1"/>
+ <StoreRegister reg="2"/>
+ <Trace/>
+ <PushData>
+ <items>
+ <StackRegister reg="0"/>
+ <StackRegister reg="1"/>
+ <StackRegister reg="2"/>
+ </items>
+ </PushData>
+ <Trace/>
+ <Trace/>
+ <Trace/>
+ </actions>
+ </DeclareFunction2>
+ <PushData>
+ <items>
+ <StackInteger value="0"/>
+ <StackString value="foo"/>
+ </items>
+ </PushData>
+ <CallFunction/>
+ <Pop/>
+ <GetURL url="fscommand:quit" target=""/>
+ </actions>
+ </DoAction>
+ <ShowFrame/>
+ <End/>
+ </tags>
+ </Header>
+</swf>
diff-tree 126b24899c6561130f878bfd34cb678f1a9d8458 (from 901e0d3178453de96dbbcc7fcc35dc782bb4b09e)
Author: Benjamin Otte <otte at gnome.org>
Date: Tue Jul 31 20:41:46 2007 +0200
make swfdec_url_new always return a SwfdecURL
diff --git a/libswfdec/swfdec_url.c b/libswfdec/swfdec_url.c
index 95f0cc3..d1ec4ec 100644
--- a/libswfdec/swfdec_url.c
+++ b/libswfdec/swfdec_url.c
@@ -70,7 +70,7 @@ swfdec_url_get_type (void)
*
* Parses the given string into a URL for use in swfdec.
*
- * Returns: a new #SwfdecURL or %NULL if an error was found in @string
+ * Returns: a new #SwfdecURL
**/
SwfdecURL *
swfdec_url_new (const char *string)
@@ -80,13 +80,13 @@ swfdec_url_new (const char *string)
g_return_val_if_fail (string != NULL, NULL);
+ g_print ("%s\n", string);
url = g_slice_new0 (SwfdecURL);
url->url = g_strdup (string);
s = strstr (string, "://");
if (s == NULL) {
SWFDEC_ERROR ("URL %s has no protocol", string);
- swfdec_url_free (url);
- return NULL;
+ return url;
}
url->protocol = g_strndup (string, s - string);
string = s + 3;
@@ -227,14 +227,17 @@ swfdec_url_get_url (const SwfdecURL *url
*
* Gets the protocol used by this URL, such as "http" or "file".
*
- * Returns: the protocol used
+ * Returns: the protocol used or "error" if the URL is broken
**/
const char *
swfdec_url_get_protocol (const SwfdecURL *url)
{
g_return_val_if_fail (url != NULL, NULL);
- return url->protocol;
+ if (url->protocol)
+ return url->protocol;
+ else
+ return "error";
}
/**
diff-tree 901e0d3178453de96dbbcc7fcc35dc782bb4b09e (from c691d98fb0680b7c229b91f1e59e8d1718267f7f)
Author: Benjamin Otte <otte at gnome.org>
Date: Tue Jul 31 15:19:18 2007 +0200
bugfixes
- set url on new loader
- initialize gnome-vfs in class_init()
diff --git a/libswfdec-gtk/swfdec_gtk_loader.c b/libswfdec-gtk/swfdec_gtk_loader.c
index 5b19760..d506537 100644
--- a/libswfdec-gtk/swfdec_gtk_loader.c
+++ b/libswfdec-gtk/swfdec_gtk_loader.c
@@ -194,6 +194,8 @@ swfdec_gtk_loader_class_init (SwfdecGtkL
GObjectClass *object_class = G_OBJECT_CLASS (klass);
SwfdecLoaderClass *loader_class = SWFDEC_LOADER_CLASS (klass);
+ gnome_vfs_init ();
+
object_class->dispose = swfdec_gtk_loader_dispose;
loader_class->load = swfdec_gtk_loader_load;
@@ -219,14 +221,12 @@ swfdec_gtk_loader_init (SwfdecGtkLoader
SwfdecLoader *
swfdec_gtk_loader_new (const char *uri)
{
- SwfdecURL *url;
SwfdecLoader *loader;
g_return_val_if_fail (uri != NULL, NULL);
- url = swfdec_url_new (uri);
- g_return_val_if_fail (url != NULL, NULL); /* FIXME */
loader = g_object_new (SWFDEC_TYPE_GTK_LOADER, NULL);
+ loader->url = swfdec_url_new (uri);
swfdec_gtk_loader_load (loader, SWFDEC_LOADER_REQUEST_DEFAULT, NULL, 0);
return loader;
}
diff-tree c691d98fb0680b7c229b91f1e59e8d1718267f7f (from 67a997bc57fad8b87d13d1f7baaaa737398ac6e9)
Author: Benjamin Otte <otte at gnome.org>
Date: Tue Jul 31 15:10:36 2007 +0200
wrong check
diff --git a/libswfdec-gtk/swfdec_gtk_loader.c b/libswfdec-gtk/swfdec_gtk_loader.c
index 77ffd29..5b19760 100644
--- a/libswfdec-gtk/swfdec_gtk_loader.c
+++ b/libswfdec-gtk/swfdec_gtk_loader.c
@@ -225,7 +225,7 @@ swfdec_gtk_loader_new (const char *uri)
g_return_val_if_fail (uri != NULL, NULL);
url = swfdec_url_new (uri);
- g_return_val_if_fail (url == NULL, NULL); /* FIXME */
+ g_return_val_if_fail (url != NULL, NULL); /* FIXME */
loader = g_object_new (SWFDEC_TYPE_GTK_LOADER, NULL);
swfdec_gtk_loader_load (loader, SWFDEC_LOADER_REQUEST_DEFAULT, NULL, 0);
return loader;
More information about the Swfdec
mailing list