Benjamin Otte
2007-Nov-22 20:34 UTC
[Swfdec] 5 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_debugger.c libswfdec/swfdec_movie.c libswfdec/swfdec_script.c libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_tag.c libswfdec/swfdec_text_field.c test/trace
libswfdec/swfdec_as_interpret.c | 23 ++++++++++++----------- libswfdec/swfdec_bits.c | 13 +++---------- libswfdec/swfdec_bits.h | 3 +-- libswfdec/swfdec_debugger.c | 2 +- libswfdec/swfdec_movie.c | 2 +- libswfdec/swfdec_script.c | 2 +- libswfdec/swfdec_sprite_movie.c | 4 ++-- libswfdec/swfdec_tag.c | 4 ++-- libswfdec/swfdec_text_field.c | 4 ++-- test/trace/atan2-5.swf |binary test/trace/atan2-5.swf.trace | 6 ++++++ test/trace/atan2-6.swf |binary test/trace/atan2-6.swf.trace | 6 ++++++ test/trace/atan2-7.swf |binary test/trace/atan2-7.swf.trace | 6 ++++++ test/trace/atan2-8.swf |binary test/trace/atan2-8.swf.trace | 6 ++++++ test/trace/atan2.as | 6 ++++++ 18 files changed, 55 insertions(+), 32 deletions(-) New commits: commit 1e5f7cd44c31b1c67b912dd1bc67d41592de3c2d Author: Benjamin Otte <otte at gnome.org> Date: Thu Nov 22 21:33:02 2007 +0100 remove swfdec_bits_get_string() and rename swfdec_bits_get_String_with_version() to it diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c index b703847..130d920 100644 --- a/libswfdec/swfdec_as_interpret.c +++ b/libswfdec/swfdec_as_interpret.c @@ -326,7 +326,7 @@ swfdec_action_push (SwfdecAsContext *cx, guint action, const guint8 *data, guint switch (type) { case 0: /* string */ { - char *s = swfdec_bits_get_string_with_version (&bits, cx->version); + char *s = swfdec_bits_get_string (&bits, cx->version); if (s == NULL) return; SWFDEC_AS_VALUE_SET_STRING (swfdec_as_stack_push (cx), @@ -1130,8 +1130,8 @@ swfdec_action_get_url (SwfdecAsContext *cx, guint action, const guint8 *data, gu char *url, *target; swfdec_bits_init_data (&bits, data, len); - url = swfdec_bits_get_string_with_version (&bits, cx->version); - target = swfdec_bits_get_string_with_version (&bits, cx->version); + url = swfdec_bits_get_string (&bits, cx->version); + target = swfdec_bits_get_string (&bits, cx->version); if (url == NULL || target == NULL) { SWFDEC_ERROR ("not enough data in GetURL"); g_free (url); @@ -1797,7 +1797,7 @@ swfdec_action_define_function (SwfdecAsContext *cx, guint action, frame = cx->frame; swfdec_bits_init_data (&bits, data, len); - function_name = swfdec_bits_get_string_with_version (&bits, cx->version); + function_name = swfdec_bits_get_string (&bits, cx->version); if (function_name == NULL) { SWFDEC_ERROR ("could not parse function name"); return; @@ -1823,7 +1823,7 @@ swfdec_action_define_function (SwfdecAsContext *cx, guint action, args[i].preload = 0; } } - args[i].name = swfdec_bits_get_string_with_version (&bits, cx->version); + args[i].name = swfdec_bits_get_string (&bits, cx->version); if (args[i].name == NULL || args[i].name == '\0') { SWFDEC_ERROR ("empty argument name not allowed"); g_free (args); @@ -2715,7 +2715,7 @@ swfdec_action_try (SwfdecAsContext *cx, guint action, const guint8 *data, guint try_data->register_number = swfdec_bits_get_u8 (&bits); } else { try_data->variable_name - swfdec_bits_get_string_with_version (&bits, cx->version); + swfdec_bits_get_string (&bits, cx->version); } if (swfdec_bits_left (&bits)) { @@ -2855,7 +2855,7 @@ swfdec_action_print_define_function (guint action, const guint8 *data, guint len string = g_string_new (v2 ? "DefineFunction2 " : "DefineFunction "); swfdec_bits_init_data (&bits, data, len); /* FIXME: version! */ - function_name = swfdec_bits_get_string_with_version (&bits, 7); + function_name = swfdec_bits_get_string (&bits, 7); if (function_name == NULL) { SWFDEC_ERROR ("could not parse function name"); g_string_free (string, TRUE); @@ -2879,7 +2879,7 @@ swfdec_action_print_define_function (guint action, const guint8 *data, guint len preload = swfdec_bits_get_u8 (&bits); else preload = 0; - arg_name = swfdec_bits_get_string_with_version (&bits, 7); + arg_name = swfdec_bits_get_string (&bits, 7); if (preload == 0 && (arg_name == NULL || *arg_name == '\0')) { SWFDEC_ERROR ("empty argument name not allowed"); g_string_free (string, TRUE); @@ -2925,8 +2925,8 @@ swfdec_action_print_get_url (guint action, const guint8 *data, guint len) char *url, *target, *ret; swfdec_bits_init_data (&bits, data, len); - url = swfdec_bits_get_string_with_version (&bits, 7); - target = swfdec_bits_get_string_with_version (&bits, 7); + url = swfdec_bits_get_string (&bits, 7); + target = swfdec_bits_get_string (&bits, 7); if (url == NULL) { SWFDEC_ERROR ("not enough data in GetURL"); url = g_strdup ("???"); @@ -2983,7 +2983,7 @@ swfdec_action_print_push (guint action, const guint8 *data, guint len) case 0: /* string */ { /* FIXME: need version! */ - char *s = swfdec_bits_get_string_with_version (&bits, 7); + char *s = swfdec_bits_get_string (&bits, 7); if (!s) { g_string_free (string, TRUE); return NULL; diff --git a/libswfdec/swfdec_bits.c b/libswfdec/swfdec_bits.c index 992ec27..fbc35fc 100644 --- a/libswfdec/swfdec_bits.c +++ b/libswfdec/swfdec_bits.c @@ -481,18 +481,18 @@ swfdec_bits_skip_string (SwfdecBits *bits) } /** - * swfdec_bits_get_string_with_version: + * swfdec_bits_get_string: * @bits: a #SwfdecBits * @version: Flash player version * * Prior to Flash 6, strings used to be encoded as LATIN1. Since Flash 6, - * strings are encoded as UTF-8. This version does the check automatically + * strings are encoded as UTF-8. This version does that check automatically * and converts strings to UTF-8. * * Returns: a UTF-8 encoded string or %NULL on error **/ char * -swfdec_bits_get_string_with_version (SwfdecBits *bits, guint version) +swfdec_bits_get_string (SwfdecBits *bits, guint version) { const char *s; @@ -516,13 +516,6 @@ swfdec_bits_get_string_with_version (SwfdecBits *bits, guint version) } } -/* FIXME: deprecated - someone remove this */ -char * -swfdec_bits_get_string (SwfdecBits * bits) -{ - return swfdec_bits_get_string_with_version (bits, 6); -} - /** * swfdec_bits_skip_bytes: * @bits: a #SwfdecBits diff --git a/libswfdec/swfdec_bits.h b/libswfdec/swfdec_bits.h index defa165..29e9cce 100644 --- a/libswfdec/swfdec_bits.h +++ b/libswfdec/swfdec_bits.h @@ -62,9 +62,8 @@ void swfdec_bits_get_color_transform (SwfdecBits * bits, void swfdec_bits_get_matrix (SwfdecBits * bits, cairo_matrix_t *matrix, cairo_matrix_t *inverse); guint swfdec_bits_skip_bytes (SwfdecBits *bits, guint bytes); -char *swfdec_bits_get_string (SwfdecBits * bits); char *swfdec_bits_get_string_length (SwfdecBits * bits, guint len); -char *swfdec_bits_get_string_with_version (SwfdecBits *bits, guint version); +char *swfdec_bits_get_string (SwfdecBits *bits, guint version); SwfdecColor swfdec_bits_get_color (SwfdecBits * bits); SwfdecColor swfdec_bits_get_rgba (SwfdecBits * bits); void swfdec_bits_get_rect (SwfdecBits * bits, SwfdecRect *rect); diff --git a/libswfdec/swfdec_debugger.c b/libswfdec/swfdec_debugger.c index 89adbf6..2dca1df 100644 --- a/libswfdec/swfdec_debugger.c +++ b/libswfdec/swfdec_debugger.c @@ -71,7 +71,7 @@ swfdec_debugger_print_push (ScriptParser *parser, const guint8 *data, guint len) switch (type) { case 0: /* string */ { - char *s = swfdec_bits_get_string_with_version (&bits, parser->version); + char *s = swfdec_bits_get_string (&bits, parser->version); if (!s) goto error; g_string_append_c (string, '"'); diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 2dd36be..ec73386 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -64,7 +64,7 @@ swfdec_constant_pool_new_from_action (const guint8 *data, guint len, guint versi pool = g_malloc0 (sizeof (SwfdecConstantPool) + (n - 1) * sizeof (char *)); pool->n_strings = n; for (i = 0; i < n; i++) { - pool->strings[i] = swfdec_bits_get_string_with_version (&bits, version); + pool->strings[i] = swfdec_bits_get_string (&bits, version); if (pool->strings[i] == NULL) { SWFDEC_ERROR ("not enough strings available"); swfdec_constant_pool_free (pool); diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c index 6ffdc67..1a7b6d5 100644 --- a/libswfdec/swfdec_sprite_movie.c +++ b/libswfdec/swfdec_sprite_movie.c @@ -229,7 +229,7 @@ swfdec_sprite_movie_perform_place (SwfdecSpriteMovie *movie, SwfdecBits *bits, g } if (has_name) { - char *s = swfdec_bits_get_string_with_version (bits, version); + char *s = swfdec_bits_get_string (bits, version); name = swfdec_as_context_give_string (SWFDEC_AS_CONTEXT (player), s); SWFDEC_LOG (" name = %s", name); } else { @@ -425,7 +425,7 @@ swfdec_sprite_movie_perform_one_action (SwfdecSpriteMovie *movie, guint tag, Swf char *name; id = swfdec_bits_get_u16 (&bits); object = swfdec_swf_decoder_get_character (SWFDEC_SWF_DECODER (resource->decoder), id); - name = swfdec_bits_get_string_with_version (&bits, SWFDEC_AS_CONTEXT (player)->version); + name = swfdec_bits_get_string (&bits, SWFDEC_AS_CONTEXT (player)->version); if (object == NULL) { SWFDEC_ERROR ("cannot export id %u as %s, id wasn't found", id, name); } else if (name == NULL) { diff --git a/libswfdec/swfdec_tag.c b/libswfdec/swfdec_tag.c index 6103f51..5e0142e 100644 --- a/libswfdec/swfdec_tag.c +++ b/libswfdec/swfdec_tag.c @@ -65,7 +65,7 @@ tag_func_protect (SwfdecSwfDecoder * s, guint tag) if (swfdec_bits_left (&s->b)) { /* FIXME: What's this for? */ swfdec_bits_get_u16 (&s->b); - s->password = swfdec_bits_get_string_with_version (&s->b, s->version); + s->password = swfdec_bits_get_string (&s->b, s->version); } return SWFDEC_STATUS_OK; } @@ -79,7 +79,7 @@ tag_func_frame_label (SwfdecSwfDecoder * s, guint tag) SWFDEC_WARNING ("frame %d already has a label (%s)", s->parse_sprite->parse_frame, frame->label); g_free (frame->label); } - frame->label = swfdec_bits_get_string_with_version (&s->b, s->version); + frame->label = swfdec_bits_get_string (&s->b, s->version); SWFDEC_LOG ("frame %d named %s", s->parse_sprite->parse_frame, frame->label); return SWFDEC_STATUS_OK; diff --git a/libswfdec/swfdec_text_field.c b/libswfdec/swfdec_text_field.c index f7bf2cf..91af056 100644 --- a/libswfdec/swfdec_text_field.c +++ b/libswfdec/swfdec_text_field.c @@ -185,14 +185,14 @@ tag_func_define_edit_text (SwfdecSwfDecoder * s, guint tag) text->leading = swfdec_bits_get_s16 (b); } - text->variable = swfdec_bits_get_string_with_version (b, s->version); + text->variable = swfdec_bits_get_string (b, s->version); if (text->variable && *text->variable == 0) { g_free (text->variable); text->variable = NULL; } if (has_text) - text->input = swfdec_bits_get_string_with_version (b, s->version); + text->input = swfdec_bits_get_string (b, s->version); return SWFDEC_STATUS_OK; } commit 9eed89d76ace0ea8bcb589293269ee0b064f7248 Author: Benjamin Otte <otte at gnome.org> Date: Thu Nov 22 21:28:44 2007 +0100 use swfdec_bits_get_string_with_version () everywhere diff --git a/libswfdec/swfdec_tag.c b/libswfdec/swfdec_tag.c index 1b18fd2..6103f51 100644 --- a/libswfdec/swfdec_tag.c +++ b/libswfdec/swfdec_tag.c @@ -65,7 +65,7 @@ tag_func_protect (SwfdecSwfDecoder * s, guint tag) if (swfdec_bits_left (&s->b)) { /* FIXME: What's this for? */ swfdec_bits_get_u16 (&s->b); - s->password = swfdec_bits_get_string (&s->b); + s->password = swfdec_bits_get_string_with_version (&s->b, s->version); } return SWFDEC_STATUS_OK; } @@ -79,7 +79,7 @@ tag_func_frame_label (SwfdecSwfDecoder * s, guint tag) SWFDEC_WARNING ("frame %d already has a label (%s)", s->parse_sprite->parse_frame, frame->label); g_free (frame->label); } - frame->label = swfdec_bits_get_string (&s->b); + frame->label = swfdec_bits_get_string_with_version (&s->b, s->version); SWFDEC_LOG ("frame %d named %s", s->parse_sprite->parse_frame, frame->label); return SWFDEC_STATUS_OK; diff --git a/libswfdec/swfdec_text_field.c b/libswfdec/swfdec_text_field.c index af90d23..f7bf2cf 100644 --- a/libswfdec/swfdec_text_field.c +++ b/libswfdec/swfdec_text_field.c @@ -185,14 +185,14 @@ tag_func_define_edit_text (SwfdecSwfDecoder * s, guint tag) text->leading = swfdec_bits_get_s16 (b); } - text->variable = swfdec_bits_get_string (b); + text->variable = swfdec_bits_get_string_with_version (b, s->version); if (text->variable && *text->variable == 0) { g_free (text->variable); text->variable = NULL; } if (has_text) - text->input = swfdec_bits_get_string (b); + text->input = swfdec_bits_get_string_with_version (b, s->version); return SWFDEC_STATUS_OK; } commit 089fa86197ccc7df5f25bb23f0f951c1fda1df1f Author: Benjamin Otte <otte at gnome.org> Date: Thu Nov 22 21:28:29 2007 +0100 make print functions always assume utf-8 diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c index 7d6686f..b703847 100644 --- a/libswfdec/swfdec_as_interpret.c +++ b/libswfdec/swfdec_as_interpret.c @@ -2854,7 +2854,8 @@ swfdec_action_print_define_function (guint action, const guint8 *data, guint len string = g_string_new (v2 ? "DefineFunction2 " : "DefineFunction "); swfdec_bits_init_data (&bits, data, len); - function_name = swfdec_bits_get_string (&bits); + /* FIXME: version! */ + function_name = swfdec_bits_get_string_with_version (&bits, 7); if (function_name == NULL) { SWFDEC_ERROR ("could not parse function name"); g_string_free (string, TRUE); @@ -2878,7 +2879,7 @@ swfdec_action_print_define_function (guint action, const guint8 *data, guint len preload = swfdec_bits_get_u8 (&bits); else preload = 0; - arg_name = swfdec_bits_get_string (&bits); + arg_name = swfdec_bits_get_string_with_version (&bits, 7); if (preload == 0 && (arg_name == NULL || *arg_name == '\0')) { SWFDEC_ERROR ("empty argument name not allowed"); g_string_free (string, TRUE); @@ -2924,8 +2925,8 @@ swfdec_action_print_get_url (guint action, const guint8 *data, guint len) char *url, *target, *ret; swfdec_bits_init_data (&bits, data, len); - url = swfdec_bits_get_string (&bits); - target = swfdec_bits_get_string (&bits); + url = swfdec_bits_get_string_with_version (&bits, 7); + target = swfdec_bits_get_string_with_version (&bits, 7); if (url == NULL) { SWFDEC_ERROR ("not enough data in GetURL"); url = g_strdup ("???"); @@ -2982,7 +2983,7 @@ swfdec_action_print_push (guint action, const guint8 *data, guint len) case 0: /* string */ { /* FIXME: need version! */ - char *s = swfdec_bits_get_string (&bits); + char *s = swfdec_bits_get_string_with_version (&bits, 7); if (!s) { g_string_free (string, TRUE); return NULL; commit 012de7090f5bfdf49e184b85ebf11e49e61414ad Author: Benjamin Otte <otte at gnome.org> Date: Thu Nov 22 10:31:42 2007 +0100 update to include more values diff --git a/test/trace/atan2-5.swf b/test/trace/atan2-5.swf index 84ef951..a48098d 100644 Binary files a/test/trace/atan2-5.swf and b/test/trace/atan2-5.swf differ diff --git a/test/trace/atan2-5.swf.trace b/test/trace/atan2-5.swf.trace index c553b4d..56df156 100644 --- a/test/trace/atan2-5.swf.trace +++ b/test/trace/atan2-5.swf.trace @@ -1,2 +1,8 @@ +0.785398163397448 1.5707963267949 0 +0 +3.14159265358979 +-0.785398163397448 +-1.5707963267949 +-2.35619449019234 diff --git a/test/trace/atan2-6.swf b/test/trace/atan2-6.swf index 2d37034..57485e4 100644 Binary files a/test/trace/atan2-6.swf and b/test/trace/atan2-6.swf differ diff --git a/test/trace/atan2-6.swf.trace b/test/trace/atan2-6.swf.trace index c553b4d..56df156 100644 --- a/test/trace/atan2-6.swf.trace +++ b/test/trace/atan2-6.swf.trace @@ -1,2 +1,8 @@ +0.785398163397448 1.5707963267949 0 +0 +3.14159265358979 +-0.785398163397448 +-1.5707963267949 +-2.35619449019234 diff --git a/test/trace/atan2-7.swf b/test/trace/atan2-7.swf index 637ba50..21e55d0 100644 Binary files a/test/trace/atan2-7.swf and b/test/trace/atan2-7.swf differ diff --git a/test/trace/atan2-7.swf.trace b/test/trace/atan2-7.swf.trace index c553b4d..56df156 100644 --- a/test/trace/atan2-7.swf.trace +++ b/test/trace/atan2-7.swf.trace @@ -1,2 +1,8 @@ +0.785398163397448 1.5707963267949 0 +0 +3.14159265358979 +-0.785398163397448 +-1.5707963267949 +-2.35619449019234 diff --git a/test/trace/atan2-8.swf b/test/trace/atan2-8.swf index 14333ec..ac00cd8 100644 Binary files a/test/trace/atan2-8.swf and b/test/trace/atan2-8.swf differ diff --git a/test/trace/atan2-8.swf.trace b/test/trace/atan2-8.swf.trace index c553b4d..56df156 100644 --- a/test/trace/atan2-8.swf.trace +++ b/test/trace/atan2-8.swf.trace @@ -1,2 +1,8 @@ +0.785398163397448 1.5707963267949 0 +0 +3.14159265358979 +-0.785398163397448 +-1.5707963267949 +-2.35619449019234 diff --git a/test/trace/atan2.as b/test/trace/atan2.as index 602f072..687b91a 100644 --- a/test/trace/atan2.as +++ b/test/trace/atan2.as @@ -1,6 +1,12 @@ // makeswf -v 7 -s 200x150 -r 1 -o atan2.swf atan2.as +trace(Math.atan2(10, 10)); trace(Math.atan2(10, 0)); trace(Math.atan2(0, 10)); +trace(Math.atan2(0, 0)); +trace(Math.atan2(0, -10)); +trace(Math.atan2(-10, 10)); +trace(Math.atan2(-10, 0)); +trace(Math.atan2(-10, -10)); loadMovie ("FSCommand:quit", ""); commit 63fb37928a76bdfed2a4b8dd6afb96f0cec4f3fb Author: Benjamin Otte <otte at gnome.org> Date: Tue Nov 20 23:38:38 2007 +0100 fix typo diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c index 0fbf8a2..69a265b 100644 --- a/libswfdec/swfdec_movie.c +++ b/libswfdec/swfdec_movie.c @@ -308,7 +308,7 @@ swfdec_movie_remove (SwfdecMovie *movie) * * Removes this movie from its parent. After this it will no longer be present, * neither visually nor via ActionScript. This function will not cause an - * unload event. Compare with swfdec_movie_destroy (). + * unload event. Compare with swfdec_movie_remove (). **/ void swfdec_movie_destroy (SwfdecMovie *movie)
Maybe Matching Threads
- Branch 'as' - 13 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h
- 3 commits - libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_sprite.c libswfdec/swfdec_tag.c
- Branch 'interpreter' - 8 commits - libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_js.c libswfdec/swfdec_js.h libswfdec/swfdec_script.c test/swfdec_out.c test/swfdec_out.h test/swfedit_tag.c test/swfedit_token.c test/swfedit_token.h
- libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_string.c libswfdec/swfdec_bits.c
- 11 commits - libswfdec/swfdec_font.c libswfdec/swfdec_font.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c libswfdec/swfdec_script.h test/.gitignore test/trace