[Swfdec] Branch 'as' - 9 commits - libswfdec-gtk/swfdec_playback_alsa.c libswfdec/js libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.c libswfdec/swfdec_as_function.h libswfdec/swfdec_as_object.c libswfdec/swfdec_as_stack.h libswfdec/swfdec_audio_event.h libswfdec/swfdec_audio_flv.h libswfdec/swfdec_audio_stream.h libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_buffer.c libswfdec/swfdec_buffer.h libswfdec/swfdec_cache.c libswfdec/swfdec_cache.h libswfdec/swfdec_codec_ffmpeg.c libswfdec/swfdec_codec.h libswfdec/swfdec_codec_mad.c libswfdec/swfdec_codec_screen.c libswfdec/swfdec_color.c libswfdec/swfdec_color.h libswfdec/swfdec_debug.c libswfdec/swfdec_debug.h libswfdec/swfdec_edittext.c libswfdec/swfdec_edittext.h libswfdec/swfdec_event.c libswfdec/swfdec_event.h libswfdec/swfdec_font.c libswfdec/swfdec_font.h libswfdec/swfdec_html_parser.c libswfdec/swfdec_image.c libswfdec/swfdec_js_color.c libswfdec/swfdec_js_global.c libswfdec/swfdec_morph_movie.c libswfdec/swfdec_morphshape.h libswfdec/swfdec_movie.h libswfdec/swfdec_pattern.c libswfdec/swfdec_pattern.h libswfdec/swfdec_player.c libswfdec/swfdec_player.h libswfdec/swfdec_player_internal.h libswfdec/swfdec_root_movie.c libswfdec/swfdec_root_sprite.c libswfdec/swfdec_script.c libswfdec/swfdec_script.h libswfdec/swfdec_shape.c libswfdec/swfdec_shape.h libswfdec/swfdec_sound.c libswfdec/swfdec_sound.h libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_sprite_movie.h libswfdec/swfdec_swf_decoder.c libswfdec/swfdec_swf_decoder.h libswfdec/swfdec_tag.c libswfdec/swfdec_text.c libswfdec/swfdec_types.h libswfdec/swfdec_video.h

Benjamin Otte company at kemper.freedesktop.org
Thu Mar 29 14:13:48 PDT 2007


 libswfdec-gtk/swfdec_playback_alsa.c |    6 -
 libswfdec/Makefile.am                |    2 
 libswfdec/js/jsinterp.c              |   10 --
 libswfdec/swfdec_as_context.c        |   50 ++++++++++-
 libswfdec/swfdec_as_context.h        |    4 
 libswfdec/swfdec_as_frame.c          |    7 -
 libswfdec/swfdec_as_frame.h          |    3 
 libswfdec/swfdec_as_function.c       |  146 +++++++++++++++++++++++++++++++++++
 libswfdec/swfdec_as_function.h       |   73 +++++++++++++++++
 libswfdec/swfdec_as_object.c         |   24 +++++
 libswfdec/swfdec_as_stack.h          |    1 
 libswfdec/swfdec_audio_event.h       |    2 
 libswfdec/swfdec_audio_flv.h         |    4 
 libswfdec/swfdec_audio_stream.h      |    4 
 libswfdec/swfdec_bits.c              |   60 +++++++-------
 libswfdec/swfdec_bits.h              |   28 +++---
 libswfdec/swfdec_buffer.c            |   18 ++--
 libswfdec/swfdec_buffer.h            |   20 ++--
 libswfdec/swfdec_cache.c             |    6 -
 libswfdec/swfdec_cache.h             |   14 +--
 libswfdec/swfdec_codec.h             |    4 
 libswfdec/swfdec_codec_ffmpeg.c      |    2 
 libswfdec/swfdec_codec_mad.c         |    2 
 libswfdec/swfdec_codec_screen.c      |    2 
 libswfdec/swfdec_color.c             |    6 -
 libswfdec/swfdec_color.h             |    4 
 libswfdec/swfdec_debug.c             |    6 -
 libswfdec/swfdec_debug.h             |    4 
 libswfdec/swfdec_edittext.c          |    4 
 libswfdec/swfdec_edittext.h          |   10 +-
 libswfdec/swfdec_event.c             |   16 +--
 libswfdec/swfdec_event.h             |    6 -
 libswfdec/swfdec_font.c              |   10 +-
 libswfdec/swfdec_font.h              |    4 
 libswfdec/swfdec_html_parser.c       |    2 
 libswfdec/swfdec_image.c             |    4 
 libswfdec/swfdec_js_color.c          |    2 
 libswfdec/swfdec_js_global.c         |    8 -
 libswfdec/swfdec_morph_movie.c       |    2 
 libswfdec/swfdec_morphshape.h        |    4 
 libswfdec/swfdec_movie.h             |    2 
 libswfdec/swfdec_pattern.c           |   20 ++--
 libswfdec/swfdec_pattern.h           |    4 
 libswfdec/swfdec_player.c            |    4 
 libswfdec/swfdec_player.h            |    4 
 libswfdec/swfdec_player_internal.h   |    8 -
 libswfdec/swfdec_root_movie.c        |    2 
 libswfdec/swfdec_root_sprite.c       |    2 
 libswfdec/swfdec_script.c            |   92 +++-------------------
 libswfdec/swfdec_script.h            |   17 ++--
 libswfdec/swfdec_shape.c             |   12 +-
 libswfdec/swfdec_shape.h             |    8 -
 libswfdec/swfdec_sound.c             |   10 +-
 libswfdec/swfdec_sound.h             |   22 ++---
 libswfdec/swfdec_sprite.c            |   18 ++--
 libswfdec/swfdec_sprite.h            |   14 +--
 libswfdec/swfdec_sprite_movie.c      |    2 
 libswfdec/swfdec_sprite_movie.h      |    4 
 libswfdec/swfdec_swf_decoder.c       |    6 -
 libswfdec/swfdec_swf_decoder.h       |    4 
 libswfdec/swfdec_tag.c               |   12 +-
 libswfdec/swfdec_text.c              |    4 
 libswfdec/swfdec_types.h             |    2 
 libswfdec/swfdec_video.h             |    6 -
 64 files changed, 536 insertions(+), 327 deletions(-)

New commits:
diff-tree e9bda1999fcb67c54febb83a8bc1be75e62c60be (from 7fbbe64db09817aaed4d28fa5bb1ac4869c835f5)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Mar 29 21:35:33 2007 +0200

    get rid of undefined functions

diff --git a/libswfdec/js/jsinterp.c b/libswfdec/js/jsinterp.c
index f92e9c9..e7fd843 100644
--- a/libswfdec/js/jsinterp.c
+++ b/libswfdec/js/jsinterp.c
@@ -626,9 +626,6 @@ ComputeThis(JSContext *cx, JSObject *thi
     return JS_TRUE;
 }
 
-extern JSBool
-swfdec_script_interpret(void *script, JSContext *cx, jsval *rval);
-
 /*
  * Find a function reference and its 'this' object implicit first parameter
  * under argc arguments on cx's stack, and call the function.  Push missing
@@ -966,11 +963,8 @@ have_fun:
         }
         ok = js_Interpret(cx, &v);
     } else if (swf) {
-	if (!js_GetCallObject(cx, &frame, parent)) {
-	    ok = JS_FALSE;
-	    goto out;
-	}
-        ok = swfdec_script_interpret(swf, cx, &v);
+	ok = JS_FALSE;
+	goto out;
     } else {
         /* fun might be onerror trying to report a syntax error in itself. */
         frame.scopeChain = NULL;
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index b9f605b..e6c25a5 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -3008,9 +3008,12 @@ internal_error:
  *
  * Returns: the return value of @script
  **/
-jsval
+#endif
+void
 swfdec_script_execute (SwfdecScript *script, SwfdecScriptable *scriptable)
 {
+}
+#if 0
   JSContext *cx;
   JSStackFrame *oldfp, frame;
   JSObject *obj;
diff-tree 7fbbe64db09817aaed4d28fa5bb1ac4869c835f5 (from parents)
Merge: 97a34e2bdc46d12e66fa103489e8f630fbf0d495 f516f0186bef8f00810f200034d63776bfab9271
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Mar 29 21:31:14 2007 +0200

    Merge branch 'master' of ssh://company@git.freedesktop.org/git/swfdec into as
    
    Conflicts:
    
    	libswfdec/swfdec_script.h

diff --cc libswfdec/swfdec_script.h
index 8a3741e,b58252b..673332a
@@@ -47,12 -48,11 +47,12 @@@
  /* FIXME: May want to typedef to SwfdecBuffer directly */
  struct _SwfdecScript {
    /* must be first arg */
 -  JSFunction *		fun;			/* function script belongs to or NULL */
 +  gpointer		fun;			/* function script belongs to or NULL */
    SwfdecBuffer *	buffer;			/* buffer holding the script */
-   unsigned int	  	refcount;		/* reference count */
+   guint	  	refcount;		/* reference count */
    char *		name;			/* name identifying this script */
-   unsigned int		version;		/* version of the script */
-   unsigned int		n_registers;		/* number of registers */
 -  guint		version;		/* version of the script */
++  guint			version;		/* version of the script */
++  guint			n_registers;		/* number of registers */
    gpointer		debugger;		/* debugger owning us or NULL */
    /* needed by functions */
    SwfdecBuffer *	constant_pool;		/* constant pool action */
@@@ -73,15 -73,14 +73,15 @@@
  
  SwfdecScript *	swfdec_script_new		(SwfdecBits *		bits,
  						 const char *		name,
- 						 unsigned int	      	version);
 -						 guint	      	version);
++						 guint			version);
  SwfdecScript *	swfdec_script_new_for_player  	(SwfdecPlayer *		player,
  						 SwfdecBits *		bits,
  						 const char *		name,
- 						 unsigned int	      	version);
 -						 guint	      	version);
 -void		swfdec_script_ref		(SwfdecScript *		script);
++						 guint			version);
 +SwfdecScript *	swfdec_script_ref		(SwfdecScript *		script);
  void		swfdec_script_unref		(SwfdecScript *		script);
  
 +#if 0
  JSBool		swfdec_script_interpret		(SwfdecScript *		script,
  						 JSContext *		cx,
  						 jsval *		rval);
diff-tree 97a34e2bdc46d12e66fa103489e8f630fbf0d495 (from 22cdc6cbbf1030d34c2b4f414006cfcbf3a27c18)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Mar 29 21:26:54 2007 +0200

    comment out all the old interpreter code

diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index 6f7fe6e..037e146 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -320,7 +320,7 @@ swfdec_as_context_new (void)
 #define MAXSCRIPTVERSION 7
 #define EXTRACT_VERSION(v) MIN ((v) - MINSCRIPTVERSION, MAXSCRIPTVERSION - MINSCRIPTVERSION)
 
-typedef JSBool (* SwfdecActionExec) (JSContext *cx, guint action, const guint8 *data, guint len);
+typedef void (* SwfdecActionExec) (SwfdecAsContext *cx, guint action, const guint8 *data, guint len);
 typedef struct {
   const char *		name;		/* name identifying the action */
   char *		(* print)	(guint action, const guint8 *data, guint len);
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index a6e8312..0d2f338 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -26,8 +26,6 @@
 #include "swfdec_debug.h"
 #include "swfdec_debugger.h"
 #include "swfdec_scriptable.h"
-#include "js/jscntxt.h"
-#include "js/jsinterp.h"
 
 #include <errno.h>
 #include <math.h>
@@ -39,8 +37,6 @@
 #include "swfdec_root_movie.h"
 #include "swfdec_sprite.h"
 #include "swfdec_sprite_movie.h"
-#include "js/jsfun.h"
-#include "js/jsscope.h"
 
 /* Define this to get SWFDEC_WARN'd about missing properties of objects.
  * This can be useful to find out about unimplemented native properties,
@@ -116,6 +112,7 @@ swfdec_constant_pool_free (SwfdecConstan
   g_ptr_array_free (pool, TRUE);
 }
 
+#if 0
 /* FIXME: this is a bit hacky */
 static SwfdecBuffer *
 swfdec_constant_pool_get_area (SwfdecScript *script, SwfdecConstantPool *pool)
@@ -140,6 +137,7 @@ swfdec_constant_pool_get_area (SwfdecScr
   g_assert (start + len < buffer->data + buffer->length);
   return swfdec_buffer_new_subbuffer (buffer, start - buffer->data, len);
 }
+#endif
 
 /*** SUPPORT FUNCTIONS ***/
 
@@ -152,46 +150,10 @@ swfdec_script_add_to_player (SwfdecScrip
   }
 }
 
-/**
- * swfdec_script_ensure_stack:
- * @cx: #JSContext to check
- * @n_elements: number of elements the stack should contain
- *
- * Ensures that the stack is at least @n_elements values. If not enough stack
- * space is available, the stack is filled up with JSVAL_VOID.
- *
- * Returns: JS_TRUE on success or JS_FALSE on OOM
- **/
-static inline JSBool
-swfdec_script_ensure_stack (JSContext *cx, guint n_elements)
-{
-  JSStackFrame *fp = cx->fp;
-  guint current = (guint) (fp->sp - fp->spbase);
-
-  if (current >= n_elements)
-    return JS_TRUE;
-
-  if (n_elements > (guint) (fp->spend - fp->spbase)) {
-    SWFDEC_ERROR ("FIXME: implement stack expansion, we got an overflow (want %u, have %td)",
-	n_elements, (fp->spend - fp->spbase));
-    return JS_FALSE;
-  }
-
-  if (current) {
-    n_elements -= current;
-    memmove (fp->spbase + n_elements, fp->spbase, (fp->sp - fp->spbase) * sizeof (jsval));
-  }
-  fp->sp += n_elements;
-  while (n_elements)  {
-    n_elements--;
-    fp->spbase[n_elements] = JSVAL_VOID;
-  }
-  return JS_TRUE;
-}
-
 #define swfdec_action_has_register(cx, i) \
   ((i) < ((SwfdecScript *) (cx)->fp->swf)->n_registers)
 
