[Swfdec] Branch 'as' - 9 commits - configure.ac
libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c
libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.h
libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c
libswfdec/swfdec_as_object.h libswfdec/swfdec_as_stack.h
libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h
libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_net_stream.c
Benjamin Otte
company at kemper.freedesktop.org
Thu Apr 5 06:52:07 PDT 2007
configure.ac | 3
libswfdec/swfdec_as_context.c | 46 +++---
libswfdec/swfdec_as_frame.c | 24 +++
libswfdec/swfdec_as_frame.h | 4
libswfdec/swfdec_as_function.h | 2
libswfdec/swfdec_as_interpret.c | 285 ++++++++++++++++------------------------
libswfdec/swfdec_as_object.c | 23 +++
libswfdec/swfdec_as_object.h | 3
libswfdec/swfdec_as_stack.h | 1
libswfdec/swfdec_as_types.c | 66 +++++++++
libswfdec/swfdec_as_types.h | 114 +++++++++-------
libswfdec/swfdec_flv_decoder.c | 3
libswfdec/swfdec_net_stream.c | 2
13 files changed, 338 insertions(+), 238 deletions(-)
New commits:
diff-tree d56c79c4f98469d9bfa85e47781dcd51d6acf43c (from bcf8141b997f93bcc6581c5effa8abfdc2131d2e)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Apr 5 15:34:42 2007 +0200
implement [GS]et(Member|Property) and Pop actions
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index aab5f44..893adbd 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -532,10 +532,116 @@ swfdec_action_set_variable (SwfdecAsCont
const char *s;
s = swfdec_as_value_to_string (cx, swfdec_as_stack_peek (cx->frame->stack, 2));
- swfdec_as_context_eval_set (cx, NULL, s, swfdec_as_stack_pop (cx->frame->stack));
+ swfdec_as_context_eval_set (cx, NULL, s, swfdec_as_stack_peek (cx->frame->stack, 1));
+ swfdec_as_stack_pop_n (cx->frame->stack, 2);
+}
+
+static const char *
+swfdec_as_interpret_eval (SwfdecAsContext *cx, SwfdecAsObject *obj,
+ SwfdecAsValue *val)
+{
+ if (SWFDEC_AS_VALUE_IS_STRING (val)) {
+ const char *s = SWFDEC_AS_VALUE_GET_STRING (val);
+ if (s != SWFDEC_AS_STR_EMPTY) {
+ swfdec_as_context_eval (cx, obj, s, val);
+ return s;
+ }
+ }
+ if (obj != NULL)
+ SWFDEC_AS_VALUE_SET_OBJECT (val, obj);
+ else
+ SWFDEC_AS_VALUE_SET_UNDEFINED (val);
+ return SWFDEC_AS_STR_EMPTY;
+}
+
+#define CONSTANT_INDEX 39
+static void
+swfdec_action_get_property (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
+{
+ SwfdecAsValue *val;
+ SwfdecAsObject *obj;
+ guint id;
+
+ id = swfdec_as_value_to_integer (cx, swfdec_as_stack_pop (cx->frame->stack));
+ if (id > (cx->version > 4 ? 21 : 18)) {
+ SWFDEC_WARNING ("trying to SetProperty %u, not allowed", id);
+ goto out;
+ }
+ val = swfdec_as_stack_peek (cx->frame->stack, 1);
+ swfdec_as_interpret_eval (cx, NULL, val);
+ if (SWFDEC_AS_VALUE_IS_UNDEFINED (val)) {
+ obj = cx->frame->scope;
+ } else if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
+ obj = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ } else {
+ SWFDEC_WARNING ("not an object, can't GetProperty");
+ goto out;
+ }
+ swfdec_as_object_get (obj, SWFDEC_AS_STR_CONSTANT (CONSTANT_INDEX + id),
+ swfdec_as_stack_peek (cx->frame->stack, 1));
+ return;
+
+out:
+ SWFDEC_AS_VALUE_SET_UNDEFINED (swfdec_as_stack_peek (cx->frame->stack, 1));
+}
+
+static void
+swfdec_action_set_property (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
+{
+ SwfdecAsValue *val;
+ SwfdecAsObject *obj;
+ guint id;
+
+ id = swfdec_as_value_to_integer (cx, swfdec_as_stack_peek (cx->frame->stack, 1));
+ if (id > (cx->version > 4 ? 21 : 18)) {
+ SWFDEC_WARNING ("trying to SetProperty %u, not allowed", id);
+ goto out;
+ }
+ val = swfdec_as_stack_peek (cx->frame->stack, 2);
+ swfdec_as_interpret_eval (cx, NULL, val);
+ if (SWFDEC_AS_VALUE_IS_UNDEFINED (val)) {
+ obj = cx->frame->var_object;
+ } else if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
+ obj = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ } else {
+ SWFDEC_WARNING ("not an object, can't get SetProperty");
+ goto out;
+ }
+ swfdec_as_object_set (obj, SWFDEC_AS_STR_CONSTANT (CONSTANT_INDEX + id),
+ swfdec_as_stack_peek (cx->frame->stack, 3));
+out:
+ swfdec_as_stack_pop_n (cx->frame->stack, 3);
+}
+
+static void
+swfdec_action_get_member (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
+{
+ /* FIXME: do we need a "convert to object" function here? */
+ if (SWFDEC_AS_VALUE_IS_OBJECT (swfdec_as_stack_peek (cx->frame->stack, 2))) {
+ SwfdecAsObject *o = SWFDEC_AS_VALUE_GET_OBJECT (swfdec_as_stack_peek (cx->frame->stack, 2));
+ swfdec_as_object_get_variable (o, swfdec_as_stack_peek (cx->frame->stack, 1),
+ swfdec_as_stack_peek (cx->frame->stack, 1));
+#ifdef SWFDEC_WARN_MISSING_PROPERTIES
+ if (SWFDEC_AS_VALUE_IS_UNDEFINED (swfdec_as_stack_peek (cx->frame->stack, 1))) {
+ SWFDEC_WARNING ("no variable named %s:%s", G_OBJECT_TYPE_NAME (o), s);
+ }
+#endif
+ } else {
+ SWFDEC_AS_VALUE_SET_UNDEFINED (swfdec_as_stack_peek (cx->frame->stack, 2));
+ }
swfdec_as_stack_pop (cx->frame->stack);
}
+static void
+swfdec_action_set_member (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
+{
+ if (SWFDEC_AS_VALUE_IS_OBJECT (swfdec_as_stack_peek (cx->frame->stack, 3))) {
+ swfdec_as_object_set_variable (SWFDEC_AS_VALUE_GET_OBJECT (swfdec_as_stack_peek (cx->frame->stack, 3)),
+ swfdec_as_stack_peek (cx->frame->stack, 2), swfdec_as_stack_peek (cx->frame->stack, 1));
+ }
+ swfdec_as_stack_pop_n (cx->frame->stack, 3);
+}
+
#if 0
static void
swfdec_action_trace (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
@@ -674,128 +780,15 @@ fail:
fp->sp[-1] = JSVAL_VOID;
return JS_TRUE;
}
+#endif
static void
swfdec_action_pop (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
- cx->fp->sp--;
- return JS_TRUE;
-}
-
-static const char *
-swfdec_eval_jsval (SwfdecAsContext *cx, JSObject *obj, jsval *val)
-{
- if (JSVAL_IS_STRING (*val)) {
- const char *bytes = swfdec_js_to_string (cx, *val);
- if (bytes == NULL)
- return NULL;
- *val = swfdec_js_eval (cx, obj, bytes);
- return bytes;
- } else {
- if (obj == NULL) {
- obj = OBJ_THIS_OBJECT (cx, cx->fp->scopeChain);
- }
- *val = OBJECT_TO_JSVAL (obj);
- return ".";
- }
-}
-
-static const char *properties[22] = {
- "_x", "_y", "_xscale", "_yscale", "_currentframe",
- "_totalframes", "_alpha", "_visible", "_width", "_height",
- "_rotation", "_target", "_framesloaded", "_name", "_droptarget",
- "_url", "_highquality", "_focusrect", "_soundbuftime", "_quality",
- "_xmouse", "_ymouse"
-};
-
-static void
-swfdec_action_get_property (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
-{
- jsval val;
- SwfdecMovie *movie;
- JSObject *jsobj;
- guint32 id;
- const char *bytes;
-
- if (!JS_ValueToECMAUint32 (cx, cx->fp->sp[-1], &id))
- return JS_FALSE;
- val = cx->fp->sp[-2];
- bytes = swfdec_eval_jsval (cx, NULL, &val);
- if (id > (((SwfdecScript *) cx->fp->swf)->version > 4 ? 21 : 18)) {
- SWFDEC_WARNING ("trying to SetProperty %u, not allowed", id);
- goto out;
- }
-
- if (bytes == NULL)
- return JS_FALSE;
- if (*bytes == '\0') {
- JSObject *pobj;
- JSProperty *prop;
- JSAtom *atom = js_Atomize (cx, properties[id], strlen (properties[id]), 0);
- if (atom == NULL)
- return JS_FALSE;
- if (!js_FindProperty (cx, (jsid) atom, &jsobj, &pobj, &prop))
- return JS_FALSE;
- if (!prop)
- return JS_FALSE;
- if (!OBJ_GET_PROPERTY (cx, jsobj, (jsid) prop->id, &val))
- return JS_FALSE;
- } else {
- movie = swfdec_scriptable_from_jsval (cx, val, SWFDEC_TYPE_MOVIE);
- if (movie == NULL) {
- SWFDEC_WARNING ("specified target does not reference a movie clip");
- goto out;
- }
-
- jsobj = JSVAL_TO_OBJECT (val);
- val = JSVAL_VOID;
-
- if (!JS_GetProperty (cx, jsobj, properties[id], &val))
- return JS_FALSE;
- }
-
-out:
- cx->fp->sp -= 1;
- cx->fp->sp[-1] = val;
- return JS_TRUE;
-}
-
-static void
-swfdec_action_set_property (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
-{
- jsval val;
- SwfdecMovie *movie;
- JSObject *jsobj;
- guint32 id;
- const char *bytes;
-
- val = cx->fp->sp[-3];
- if (!JS_ValueToECMAUint32 (cx, cx->fp->sp[-2], &id))
- return JS_FALSE;
- bytes = swfdec_eval_jsval (cx, NULL, &val);
- if (!bytes)
- return JS_FALSE;
- if (id > (((SwfdecScript *) cx->fp->swf)->version > 4 ? 21 : 18)) {
- SWFDEC_WARNING ("trying to SetProperty %u, not allowed", id);
- goto out;
- }
- if (*bytes == '\0' || *bytes == '.')
- val = OBJECT_TO_JSVAL (cx->fp->varobj);
- movie = swfdec_scriptable_from_jsval (cx, val, SWFDEC_TYPE_MOVIE);
- if (movie == NULL) {
- SWFDEC_WARNING ("specified target does not reference a movie clip");
- goto out;
- }
- jsobj = JSVAL_TO_OBJECT (val);
-
- if (!JS_SetProperty (cx, jsobj, properties[id], &cx->fp->sp[-1]))
- return JS_FALSE;
-
-out:
- cx->fp->sp -= 3;
- return JS_TRUE;
+ swfdec_as_stack_pop (cx->frame->stack);
}
+#if 0
static void
swfdec_action_binary (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
@@ -925,52 +918,6 @@ swfdec_action_add2_7 (SwfdecAsContext *c
}
static void
-swfdec_action_get_member (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
-{
- const char *s;
- jsval o;
-
- s = swfdec_js_to_string (cx, cx->fp->sp[-1]);
- if (s == NULL)
- return JS_FALSE;
-
- o = cx->fp->sp[-2];
- if (JSVAL_IS_OBJECT (o) && !JSVAL_IS_NULL (o)) {
- if (!JS_GetProperty (cx, JSVAL_TO_OBJECT (o), s, &cx->fp->sp[-2]))
- return JS_FALSE;
-#ifdef SWFDEC_WARN_MISSING_PROPERTIES
- if (cx->fp->sp[-2] == JSVAL_VOID) {
- const JSClass *clasp = JS_GetClass (JSVAL_TO_OBJECT (o));
- if (clasp != &js_ObjectClass) {
- SWFDEC_WARNING ("no variable named %s:%s", clasp->name, s);
- }
- }
-#endif
- } else {
- cx->fp->sp[-2] = JSVAL_VOID;
- }
- cx->fp->sp--;
- return JS_TRUE;
-}
-
-static void
-swfdec_action_set_member (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
-{
- const char *s;
-
- s = swfdec_js_to_string (cx, cx->fp->sp[-2]);
- if (s == NULL)
- return JS_FALSE;
-
- if (JSVAL_IS_OBJECT (cx->fp->sp[-3]) && !JSVAL_IS_NULL (cx->fp->sp[-3])) {
- if (!JS_SetProperty (cx, JSVAL_TO_OBJECT (cx->fp->sp[-3]), s, &cx->fp->sp[-1]))
- return JS_FALSE;
- }
- cx->fp->sp -= 3;
- return JS_TRUE;
-}
-
-static void
swfdec_action_new_comparison_6 (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
jsval lval, rval;
@@ -2347,7 +2294,9 @@ const SwfdecActionSpec swfdec_as_actions
[0x13] = { "StringEquals", NULL },
[0x14] = { "StringLength", NULL },
[0x15] = { "StringExtract", NULL },
- [0x17] = { "Pop", NULL, 1, 0, { NULL, swfdec_action_pop, swfdec_action_pop, swfdec_action_pop, swfdec_action_pop } },
+#endif
+ [SWFDEC_AS_ACTION_POP] = { "Pop", NULL, 1, 0, { NULL, swfdec_action_pop, swfdec_action_pop, swfdec_action_pop, swfdec_action_pop } },
+#if 0
[0x18] = { "ToInteger", NULL, 1, 1, { NULL, swfdec_action_to_integer, swfdec_action_to_integer, swfdec_action_to_integer, swfdec_action_to_integer } },
#endif
[SWFDEC_AS_ACTION_GET_VARIABLE] = { "GetVariable", NULL, 1, 1, { NULL, swfdec_action_get_variable, swfdec_action_get_variable, swfdec_action_get_variable, swfdec_action_get_variable } },
@@ -2355,8 +2304,10 @@ const SwfdecActionSpec swfdec_as_actions
#if 0
[0x20] = { "SetTarget2", NULL, 1, 0, { swfdec_action_set_target2, swfdec_action_set_target2, swfdec_action_set_target2, swfdec_action_set_target2, swfdec_action_set_target2 } },
[0x21] = { "StringAdd", NULL, 2, 1, { NULL, swfdec_action_string_add, swfdec_action_string_add, swfdec_action_string_add, swfdec_action_string_add } },
+#endif
[0x22] = { "GetProperty", NULL, 2, 1, { NULL, swfdec_action_get_property, swfdec_action_get_property, swfdec_action_get_property, swfdec_action_get_property } },
[0x23] = { "SetProperty", NULL, 3, 0, { NULL, swfdec_action_set_property, swfdec_action_set_property, swfdec_action_set_property, swfdec_action_set_property } },
+#if 0
[0x24] = { "CloneSprite", NULL },
[0x25] = { "RemoveSprite", NULL },
[0x26] = { "Trace", NULL, 1, 0, { NULL, swfdec_action_trace, swfdec_action_trace, swfdec_action_trace, swfdec_action_trace } },
@@ -2397,8 +2348,10 @@ const SwfdecActionSpec swfdec_as_actions
[0x4b] = { "ToString", NULL, 1, 1, { NULL, NULL, swfdec_action_to_string, swfdec_action_to_string, swfdec_action_to_string } },
[0x4c] = { "PushDuplicate", NULL, 1, 2, { NULL, NULL, swfdec_action_push_duplicate, swfdec_action_push_duplicate, swfdec_action_push_duplicate } },
[0x4d] = { "Swap", NULL, 2, 2, { NULL, NULL, swfdec_action_swap, swfdec_action_swap, swfdec_action_swap } },
- [0x4e] = { "GetMember", NULL, 2, 1, { NULL, swfdec_action_get_member, swfdec_action_get_member, swfdec_action_get_member, swfdec_action_get_member } },
- [0x4f] = { "SetMember", NULL, 3, 0, { NULL, swfdec_action_set_member, swfdec_action_set_member, swfdec_action_set_member, swfdec_action_set_member } },
+#endif
+ [SWFDEC_AS_ACTION_GET_MEMBER] = { "GetMember", NULL, 2, 1, { NULL, swfdec_action_get_member, swfdec_action_get_member, swfdec_action_get_member, swfdec_action_get_member } },
+ [SWFDEC_AS_ACTION_SET_MEMBER] = { "SetMember", NULL, 3, 0, { NULL, swfdec_action_set_member, swfdec_action_set_member, swfdec_action_set_member, swfdec_action_set_member } },
+#if 0
[0x50] = { "Increment", NULL, 1, 1, { NULL, NULL, swfdec_action_increment, swfdec_action_increment, swfdec_action_increment } },
[0x51] = { "Decrement", NULL, 1, 1, { NULL, NULL, swfdec_action_decrement, swfdec_action_decrement, swfdec_action_decrement } },
[0x52] = { "CallMethod", NULL, -1, 1, { NULL, NULL, swfdec_action_call_method, swfdec_action_call_method, swfdec_action_call_method } },
diff-tree bcf8141b997f93bcc6581c5effa8abfdc2131d2e (from 7f368a0aa96f48fd8e99c40c42b0f22cadef75a5)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Apr 5 15:33:49 2007 +0200
implement eval completely
diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index 47458b9..1adebe6 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -505,16 +505,18 @@ swfdec_as_context_eval_get_property (Swf
if (obj) {
swfdec_as_object_get (obj, name, ret);
} else {
- g_assert_not_reached ();
-#if 0
- if (cx->fp == NULL || cx->fp->scopeChain == NULL)
- return JS_FALSE;
- if (!js_FindProperty (cx, (jsid) atom, &obj, &pobj, &prop))
- return JS_FALSE;
- if (!prop)
- return JS_FALSE;
- return OBJ_GET_PROPERTY (cx, obj, (jsid) prop->id, ret);
-#endif
+ SwfdecAsValue val;
+ SWFDEC_AS_VALUE_SET_STRING (&val, name);
+ if (cx->frame) {
+ obj = swfdec_as_frame_find_variable (cx->frame, &val);
+ if (obj) {
+ swfdec_as_object_get_variable (obj, &val, ret);
+ return;
+ }
+ } else {
+ SWFDEC_ERROR ("no frame in eval?");
+ }
+ SWFDEC_AS_VALUE_SET_UNDEFINED (ret);
}
}
@@ -523,21 +525,17 @@ swfdec_as_context_eval_set_property (Swf
SwfdecAsObject *obj, const char *name, const SwfdecAsValue *ret)
{
if (obj == NULL) {
- g_assert_not_reached ();
-#if 0
- JSObject *pobj;
- JSProperty *prop;
- if (cx->fp == NULL || cx->fp->varobj == NULL)
- return JS_FALSE;
- if (!js_FindProperty (cx, (jsid) atom, &obj, &pobj, &prop))
- return JS_FALSE;
- if (pobj)
- obj = pobj;
- else
- obj = cx->fp->varobj;
-#endif
+ SwfdecAsValue val;
+ SWFDEC_AS_VALUE_SET_STRING (&val, name);
+ if (cx->frame == NULL) {
+ SWFDEC_ERROR ("no frame in eval_set?");
+ return;
+ }
+ obj = swfdec_as_frame_find_variable (cx->frame, &val);
+ if (obj == NULL)
+ obj = cx->frame->var_object;
}
- return swfdec_as_object_set (obj, name, ret);
+ swfdec_as_object_set (obj, name, ret);
}
static void
diff-tree 7f368a0aa96f48fd8e99c40c42b0f22cadef75a5 (from d4da7e1074456705c898d9bb14d431ef21472cb7)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Apr 5 15:32:37 2007 +0200
Require C99 and implement some functions
I'm too lazy to define NaN and +-Infinity myself. And
swfdec_as_value_to_number needs those.
diff --git a/configure.ac b/configure.ac
index fdf2a31..d04bd19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,9 @@ SWFDEC_LIBVERSION="3:0:0"
AC_SUBST(SWFDEC_LIBVERSION)
AM_PROG_LIBTOOL
+dnl C99 is only required to get definitions for NAN and INFINITY.
+GLOBAL_CFLAGS="$GLOBAL_CFLAGS -std=c99"
+
dnl Add parameters for aclocal
dnl (This must come after AM_INIT_AUTOMAKE, since it modifies ACLOCAL)
#ACLOCAL_AMFLAGS="-I m4 $ACLOCAL_AMFLAGS"
diff --git a/libswfdec/swfdec_as_types.c b/libswfdec/swfdec_as_types.c
index 14cb0e4..45fd7ce 100644
--- a/libswfdec/swfdec_as_types.c
+++ b/libswfdec/swfdec_as_types.c
@@ -21,6 +21,8 @@
#include "config.h"
#endif
+#include <math.h>
+
#include "swfdec_as_types.h"
#include "swfdec_as_object.h"
#include "swfdec_as_context.h"
@@ -67,6 +69,28 @@ const char *swfdec_as_strings[] = {
SWFDEC_AS_CONSTANT_STRING ("[object Object]"),
SWFDEC_AS_CONSTANT_STRING ("true"),
SWFDEC_AS_CONSTANT_STRING ("false"),
+ SWFDEC_AS_CONSTANT_STRING ("_x"),
+ SWFDEC_AS_CONSTANT_STRING ("_y"),
+ SWFDEC_AS_CONSTANT_STRING ("_xscale"),
+ SWFDEC_AS_CONSTANT_STRING ("_yscale"),
+ SWFDEC_AS_CONSTANT_STRING ("_currentframe"),
+ SWFDEC_AS_CONSTANT_STRING ("_totalframes"),
+ SWFDEC_AS_CONSTANT_STRING ("_alpha"),
+ SWFDEC_AS_CONSTANT_STRING ("_visible"),
+ SWFDEC_AS_CONSTANT_STRING ("_width"),
+ SWFDEC_AS_CONSTANT_STRING ("_height"),
+ SWFDEC_AS_CONSTANT_STRING ("_rotation"),
+ SWFDEC_AS_CONSTANT_STRING ("_target"),
+ SWFDEC_AS_CONSTANT_STRING ("_framesloaded"),
+ SWFDEC_AS_CONSTANT_STRING ("_name"),
+ SWFDEC_AS_CONSTANT_STRING ("_droptarget"),
+ SWFDEC_AS_CONSTANT_STRING ("_url"),
+ SWFDEC_AS_CONSTANT_STRING ("_highquality"),
+ SWFDEC_AS_CONSTANT_STRING ("_focusrect"),
+ SWFDEC_AS_CONSTANT_STRING ("_soundbuftime"),
+ SWFDEC_AS_CONSTANT_STRING ("_quality"),
+ SWFDEC_AS_CONSTANT_STRING ("_xmouse"),
+ SWFDEC_AS_CONSTANT_STRING ("_ymouse"),
/* add more here */
NULL
};
@@ -107,10 +131,50 @@ swfdec_as_value_to_string (SwfdecAsConte
return ret;
}
case SWFDEC_TYPE_AS_ASOBJECT:
- /* FIXME! */
+ SWFDEC_ERROR ("FIXME");
return SWFDEC_AS_STR_OBJECT_OBJECT;
default:
g_assert_not_reached ();
return SWFDEC_AS_STR_EMPTY;
}
}
+
+double
+swfdec_as_value_to_number (SwfdecAsContext *context, const SwfdecAsValue *value)
+{
+ g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), 0.0);
+ g_return_val_if_fail (SWFDEC_IS_AS_VALUE (value), 0.0);
+
+ switch (value->type) {
+ case SWFDEC_TYPE_AS_UNDEFINED:
+ case SWFDEC_TYPE_AS_NULL:
+ return (context->version >= 7) ? NAN : 0.0;
+ case SWFDEC_TYPE_AS_BOOLEAN:
+ return SWFDEC_AS_VALUE_GET_BOOLEAN (value) ? 1 : 0;
+ case SWFDEC_TYPE_AS_NUMBER:
+ return SWFDEC_AS_VALUE_GET_NUMBER (value);
+ case SWFDEC_TYPE_AS_STRING:
+ {
+ char *end;
+ double d = g_ascii_strtod (SWFDEC_AS_VALUE_GET_STRING (value), &end);
+ if (*end == '\0')
+ return d;
+ else
+ return NAN;
+ }
+ case SWFDEC_TYPE_AS_ASOBJECT:
+ SWFDEC_ERROR ("FIXME");
+ return NAN;
+ default:
+ g_assert_not_reached ();
+ return NAN;
+ }
+}
+
+int
+swfdec_as_value_to_integer (SwfdecAsContext *context, const SwfdecAsValue *value)
+{
+ /* FIXME */
+ return swfdec_as_value_to_number (context, value);
+}
+
diff --git a/libswfdec/swfdec_as_types.h b/libswfdec/swfdec_as_types.h
index fe25c3f..b85a094 100644
--- a/libswfdec/swfdec_as_types.h
+++ b/libswfdec/swfdec_as_types.h
@@ -58,7 +58,7 @@ struct _SwfdecAsValue {
#define SWFDEC_AS_VALUE_SET_UNDEFINED(val) (val)->type = SWFDEC_TYPE_AS_UNDEFINED
#define SWFDEC_AS_VALUE_IS_BOOLEAN(val) ((val)->type == SWFDEC_TYPE_AS_BOOLEAN)
-#define SWFDEC_AS_VALUE_GET_BOOLEAN(val) (g_assert ((val)->type == SWFDEC_TYPE_AS_BOOLEAN), (val)->value.boolean)
+#define SWFDEC_AS_VALUE_GET_BOOLEAN(val) ((val)->value.boolean)
#define SWFDEC_AS_VALUE_SET_BOOLEAN(val,b) G_STMT_START { \
SwfdecAsValue *__val = (val); \
(__val)->type = SWFDEC_TYPE_AS_BOOLEAN; \
@@ -66,7 +66,7 @@ struct _SwfdecAsValue {
} G_STMT_END
#define SWFDEC_AS_VALUE_IS_NUMBER(val) ((val)->type == SWFDEC_TYPE_AS_NUMBER)
-#define SWFDEC_AS_VALUE_GET_NUMBER(val) (g_assert ((val)->type == SWFDEC_TYPE_AS_NUMBER), (val)->value.number)
+#define SWFDEC_AS_VALUE_GET_NUMBER(val) ((val)->value.number)
#define SWFDEC_AS_VALUE_SET_NUMBER(val,d) G_STMT_START { \
SwfdecAsValue *__val = (val); \
(__val)->type = SWFDEC_TYPE_AS_NUMBER; \
@@ -74,7 +74,7 @@ struct _SwfdecAsValue {
} G_STMT_END
#define SWFDEC_AS_VALUE_IS_STRING(val) ((val)->type == SWFDEC_TYPE_AS_STRING)
-#define SWFDEC_AS_VALUE_GET_STRING(val) (g_assert ((val)->type == SWFDEC_TYPE_AS_STRING), (val)->value.string)
+#define SWFDEC_AS_VALUE_GET_STRING(val) ((val)->value.string)
#define SWFDEC_AS_VALUE_SET_STRING(val,s) G_STMT_START { \
SwfdecAsValue *__val = (val); \
(__val)->type = SWFDEC_TYPE_AS_STRING; \
@@ -85,7 +85,7 @@ struct _SwfdecAsValue {
#define SWFDEC_AS_VALUE_SET_NULL(val) (val)->type = SWFDEC_TYPE_AS_NULL
#define SWFDEC_AS_VALUE_IS_OBJECT(val) ((val)->type == SWFDEC_TYPE_AS_ASOBJECT)
-#define SWFDEC_AS_VALUE_GET_OBJECT(val) (g_assert ((val)->type == SWFDEC_TYPE_AS_ASOBJECT), (val)->value.object)
+#define SWFDEC_AS_VALUE_GET_OBJECT(val) ((val)->value.object)
#define SWFDEC_AS_VALUE_SET_OBJECT(val,o) G_STMT_START { \
SwfdecAsValue *__val = (val); \
(__val)->type = SWFDEC_TYPE_AS_ASOBJECT; \
@@ -95,45 +95,69 @@ struct _SwfdecAsValue {
/* List of static strings that are required all the time */
extern const char *swfdec_as_strings[];
-#define SWFDEC_AS_STR_EMPTY (swfdec_as_strings[0] + 1)
-#define SWFDEC_AS_STR_PROTO (swfdec_as_strings[1] + 1)
-#define SWFDEC_AS_STR_THIS (swfdec_as_strings[2] + 1)
-#define SWFDEC_AS_STR_CODE (swfdec_as_strings[3] + 1)
-#define SWFDEC_AS_STR_LEVEL (swfdec_as_strings[4] + 1)
-#define SWFDEC_AS_STR_DESCRIPTION (swfdec_as_strings[5] + 1)
-#define SWFDEC_AS_STR_STATUS (swfdec_as_strings[6] + 1)
-#define SWFDEC_AS_STR_SUCCESS (swfdec_as_strings[7] + 1)
-#define SWFDEC_AS_STR_NET_CONNECTION_CONNECT_SUCCESS (swfdec_as_strings[8] + 1)
-#define SWFDEC_AS_STR_ON_LOAD (swfdec_as_strings[9] + 1)
-#define SWFDEC_AS_STR_ON_ENTER_FRAME (swfdec_as_strings[10] + 1)
-#define SWFDEC_AS_STR_ON_UNLOAD (swfdec_as_strings[11] + 1)
-#define SWFDEC_AS_STR_ON_MOUSE_MOVE (swfdec_as_strings[12] + 1)
-#define SWFDEC_AS_STR_ON_MOUSE_DOWN (swfdec_as_strings[13] + 1)
-#define SWFDEC_AS_STR_ON_MOUSE_UP (swfdec_as_strings[14] + 1)
-#define SWFDEC_AS_STR_ON_KEY_UP (swfdec_as_strings[15] + 1)
-#define SWFDEC_AS_STR_ON_KEY_DOWN (swfdec_as_strings[16] + 1)
-#define SWFDEC_AS_STR_ON_DATA (swfdec_as_strings[17] + 1)
-#define SWFDEC_AS_STR_ON_PRESS (swfdec_as_strings[18] + 1)
-#define SWFDEC_AS_STR_ON_RELEASE (swfdec_as_strings[19] + 1)
-#define SWFDEC_AS_STR_ON_RELEASE_OUTSIDE (swfdec_as_strings[20] + 1)
-#define SWFDEC_AS_STR_ON_ROLL_OVER (swfdec_as_strings[21] + 1)
-#define SWFDEC_AS_STR_ON_ROLL_OUT (swfdec_as_strings[22] + 1)
-#define SWFDEC_AS_STR_ON_DRAG_OVER (swfdec_as_strings[23] + 1)
-#define SWFDEC_AS_STR_ON_DRAG_OUT (swfdec_as_strings[24] + 1)
-#define SWFDEC_AS_STR_ON_CONSTRUCT (swfdec_as_strings[25] + 1)
-#define SWFDEC_AS_STR_ON_STATUS (swfdec_as_strings[26] + 1)
-#define SWFDEC_AS_STR_ERROR (swfdec_as_strings[27] + 1)
-#define SWFDEC_AS_STR_NETSTREAM_BUFFER_EMPTY (swfdec_as_strings[28] + 1)
-#define SWFDEC_AS_STR_NETSTREAM_BUFFER_FULL (swfdec_as_strings[29] + 1)
-#define SWFDEC_AS_STR_NETSTREAM_BUFFER_FLUSH (swfdec_as_strings[30] + 1)
-#define SWFDEC_AS_STR_NETSTREAM_PLAY_START (swfdec_as_strings[31] + 1)
-#define SWFDEC_AS_STR_NETSTREAM_PLAY_STOP (swfdec_as_strings[32] + 1)
-#define SWFDEC_AS_STR_NETSTREAM_PLAY_STREAMNOTFOUND (swfdec_as_strings[33] + 1)
-#define SWFDEC_AS_STR_UNDEFINED (swfdec_as_strings[34] + 1)
-#define SWFDEC_AS_STR_NULL (swfdec_as_strings[35] + 1)
-#define SWFDEC_AS_STR_OBJECT_OBJECT (swfdec_as_strings[36] + 1)
-#define SWFDEC_AS_STR_TRUE (swfdec_as_strings[37] + 1)
-#define SWFDEC_AS_STR_FALSE (swfdec_as_strings[38] + 1)
+#define SWFDEC_AS_STR_CONSTANT(n) (swfdec_as_strings[(n)] + 1)
+
+#define SWFDEC_AS_STR_EMPTY SWFDEC_AS_STR_CONSTANT(0)
+#define SWFDEC_AS_STR_PROTO SWFDEC_AS_STR_CONSTANT(1)
+#define SWFDEC_AS_STR_THIS SWFDEC_AS_STR_CONSTANT(2)
+#define SWFDEC_AS_STR_CODE SWFDEC_AS_STR_CONSTANT(3)
+#define SWFDEC_AS_STR_LEVEL SWFDEC_AS_STR_CONSTANT(4)
+#define SWFDEC_AS_STR_DESCRIPTION SWFDEC_AS_STR_CONSTANT(5)
+#define SWFDEC_AS_STR_STATUS SWFDEC_AS_STR_CONSTANT(6)
+#define SWFDEC_AS_STR_SUCCESS SWFDEC_AS_STR_CONSTANT(7)
+#define SWFDEC_AS_STR_NET_CONNECTION_CONNECT_SUCCESS SWFDEC_AS_STR_CONSTANT(8)
+#define SWFDEC_AS_STR_ON_LOAD SWFDEC_AS_STR_CONSTANT(9)
+#define SWFDEC_AS_STR_ON_ENTER_FRAME SWFDEC_AS_STR_CONSTANT(10)
+#define SWFDEC_AS_STR_ON_UNLOAD SWFDEC_AS_STR_CONSTANT(11)
+#define SWFDEC_AS_STR_ON_MOUSE_MOVE SWFDEC_AS_STR_CONSTANT(12)
+#define SWFDEC_AS_STR_ON_MOUSE_DOWN SWFDEC_AS_STR_CONSTANT(13)
+#define SWFDEC_AS_STR_ON_MOUSE_UP SWFDEC_AS_STR_CONSTANT(14)
+#define SWFDEC_AS_STR_ON_KEY_UP SWFDEC_AS_STR_CONSTANT(15)
+#define SWFDEC_AS_STR_ON_KEY_DOWN SWFDEC_AS_STR_CONSTANT(16)
+#define SWFDEC_AS_STR_ON_DATA SWFDEC_AS_STR_CONSTANT(17)
+#define SWFDEC_AS_STR_ON_PRESS SWFDEC_AS_STR_CONSTANT(18)
+#define SWFDEC_AS_STR_ON_RELEASE SWFDEC_AS_STR_CONSTANT(19)
+#define SWFDEC_AS_STR_ON_RELEASE_OUTSIDE SWFDEC_AS_STR_CONSTANT(20)
+#define SWFDEC_AS_STR_ON_ROLL_OVER SWFDEC_AS_STR_CONSTANT(21)
+#define SWFDEC_AS_STR_ON_ROLL_OUT SWFDEC_AS_STR_CONSTANT(22)
+#define SWFDEC_AS_STR_ON_DRAG_OVER SWFDEC_AS_STR_CONSTANT(23)
+#define SWFDEC_AS_STR_ON_DRAG_OUT SWFDEC_AS_STR_CONSTANT(24)
+#define SWFDEC_AS_STR_ON_CONSTRUCT SWFDEC_AS_STR_CONSTANT(25)
+#define SWFDEC_AS_STR_ON_STATUS SWFDEC_AS_STR_CONSTANT(26)
+#define SWFDEC_AS_STR_ERROR SWFDEC_AS_STR_CONSTANT(27)
+#define SWFDEC_AS_STR_NETSTREAM_BUFFER_EMPTY SWFDEC_AS_STR_CONSTANT(28)
+#define SWFDEC_AS_STR_NETSTREAM_BUFFER_FULL SWFDEC_AS_STR_CONSTANT(29)
+#define SWFDEC_AS_STR_NETSTREAM_BUFFER_FLUSH SWFDEC_AS_STR_CONSTANT(30)
+#define SWFDEC_AS_STR_NETSTREAM_PLAY_START SWFDEC_AS_STR_CONSTANT(31)
+#define SWFDEC_AS_STR_NETSTREAM_PLAY_STOP SWFDEC_AS_STR_CONSTANT(32)
+#define SWFDEC_AS_STR_NETSTREAM_PLAY_STREAMNOTFOUND SWFDEC_AS_STR_CONSTANT(33)
+#define SWFDEC_AS_STR_UNDEFINED SWFDEC_AS_STR_CONSTANT(34)
+#define SWFDEC_AS_STR_NULL SWFDEC_AS_STR_CONSTANT(35)
+#define SWFDEC_AS_STR_OBJECT_OBJECT SWFDEC_AS_STR_CONSTANT(36)
+#define SWFDEC_AS_STR_TRUE SWFDEC_AS_STR_CONSTANT(37)
+#define SWFDEC_AS_STR_FALSE SWFDEC_AS_STR_CONSTANT(38)
+#define SWFDEC_AS_STR__X SWFDEC_AS_STR_CONSTANT(39)
+#define SWFDEC_AS_STR__Y SWFDEC_AS_STR_CONSTANT(40)
+#define SWFDEC_AS_STR__XSCALE SWFDEC_AS_STR_CONSTANT(41)
+#define SWFDEC_AS_STR__YSCALE SWFDEC_AS_STR_CONSTANT(42)
+#define SWFDEC_AS_STR__CURRENTFRAME SWFDEC_AS_STR_CONSTANT(43)
+#define SWFDEC_AS_STR__TOTALFRAMES SWFDEC_AS_STR_CONSTANT(44)
+#define SWFDEC_AS_STR__ALPHA SWFDEC_AS_STR_CONSTANT(45)
+#define SWFDEC_AS_STR__VISIBLE SWFDEC_AS_STR_CONSTANT(46)
+#define SWFDEC_AS_STR__WIDTH SWFDEC_AS_STR_CONSTANT(47)
+#define SWFDEC_AS_STR__HEIGHT SWFDEC_AS_STR_CONSTANT(48)
+#define SWFDEC_AS_STR__ROTATION SWFDEC_AS_STR_CONSTANT(49)
+#define SWFDEC_AS_STR__TARGET SWFDEC_AS_STR_CONSTANT(50)
+#define SWFDEC_AS_STR__FRAMESLOADED SWFDEC_AS_STR_CONSTANT(51)
+#define SWFDEC_AS_STR__NAME SWFDEC_AS_STR_CONSTANT(52)
+#define SWFDEC_AS_STR__DROPTARGET SWFDEC_AS_STR_CONSTANT(53)
+#define SWFDEC_AS_STR__URL SWFDEC_AS_STR_CONSTANT(54)
+#define SWFDEC_AS_STR__HIGHQUALITY SWFDEC_AS_STR_CONSTANT(55)
+#define SWFDEC_AS_STR__FOCUSRECT SWFDEC_AS_STR_CONSTANT(56)
+#define SWFDEC_AS_STR__SOUNDBUFTIME SWFDEC_AS_STR_CONSTANT(57)
+#define SWFDEC_AS_STR__QUALITY SWFDEC_AS_STR_CONSTANT(58)
+#define SWFDEC_AS_STR__XMOUSE SWFDEC_AS_STR_CONSTANT(59)
+#define SWFDEC_AS_STR__YMOUSE SWFDEC_AS_STR_CONSTANT(60)
/* all existing actions */
typedef enum {
@@ -236,6 +260,10 @@ typedef enum {
const char * swfdec_as_value_to_string (SwfdecAsContext * context,
const SwfdecAsValue * value);
+double swfdec_as_value_to_number (SwfdecAsContext * context,
+ const SwfdecAsValue * value);
+int swfdec_as_value_to_integer (SwfdecAsContext * context,
+ const SwfdecAsValue * value);
G_END_DECLS
diff-tree d4da7e1074456705c898d9bb14d431ef21472cb7 (from 565b17764bca8304bb09120bc492d2459ebec791)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Apr 5 15:30:45 2007 +0200
improve comment
diff --git a/libswfdec/swfdec_as_function.h b/libswfdec/swfdec_as_function.h
index 818d7cb..b8457e5 100644
--- a/libswfdec/swfdec_as_function.h
+++ b/libswfdec/swfdec_as_function.h
@@ -48,7 +48,7 @@ struct _SwfdecAsFunction {
/* for script functions */
SwfdecScript * script; /* script being executed or NULL when native */
- SwfdecAsObject * scope; /* scope object coming after this */
+ SwfdecAsObject * scope; /* scope this function was defined in or NULL */
};
struct _SwfdecAsFunctionClass {
diff-tree 565b17764bca8304bb09120bc492d2459ebec791 (from cd7d3ebecd447ea26d88958ad2856f4e43e2e843)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Apr 5 15:30:30 2007 +0200
Add swfdec_as_frame_find_variable
Finds the variable in the current scope chain or NULL
diff --git a/libswfdec/swfdec_as_frame.c b/libswfdec/swfdec_as_frame.c
index 4614f7c..d2f3256 100644
--- a/libswfdec/swfdec_as_frame.c
+++ b/libswfdec/swfdec_as_frame.c
@@ -117,3 +117,27 @@ swfdec_as_frame_new (SwfdecAsObject *thi
return frame;
}
+SwfdecAsObject *
+swfdec_as_frame_find_variable (SwfdecAsFrame *frame, const SwfdecAsValue *variable)
+{
+ SwfdecAsObject *ret = NULL;
+ guint i;
+
+ g_return_val_if_fail (SWFDEC_IS_AS_FRAME (frame), NULL);
+ g_return_val_if_fail (SWFDEC_IS_AS_VALUE (variable), NULL);
+
+ for (i = 0; i < 256 && frame != NULL; i++) {
+ ret = swfdec_as_object_find_variable (frame->scope, variable);
+ if (ret)
+ break;
+ if (!SWFDEC_IS_AS_FRAME (frame->scope))
+ break;
+ frame = SWFDEC_AS_FRAME (frame->scope);
+ }
+ if (i == 256) {
+ swfdec_as_context_abort (SWFDEC_AS_OBJECT (frame)->context, "Scope recursion limit exceeded");
+ return NULL;
+ }
+ return ret;
+}
+
diff --git a/libswfdec/swfdec_as_frame.h b/libswfdec/swfdec_as_frame.h
index dd627cd..1753137 100644
--- a/libswfdec/swfdec_as_frame.h
+++ b/libswfdec/swfdec_as_frame.h
@@ -40,7 +40,7 @@ struct _SwfdecAsFrame {
SwfdecAsFrame * next; /* next frame (FIXME: keep a list in the context instead?) */
SwfdecScript * script; /* script being executed */
- SwfdecAsObject * scope; /* scope object coming after this */
+ SwfdecAsObject * scope; /* scope object coming after this or NULL */
SwfdecAsObject * var_object; /* new variables go here */
SwfdecAsValue * registers; /* the registers */
guint n_registers; /* number of allocated registers */
@@ -59,6 +59,8 @@ GType swfdec_as_frame_get_type (void);
SwfdecAsFrame * swfdec_as_frame_new (SwfdecAsObject * thisp,
SwfdecScript * script);
+SwfdecAsObject *swfdec_as_frame_find_variable (SwfdecAsFrame * frame,
+ const SwfdecAsValue * variable);
G_END_DECLS
diff-tree cd7d3ebecd447ea26d88958ad2856f4e43e2e843 (from 04caa48b48e55a62787a5b5bd7f2ee77d330ebbf)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Apr 5 15:28:14 2007 +0200
Add swfdec_as_object_find_variable
Finds the object in the prototype chain that defines the variable or NULL
diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index a8cb206..588094f 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -250,6 +250,29 @@ swfdec_as_object_delete_variable (Swfdec
}
}
+SwfdecAsObject *
+swfdec_as_object_find_variable (SwfdecAsObject *object,
+ const SwfdecAsValue *variable)
+{
+ const char *s;
+ guint i;
+
+ g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
+ g_return_val_if_fail (SWFDEC_IS_AS_VALUE (variable), NULL);
+
+ s = swfdec_as_value_to_string (object->context, variable);
+ for (i = 0; i < 256 && object != NULL; i++) {
+ if (g_hash_table_lookup (object->properties, s))
+ return object;
+ object = object->prototype;
+ }
+ if (i == 256) {
+ swfdec_as_context_abort (object->context, "Prototype recursion limit exceeded");
+ return NULL;
+ }
+ return NULL;
+}
+
/**
* swfdec_as_object_run:
* @object: a #SwfdecAsObject
diff --git a/libswfdec/swfdec_as_object.h b/libswfdec/swfdec_as_object.h
index 6462784..b7f7a2a 100644
--- a/libswfdec/swfdec_as_object.h
+++ b/libswfdec/swfdec_as_object.h
@@ -80,6 +80,9 @@ void swfdec_as_object_get_variable (Swf
SwfdecAsValue * value);
void swfdec_as_object_delete_variable(SwfdecAsObject * object,
const SwfdecAsValue * variable);
+SwfdecAsObject *swfdec_as_object_find_variable (SwfdecAsObject * object,
+ const SwfdecAsValue * variable);
+
/* shortcuts, you probably don't want to bind them */
#define swfdec_as_object_set(object, name, value) G_STMT_START { \
SwfdecAsValue __variable; \
diff-tree 04caa48b48e55a62787a5b5bd7f2ee77d330ebbf (from 737748443383004fd830136283af95dc9f8c2a20)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Apr 5 15:27:06 2007 +0200
add swfdec_as_stack_pop_n
diff --git a/libswfdec/swfdec_as_stack.h b/libswfdec/swfdec_as_stack.h
index a5b14a6..49c57a7 100644
--- a/libswfdec/swfdec_as_stack.h
+++ b/libswfdec/swfdec_as_stack.h
@@ -40,6 +40,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_pop_n(stack, n) ((stack)->cur -= (n))
#define swfdec_as_stack_push(stack) ((stack)->cur++)
#define swfdec_as_stack_get_size(stack) ((guint)((stack)->cur - (stack)->base))
diff-tree 737748443383004fd830136283af95dc9f8c2a20 (from 6fde0b1cfdf42ab05cf00b60030f926be534efd2)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Apr 5 15:26:50 2007 +0200
fix gcc warning
diff --git a/libswfdec/swfdec_net_stream.c b/libswfdec/swfdec_net_stream.c
index 04d89a3..b9d39ed 100644
--- a/libswfdec/swfdec_net_stream.c
+++ b/libswfdec/swfdec_net_stream.c
@@ -472,7 +472,7 @@ swfdec_net_stream_seek (SwfdecNetStream
if (stream->flvdecoder == NULL)
return;
- if (!finite (secs) || secs < 0) {
+ if (!isfinite (secs) || secs < 0) {
SWFDEC_ERROR ("seeking to %g doesn't work", secs);
return;
}
diff-tree 6fde0b1cfdf42ab05cf00b60030f926be534efd2 (from d646f6672f12f65ebab2bf3afd607df71af77dd6)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Apr 5 15:26:43 2007 +0200
fix gcc warning
diff --git a/libswfdec/swfdec_flv_decoder.c b/libswfdec/swfdec_flv_decoder.c
index fe35ed2..10b97c3 100644
--- a/libswfdec/swfdec_flv_decoder.c
+++ b/libswfdec/swfdec_flv_decoder.c
@@ -385,8 +385,9 @@ swfdec_flv_decoder_parse_tag (SwfdecFlvD
swfdec_bits_init (&bits, buffer);
type = swfdec_bits_get_u8 (&bits);
/* I think I'm paranoid and complicated. I think I'm paranoid, manipulated */
- if (size != swfdec_bits_get_bu24 (&bits))
+ if (size != swfdec_bits_get_bu24 (&bits)) {
g_assert_not_reached ();
+ }
timestamp = swfdec_bits_get_bu24 (&bits);
swfdec_bits_get_bu32 (&bits);
SWFDEC_LOG ("new tag");
More information about the Swfdec
mailing list