+#if 0
 static SwfdecMovie *
 swfdec_action_get_target (JSContext *cx)
 {
@@ -2481,6 +2443,7 @@ swfdec_action_print_wait_for_frame (guin
   jump = data[2];
   return g_strdup_printf ("WaitForFrame %u %u", frame, jump);
 }
+#endif
 
 /*** BIG FUNCTION TABLE ***/
 
@@ -2489,7 +2452,7 @@ swfdec_action_print_wait_for_frame (guin
 #define MAXSCRIPTVERSION 7
 #define EXTRACT_VERSION(v) MIN ((v) - MINSCRIPTVERSION, MAXSCRIPTVERSION - MINSCRIPTVERSION)
 
-typedef JSBool (* SwfdecActionExec) (JSContext *cx, guint action, const guint8 *data, guint len);
+typedef void (* SwfdecActionExec) (SwfdecAsContext *cx, guint action, const guint8 *data, guint len);
 typedef struct {
   const char *		name;		/* name identifying the action */
   char *		(* print)	(guint action, const guint8 *data, guint len);
@@ -2500,6 +2463,7 @@ typedef struct {
 } SwfdecActionSpec;
 
 const SwfdecActionSpec actions[256] = {
+#if 0
   /* version 3 */
   [0x04] = { "NextFrame", NULL, 0, 0, { swfdec_action_next_frame, swfdec_action_next_frame, swfdec_action_next_frame, swfdec_action_next_frame, swfdec_action_next_frame } },
   [0x05] = { "PreviousFrame", NULL, 0, 0, { swfdec_action_previous_frame, swfdec_action_previous_frame, swfdec_action_previous_frame, swfdec_action_previous_frame, swfdec_action_previous_frame } },
@@ -2618,6 +2582,7 @@ const SwfdecActionSpec actions[256] = {
   [0x9d] = { "If", swfdec_action_print_if, 1, 0, { NULL, swfdec_action_if, swfdec_action_if, swfdec_action_if, swfdec_action_if } },
   [0x9e] = { "Call", NULL },
   [0x9f] = { "GotoFrame2", swfdec_action_print_goto_frame2, 1, 0, { NULL, swfdec_action_goto_frame2, swfdec_action_goto_frame2, swfdec_action_goto_frame2, swfdec_action_goto_frame2 } }
+#endif
 };
 
 char *
@@ -2735,7 +2700,6 @@ swfdec_script_new (SwfdecBits *bits, con
     return NULL;
   }
 
-  swfdec_bits_syncbits (bits);
   start = bits->ptr;
   script = g_new0 (SwfdecScript, 1);
   script->refcount = 1;
@@ -2792,21 +2756,7 @@ swfdec_script_unref (SwfdecScript *scrip
   g_free (script);
 }
 
-#ifndef MAX_INTERP_LEVEL
-#if defined(XP_OS2)
-#define MAX_INTERP_LEVEL 250
-#elif defined _MSC_VER && _MSC_VER <= 800
-#define MAX_INTERP_LEVEL 30
-#else
-#define MAX_INTERP_LEVEL 1000
-#endif
-#endif
-
-/* random guess */
-#define STACKSIZE 100
-
-/* FIXME: the implementation of this function needs the usual debugging hooks 
- * found in mozilla */
+#if 0
 JSBool
 swfdec_script_interpret (SwfdecScript *script, JSContext *cx, jsval *rval)
 {
@@ -3047,22 +2997,6 @@ internal_error:
   goto no_catch;
 }
 
-static JSFunction *
-swfdec_script_ensure_function (SwfdecScript *script, SwfdecScriptable *scriptable)
-{
-  JSContext *cx = scriptable->jscx;
-  JSObject *parent;
-
-  if (script->fun)
-    return script->fun;
-  parent = swfdec_scriptable_get_object (scriptable);
-  script->fun = JS_NewFunction (cx, NULL, 0, JSFUN_LAMBDA, parent, NULL);
-  script->fun->swf = script;
-  script->fun->nvars = 4;
-  swfdec_script_ref (script);
-  return script->fun;
-}
-
 /**
  * swfdec_script_execute:
  * @script: a #SwfdecScript to execute
@@ -3149,6 +3083,7 @@ swfdec_script_execute (SwfdecScript *scr
 
   return ok ? frame.rval : JSVAL_VOID;
 }
+#endif
 
 /*** UTILITY FUNCTIONS ***/
 
diff --git a/libswfdec/swfdec_script.h b/libswfdec/swfdec_script.h
index 27ef714..8a3741e 100644
--- a/libswfdec/swfdec_script.h
+++ b/libswfdec/swfdec_script.h
@@ -23,7 +23,6 @@
 #include <libswfdec/swfdec.h>
 #include <libswfdec/swfdec_types.h>
 #include <libswfdec/swfdec_bits.h>
-#include <libswfdec/js/jsapi.h>
 
 G_BEGIN_DECLS
 
@@ -48,7 +47,7 @@ typedef gboolean (* SwfdecScriptForeachF
 /* FIXME: May want to typedef to SwfdecBuffer directly */
 struct _SwfdecScript {
   /* must be first arg */
-  JSFunction *		fun;			/* function script belongs to or NULL */
+  gpointer		fun;			/* function script belongs to or NULL */
   SwfdecBuffer *	buffer;			/* buffer holding the script */
   unsigned int	  	refcount;		/* reference count */
   char *		name;			/* name identifying this script */
@@ -82,10 +81,12 @@ SwfdecScript *	swfdec_script_new_for_pla
 SwfdecScript *	swfdec_script_ref		(SwfdecScript *		script);
 void		swfdec_script_unref		(SwfdecScript *		script);
 
+#if 0
 JSBool		swfdec_script_interpret		(SwfdecScript *		script,
 						 JSContext *		cx,
 						 jsval *		rval);
-jsval		swfdec_script_execute		(SwfdecScript *		script,
+#endif
+void		swfdec_script_execute		(SwfdecScript *		script,
 						 SwfdecScriptable *	scriptable);
 
 gboolean	swfdec_script_foreach		(SwfdecScript *		script,
diff-tree 22cdc6cbbf1030d34c2b4f414006cfcbf3a27c18 (from 7e52bab9810b4e7e90d28f47f171943188e0fde2)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Mar 29 21:18:46 2007 +0200

    add a function object

diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am
index dbcf847..be8455c 100644
--- a/libswfdec/Makefile.am
+++ b/libswfdec/Makefile.am
@@ -18,6 +18,7 @@ js_cflags = -I$(srcdir)/js/ -I./js -DXP_
 libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES = \
 	swfdec_as_context.c \
 	swfdec_as_frame.c \
+	swfdec_as_function.c \
 	swfdec_as_object.c \
 	swfdec_as_stack.c \
 	swfdec_as_types.c \
@@ -113,6 +114,7 @@ libswfdec_ at SWFDEC_MAJORMINOR@include_HEA
 noinst_HEADERS = \
 	swfdec_as_context.h \
 	swfdec_as_frame.h \
+	swfdec_as_function.h \
 	swfdec_as_object.h \
 	swfdec_as_stack.h \
 	swfdec_as_types.h \
diff --git a/libswfdec/swfdec_as_function.c b/libswfdec/swfdec_as_function.c
new file mode 100644
index 0000000..68e98c5
--- /dev/null
+++ b/libswfdec/swfdec_as_function.c
@@ -0,0 +1,146 @@
+/* SwfdecAs
+ * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "swfdec_as_function.h"
+#include "swfdec_as_context.h"
+#include "swfdec_as_frame.h"
+#include "swfdec_as_stack.h"
+#include "swfdec_debug.h"
+
+G_DEFINE_TYPE (SwfdecAsFunction, swfdec_as_function, SWFDEC_TYPE_AS_OBJECT)
+
+static void
+swfdec_as_function_dispose (GObject *object)
+{
+  SwfdecAsFunction *function = SWFDEC_AS_FUNCTION (object);
+
+  if (function->script) {
+    swfdec_script_unref (function->script);
+    function->script = NULL;
+  }
+
+  G_OBJECT_CLASS (swfdec_as_function_parent_class)->dispose (object);
+}
+
+static void
+swfdec_as_function_mark (SwfdecAsObject *object)
+{
+  SwfdecAsFunction *function = SWFDEC_AS_FUNCTION (object);
+
+  if (function->scope)
+    swfdec_as_object_mark (function->scope);
+
+  SWFDEC_AS_OBJECT_CLASS (swfdec_as_function_parent_class)->mark (object);
+}
+
+static void
+swfdec_as_function_class_init (SwfdecAsFunctionClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  SwfdecAsObjectClass *asobject_class = SWFDEC_AS_OBJECT_CLASS (klass);
+
+  object_class->dispose = swfdec_as_function_dispose;
+
+  asobject_class->mark = swfdec_as_function_mark;
+}
+
+static void
+swfdec_as_function_init (SwfdecAsFunction *function)
+{
+}
+
+SwfdecAsFunction *
+swfdec_as_function_new (SwfdecAsObject *scope, SwfdecScript *script)
+{
+  SwfdecAsFunction *fun;
+
+  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (scope), NULL);
+  g_return_val_if_fail (script != NULL, NULL);
+
+  if (!swfdec_as_context_use_mem (scope->context, sizeof (SwfdecAsFunction)))
+    return NULL;
+  fun = g_object_new (SWFDEC_TYPE_AS_FUNCTION, NULL);
+  swfdec_as_object_add (SWFDEC_AS_OBJECT (fun), scope->context, sizeof (SwfdecAsFunction));
+  fun->scope = scope;
+  fun->script = script;
+
+  return fun;
+}
+
+SwfdecAsFunction *
+swfdec_as_function_new_native (SwfdecAsContext *context, SwfdecAsNativeCall native,
+    guint min_args)
+{
+  SwfdecAsFunction *fun;
+
+  g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
+  g_return_val_if_fail (native != NULL, NULL);
+
+  if (!swfdec_as_context_use_mem (context, sizeof (SwfdecAsFunction)))
+    return NULL;
+  fun = g_object_new (SWFDEC_TYPE_AS_FUNCTION, NULL);
+  swfdec_as_object_add (SWFDEC_AS_OBJECT (fun), context, sizeof (SwfdecAsFunction));
+  fun->native = native;
+  fun->min_args = min_args;
+
+  return fun;
+}
+
+void
+swfdec_as_function_call (SwfdecAsFunction *function, SwfdecAsObject *thisp, guint n_args)
+{
+  SwfdecAsContext *context;
+
+  g_return_if_fail (SWFDEC_IS_AS_FUNCTION (function));
+  g_return_if_fail (SWFDEC_IS_AS_OBJECT (thisp));
+
+  context = thisp->context;
+  if (context->frame) {
+    guint available_args = swfdec_as_stack_get_size (context->frame->stack);
+    n_args = MIN (available_args, n_args);
+  } else {
+    n_args = 0;
+  }
+  /* now do different things depending on if we're a native function or not */
+  if (function->native) {
+    if (n_args < function->min_args) {
+      SwfdecAsStack *stack = context->frame->stack;
+      if (n_args == 0) {
+	SwfdecAsValue value = { SWFDEC_TYPE_AS_UNDEFINED, };
+	swfdec_as_stack_ensure_size (stack, 1);
+	swfdec_as_stack_push (stack, &value);
+      } else {
+	stack->cur -= (n_args - 1);
+	SWFDEC_AS_VALUE_SET_UNDEFINED (swfdec_as_stack_peek (stack, 1));
+      }
+      return;
+    }
+    g_assert_not_reached ();
+  } else {
+    SwfdecAsFrame *frame;
+
+    frame = swfdec_as_frame_new (thisp, function->script);
+    /* FIXME: do the preloading here */
+  }
+}
+
diff --git a/libswfdec/swfdec_as_function.h b/libswfdec/swfdec_as_function.h
new file mode 100644
index 0000000..818d7cb
--- /dev/null
+++ b/libswfdec/swfdec_as_function.h
@@ -0,0 +1,73 @@
+/* SwfdecAs
+ * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+#ifndef _SWFDEC_AS_FUNCTION_H_
+#define _SWFDEC_AS_FUNCTION_H_
+
+#include <libswfdec/swfdec_as_object.h>
+#include <libswfdec/swfdec_as_types.h>
+#include <libswfdec/swfdec_script.h>
+
+G_BEGIN_DECLS
+
+typedef struct _SwfdecAsFunction SwfdecAsFunction;
+typedef struct _SwfdecAsFunctionClass SwfdecAsFunctionClass;
+
+typedef void (* SwfdecAsNativeCall) (SwfdecAsContext *context, SwfdecAsObject *thisp, guint argc, SwfdecAsValue *argv);
+
+#define SWFDEC_TYPE_AS_FUNCTION                    (swfdec_as_function_get_type())
+#define SWFDEC_IS_AS_FUNCTION(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AS_FUNCTION))
+#define SWFDEC_IS_AS_FUNCTION_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AS_FUNCTION))
+#define SWFDEC_AS_FUNCTION(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AS_FUNCTION, SwfdecAsFunction))
+#define SWFDEC_AS_FUNCTION_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AS_FUNCTION, SwfdecAsFunctionClass))
+#define SWFDEC_AS_FUNCTION_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AS_FUNCTION, SwfdecAsFunctionClass))
+
+/* FIXME: do two obejcts, one for scripts and one for native? */
+struct _SwfdecAsFunction {
+  SwfdecAsObject	object;
+
+  /* for native functions */
+  SwfdecAsNativeCall	native;		/* native call or NULL when script */
+  guint			min_args;	/* minimum number of required arguments */
+
+  /* for script functions */
+  SwfdecScript *	script;		/* script being executed or NULL when native */
+  SwfdecAsObject *	scope;		/* scope object coming after this */
+};
+
+struct _SwfdecAsFunctionClass {
+  SwfdecAsObjectClass	object_class;
+};
+
+GType			swfdec_as_function_get_type	(void);
+
+SwfdecAsFunction *	swfdec_as_function_new		(SwfdecAsObject *	scope,
+							 SwfdecScript *		script);
+SwfdecAsFunction *	swfdec_as_function_new_native	(SwfdecAsContext *	context,
+							 SwfdecAsNativeCall	native,
+							 guint			min_args);
+
+void			swfdec_as_function_call		(SwfdecAsFunction *	function,
+							 SwfdecAsObject *	thisp,
+							 guint			n_args);
+
+
+
+G_END_DECLS
+#endif
diff-tree 7e52bab9810b4e7e90d28f47f171943188e0fde2 (from 5bd54f9f3d00883be621ebee17f159b10e540776)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Mar 29 21:17:39 2007 +0200

    swfdec_as_frame_new can take the context from the this object

diff --git a/libswfdec/swfdec_as_frame.c b/libswfdec/swfdec_as_frame.c
index 2a3e0a6..8abf677 100644
--- a/libswfdec/swfdec_as_frame.c
+++ b/libswfdec/swfdec_as_frame.c
@@ -73,17 +73,19 @@ swfdec_as_frame_init (SwfdecAsFrame *fra
 }
 
 SwfdecAsFrame *
-swfdec_as_frame_new (SwfdecAsContext *context, SwfdecAsObject *thisp, SwfdecScript *script)
+swfdec_as_frame_new (SwfdecAsObject *thisp, SwfdecScript *script)
 {
   SwfdecAsValue val;
+  SwfdecAsContext *context;
   SwfdecAsFrame *frame;
   SwfdecAsStack *stack;
   gsize size;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
   g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (thisp), NULL);
+  g_return_val_if_fail (thisp->properties, NULL);
   g_return_val_if_fail (script != NULL, NULL);
   
+  context = thisp->context;
   stack = swfdec_as_stack_new (context, 100); /* FIXME: invent better numbers here */
   if (!stack)
     return NULL;
diff --git a/libswfdec/swfdec_as_frame.h b/libswfdec/swfdec_as_frame.h
index 10825de..fb3abd0 100644
--- a/libswfdec/swfdec_as_frame.h
+++ b/libswfdec/swfdec_as_frame.h
@@ -55,8 +55,7 @@ struct _SwfdecAsFrameClass {
 
 GType		swfdec_as_frame_get_type	(void);
 
-SwfdecAsFrame *	swfdec_as_frame_new		(SwfdecAsContext *    	context,
-						 SwfdecAsObject *	thisp,
+SwfdecAsFrame *	swfdec_as_frame_new		(SwfdecAsObject *	thisp,
 						 SwfdecScript *		script);
 
 
diff-tree 5bd54f9f3d00883be621ebee17f159b10e540776 (from 303d67ffb794a469257209fb35f4714dfd1ab670)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Mar 29 21:17:02 2007 +0200

    add swfdec_as_stack_get_size

diff --git a/libswfdec/swfdec_as_stack.h b/libswfdec/swfdec_as_stack.h
index c201e8a..97422a0 100644
--- a/libswfdec/swfdec_as_stack.h
+++ b/libswfdec/swfdec_as_stack.h
@@ -41,6 +41,7 @@ void		swfdec_as_stack_free		(SwfdecAsSta
 #define swfdec_as_stack_peek(stack,n) (&(stack)->cur[-(gssize)(n)])
 #define swfdec_as_stack_pop(stack) (--(stack)->cur)
 #define swfdec_as_stack_push(stack,val) (*(stack)->cur++ = *(val))
+#define swfdec_as_stack_get_size(stack) ((guint)((stack)->cur - (stack)->base))
 
 void		swfdec_as_stack_mark		(SwfdecAsStack *	stack);
 void		swfdec_as_stack_ensure_size	(SwfdecAsStack *	stack,
diff-tree 303d67ffb794a469257209fb35f4714dfd1ab670 (from 15e6e0485ce480ce1532f199e4b03df951ae754b)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Mar 29 16:46:38 2007 +0200

    swfdec_as_object_add now takes over a reference
    
    Also documented it.

diff --git a/libswfdec/swfdec_as_frame.c b/libswfdec/swfdec_as_frame.c
index 632d439..2a3e0a6 100644
--- a/libswfdec/swfdec_as_frame.c
+++ b/libswfdec/swfdec_as_frame.c
@@ -92,7 +92,6 @@ swfdec_as_frame_new (SwfdecAsContext *co
     return NULL;
   frame = g_object_new (SWFDEC_TYPE_AS_FRAME, NULL);
   swfdec_as_object_add (SWFDEC_AS_OBJECT (frame), context, size);
-  g_object_unref (frame);
   frame->next = context->frame;
   context->frame = frame;
   frame->script = swfdec_script_ref (script);
diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 79ce1cf..34db07b 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -74,6 +74,16 @@ swfdec_as_object_init (SwfdecAsObject *o
 {
 }
 
+/**
+ * swfdec_as_object_new:
+ * @context: a #SwfdecAsContext
+ *
+ * Allocates a new Object. This does the same as the Actionscript code 
+ * "new Object()".
+ * <warn>This function may run the garbage collector.</warn>
+ *
+ * Returns: the new object or NULL on out of memory.
+ **/
 SwfdecAsObject *
 swfdec_as_object_new (SwfdecAsContext *context)
 {
@@ -85,10 +95,21 @@ swfdec_as_object_new (SwfdecAsContext *c
     return NULL;
   object = g_object_new (SWFDEC_TYPE_AS_OBJECT, NULL);
   swfdec_as_object_add (object, context, sizeof (SwfdecAsObject));
-  g_object_unref (object);
   return object;
 }
 
+/**
+ * swfdec_as_object_add:
+ * @object: #SwfdecAsObject to make garbage-collected
+ * @context: #SwfdecAsContext that should manage the object
+ * @size: size the object currently uses
+ *
+ * Takes over the reference to @object for the garbage collector of @context. 
+ * The object may not already be part of a different context. The given @size 
+ * must have been allocated before with swfdec_as_context_use_mem ().
+ * Note that after swfdec_as_object_add() the garbage collector might hold the
+ * only reference to @object.
+ **/
 void
 swfdec_as_object_add (SwfdecAsObject *object, SwfdecAsContext *context, gsize size)
 {
@@ -100,7 +121,6 @@ swfdec_as_object_add (SwfdecAsObject *ob
   object->size = size;
   g_hash_table_insert (context->objects, object, object);
   object->properties = g_hash_table_new (g_direct_hash, g_direct_equal);
-  g_object_ref (object);
 }
 
 static void
diff-tree 15e6e0485ce480ce1532f199e4b03df951ae754b (from a3edf76ea058a63d1ef650cf5f57eeb37b893f3a)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Mar 29 16:43:34 2007 +0200

    document swfdec_as_context_(un)use_mem

diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index cbbc378..6f7fe6e 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -67,24 +67,58 @@ swfdec_as_context_abort (SwfdecAsContext
 
 /*** MEMORY MANAGEMENT ***/
 
+/**
+ * swfdec_as_context_use_mem:
+ * @context: a #SwfdecAsContext
+ * @bytes: number of bytes to use
+ *
+ * Registers @bytes additional bytes as in use by the @context. This function
+ * keeps track of the memory that script code consumes. If too many memory is 
+ * in use, this function may decide to abort execution with an out of memory 
+ * error. It may also invoke the garbage collector to free unused memory. Note
+ * that running the garbage collector is a potentially dangerous operation,
+ * since the calling code must ensure that all memory is reachable for the 
+ * garbage collector. Consider the following innocent looking code:
+ * <informalexample><programlisting>SwfdecAsValue *v = swfdec_as_stack_pop (stack);
+ * SwfdecAsObject *object = swfdec_as_object_new (context);
+ * swfdec_as_object_set (object, swfdec_as_context_get_string (context, "something"), v);
+ * </programlisting></informalexample>
+ * This code may cause the value stored in v to be lost, as it is not reachable
+ * when swfdec_as_object_new() invokes the garbage collector. Because of this,
+ * all functions in the Actionscript engine that might invoke the garbage 
+ * collector contain this warning:
+ * <warning>This function may run the garbage collector.</warning>
+ * All memory allocated with this function must be released with 
+ * swfdec_as_context_unuse_mem(), when it is freed.
+ *
+ * Returns: %TRUE if the memory could be allocated. %FALSE on OOM.
+ **/
 gboolean
-swfdec_as_context_use_mem (SwfdecAsContext *context, gsize len)
+swfdec_as_context_use_mem (SwfdecAsContext *context, gsize bytes)
 {
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), FALSE);
-  g_return_val_if_fail (len > 0, FALSE);
+  g_return_val_if_fail (bytes > 0, FALSE);
 
-  context->memory += len;
+  context->memory += bytes;
   return TRUE;
 }
 
+/**
+ * swfdec_as_context_unuse_mem:
+ * @context: a #SwfdecAsContext
+ * @bytes: number of bytes to release
+ *
+ * Releases a number of bytes previously allocated using 
+ * swfdec_as_context_use_mem(). See that function for details.
+ **/
 void
-swfdec_as_context_unuse_mem (SwfdecAsContext *context, gsize len)
+swfdec_as_context_unuse_mem (SwfdecAsContext *context, gsize bytes)
 {
   g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
-  g_return_if_fail (len > 0);
-  g_return_if_fail (context->memory >= len);
+  g_return_if_fail (bytes > 0);
+  g_return_if_fail (context->memory >= bytes);
 
-  context->memory -= len;
+  context->memory -= bytes;
 }
 
 /*** GC ***/
diff --git a/libswfdec/swfdec_as_context.h b/libswfdec/swfdec_as_context.h
index 420df04..b3061f7 100644
--- a/libswfdec/swfdec_as_context.h
+++ b/libswfdec/swfdec_as_context.h
@@ -74,9 +74,9 @@ void		swfdec_as_context_abort		(SwfdecAs
 						 const char *		reason);
 
 gboolean	swfdec_as_context_use_mem     	(SwfdecAsContext *	context, 
-						 gsize			len);
+						 gsize			bytes);
 void		swfdec_as_context_unuse_mem   	(SwfdecAsContext *	context,
-						 gsize			len);
+						 gsize			bytes);
 void		swfdec_as_object_mark		(SwfdecAsObject *	object);
 void		swfdec_as_value_mark		(SwfdecAsValue *	value);
 void		swfdec_as_string_mark		(const char *		string);
diff-tree f516f0186bef8f00810f200034d63776bfab9271 (from 7f7d106034cd5fac344b12e3c93562a24ecd825f)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Mar 29 15:37:36 2007 +0200

    s/unsigned int/guint/ to ease Python bindings

diff --git a/libswfdec-gtk/swfdec_playback_alsa.c b/libswfdec-gtk/swfdec_playback_alsa.c
index 8160f1c..b6a2f1a 100644
--- a/libswfdec-gtk/swfdec_playback_alsa.c
+++ b/libswfdec-gtk/swfdec_playback_alsa.c
@@ -120,7 +120,7 @@ try_write (Stream *stream)
 static void
 swfdec_stream_remove_handlers (Stream *stream)
 {
-  unsigned int i;
+  guint i;
 
   for (i = 0; i < stream->n_sources; i++) {
     if (stream->sources[i]) {
@@ -152,7 +152,7 @@ swfdec_stream_install_handlers (Stream *
 {
   if (stream->n_sources > 0) {
     struct pollfd polls[stream->n_sources];
-    unsigned int i, count;
+    guint i, count;
     if (stream->n_sources > 1)
       g_printerr ("attention: more than one fd!\n");
     count = snd_pcm_poll_descriptors (stream->pcm, polls, stream->n_sources);
@@ -198,7 +198,7 @@ swfdec_stream_open (SwfdecPlayback *soun
   Stream *stream;
   snd_pcm_t *ret;
   snd_pcm_hw_params_t *hw_params;
-  unsigned int rate;
+  guint rate;
   snd_pcm_uframes_t uframes;
 
   /* "default" uses dmix, and dmix ticks way slow, so this thingy here stutters */
diff --git a/libswfdec/swfdec_audio_event.h b/libswfdec/swfdec_audio_event.h
index 677edce..6b5bbcd 100644
--- a/libswfdec/swfdec_audio_event.h
+++ b/libswfdec/swfdec_audio_event.h
@@ -43,7 +43,7 @@ struct _SwfdecAudioEvent
 
   SwfdecSound *		sound;	      	/* sound we're playing */
   SwfdecSoundChunk *	chunk;		/* chunk we're playing back */
-  unsigned int		offset;		/* current offset */
+  guint		offset;		/* current offset */
 };
 
 struct _SwfdecAudioEventClass
diff --git a/libswfdec/swfdec_audio_flv.h b/libswfdec/swfdec_audio_flv.h
index 7722126..5a41edc 100644
--- a/libswfdec/swfdec_audio_flv.h
+++ b/libswfdec/swfdec_audio_flv.h
@@ -48,8 +48,8 @@ struct _SwfdecAudioFlv
   gpointer		decoder;	/* decoder used for playback */
 
   SwfdecTick		timestamp;	/* current playback timestamp */
-  unsigned int		next_timestamp;	/* next timestamp in FLV file we request from */
-  unsigned int		playback_skip;	/* number of samples to skip at start of queue */
+  guint		next_timestamp;	/* next timestamp in FLV file we request from */
+  guint		playback_skip;	/* number of samples to skip at start of queue */
   GQueue *		playback_queue;	/* all the samples we've decoded so far */
 };
 
diff --git a/libswfdec/swfdec_audio_stream.h b/libswfdec/swfdec_audio_stream.h
index 8758462..9d31b3c 100644
--- a/libswfdec/swfdec_audio_stream.h
+++ b/libswfdec/swfdec_audio_stream.h
@@ -46,9 +46,9 @@ struct _SwfdecAudioStream
   const SwfdecAudioCodec *codec;	/* codec used by this stream */
   gpointer		decoder;	/* decoder used for this frame */
   SwfdecAudioOut	format;		/* format used by decoder */
-  unsigned int		playback_skip;	/* number of samples to skip at the beginning of queue */
+  guint		playback_skip;	/* number of samples to skip at the beginning of queue */
   GQueue *		playback_queue;	/* all the samples we've decoded so far */
-  unsigned int		current_frame;	/* last decoded frame */
+  guint		current_frame;	/* last decoded frame */
   gboolean		done;		/* TRUE when no new data will be made available */
 };
 
diff --git a/libswfdec/swfdec_bits.c b/libswfdec/swfdec_bits.c
index 46b0581..6e25cf7 100644
--- a/libswfdec/swfdec_bits.c
+++ b/libswfdec/swfdec_bits.c
@@ -87,7 +87,7 @@ swfdec_bits_init (SwfdecBits *bits, Swfd
  * available using swfdec_bits_left() before calling this function.
  **/
 void
-swfdec_bits_init_bits (SwfdecBits *bits, SwfdecBits *from, unsigned int bytes)
+swfdec_bits_init_bits (SwfdecBits *bits, SwfdecBits *from, guint bytes)
 {
   g_return_if_fail (bits != NULL);
   g_return_if_fail (from != NULL);
@@ -122,7 +122,7 @@ swfdec_bits_init_data (SwfdecBits *bits,
   bits->end = bits->ptr + len;
 }
 
-unsigned int 
+guint 
 swfdec_bits_left (SwfdecBits *b)
 {
   if (b->ptr == NULL)
@@ -150,11 +150,11 @@ swfdec_bits_getbit (SwfdecBits * b)
   return r;
 }
 
-unsigned int
-swfdec_bits_getbits (SwfdecBits * b, unsigned int n)
+guint
+swfdec_bits_getbits (SwfdecBits * b, guint n)
 {
   unsigned long r = 0;
-  unsigned int i;
+  guint i;
 
   SWFDEC_BITS_CHECK (b, n);
 
@@ -176,8 +176,8 @@ swfdec_bits_getbits (SwfdecBits * b, uns
   return r;
 }
 
-unsigned int
-swfdec_bits_peekbits (SwfdecBits * b, unsigned int n)
+guint
+swfdec_bits_peekbits (SwfdecBits * b, guint n)
 {
   SwfdecBits tmp = *b;
 
@@ -185,7 +185,7 @@ swfdec_bits_peekbits (SwfdecBits * b, un
 }
 
 int
-swfdec_bits_getsbits (SwfdecBits * b, unsigned int n)
+swfdec_bits_getsbits (SwfdecBits * b, guint n)
 {
   unsigned long r = 0;
 
@@ -198,7 +198,7 @@ swfdec_bits_getsbits (SwfdecBits * b, un
   return r;
 }
 
-unsigned int
+guint
 swfdec_bits_peek_u8 (SwfdecBits * b)
 {
   SWFDEC_BYTES_CHECK (b, 1);
@@ -206,7 +206,7 @@ swfdec_bits_peek_u8 (SwfdecBits * b)
   return *b->ptr;
 }
 
-unsigned int
+guint
 swfdec_bits_get_u8 (SwfdecBits * b)
 {
   SWFDEC_BYTES_CHECK (b, 1);
@@ -214,10 +214,10 @@ swfdec_bits_get_u8 (SwfdecBits * b)
   return *b->ptr++;
 }
 
-unsigned int
+guint
 swfdec_bits_get_u16 (SwfdecBits * b)
 {
-  unsigned int r;
+  guint r;
 
   SWFDEC_BYTES_CHECK (b, 2);
 
@@ -240,10 +240,10 @@ swfdec_bits_get_s16 (SwfdecBits * b)
   return r;
 }
 
-unsigned int
+guint
 swfdec_bits_get_u32 (SwfdecBits * b)
 {
-  unsigned int r;
+  guint r;
 
   SWFDEC_BYTES_CHECK (b, 4);
 
@@ -253,10 +253,10 @@ swfdec_bits_get_u32 (SwfdecBits * b)
   return r;
 }
 
-unsigned int
+guint
 swfdec_bits_get_bu16 (SwfdecBits *b)
 {
-  unsigned int r;
+  guint r;
 
   SWFDEC_BYTES_CHECK (b, 2);
 
@@ -266,10 +266,10 @@ swfdec_bits_get_bu16 (SwfdecBits *b)
   return r;
 }
 
-unsigned int
+guint
 swfdec_bits_get_bu24 (SwfdecBits *b)
 {
-  unsigned int r;
+  guint r;
 
   SWFDEC_BYTES_CHECK (b, 3);
 
@@ -279,10 +279,10 @@ swfdec_bits_get_bu24 (SwfdecBits *b)
   return r;
 }
 
-unsigned int 
+guint 
 swfdec_bits_get_bu32 (SwfdecBits *b)
 {
-  unsigned int r;
+  guint r;
 
   SWFDEC_BYTES_CHECK (b, 4);
 
@@ -478,7 +478,7 @@ swfdec_bits_skip_string (SwfdecBits *bit
 {
   char *s;
   const char *end;
-  unsigned int len;
+  guint len;
 
   swfdec_bits_syncbits (bits);
   end = memchr (bits->ptr, 0, bits->end - bits->ptr);
@@ -522,7 +522,7 @@ swfdec_bits_skip_bytes (SwfdecBits *bits
 }
 
 char *
-swfdec_bits_get_string_length (SwfdecBits * bits, unsigned int len)
+swfdec_bits_get_string_length (SwfdecBits * bits, guint len)
 {
   char *ret;
 
@@ -541,7 +541,7 @@ swfdec_bits_get_string_length (SwfdecBit
 SwfdecColor
 swfdec_bits_get_color (SwfdecBits * bits)
 {
-  unsigned int r, g, b;
+  guint r, g, b;
 
   r = swfdec_bits_get_u8 (bits);
   g = swfdec_bits_get_u8 (bits);
@@ -553,7 +553,7 @@ swfdec_bits_get_color (SwfdecBits * bits
 SwfdecColor
 swfdec_bits_get_rgba (SwfdecBits * bits)
 {
-  unsigned int r, g, b, a;
+  guint r, g, b, a;
 
   r = swfdec_bits_get_u8 (bits);
   g = swfdec_bits_get_u8 (bits);
@@ -567,7 +567,7 @@ SwfdecGradient *
 swfdec_bits_get_gradient (SwfdecBits * bits)
 {
   SwfdecGradient *grad;
-  unsigned int i, n_gradients;
+  guint i, n_gradients;
 
   n_gradients = swfdec_bits_get_u8 (bits);
   grad = g_malloc (sizeof (SwfdecGradient) +
@@ -584,7 +584,7 @@ SwfdecGradient *
 swfdec_bits_get_gradient_rgba (SwfdecBits * bits)
 {
   SwfdecGradient *grad;
-  unsigned int i, n_gradients;
+  guint i, n_gradients;
 
   n_gradients = swfdec_bits_get_u8 (bits);
   grad = g_malloc (sizeof (SwfdecGradient) +
@@ -601,7 +601,7 @@ SwfdecGradient *
 swfdec_bits_get_morph_gradient (SwfdecBits * bits)
 {
   SwfdecGradient *grad;
-  unsigned int i, n_gradients;
+  guint i, n_gradients;
 
   n_gradients = swfdec_bits_get_u8 (bits);
   n_gradients *= 2;
@@ -648,7 +648,7 @@ swfdec_bits_get_buffer (SwfdecBits *bits
   g_return_val_if_fail (len >= -1, NULL);
 
   if (len > 0) {
-    SWFDEC_BYTES_CHECK (bits, (unsigned int) len);
+    SWFDEC_BYTES_CHECK (bits, (guint) len);
   } else {
     g_assert (bits->idx == 0);
     len = bits->end - bits->ptr;
@@ -667,7 +667,7 @@ swfdec_bits_get_buffer (SwfdecBits *bits
 }
 
 static void *
-swfdec_bits_zalloc (void *opaque, unsigned int items, unsigned int size)
+swfdec_bits_zalloc (void *opaque, guint items, guint size)
 {
   return g_malloc (items * size);
 }
@@ -706,7 +706,7 @@ swfdec_bits_decompress (SwfdecBits *bits
 
   /* prepare the bits structure */
   if (compressed > 0) {
-    SWFDEC_BYTES_CHECK (bits, (unsigned int) compressed);
+    SWFDEC_BYTES_CHECK (bits, (guint) compressed);
   } else {
     g_assert (bits->idx == 0);
     compressed = bits->end - bits->ptr;
diff --git a/libswfdec/swfdec_bits.h b/libswfdec/swfdec_bits.h
index 4f7b20a..9e14628 100644
--- a/libswfdec/swfdec_bits.h
+++ b/libswfdec/swfdec_bits.h
@@ -32,26 +32,26 @@ struct _SwfdecBits
 {
   SwfdecBuffer *	buffer;		/* buffer data is taken from or NULL */
   const unsigned char *	ptr;		/* current location to read from */
-  unsigned int		idx;		/* bits already read from ptr */
+  guint		idx;		/* bits already read from ptr */
   const unsigned char *	end;		/* pointer after last byte */
 };
 
 void swfdec_bits_init (SwfdecBits *bits, SwfdecBuffer *buffer);
 void swfdec_bits_init_data (SwfdecBits *bits, const guint8 *data, guint len);
-void swfdec_bits_init_bits (SwfdecBits *bits, SwfdecBits *from, unsigned int bytes);
-unsigned int swfdec_bits_left (SwfdecBits *b);
+void swfdec_bits_init_bits (SwfdecBits *bits, SwfdecBits *from, guint bytes);
+guint swfdec_bits_left (SwfdecBits *b);
 int swfdec_bits_getbit (SwfdecBits * b);
-unsigned int swfdec_bits_getbits (SwfdecBits * b, unsigned int n);
-unsigned int swfdec_bits_peekbits (SwfdecBits * b, unsigned int n);
-int swfdec_bits_getsbits (SwfdecBits * b, unsigned int n);
-unsigned int swfdec_bits_peek_u8 (SwfdecBits * b);
-unsigned int swfdec_bits_get_u8 (SwfdecBits * b);
-unsigned int swfdec_bits_get_u16 (SwfdecBits * b);
+guint swfdec_bits_getbits (SwfdecBits * b, guint n);
+guint swfdec_bits_peekbits (SwfdecBits * b, guint n);
+int swfdec_bits_getsbits (SwfdecBits * b, guint n);
+guint swfdec_bits_peek_u8 (SwfdecBits * b);
+guint swfdec_bits_get_u8 (SwfdecBits * b);
+guint swfdec_bits_get_u16 (SwfdecBits * b);
 int swfdec_bits_get_s16 (SwfdecBits * b);
-unsigned int swfdec_bits_get_u32 (SwfdecBits * b);
-unsigned int swfdec_bits_get_bu16 (SwfdecBits *b);
-unsigned int swfdec_bits_get_bu24 (SwfdecBits *b);
-unsigned int swfdec_bits_get_bu32 (SwfdecBits *b);
+guint swfdec_bits_get_u32 (SwfdecBits * b);
+guint swfdec_bits_get_bu16 (SwfdecBits *b);
+guint swfdec_bits_get_bu24 (SwfdecBits *b);
+guint swfdec_bits_get_bu32 (SwfdecBits *b);
 float swfdec_bits_get_float (SwfdecBits * b);
 double swfdec_bits_get_double (SwfdecBits * b);
 double swfdec_bits_get_bdouble (SwfdecBits * b);
@@ -64,7 +64,7 @@ void swfdec_bits_get_matrix (SwfdecBits 
 const char *swfdec_bits_skip_string (SwfdecBits * bits);
 guint swfdec_bits_skip_bytes (SwfdecBits *bits, guint bytes);
 char *swfdec_bits_get_string (SwfdecBits * bits);
-char *swfdec_bits_get_string_length (SwfdecBits * bits, unsigned int len);
+char *swfdec_bits_get_string_length (SwfdecBits * bits, guint len);
 SwfdecColor swfdec_bits_get_color (SwfdecBits * bits);
 SwfdecColor swfdec_bits_get_rgba (SwfdecBits * bits);
 SwfdecGradient *swfdec_bits_get_gradient (SwfdecBits * bits);
diff --git a/libswfdec/swfdec_buffer.c b/libswfdec/swfdec_buffer.c
index 3b8e929..babf3ac 100644
--- a/libswfdec/swfdec_buffer.c
+++ b/libswfdec/swfdec_buffer.c
@@ -110,7 +110,7 @@ swfdec_buffer_free_mem (SwfdecBuffer * b
  * Returns: a new #SwfdecBuffer with buffer->data pointing to new data
  **/
 SwfdecBuffer *
-swfdec_buffer_new_and_alloc (unsigned int size)
+swfdec_buffer_new_and_alloc (guint size)
 {
   SwfdecBuffer *buffer = swfdec_buffer_new ();
 
@@ -131,7 +131,7 @@ swfdec_buffer_new_and_alloc (unsigned in
  * Returns: a new #SwfdecBuffer with buffer->data pointing to new data
  **/
 SwfdecBuffer *
-swfdec_buffer_new_and_alloc0 (unsigned int size)
+swfdec_buffer_new_and_alloc0 (guint size)
 {
   SwfdecBuffer *buffer = swfdec_buffer_new ();
 
@@ -152,7 +152,7 @@ swfdec_buffer_new_and_alloc0 (unsigned i
  * Returns: a new #SwfdecBuffer pointing to @data
  **/
 SwfdecBuffer *
-swfdec_buffer_new_for_data (unsigned char *data, unsigned int size)
+swfdec_buffer_new_for_data (unsigned char *data, guint size)
 {
   SwfdecBuffer *buffer;
   
@@ -185,7 +185,7 @@ swfdec_buffer_free_subbuffer (SwfdecBuff
  * Returns: a new #SwfdecBuffer managing the indicated region.
  **/
 SwfdecBuffer *
-swfdec_buffer_new_subbuffer (SwfdecBuffer * buffer, unsigned int offset, unsigned int length)
+swfdec_buffer_new_subbuffer (SwfdecBuffer * buffer, guint offset, guint length)
 {
   SwfdecBuffer *subbuffer;
   
@@ -368,7 +368,7 @@ swfdec_buffer_queue_pull_buffer (SwfdecB
 }
 
 SwfdecBuffer *
-swfdec_buffer_queue_pull (SwfdecBufferQueue * queue, unsigned int length)
+swfdec_buffer_queue_pull (SwfdecBufferQueue * queue, guint length)
 {
   GList *g;
   SwfdecBuffer *newbuffer;
@@ -398,7 +398,7 @@ swfdec_buffer_queue_pull (SwfdecBufferQu
     queue->buffers = g_list_remove (queue->buffers, buffer);
     newbuffer = buffer;
   } else {
-    unsigned int offset = 0;
+    guint offset = 0;
 
     newbuffer = swfdec_buffer_new_and_alloc (length);
 
@@ -407,7 +407,7 @@ swfdec_buffer_queue_pull (SwfdecBufferQu
       buffer = g->data;
 
       if (buffer->length > length - offset) {
-        unsigned int n = length - offset;
+        guint n = length - offset;
 
         oil_copy_u8 (newbuffer->data + offset, buffer->data, n);
         subbuffer = swfdec_buffer_new_subbuffer (buffer, n, buffer->length - n);
@@ -442,12 +442,12 @@ swfdec_buffer_queue_pull (SwfdecBufferQu
  *          readonly #SwfdecBuffer. Use swfdec_buffer_unref() after use.
  **/
 SwfdecBuffer *
-swfdec_buffer_queue_peek (SwfdecBufferQueue * queue, unsigned int length)
+swfdec_buffer_queue_peek (SwfdecBufferQueue * queue, guint length)
 {
   GList *g;
   SwfdecBuffer *newbuffer;
   SwfdecBuffer *buffer;
-  unsigned int offset = 0;
+  guint offset = 0;
 
   g_return_val_if_fail (length > 0, NULL);
 
diff --git a/libswfdec/swfdec_buffer.h b/libswfdec/swfdec_buffer.h
index 38a7f2f..95b89f0 100644
--- a/libswfdec/swfdec_buffer.h
+++ b/libswfdec/swfdec_buffer.h
@@ -31,7 +31,7 @@ typedef struct _SwfdecBufferQueue Swfdec
 struct _SwfdecBuffer
 {
   unsigned char *data;
-  unsigned int length;
+  guint length;
 
   int ref_count;
 
@@ -47,8 +47,8 @@ GType swfdec_buffer_get_type  (void);
 struct _SwfdecBufferQueue
 {
   GList *buffers;
-  unsigned int depth;
-  unsigned int offset;
+  guint depth;
+  guint offset;
   
   int ref_count;
 };
@@ -57,11 +57,11 @@ struct _SwfdecBufferQueue
 GType swfdec_buffer_queue_get_type  (void);
 
 SwfdecBuffer *swfdec_buffer_new (void);
-SwfdecBuffer *swfdec_buffer_new_and_alloc (unsigned int size);
-SwfdecBuffer *swfdec_buffer_new_and_alloc0 (unsigned int size);
-SwfdecBuffer *swfdec_buffer_new_for_data (unsigned char *data, unsigned int size);
-SwfdecBuffer *swfdec_buffer_new_subbuffer (SwfdecBuffer * buffer, unsigned int offset,
-    unsigned int length);
+SwfdecBuffer *swfdec_buffer_new_and_alloc (guint size);
+SwfdecBuffer *swfdec_buffer_new_and_alloc0 (guint size);
+SwfdecBuffer *swfdec_buffer_new_for_data (unsigned char *data, guint size);
+SwfdecBuffer *swfdec_buffer_new_subbuffer (SwfdecBuffer * buffer, guint offset,
+    guint length);
 SwfdecBuffer *swfdec_buffer_new_from_file (const char *filename, GError **error);
 SwfdecBuffer *swfdec_buffer_ref (SwfdecBuffer * buffer);
 void swfdec_buffer_unref (SwfdecBuffer * buffer);
@@ -72,9 +72,9 @@ int swfdec_buffer_queue_get_depth (Swfde
 int swfdec_buffer_queue_get_offset (SwfdecBufferQueue * queue);
 void swfdec_buffer_queue_push (SwfdecBufferQueue * queue,
     SwfdecBuffer * buffer);
-SwfdecBuffer *swfdec_buffer_queue_pull (SwfdecBufferQueue * queue, unsigned int length);
+SwfdecBuffer *swfdec_buffer_queue_pull (SwfdecBufferQueue * queue, guint length);
 SwfdecBuffer *swfdec_buffer_queue_pull_buffer (SwfdecBufferQueue * queue);
-SwfdecBuffer *swfdec_buffer_queue_peek (SwfdecBufferQueue * queue, unsigned int length);
+SwfdecBuffer *swfdec_buffer_queue_peek (SwfdecBufferQueue * queue, guint length);
 SwfdecBufferQueue *swfdec_buffer_queue_ref (SwfdecBufferQueue * queue);
 void swfdec_buffer_queue_unref (SwfdecBufferQueue * queue);
 #endif
diff --git a/libswfdec/swfdec_cache.c b/libswfdec/swfdec_cache.c
index 0620b51..09d58a0 100644
--- a/libswfdec/swfdec_cache.c
+++ b/libswfdec/swfdec_cache.c
@@ -26,7 +26,7 @@
 #include "swfdec_debug.h"
 
 SwfdecCache *
-swfdec_cache_new (unsigned int max_size)
+swfdec_cache_new (guint max_size)
 {
   SwfdecCache *cache;
   
@@ -62,7 +62,7 @@ swfdec_cache_unref (SwfdecCache *cache)
   g_free (cache);
 }
 
-unsigned int
+guint
 swfdec_cache_get_usage (SwfdecCache *cache)
 {
   g_return_val_if_fail (cache != NULL, 0);
@@ -71,7 +71,7 @@ swfdec_cache_get_usage (SwfdecCache *cac
 }
 
 void
-swfdec_cache_shrink (SwfdecCache *cache, unsigned int max_usage)
+swfdec_cache_shrink (SwfdecCache *cache, guint max_usage)
 {
   g_return_if_fail (cache != NULL);
 
diff --git a/libswfdec/swfdec_cache.h b/libswfdec/swfdec_cache.h
index aefc108..c19be85 100644
--- a/libswfdec/swfdec_cache.h
+++ b/libswfdec/swfdec_cache.h
@@ -29,26 +29,26 @@ G_BEGIN_DECLS
 //typedef struct _SwfdecCacheHandle SwfdecCacheHandle;
 
 struct _SwfdecCache {
-  unsigned int	refcount;		/* reference count */
-  unsigned int	max_size;		/* max size of cache */
-  unsigned int	usage;			/* current size of cache */
+  guint	refcount;		/* reference count */
+  guint	max_size;		/* max size of cache */
+  guint	usage;			/* current size of cache */
 
   GQueue *	queue;			/* queue of loaded SwfdecCacheHandle, sorted by most recently used */
 };
 
 struct _SwfdecCacheHandle {
-  unsigned int		size;	      	/* size of this item */
+  guint		size;	      	/* size of this item */
 
   GDestroyNotify	unload;		/* function called when unloading this handle */
 };
 
-SwfdecCache *	swfdec_cache_new		(unsigned int		max_size);
+SwfdecCache *	swfdec_cache_new		(guint		max_size);
 void		swfdec_cache_ref		(SwfdecCache *		cache);
 void		swfdec_cache_unref		(SwfdecCache *		cache);
 
-unsigned int	swfdec_cache_get_usage	  	(SwfdecCache *		cache);
+guint	swfdec_cache_get_usage	  	(SwfdecCache *		cache);
 void		swfdec_cache_shrink		(SwfdecCache *		cache,
-						 unsigned int		max_usage);
+						 guint		max_usage);
 void		swfdec_cache_add_handle		(SwfdecCache *	  	cache,
 						 const SwfdecCacheHandle *handle);
 void		swfdec_cache_remove_handle    	(SwfdecCache *	  	cache,
diff --git a/libswfdec/swfdec_codec.h b/libswfdec/swfdec_codec.h
index 0dcc24e..58acaaf 100644
--- a/libswfdec/swfdec_codec.h
+++ b/libswfdec/swfdec_codec.h
@@ -58,8 +58,8 @@ struct _SwfdecAudioCodec {
 struct _SwfdecVideoCodec {
   gpointer		(* init)	(void);
   gboolean	    	(* get_size)	(gpointer	codec_data,
-					 unsigned int *	width,
-					 unsigned int *	height);
+					 guint *	width,
+					 guint *	height);
   SwfdecBuffer *	(* decode)	(gpointer	codec_data,
 					 SwfdecBuffer *	buffer);
   void			(* finish)	(gpointer	codec_data);
diff --git a/libswfdec/swfdec_codec_ffmpeg.c b/libswfdec/swfdec_codec_ffmpeg.c
index 127e1bd..b34bd66 100644
--- a/libswfdec/swfdec_codec_ffmpeg.c
+++ b/libswfdec/swfdec_codec_ffmpeg.c
@@ -229,7 +229,7 @@ swfdec_codec_ffmpeg_h263_init (void)
 
 static gboolean
 swfdec_codec_ffmpeg_video_get_size (gpointer codec_data,
-    unsigned int *width, unsigned int *height)
+    guint *width, guint *height)
 {
   SwfdecCodecFFMpegVideo *codec = codec_data;
   AVCodecContext *ctx = codec->ctx;
diff --git a/libswfdec/swfdec_codec_mad.c b/libswfdec/swfdec_codec_mad.c
index fa59e9c..054de4f 100644
--- a/libswfdec/swfdec_codec_mad.c
+++ b/libswfdec/swfdec_codec_mad.c
@@ -144,7 +144,7 @@ swfdec_codec_mad_decode (gpointer datap,
   MadData *data = datap;
   SwfdecBuffer *out;
   SwfdecBufferQueue *queue;
-  unsigned int amount = 0, size;
+  guint amount = 0, size;
 
   queue = swfdec_buffer_queue_new ();
 
diff --git a/libswfdec/swfdec_codec_screen.c b/libswfdec/swfdec_codec_screen.c
index 417fc58..259cf63 100644
--- a/libswfdec/swfdec_codec_screen.c
+++ b/libswfdec/swfdec_codec_screen.c
@@ -47,7 +47,7 @@ swfdec_codec_screen_init (void)
 
 static gboolean
 swfdec_codec_screen_get_size (gpointer codec_data,
-    unsigned int *width, unsigned int *height)
+    guint *width, guint *height)
 {
   SwfdecCodecScreen *screen = codec_data;
 
diff --git a/libswfdec/swfdec_color.c b/libswfdec/swfdec_color.c
index a3e3077..23fda5a 100644
--- a/libswfdec/swfdec_color.c
+++ b/libswfdec/swfdec_color.c
@@ -28,10 +28,10 @@
 #include "swfdec_debug.h"
 
 SwfdecColor 
-swfdec_color_apply_morph (SwfdecColor start, SwfdecColor end, unsigned int ratio)
+swfdec_color_apply_morph (SwfdecColor start, SwfdecColor end, guint ratio)
 {
-  unsigned int r, g, b, a;
-  unsigned int start_ratio, end_ratio;
+  guint r, g, b, a;
+  guint start_ratio, end_ratio;
 
   g_assert (ratio < 65536);
   if (ratio == 0)
diff --git a/libswfdec/swfdec_color.h b/libswfdec/swfdec_color.h
index 878ec66..296311b 100644
--- a/libswfdec/swfdec_color.h
+++ b/libswfdec/swfdec_color.h
@@ -40,7 +40,7 @@ struct swfdec_gradient_entry_struct
 
 struct swfdec_gradient_struct
 {
-  unsigned int n_gradients;
+  guint n_gradients;
   SwfdecGradientEntry array[1];
 };
 
@@ -64,7 +64,7 @@ struct swfdec_gradient_struct
 #define SWFDEC_COLOR_G(x)		(((x)>>8)&0xff)
 #define SWFDEC_COLOR_B(x)		((x)&0xff)
 
-SwfdecColor swfdec_color_apply_morph (SwfdecColor start, SwfdecColor end, unsigned int ratio);
+SwfdecColor swfdec_color_apply_morph (SwfdecColor start, SwfdecColor end, guint ratio);
 void swfdec_color_set_source (cairo_t *cr, SwfdecColor color);
 void swfdec_color_transform_init_identity (SwfdecColorTransform * trans);
 void swfdec_color_transform_init_color (SwfdecColorTransform *trans, SwfdecColor color);
diff --git a/libswfdec/swfdec_debug.c b/libswfdec/swfdec_debug.c
index cf95a14..d18e8a7 100644
--- a/libswfdec/swfdec_debug.c
+++ b/libswfdec/swfdec_debug.c
@@ -39,10 +39,10 @@ static const char *swfdec_debug_level_na
 #  define SWFDEC_LEVEL_DEFAULT SWFDEC_LEVEL_ERROR
 #endif
 
-static unsigned int swfdec_debug_level = SWFDEC_LEVEL_DEFAULT;
+static guint swfdec_debug_level = SWFDEC_LEVEL_DEFAULT;
 
 void
-swfdec_debug_log (unsigned int level, const char *file, const char *function,
+swfdec_debug_log (guint level, const char *file, const char *function,
     int line, const char *format, ...)
 {
   va_list varargs;
@@ -61,7 +61,7 @@ swfdec_debug_log (unsigned int level, co
 }
 
 void
-swfdec_debug_set_level (unsigned int level)
+swfdec_debug_set_level (guint level)
 {
   if (swfdec_debug_level >= G_N_ELEMENTS (swfdec_debug_level_names))
     swfdec_debug_level = G_N_ELEMENTS (swfdec_debug_level_names) - 1;
diff --git a/libswfdec/swfdec_debug.h b/libswfdec/swfdec_debug.h
index 2a59774..60eec2a 100644
--- a/libswfdec/swfdec_debug.h
+++ b/libswfdec/swfdec_debug.h
@@ -49,9 +49,9 @@ enum {
   swfdec_debug_log ((level), __FILE__, G_GNUC_FUNCTION, __LINE__, __VA_ARGS__)
 #endif
 
-void swfdec_debug_log (unsigned int level, const char *file, const char *function,
+void swfdec_debug_log (guint level, const char *file, const char *function,
     int line, const char *format, ...) G_GNUC_PRINTF (5, 6);
-void swfdec_debug_set_level (unsigned int level);
+void swfdec_debug_set_level (guint level);
 int swfdec_debug_get_level (void);
 
 #endif
diff --git a/libswfdec/swfdec_edittext.c b/libswfdec/swfdec_edittext.c
index 37727eb..151feb2 100644
--- a/libswfdec/swfdec_edittext.c
+++ b/libswfdec/swfdec_edittext.c
@@ -97,7 +97,7 @@ int
 tag_func_define_edit_text (SwfdecSwfDecoder * s)
 {
   SwfdecEditText *text;
-  unsigned int id;
+  guint id;
   int reserved, use_outlines;
   gboolean has_font, has_color, has_max_length, has_layout, has_text;
   SwfdecBits *b = &s->b;
@@ -154,7 +154,7 @@ tag_func_define_edit_text (SwfdecSwfDeco
     text->max_length = swfdec_bits_get_u16 (b);
   }
   if (has_layout) {
-    unsigned int align = swfdec_bits_get_u8 (b);
+    guint align = swfdec_bits_get_u8 (b);
     switch (align) {
       case 0:
 	text->align = PANGO_ALIGN_LEFT;
diff --git a/libswfdec/swfdec_edittext.h b/libswfdec/swfdec_edittext.h
index 55de794..d6051ec 100644
--- a/libswfdec/swfdec_edittext.h
+++ b/libswfdec/swfdec_edittext.h
@@ -45,7 +45,7 @@ struct _SwfdecEditText
   /* text info */
   char *		text;		/* initial displayed text or NULL if none */
   gboolean		password;	/* if text is a password and should be displayed as '*' */
-  unsigned int		max_length;	/* maximum number of characters */
+  guint		max_length;	/* maximum number of characters */
   gboolean		html;		/* text is pseudo-html */
 
   /* layout info */
@@ -54,15 +54,15 @@ struct _SwfdecEditText
   gboolean		multiline;
   PangoAlignment	align;
   gboolean		justify;
-  unsigned int		indent;		/* first line indentation */
+  guint		indent;		/* first line indentation */
   int			spacing;	/* spacing between lines */
   /* visual info */
   SwfdecColor		color;		/* text color */
   gboolean		selectable;
   gboolean		border;		/* draw a border around the text field */
-  unsigned int		height;
-  unsigned int		left_margin;
-  unsigned int		right_margin;
+  guint		height;
+  guint		left_margin;
+  guint		right_margin;
   gboolean		autosize;	/* FIXME: implement */
 
   /* variable info */
diff --git a/libswfdec/swfdec_event.c b/libswfdec/swfdec_event.c
index 66d6aa7..af41b9e 100644
--- a/libswfdec/swfdec_event.c
+++ b/libswfdec/swfdec_event.c
@@ -30,7 +30,7 @@
 typedef struct _SwfdecEvent SwfdecEvent;
 
 struct _SwfdecEvent {
-  unsigned int	conditions;
+  guint	conditions;
   guint8	key;
   SwfdecScript *script;
 };
@@ -140,7 +140,7 @@ swfdec_event_list_copy (SwfdecEventList 
 void
 swfdec_event_list_free (SwfdecEventList *list)
 {
-  unsigned int i;
+  guint i;
 
   g_return_if_fail (list != NULL);
 
@@ -157,7 +157,7 @@ swfdec_event_list_free (SwfdecEventList 
 }
 
 static const char *
-swfdec_event_list_condition_name (unsigned int conditions)
+swfdec_event_list_condition_name (guint conditions)
 {
   if (conditions & SWFDEC_EVENT_LOAD)
     return "Load";
@@ -202,7 +202,7 @@ swfdec_event_list_condition_name (unsign
 
 void
 swfdec_event_list_parse (SwfdecEventList *list, SwfdecBits *bits, int version,
-    unsigned int conditions, guint8 key, const char *description)
+    guint conditions, guint8 key, const char *description)
 {
   SwfdecEvent event;
   char *name;
@@ -223,9 +223,9 @@ swfdec_event_list_parse (SwfdecEventList
 
 void
 swfdec_event_list_execute (SwfdecEventList *list, SwfdecScriptable *scriptable, 
-    unsigned int condition, guint8 key)
+    guint condition, guint8 key)
 {
-  unsigned int i;
+  guint i;
 
   g_return_if_fail (list != NULL);
 
@@ -241,9 +241,9 @@ swfdec_event_list_execute (SwfdecEventLi
 
 gboolean
 swfdec_event_list_has_conditions (SwfdecEventList *list, SwfdecScriptable *scriptable,
-    unsigned int condition, guint8 key)
+    guint condition, guint8 key)
 {
-  unsigned int i;
+  guint i;
   const char *name;
 
   g_return_val_if_fail (list != NULL, FALSE);
diff --git a/libswfdec/swfdec_event.h b/libswfdec/swfdec_event.h
index 768dc8d..604e74b 100644
--- a/libswfdec/swfdec_event.h
+++ b/libswfdec/swfdec_event.h
@@ -57,16 +57,16 @@ void			swfdec_event_list_free		(SwfdecEv
 void			swfdec_event_list_parse		(SwfdecEventList *    list,
 							 SwfdecBits *	      bits,
 							 int		      version,
-							 unsigned int	      conditions,
+							 guint	      conditions,
 							 guint8		      key,
 							 const char *	      description);
 void			swfdec_event_list_execute	(SwfdecEventList *    list,
 							 SwfdecScriptable *	scriptable,
-							 unsigned int	      condition,
+							 guint	      condition,
 							 guint8		      key);
 gboolean		swfdec_event_list_has_conditions(SwfdecEventList *    list,
 							 SwfdecScriptable *	scriptable,
-							 unsigned int	      conditions,
+							 guint	      conditions,
 							 guint8		      key);
 							 
 
diff --git a/libswfdec/swfdec_font.c b/libswfdec/swfdec_font.c
index 03157b1..6794e0f 100644
--- a/libswfdec/swfdec_font.c
+++ b/libswfdec/swfdec_font.c
@@ -73,7 +73,7 @@ swfdec_font_init (SwfdecFont * font)
  * Returns: the shape of the requested glyph or %NULL if no such glyph exists.
  **/
 SwfdecShape *
-swfdec_font_get_glyph (SwfdecFont * font, unsigned int glyph)
+swfdec_font_get_glyph (SwfdecFont * font, guint glyph)
 {
   g_return_val_if_fail (SWFDEC_IS_FONT (font), NULL);
   
@@ -112,10 +112,10 @@ convert_from_language (const char *s, Sw
 }
 
 int
-tag_func_define_font_info (SwfdecSwfDecoder *s, unsigned int version)
+tag_func_define_font_info (SwfdecSwfDecoder *s, guint version)
 {
   SwfdecFont *font;
-  unsigned int id, len, i;
+  guint id, len, i;
   int reserved, wide, ansi, jis;
   char *name;
   /* we just assume Latin1 (FIXME: option to change this?) */
@@ -198,7 +198,7 @@ swfdec_font_parse_shape (SwfdecSwfDecode
 int
 tag_func_define_font (SwfdecSwfDecoder * s)
 {
-  unsigned int i, id, n_glyphs, offset, next_offset;
+  guint i, id, n_glyphs, offset, next_offset;
   SwfdecFont *font;
   SwfdecBits offsets;
 
@@ -257,7 +257,7 @@ int
 tag_func_define_font_2 (SwfdecSwfDecoder * s)
 {
   SwfdecBits *bits = &s->b;
-  unsigned int id;
+  guint id;
   SwfdecShape *shape;
   SwfdecFont *font;
   SwfdecRect rect;
diff --git a/libswfdec/swfdec_font.h b/libswfdec/swfdec_font.h
index babfa5a..a14aa42 100644
--- a/libswfdec/swfdec_font.h
+++ b/libswfdec/swfdec_font.h
@@ -74,10 +74,10 @@ struct _SwfdecFontClass
 GType		swfdec_font_get_type		(void);
 
 SwfdecShape *	swfdec_font_get_glyph		(SwfdecFont *		font, 
-						 unsigned int		glyph);
+						 guint		glyph);
 
 int		tag_func_define_font_info	(SwfdecSwfDecoder *	s,
-						 unsigned int		version);
+						 guint		version);
 int		tag_func_define_font		(SwfdecSwfDecoder *	s);
 int		tag_func_define_font_2		(SwfdecSwfDecoder *	s);
 int		tag_func_define_font_3		(SwfdecSwfDecoder *	s);
diff --git a/libswfdec/swfdec_html_parser.c b/libswfdec/swfdec_html_parser.c
index e94a0ed..7f3ffa0 100644
--- a/libswfdec/swfdec_html_parser.c
+++ b/libswfdec/swfdec_html_parser.c
@@ -361,7 +361,7 @@ swfdec_edit_text_render (SwfdecEditText 
   guint i;
   PangoFontDescription *desc;
   PangoLayout *layout;
-  unsigned int width;
+  guint width;
   SwfdecColor color;
 
   g_return_if_fail (SWFDEC_IS_EDIT_TEXT (text));
diff --git a/libswfdec/swfdec_image.c b/libswfdec/swfdec_image.c
index 79e353a..69a3f17 100644
--- a/libswfdec/swfdec_image.c
+++ b/libswfdec/swfdec_image.c
@@ -343,7 +343,7 @@ swfdec_image_lossless_load (SwfdecImage 
     SwfdecBuffer *buffer;
     unsigned char *indexed_data;
     guint i;
-    unsigned int rowstride = (image->width + 3) & ~3;
+    guint rowstride = (image->width + 3) & ~3;
 
     image->data = g_malloc (4 * image->width * image->height);
     image->rowstride = image->width * 4;
@@ -403,7 +403,7 @@ swfdec_image_lossless_load (SwfdecImage 
     swfdec_buffer_unref (buffer);
   } else if (format == 4) {
     int i, j;
-    unsigned int c;
+    guint c;
     unsigned char *idata;
     SwfdecBuffer *buffer;
 
diff --git a/libswfdec/swfdec_js_color.c b/libswfdec/swfdec_js_color.c
index 0984207..fe7b1f0 100644
--- a/libswfdec/swfdec_js_color.c
+++ b/libswfdec/swfdec_js_color.c
@@ -77,7 +77,7 @@ swfdec_js_color_get_transform (JSContext
 static JSBool
 swfdec_js_color_set_rgb (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
-  unsigned int color;
+  guint color;
   SwfdecMovie *movie = JS_GetPrivate (cx, obj);
 
   if (!movie)
diff --git a/libswfdec/swfdec_js_global.c b/libswfdec/swfdec_js_global.c
index 02e9a55..ddbdfd4 100644
--- a/libswfdec/swfdec_js_global.c
+++ b/libswfdec/swfdec_js_global.c
@@ -36,9 +36,9 @@ typedef struct _SwfdecJSInterval SwfdecJ
 struct _SwfdecJSInterval {
   SwfdecTimeout		timeout;
   SwfdecPlayer *	player;		/* needed so it can be readded */
-  unsigned int		id;		/* id this interval is identified with */
-  unsigned int		msecs;		/* interval in milliseconds */
-  unsigned int		n_args;		/* number of arguments to call function with */
+  guint		id;		/* id this interval is identified with */
+  guint		msecs;		/* interval in milliseconds */
+  guint		n_args;		/* number of arguments to call function with */
   jsval			vals[0];	/* values: 0 is function, 1 is object, 2-n are arguments */
 };
 
@@ -97,7 +97,7 @@ swfdec_js_global_setInterval (JSContext 
   SwfdecPlayer *player = JS_GetContextPrivate (cx);
   JSObject *object;
   jsval fun;
-  unsigned int i, n_args, first_arg, msecs;
+  guint i, n_args, first_arg, msecs;
   SwfdecJSInterval *interval;
 
   if (!JSVAL_IS_OBJECT (argv[0])) {
diff --git a/libswfdec/swfdec_morph_movie.c b/libswfdec/swfdec_morph_movie.c
index 82673ee..85ccc96 100644
--- a/libswfdec/swfdec_morph_movie.c
+++ b/libswfdec/swfdec_morph_movie.c
@@ -45,7 +45,7 @@ swfdec_morph_movie_render (SwfdecMovie *
 {
   SwfdecMorphMovie *morph = SWFDEC_MORPH_MOVIE (movie);
   SwfdecShape *shape = SWFDEC_SHAPE (morph->morph);
-  unsigned int i;
+  guint i;
 
   cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
   cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
diff --git a/libswfdec/swfdec_morphshape.h b/libswfdec/swfdec_morphshape.h
index 42308fe..e09133c 100644
--- a/libswfdec/swfdec_morphshape.h
+++ b/libswfdec/swfdec_morphshape.h
@@ -41,8 +41,8 @@ struct _SwfdecMorphShape {
   GArray *		end_vecs;	/* end vectors */
 
   /* used while parsing */
-  unsigned int		n_fill_bits;
-  unsigned int		n_line_bits;
+  guint		n_fill_bits;
+  guint		n_line_bits;
 };
 
 struct _SwfdecMorphShapeClass {
diff --git a/libswfdec/swfdec_movie.h b/libswfdec/swfdec_movie.h
index 2890f9c..f1db624 100644
--- a/libswfdec/swfdec_movie.h
+++ b/libswfdec/swfdec_movie.h
@@ -45,7 +45,7 @@ struct _SwfdecContent {
   SwfdecGraphic *	graphic;	/* object to display or NULL */
   int	         	depth;		/* at which depth to display */
   int			clip_depth;	/* clip depth of object */
-  unsigned int		ratio;
+  guint		ratio;
   cairo_matrix_t	transform;
   SwfdecColorTransform	color_transform;
   char *		name;
diff --git a/libswfdec/swfdec_pattern.c b/libswfdec/swfdec_pattern.c
index f2d665a..4e32436 100644
--- a/libswfdec/swfdec_pattern.c
+++ b/libswfdec/swfdec_pattern.c
@@ -15,9 +15,9 @@
 
 static void
 swfdec_matrix_morph (cairo_matrix_t *dest, const cairo_matrix_t *start,
-    const cairo_matrix_t *end, unsigned int ratio)
+    const cairo_matrix_t *end, guint ratio)
 {
-  unsigned int inv_ratio = 65535 - ratio;
+  guint inv_ratio = 65535 - ratio;
   g_assert (ratio < 65536);
 
   if (ratio == 0) {
@@ -143,7 +143,7 @@ swfdec_pattern_append_path_snapped (cair
 
 static void
 swfdec_stroke_pattern_paint (SwfdecPattern *pattern, cairo_t *cr, const cairo_path_t *path,
-    const SwfdecColorTransform *trans, unsigned int ratio)
+    const SwfdecColorTransform *trans, guint ratio)
 {
   SwfdecColor color;
   double width;
@@ -206,7 +206,7 @@ G_DEFINE_TYPE (SwfdecColorPattern, swfde
 
 static void
 swfdec_color_pattern_paint (SwfdecPattern *pat, cairo_t *cr, const cairo_path_t *path,
-    const SwfdecColorTransform *trans, unsigned int ratio)
+    const SwfdecColorTransform *trans, guint ratio)
 {
   SwfdecColorPattern *pattern = SWFDEC_COLOR_PATTERN (pat);
   SwfdecColor color;
@@ -259,7 +259,7 @@ G_DEFINE_TYPE (SwfdecImagePattern, swfde
 
 static void
 swfdec_image_pattern_paint (SwfdecPattern *pat, cairo_t *cr, const cairo_path_t *path,
-    const SwfdecColorTransform *trans, unsigned int ratio)
+    const SwfdecColorTransform *trans, guint ratio)
 {
   SwfdecImagePattern *image = SWFDEC_IMAGE_PATTERN (pat);
   cairo_pattern_t *pattern;
@@ -322,9 +322,9 @@ G_DEFINE_TYPE (SwfdecGradientPattern, sw
 
 static void
 swfdec_gradient_pattern_paint (SwfdecPattern *pat, cairo_t *cr, const cairo_path_t *path,
-    const SwfdecColorTransform *trans, unsigned int ratio)
+    const SwfdecColorTransform *trans, guint ratio)
 {
-  unsigned int i;
+  guint i;
   cairo_pattern_t *pattern;
   SwfdecColor color;
   double offset;
@@ -417,7 +417,7 @@ swfdec_gradient_pattern_init (SwfdecGrad
 SwfdecPattern *
 swfdec_pattern_parse (SwfdecSwfDecoder *dec, gboolean rgba)
 {
-  unsigned int paint_style_type;
+  guint paint_style_type;
   SwfdecBits *bits;
   SwfdecPattern *pattern;
 
@@ -503,7 +503,7 @@ swfdec_pattern_parse (SwfdecSwfDecoder *
 SwfdecPattern *
 swfdec_pattern_parse_morph (SwfdecSwfDecoder *dec)
 {
-  unsigned int paint_style_type;
+  guint paint_style_type;
   SwfdecBits *bits;
   SwfdecPattern *pattern;
 
@@ -586,7 +586,7 @@ swfdec_pattern_parse_morph (SwfdecSwfDec
  **/
 void
 swfdec_pattern_paint (SwfdecPattern *pattern, cairo_t *cr, const cairo_path_t *path,
-    const SwfdecColorTransform *trans, unsigned int ratio)
+    const SwfdecColorTransform *trans, guint ratio)
 {
   SwfdecPatternClass *klass;
 
diff --git a/libswfdec/swfdec_pattern.h b/libswfdec/swfdec_pattern.h
index 875e339..b25dd56 100644
--- a/libswfdec/swfdec_pattern.h
+++ b/libswfdec/swfdec_pattern.h
@@ -36,7 +36,7 @@ struct _SwfdecPatternClass
 					         cairo_t *			cr,
 						 const cairo_path_t *		path,
 						 const SwfdecColorTransform *	trans,
-						 unsigned int			ratio);
+						 guint			ratio);
 };
 
 GType		swfdec_pattern_get_type		(void);
@@ -55,7 +55,7 @@ void		swfdec_pattern_paint		(SwfdecPatte
 						 cairo_t *			cr,
 						 const cairo_path_t *		path,
 						 const SwfdecColorTransform *	trans,
-						 unsigned int			ratio);
+						 guint			ratio);
 void		swfdec_pattern_get_path_extents (SwfdecPattern *		pattern,
 						 const cairo_path_t *		path,
 						 SwfdecRect *			extents);
diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index b9bf7e9..2987e1f 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1431,7 +1431,7 @@ swfdec_player_get_audio (SwfdecPlayer *	
  *
  * Returns: the background color as an ARGB value
  **/
-unsigned int
+guint
 swfdec_player_get_background_color (SwfdecPlayer *player)
 {
   g_return_val_if_fail (SWFDEC_IS_PLAYER (player), SWFDEC_COLOR_COMBINE (0xFF, 0xFF, 0xFF, 0xFF));
@@ -1448,7 +1448,7 @@ swfdec_player_get_background_color (Swfd
  * value to 0. To get a black beackground, use 0xFF000000.
  **/
 void
-swfdec_player_set_background_color (SwfdecPlayer *player, unsigned int color)
+swfdec_player_set_background_color (SwfdecPlayer *player, guint color)
 {
   g_return_if_fail (SWFDEC_IS_PLAYER (player));
 
diff --git a/libswfdec/swfdec_player.h b/libswfdec/swfdec_player.h
index 0c6f70c..0dec934 100644
--- a/libswfdec/swfdec_player.h
+++ b/libswfdec/swfdec_player.h
@@ -63,11 +63,11 @@ double		swfdec_player_get_rate		(SwfdecP
 void		swfdec_player_get_image_size	(SwfdecPlayer *	player,
 						 int *		width,
 						 int *		height);
-unsigned int	swfdec_player_get_background_color 
+guint	swfdec_player_get_background_color 
 						(SwfdecPlayer *	player);
 void		swfdec_player_set_background_color 
 						(SwfdecPlayer *	player,
-						 unsigned int	color);
+						 guint	color);
 					 
 void		swfdec_player_render		(SwfdecPlayer *	player,
 						 cairo_t *	cr,
diff --git a/libswfdec/swfdec_player_internal.h b/libswfdec/swfdec_player_internal.h
index 699a45a..f4de1a1 100644
--- a/libswfdec/swfdec_player_internal.h
+++ b/libswfdec/swfdec_player_internal.h
@@ -42,9 +42,9 @@ struct _SwfdecPlayer
   GObject		object;
 
   /* global properties */
-  unsigned int		rate;			/* divide by 256 to get iterations per second */
-  unsigned int		width;			/* width of movie */
-  unsigned int		height;			/* height of movie */
+  guint		rate;			/* divide by 256 to get iterations per second */
+  guint		width;			/* width of movie */
+  guint		height;			/* height of movie */
   GList *		roots;			/* all the root movies */
   SwfdecCache *		cache;			/* player cache */
   gboolean		bgcolor_set;		/* TRUE if the background color has been set */
@@ -54,7 +54,7 @@ struct _SwfdecPlayer
   /* javascript */
   JSContext *		jscx;			/* global Javascript context */
   JSObject *		jsobj;			/* the global object */
-  unsigned int		interval_id;		/* id returned from setInterval call */
+  guint		interval_id;		/* id returned from setInterval call */
   GList *		intervals;		/* all currently running intervals */
   GHashTable *		registered_classes;	/* name => jsval* to constructor */
   SwfdecListener *	mouse_listener;		/* emitting mouse events */
diff --git a/libswfdec/swfdec_root_movie.c b/libswfdec/swfdec_root_movie.c
index d644b44..36282d7 100644
--- a/libswfdec/swfdec_root_movie.c
+++ b/libswfdec/swfdec_root_movie.c
@@ -189,7 +189,7 @@ swfdec_root_movie_load (SwfdecRootMovie 
   if (g_str_has_prefix (target, "_level")) {
     const char *nr = target + strlen ("_level");
     char *end;
-    unsigned int depth;
+    guint depth;
 
     errno = 0;
     depth = strtoul (nr, &end, 10);
diff --git a/libswfdec/swfdec_root_sprite.c b/libswfdec/swfdec_root_sprite.c
index 1b41237..7159927 100644
--- a/libswfdec/swfdec_root_sprite.c
+++ b/libswfdec/swfdec_root_sprite.c
@@ -113,7 +113,7 @@ int
 tag_func_export_assets (SwfdecSwfDecoder * s)
 {
   SwfdecBits *bits = &s->b;
-  unsigned int count, i;
+  guint count, i;
 
   count = swfdec_bits_get_u16 (bits);
   SWFDEC_LOG ("exporting %u assets", count);
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index a9f16e0..0aff14c 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -2699,7 +2699,7 @@ validate_action (gconstpointer bytecode,
 
 SwfdecScript *
 swfdec_script_new_for_player (SwfdecPlayer *player, SwfdecBits *bits, 
-    const char *name, unsigned int version)
+    const char *name, guint version)
 {
   SwfdecScript *script;
 
@@ -2713,7 +2713,7 @@ swfdec_script_new_for_player (SwfdecPlay
 }
 
 SwfdecScript *
-swfdec_script_new (SwfdecBits *bits, const char *name, unsigned int version)
+swfdec_script_new (SwfdecBits *bits, const char *name, guint version)
 {
   SwfdecScript *script;
   const guchar *start;
diff --git a/libswfdec/swfdec_script.h b/libswfdec/swfdec_script.h
index d55cdbc..b58252b 100644
--- a/libswfdec/swfdec_script.h
+++ b/libswfdec/swfdec_script.h
@@ -50,9 +50,9 @@ struct _SwfdecScript {
   /* must be first arg */
   JSFunction *		fun;			/* function script belongs to or NULL */
   SwfdecBuffer *	buffer;			/* buffer holding the script */
-  unsigned int	  	refcount;		/* reference count */
+  guint	  	refcount;		/* reference count */
   char *		name;			/* name identifying this script */
-  unsigned int		version;		/* version of the script */
+  guint		version;		/* version of the script */
   gpointer		debugger;		/* debugger owning us or NULL */
   /* needed by functions */
   SwfdecBuffer *	constant_pool;		/* constant pool action */
@@ -73,11 +73,11 @@ void		swfdec_constant_pool_free	(SwfdecC
 
 SwfdecScript *	swfdec_script_new		(SwfdecBits *		bits,
 						 const char *		name,
-						 unsigned int	      	version);
+						 guint	      	version);
 SwfdecScript *	swfdec_script_new_for_player  	(SwfdecPlayer *		player,
 						 SwfdecBits *		bits,
 						 const char *		name,
-						 unsigned int	      	version);
+						 guint	      	version);
 void		swfdec_script_ref		(SwfdecScript *		script);
 void		swfdec_script_unref		(SwfdecScript *		script);
 
diff --git a/libswfdec/swfdec_shape.c b/libswfdec/swfdec_shape.c
index 7277d87..49dfa7b 100644
--- a/libswfdec/swfdec_shape.c
+++ b/libswfdec/swfdec_shape.c
@@ -206,7 +206,7 @@ swfdec_shape_vec_init (SwfdecShapeVec *v
 static void
 swfdec_shape_dispose (GObject *object)
 {
-  unsigned int i;
+  guint i;
   SwfdecShape * shape = SWFDEC_SHAPE (object);
 
   for (i = 0; i < shape->vecs->len; i++) {
@@ -233,7 +233,7 @@ swfdec_shape_render (SwfdecGraphic *grap
     const SwfdecColorTransform *trans, const SwfdecRect *inval, gboolean fill)
 {
   SwfdecShape *shape = SWFDEC_SHAPE (graphic);
-  unsigned int i;
+  guint i;
 
   cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
   cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
@@ -878,19 +878,19 @@ swfdec_morph_shape_do_change (SwfdecBits
       SWFDEC_LOG ("   moveto %d,%d", *x, *y);
     }
     if (state_fill_styles0) {
-      unsigned int check = swfdec_bits_getbits (end_bits, morph->n_fill_bits) + 
+      guint check = swfdec_bits_getbits (end_bits, morph->n_fill_bits) + 
 	SWFDEC_SHAPE (morph)->fills_offset;
       if (check != path->fill0style)
 	SWFDEC_ERROR ("end fill0style %u differs from start fill0style %u", check, path->fill0style);
     }
     if (state_fill_styles1) {
-      unsigned int check = swfdec_bits_getbits (end_bits, morph->n_fill_bits) + 
+      guint check = swfdec_bits_getbits (end_bits, morph->n_fill_bits) + 
 	SWFDEC_SHAPE (morph)->fills_offset;
       if (check != path->fill1style)
 	SWFDEC_ERROR ("end fill1style %u differs from start fill1style %u", check, path->fill1style);
     }
     if (state_line_styles) {
-      unsigned int check = swfdec_bits_getbits (end_bits, morph->n_line_bits) + 
+      guint check = swfdec_bits_getbits (end_bits, morph->n_line_bits) + 
 	SWFDEC_SHAPE (morph)->lines_offset;
       if (check != path->linestyle)
 	SWFDEC_ERROR ("end linestyle %u differs from start linestyle %u", check, path->linestyle);
@@ -1005,7 +1005,7 @@ tag_define_morph_shape (SwfdecSwfDecoder
   SwfdecBits end_bits;
   SwfdecBits *bits = &s->b;
   SwfdecMorphShape *morph;
-  unsigned int offset;
+  guint offset;
   int id;
   id = swfdec_bits_get_u16 (bits);
 
diff --git a/libswfdec/swfdec_shape.h b/libswfdec/swfdec_shape.h
index ec7495a..cce6cf8 100644
--- a/libswfdec/swfdec_shape.h
+++ b/libswfdec/swfdec_shape.h
@@ -59,10 +59,10 @@ struct _SwfdecShape
   GPtrArray *fills;
 
   /* used while defining */
-  unsigned int fills_offset;
-  unsigned int lines_offset;
-  unsigned int n_fill_bits;
-  unsigned int n_line_bits;
+  guint fills_offset;
+  guint lines_offset;
+  guint n_fill_bits;
+  guint n_line_bits;
   gboolean rgba;
 };
 
diff --git a/libswfdec/swfdec_sound.c b/libswfdec/swfdec_sound.c
index bc4ea93..f823bc1 100644
--- a/libswfdec/swfdec_sound.c
+++ b/libswfdec/swfdec_sound.c
@@ -333,7 +333,7 @@ swfdec_sound_parse_chunk (SwfdecSwfDecod
   int has_loops;
   int has_out_point;
   int has_in_point;
-  unsigned int i, j;
+  guint i, j;
   SwfdecSound *sound;
   SwfdecSoundChunk *chunk;
   SwfdecBits *b = &s->b;
@@ -435,8 +435,8 @@ tag_func_start_sound (SwfdecSwfDecoder *
 int
 tag_func_define_button_sound (SwfdecSwfDecoder * s)
 {
-  unsigned int i;
-  unsigned int id;
+  guint i;
+  guint id;
   SwfdecButton *button;
 
   id = swfdec_bits_get_u16 (&s->b);
@@ -500,7 +500,7 @@ swfdec_sound_buffer_get_n_samples (const
 void
 swfdec_sound_buffer_render (gint16 *dest, const SwfdecBuffer *source, 
     SwfdecAudioOut format, const SwfdecBuffer *previous, 
-    unsigned int offset, unsigned int n_samples)
+    guint offset, guint n_samples)
 {
   guint i, j;
   guint channels = SWFDEC_AUDIO_OUT_N_CHANNELS (format);
@@ -611,7 +611,7 @@ swfdec_sound_buffer_render (gint16 *dest
  **/
 void
 swfdec_sound_render (SwfdecSound *sound, gint16 *dest,
-    unsigned int offset, unsigned int n_samples)
+    guint offset, guint n_samples)
 {
   SwfdecBuffer *buffer;
   SwfdecAudioOut format;
diff --git a/libswfdec/swfdec_sound.h b/libswfdec/swfdec_sound.h
index ce837db..ea3e9af 100644
--- a/libswfdec/swfdec_sound.h
+++ b/libswfdec/swfdec_sound.h
@@ -41,7 +41,7 @@ typedef struct _SwfdecSoundEnvelope Swfd
 #define SWFDEC_SOUND_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_SOUND, SwfdecSoundClass))
 
 struct _SwfdecSoundEnvelope {
-  unsigned int		offset;			/* offset in frames */
+  guint		offset;			/* offset in frames */
   guint16		volume[2];		/* volume to use */
 };
 
@@ -52,10 +52,10 @@ struct _SwfdecSoundChunk
   int			stop;	      		/* stop the sample being played */
   int			no_restart;	      	/* don't restart if already playing */
 
-  unsigned int		start_sample; 		/* sample at which to start playing */
-  unsigned int		stop_sample;	      	/* first sample to not play anymore */
-  unsigned int		loop_count;		/* amount of times this sample should be played back */
-  unsigned int		n_envelopes;		/* amount of points in the envelope */
+  guint		start_sample; 		/* sample at which to start playing */
+  guint		stop_sample;	      	/* first sample to not play anymore */
+  guint		loop_count;		/* amount of times this sample should be played back */
+  guint		n_envelopes;		/* amount of points in the envelope */
   SwfdecSoundEnvelope *	envelope;		/* volume envelope or NULL if none */
 };
 
@@ -66,8 +66,8 @@ struct _SwfdecSound
   SwfdecAudioFormat	format;			/* format in use */
   gboolean		width;			/* TRUE for 16bit, FALSE for 8bit */
   SwfdecAudioOut	original_format;      	/* channel/rate information */
-  unsigned int		n_samples;		/* total number of samples when decoded to 44100kHz */
-  unsigned int		skip;			/* samples to skip at start */
+  guint		n_samples;		/* total number of samples when decoded to 44100kHz */
+  guint		skip;			/* samples to skip at start */
   SwfdecBuffer *	encoded;		/* encoded data */
 
   SwfdecAudioOut	decoded_format;		/* format of decoded data */
@@ -89,14 +89,14 @@ int tag_func_define_button_sound (Swfdec
 
 void			swfdec_sound_render		(SwfdecSound *		sound, 
 							 gint16 *		dest, 
-							 unsigned int		offset,
-		  					 unsigned int		len);
+							 guint		offset,
+		  					 guint		len);
 void			swfdec_sound_buffer_render	(gint16 *		dest, 
 							 const SwfdecBuffer *	source, 
 							 SwfdecAudioOut		format,
 							 const SwfdecBuffer *	previous, 
-							 unsigned int		offset,
-							 unsigned int		n_samples);
+							 guint		offset,
+							 guint		n_samples);
 guint			swfdec_sound_buffer_get_n_samples (const SwfdecBuffer * buffer, 
                                                          SwfdecAudioOut		format);
 
diff --git a/libswfdec/swfdec_sprite.c b/libswfdec/swfdec_sprite.c
index a993ece..1c6a43f 100644
--- a/libswfdec/swfdec_sprite.c
+++ b/libswfdec/swfdec_sprite.c
@@ -48,7 +48,7 @@ static void
 swfdec_sprite_dispose (GObject *object)
 {
   SwfdecSprite * sprite = SWFDEC_SPRITE (object);
-  unsigned int i;
+  guint i;
 
   if (sprite->live_content) {
     g_hash_table_destroy (sprite->live_content);
@@ -97,7 +97,7 @@ swfdec_sprite_dispose (GObject *object)
 }
 
 void
-swfdec_sprite_add_sound_chunk (SwfdecSprite * sprite, unsigned int frame,
+swfdec_sprite_add_sound_chunk (SwfdecSprite * sprite, guint frame,
     SwfdecBuffer * chunk, int skip, guint n_samples)
 {
   g_assert (sprite->frames != NULL);
@@ -182,7 +182,7 @@ swfdec_content_update_live (SwfdecSprite
 
 /* NB: does not free the action data */
 static void
-swfdec_sprite_remove_last_action (SwfdecSprite * sprite, unsigned int frame_id)
+swfdec_sprite_remove_last_action (SwfdecSprite * sprite, guint frame_id)
 {
   SwfdecSpriteFrame *frame;
   
@@ -466,7 +466,7 @@ swfdec_spriteseg_remove_object (SwfdecSw
 int
 swfdec_spriteseg_remove_object_2 (SwfdecSwfDecoder * s)
 {
-  unsigned int depth;
+  guint depth;
 
   depth = swfdec_bits_get_u16 (&s->b);
   SWFDEC_LOG ("  depth = %u", depth);
@@ -504,8 +504,8 @@ swfdec_sprite_init (SwfdecSprite * sprit
 }
 
 void
-swfdec_sprite_set_n_frames (SwfdecSprite *sprite, unsigned int n_frames,
-    unsigned int rate)
+swfdec_sprite_set_n_frames (SwfdecSprite *sprite, guint n_frames,
+    guint rate)
 {
   guint i;
 
@@ -523,10 +523,10 @@ swfdec_sprite_set_n_frames (SwfdecSprite
   SWFDEC_LOG ("n_frames = %d", sprite->n_frames);
 }
 
-unsigned int
-swfdec_sprite_get_next_frame (SwfdecSprite *sprite, unsigned int current_frame)
+guint
+swfdec_sprite_get_next_frame (SwfdecSprite *sprite, guint current_frame)
 {
-  unsigned int next_frame, n_frames;
+  guint next_frame, n_frames;
 
   g_return_val_if_fail (SWFDEC_IS_SPRITE (sprite), 0);
 
diff --git a/libswfdec/swfdec_sprite.h b/libswfdec/swfdec_sprite.h
index 779cd43..1812302 100644
--- a/libswfdec/swfdec_sprite.h
+++ b/libswfdec/swfdec_sprite.h
@@ -59,7 +59,7 @@ struct _SwfdecSpriteFrame
   SwfdecSound *sound_head;		/* sound head for this frame */
   int sound_skip;			/* samples to skip - maybe even backwards */
   SwfdecBuffer *sound_block;		/* sound chunk to play here or NULL for none */
-  unsigned int sound_samples;		/* number of samples in this frame */
+  guint sound_samples;		/* number of samples in this frame */
   GSList *sound;			/* list of SwfdecSoundChunk events to start playing here */
 
   /* visuals */
@@ -71,11 +71,11 @@ struct _SwfdecSprite
   SwfdecGraphic		graphic;
 
   SwfdecSpriteFrame *	frames;		/* the n_frames different frames */
-  unsigned int		n_frames;	/* number of frames in this sprite */
+  guint		n_frames;	/* number of frames in this sprite */
   SwfdecScript *	init_action;	/* action to run when initializing this sprite */
 
   /* parse state */
-  unsigned int		parse_frame;	/* frame we're currently parsing. == n_frames if done parsing */
+  guint		parse_frame;	/* frame we're currently parsing. == n_frames if done parsing */
   GHashTable *		live_content;	/* depth->SwfdecSpriteContent for every content in parse_frame */
 };
 
@@ -87,12 +87,12 @@ struct _SwfdecSpriteClass
 GType swfdec_sprite_get_type (void);
 
 int tag_func_define_sprite (SwfdecSwfDecoder * s);
-void swfdec_sprite_add_sound_chunk (SwfdecSprite * sprite, unsigned int frame,
-    SwfdecBuffer * chunk, int skip, unsigned int n_samples);
-void swfdec_sprite_set_n_frames (SwfdecSprite *sprite, unsigned int n_frames, unsigned int rate);
+void swfdec_sprite_add_sound_chunk (SwfdecSprite * sprite, guint frame,
+    SwfdecBuffer * chunk, int skip, guint n_samples);
+void swfdec_sprite_set_n_frames (SwfdecSprite *sprite, guint n_frames, guint rate);
 void swfdec_sprite_add_action (SwfdecSprite * sprite,
     SwfdecSpriteActionType type, gpointer data);
-unsigned int swfdec_sprite_get_next_frame (SwfdecSprite *sprite, unsigned int current_frame);
+guint swfdec_sprite_get_next_frame (SwfdecSprite *sprite, guint current_frame);
 int		swfdec_sprite_get_frame		(SwfdecSprite *		sprite,
 				      		 const char *		label);
 
diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c
index f23c4c1..a114315 100644
--- a/libswfdec/swfdec_sprite_movie.c
+++ b/libswfdec/swfdec_sprite_movie.c
@@ -224,7 +224,7 @@ static void
 swfdec_sprite_movie_iterate (SwfdecMovie *mov)
 {
   SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (mov);
-  unsigned int goto_frame;
+  guint goto_frame;
 
   if (mov->will_be_removed)
     return;
diff --git a/libswfdec/swfdec_sprite_movie.h b/libswfdec/swfdec_sprite_movie.h
index 3be1725..e244a54 100644
--- a/libswfdec/swfdec_sprite_movie.h
+++ b/libswfdec/swfdec_sprite_movie.h
@@ -43,13 +43,13 @@ struct _SwfdecSpriteMovie
   SwfdecSprite *	sprite;			/* displayed sprite */
 
   /* frame information */
-  unsigned int		current_frame;		/* frame that is currently displayed (NB: indexed from 0) */
+  guint		current_frame;		/* frame that is currently displayed (NB: indexed from 0) */
 
   /* color information */
   SwfdecColor		bg_color;		/* background color (only used on main sprite) */
 
   /* audio stream handling */
-  unsigned int		sound_frame;		/* current sound frame */
+  guint		sound_frame;		/* current sound frame */
   SwfdecAudio *		sound_stream;		/* stream that currently plays */
 };
 
diff --git a/libswfdec/swfdec_swf_decoder.c b/libswfdec/swfdec_swf_decoder.c
index 3954b36..97f6965 100644
--- a/libswfdec/swfdec_swf_decoder.c
+++ b/libswfdec/swfdec_swf_decoder.c
@@ -72,7 +72,7 @@ swfdec_decoder_dispose (GObject *object)
 }
 
 static void *
-zalloc (void *opaque, unsigned int items, unsigned int size)
+zalloc (void *opaque, guint items, guint size)
 {
   return g_malloc (items * size);
 }
@@ -349,7 +349,7 @@ swfdec_swf_decoder_init (SwfdecSwfDecode
 }
 
 gpointer
-swfdec_swf_decoder_get_character (SwfdecSwfDecoder * s, unsigned int id)
+swfdec_swf_decoder_get_character (SwfdecSwfDecoder * s, guint id)
 {
   g_return_val_if_fail (SWFDEC_IS_SWF_DECODER (s), NULL);
 
@@ -369,7 +369,7 @@ swfdec_swf_decoder_get_character (Swfdec
  * Returns: The requested character or NULL on failure;
  **/
 gpointer
-swfdec_swf_decoder_create_character (SwfdecSwfDecoder * s, unsigned int id, GType type)
+swfdec_swf_decoder_create_character (SwfdecSwfDecoder * s, guint id, GType type)
 {
   SwfdecCharacter *result;
 
diff --git a/libswfdec/swfdec_swf_decoder.h b/libswfdec/swfdec_swf_decoder.h
index 6000e24..63dec23 100644
--- a/libswfdec/swfdec_swf_decoder.h
+++ b/libswfdec/swfdec_swf_decoder.h
@@ -77,9 +77,9 @@ struct _SwfdecSwfDecoderClass {
 GType		swfdec_swf_decoder_get_type		(void);
 
 gpointer	swfdec_swf_decoder_get_character	(SwfdecSwfDecoder *	s, 
-							 unsigned int	      	id);
+							 guint	      	id);
 gpointer	swfdec_swf_decoder_create_character	(SwfdecSwfDecoder *	s,
-							 unsigned int	      	id,
+							 guint	      	id,
 							 GType			type);
 
 SwfdecTagFunc *swfdec_swf_decoder_get_tag_func (int tag);
diff --git a/libswfdec/swfdec_tag.c b/libswfdec/swfdec_tag.c
index edec808..c2f8343 100644
--- a/libswfdec/swfdec_tag.c
+++ b/libswfdec/swfdec_tag.c
@@ -337,9 +337,9 @@ tag_func_define_button_2 (SwfdecSwfDecod
 
   while (swfdec_bits_peek_u8 (bits)) {
     int reserved;
-    unsigned int character;
-    unsigned int depth;
-    unsigned int states;
+    guint character;
+    guint depth;
+    guint states;
     SwfdecContent *content;
 
     swfdec_bits_syncbits (bits);
@@ -413,9 +413,9 @@ tag_func_define_button (SwfdecSwfDecoder
 
   while (swfdec_bits_peek_u8 (bits)) {
     int reserved;
-    unsigned int character;
-    unsigned int depth;
-    unsigned int states;
+    guint character;
+    guint depth;
+    guint states;
     SwfdecContent *content;
 
     swfdec_bits_syncbits (bits);
diff --git a/libswfdec/swfdec_text.c b/libswfdec/swfdec_text.c
index 6090512..6b626d4 100644
--- a/libswfdec/swfdec_text.c
+++ b/libswfdec/swfdec_text.c
@@ -33,7 +33,7 @@ G_DEFINE_TYPE (SwfdecText, swfdec_text, 
 static gboolean
 swfdec_text_mouse_in (SwfdecGraphic *graphic, double x, double y)
 {
-  unsigned int i;
+  guint i;
   SwfdecText *text = SWFDEC_TEXT (graphic);
 
   cairo_matrix_transform_point (&text->transform_inverse, &x, &y);
@@ -62,7 +62,7 @@ static void
 swfdec_text_render (SwfdecGraphic *graphic, cairo_t *cr, 
     const SwfdecColorTransform *trans, const SwfdecRect *inval, gboolean fill)
 {
-  unsigned int i;
+  guint i;
   SwfdecColor color;
   SwfdecText *text = SWFDEC_TEXT (graphic);
   SwfdecColorTransform force_color;
diff --git a/libswfdec/swfdec_types.h b/libswfdec/swfdec_types.h
index 0603754..a556d28 100644
--- a/libswfdec/swfdec_types.h
+++ b/libswfdec/swfdec_types.h
@@ -7,7 +7,7 @@
 
 /* Pixel value in the same colorspace as cairo - endian-dependant ARGB.
  * The alpha pixel must be present */
-typedef unsigned int SwfdecColor;
+typedef guint SwfdecColor;
 
 /* audio is 44100Hz, framerate is multiple of 256Hz, FLV timestamps are 1000Hz
  * This is a multiple of all these numbers, so we can be always accurate
diff --git a/libswfdec/swfdec_video.h b/libswfdec/swfdec_video.h
index 23826d6..97c997f 100644
--- a/libswfdec/swfdec_video.h
+++ b/libswfdec/swfdec_video.h
@@ -37,9 +37,9 @@ typedef struct _SwfdecVideoClass SwfdecV
 struct _SwfdecVideo {
   SwfdecGraphic			graphic;
 
-  unsigned int			width;		/* width in pixels */
-  unsigned int			height;		/* height in pixels */
-  unsigned int			n_frames;	/* length of movie */
+  guint			width;		/* width in pixels */
+  guint			height;		/* height in pixels */
+  guint			n_frames;	/* length of movie */
   GArray *			images;		/* actual images of the movie */
   
   SwfdecVideoFormat		format;		/* format in use */


More information about the Swfdec mailing list