[Swfdec-commits] 7 commits - swfdec/swfdec_as_array.c swfdec/swfdec_bitmap_data.c swfdec/swfdec_text_field_movie_as.c swfdec/swfdec_text_field_movie_html.c test/trace

Benjamin Otte company at kemper.freedesktop.org
Fri Nov 14 06:51:56 PST 2008


 swfdec/swfdec_as_array.c                |    2 
 swfdec/swfdec_bitmap_data.c             |   26 ++++++++--
 swfdec/swfdec_text_field_movie_as.c     |    4 -
 swfdec/swfdec_text_field_movie_html.c   |   76 ++++++++++++++++----------------
 test/trace/Makefile.am                  |    9 +++
 test/trace/crash-0.8.2-copyPixels-5.swf |binary
 test/trace/crash-0.8.2-copyPixels-6.swf |binary
 test/trace/crash-0.8.2-copyPixels-7.swf |binary
 test/trace/crash-0.8.2-copyPixels-8.swf |binary
 test/trace/crash-0.8.2-copyPixels.as    |    7 ++
 10 files changed, 76 insertions(+), 48 deletions(-)

New commits:
commit 5cb5bfd415cdd1ef5d4f4581815f55fe9259bd1e
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Nov 14 15:39:13 2008 +0100

    g_strcasecmp => g_ascii_strcasecmp
    
    The first symbol is deprecated.
    I'm not sure this works for caseinsensitive sorting, but there's no test
    indicating otherwise.

diff --git a/swfdec/swfdec_as_array.c b/swfdec/swfdec_as_array.c
index 592b6a8..62729e0 100644
--- a/swfdec/swfdec_as_array.c
+++ b/swfdec/swfdec_as_array.c
@@ -886,7 +886,7 @@ swfdec_as_array_sort_compare_values (SwfdecAsContext *cx,
     const char *b_str = swfdec_as_value_to_string (cx, *b);
 
     if (options & SORT_OPTION_CASEINSENSITIVE) {
-      retval = g_strcasecmp (a_str, b_str);
+      retval = g_ascii_strcasecmp (a_str, b_str);
     } else {
       retval = strcmp (a_str, b_str);
     }
diff --git a/swfdec/swfdec_text_field_movie_as.c b/swfdec/swfdec_text_field_movie_as.c
index a429883..fd43210 100644
--- a/swfdec/swfdec_text_field_movie_as.c
+++ b/swfdec/swfdec_text_field_movie_as.c
@@ -372,9 +372,9 @@ swfdec_text_field_movie_do_set_type (SwfdecAsContext *cx,
 
   SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "s", &value);
 
-  if (!g_strcasecmp (value, SWFDEC_AS_STR_input)) {
+  if (!g_ascii_strcasecmp (value, SWFDEC_AS_STR_input)) {
     text->editable = TRUE;
-  } else if (!g_strcasecmp (value, SWFDEC_AS_STR_dynamic)) {
+  } else if (!g_ascii_strcasecmp (value, SWFDEC_AS_STR_dynamic)) {
     text->editable = FALSE;
   }
   /* else ignore */
commit 1033c2af60e085247364fae7ae126538346a87de
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Nov 14 15:37:45 2008 +0100

    g_strncasecmp => g_ascii_strncasecmp
    
    The first symbol is deprecated. And all characters were ASCII anyway.

diff --git a/swfdec/swfdec_text_field_movie_html.c b/swfdec/swfdec_text_field_movie_html.c
index 21c1ce2..e268c77 100644
--- a/swfdec/swfdec_text_field_movie_html.c
+++ b/swfdec/swfdec_text_field_movie_html.c
@@ -59,8 +59,8 @@ swfdec_text_field_movie_html_parse_close_tag (ParserData *data, ParserTag *tag,
   g_return_if_fail (tag != NULL);
 
   if (data->multiline && !end &&
-      ((tag->name_length == 1 && !g_strncasecmp (tag->name, "p", 1)) ||
-       (tag->name_length == 2 && !g_strncasecmp (tag->name, "li", 2))))
+      ((tag->name_length == 1 && !g_ascii_strncasecmp (tag->name, "p", 1)) ||
+       (tag->name_length == 2 && !g_ascii_strncasecmp (tag->name, "li", 2))))
   {
     GSList *iter;
 
@@ -68,7 +68,7 @@ swfdec_text_field_movie_html_parse_close_tag (ParserData *data, ParserTag *tag,
       ParserTag *f = iter->data;
       if (f->end_index < tag->index)
 	break;
-      if (f->name_length == 4 && !g_strncasecmp (f->name, "font", 4)) {
+      if (f->name_length == 4 && !g_ascii_strncasecmp (f->name, "font", 4)) {
 	ParserTag *n = g_new0 (ParserTag, 1);
 	n->name = f->name;
 	n->name_length = f->name_length;
@@ -133,48 +133,48 @@ swfdec_text_field_movie_html_tag_set_attribute (ParserData *data,
   SWFDEC_AS_VALUE_SET_STRING (&val, swfdec_as_context_give_string (
 	cx, g_strndup (value, value_length)));
 
-  if (tag->name_length == 10 && !g_strncasecmp (tag->name, "textformat", 10))
+  if (tag->name_length == 10 && !g_ascii_strncasecmp (tag->name, "textformat", 10))
   {
-    if (name_length == 10 && !g_strncasecmp (name, "leftmargin", 10))
+    if (name_length == 10 && !g_ascii_strncasecmp (name, "leftmargin", 10))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_leftMargin, &val);
     }
-    else if (name_length == 11 && !g_strncasecmp (name, "rightmargin", 11))
+    else if (name_length == 11 && !g_ascii_strncasecmp (name, "rightmargin", 11))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_rightMargin, &val);
     }
-    else if (name_length == 6 && !g_strncasecmp (name, "indent", 6))
+    else if (name_length == 6 && !g_ascii_strncasecmp (name, "indent", 6))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_indent, &val);
     }
-    else if (name_length == 11 && !g_strncasecmp (name, "blockindent", 11))
+    else if (name_length == 11 && !g_ascii_strncasecmp (name, "blockindent", 11))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_blockIndent, &val);
     }
-    else if (name_length == 8 && !g_strncasecmp (name, "tabstops", 8))
+    else if (name_length == 8 && !g_ascii_strncasecmp (name, "tabstops", 8))
     {
       // FIXME
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_tabStops, &val);
     }
   }
-  else if (tag->name_length == 1 && !g_strncasecmp (tag->name, "p", 1))
+  else if (tag->name_length == 1 && !g_ascii_strncasecmp (tag->name, "p", 1))
   {
-    if (name_length == 5 && !g_strncasecmp (name, "align", 5))
+    if (name_length == 5 && !g_ascii_strncasecmp (name, "align", 5))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_align, &val);
     }
   }
-  else if (tag->name_length == 4 && !g_strncasecmp (tag->name, "font", 4))
+  else if (tag->name_length == 4 && !g_ascii_strncasecmp (tag->name, "font", 4))
   {
-    if (name_length == 4 && !g_strncasecmp (name, "face", 4))
+    if (name_length == 4 && !g_ascii_strncasecmp (name, "face", 4))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_font, &val);
     }
-    else if (name_length == 4 && !g_strncasecmp (name, "size", 4))
+    else if (name_length == 4 && !g_ascii_strncasecmp (name, "size", 4))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_size, &val);
     }
-    else if (name_length == 5 && !g_strncasecmp (name, "color", 5))
+    else if (name_length == 5 && !g_ascii_strncasecmp (name, "color", 5))
     {
       SwfdecAsValue val_number;
 
@@ -192,31 +192,31 @@ swfdec_text_field_movie_html_tag_set_attribute (ParserData *data,
 
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_color, &val_number);
     }
-    else if (name_length == 13 && !g_strncasecmp (name, "letterspacing", 13))
+    else if (name_length == 13 && !g_ascii_strncasecmp (name, "letterspacing", 13))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_letterSpacing,
 	  &val);
     }
     // special case: Don't parse kerning
   }
-  else if (tag->name_length == 1 && !g_strncasecmp (tag->name, "a", 1))
+  else if (tag->name_length == 1 && !g_ascii_strncasecmp (tag->name, "a", 1))
   {
-    if (name_length == 4 && !g_strncasecmp (name, "href", 4))
+    if (name_length == 4 && !g_ascii_strncasecmp (name, "href", 4))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_url, &val);
     }
-    else if (name_length == 6 && !g_strncasecmp (name, "target", 6))
+    else if (name_length == 6 && !g_ascii_strncasecmp (name, "target", 6))
     {
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_target, &val);
     }
   }
 
   if (data->style_sheet &&
-      ((tag->name_length == 2 && !g_strncasecmp (tag->name, "li", 2)) ||
-      (tag->name_length == 4 && !g_strncasecmp (tag->name, "span", 4)) ||
-      (tag->name_length == 1 && !g_strncasecmp (tag->name, "p", 1))))
+      ((tag->name_length == 2 && !g_ascii_strncasecmp (tag->name, "li", 2)) ||
+      (tag->name_length == 4 && !g_ascii_strncasecmp (tag->name, "span", 4)) ||
+      (tag->name_length == 1 && !g_ascii_strncasecmp (tag->name, "p", 1))))
   {
-    if (name_length == 5 && !g_strncasecmp (name, "class", 5)) {
+    if (name_length == 5 && !g_ascii_strncasecmp (name, "class", 5)) {
       SwfdecTextFormat *format = swfdec_style_sheet_get_class_format (
 	  data->style_sheet, swfdec_as_context_give_string (data->cx,
 	      g_strndup (value, value_length)));
@@ -315,14 +315,14 @@ swfdec_text_field_movie_html_parse_tag (ParserData *data, const char *p)
 
   if (close)
   {
-    if (name_length == 1 && !g_strncasecmp (name, "p", 1)) {
+    if (name_length == 1 && !g_ascii_strncasecmp (name, "p", 1)) {
       GSList *iter, *found;
 
       found = NULL;
       iter = data->tags_open;
       while (iter != NULL) {
 	tag = iter->data;
-	if (tag->name_length == 1 && !g_strncasecmp (tag->name, "p", 1))
+	if (tag->name_length == 1 && !g_ascii_strncasecmp (tag->name, "p", 1))
 	  found = iter;
 	iter = iter->next;
       }
@@ -332,9 +332,9 @@ swfdec_text_field_movie_html_parse_tag (ParserData *data, const char *p)
 	while (iter != found) {
 	  tag = iter->data;
 	  iter = iter->next;
-	  if ((tag->name_length == 2 && !g_strncasecmp (tag->name, "li", 2)) ||
+	  if ((tag->name_length == 2 && !g_ascii_strncasecmp (tag->name, "li", 2)) ||
 	      (tag->name_length == 10 &&
-	       !g_strncasecmp (tag->name, "textformat", 10)))
+	       !g_ascii_strncasecmp (tag->name, "textformat", 10)))
 	    continue;
 	  swfdec_text_field_movie_html_parse_close_tag (data, tag, TRUE);
 	}
@@ -347,7 +347,7 @@ swfdec_text_field_movie_html_parse_tag (ParserData *data, const char *p)
       if (data->tags_open != NULL) {
 	tag = data->tags_open->data;
 	if (name_length == tag->name_length &&
-	    !g_strncasecmp (name, tag->name, name_length))
+	    !g_ascii_strncasecmp (name, tag->name, name_length))
 	  swfdec_text_field_movie_html_parse_close_tag (data, tag, FALSE);
       }
     }
@@ -361,15 +361,15 @@ swfdec_text_field_movie_html_parse_tag (ParserData *data, const char *p)
     SwfdecAsObject *object;
     SwfdecAsValue val;
 
-    if (name_length == 3 && !g_strncasecmp (name, "tab", 3))
+    if (name_length == 3 && !g_ascii_strncasecmp (name, "tab", 3))
       swfdec_text_buffer_append_text (data->text, "\t");
 
     if (data->multiline) {
-      if (name_length == 2 && !g_strncasecmp (name, "br", 2))
+      if (name_length == 2 && !g_ascii_strncasecmp (name, "br", 2))
       {
 	swfdec_text_buffer_append_text (data->text, "\n");
       }
-      else if (name_length == 2 && !g_strncasecmp (name, "li", 1))
+      else if (name_length == 2 && !g_ascii_strncasecmp (name, "li", 1))
       {
 	gsize length = swfdec_text_buffer_get_length (data->text);
 	const char *s = swfdec_text_buffer_get_text (data->text);
@@ -391,24 +391,24 @@ swfdec_text_field_movie_html_parse_tag (ParserData *data, const char *p)
       object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (tag->format));
       SWFDEC_AS_VALUE_SET_BOOLEAN (&val, TRUE);
 
-      if (tag->name_length == 2 && !g_strncasecmp (tag->name, "li", 2)) {
+      if (tag->name_length == 2 && !g_ascii_strncasecmp (tag->name, "li", 2)) {
 	swfdec_as_object_set_variable (object, SWFDEC_AS_STR_bullet, &val);
-      } else if (tag->name_length == 1 && !g_strncasecmp (tag->name, "b", 1)) {
+      } else if (tag->name_length == 1 && !g_ascii_strncasecmp (tag->name, "b", 1)) {
 	swfdec_as_object_set_variable (object, SWFDEC_AS_STR_bold, &val);
-      } else if (tag->name_length == 1 && !g_strncasecmp (tag->name, "i", 1)) {
+      } else if (tag->name_length == 1 && !g_ascii_strncasecmp (tag->name, "i", 1)) {
 	swfdec_as_object_set_variable (object, SWFDEC_AS_STR_italic, &val);
-      } else if (tag->name_length == 1 && !g_strncasecmp (tag->name, "u", 1)) {
+      } else if (tag->name_length == 1 && !g_ascii_strncasecmp (tag->name, "u", 1)) {
 	swfdec_as_object_set_variable (object, SWFDEC_AS_STR_underline, &val);
       }
-      else if (tag->name_length == 3 && !g_strncasecmp (tag->name, "img", 3))
+      else if (tag->name_length == 3 && !g_ascii_strncasecmp (tag->name, "img", 3))
       {
 	SWFDEC_FIXME ("IMG tag support for TextField's HTML input missing");
       }
     }
 
     if (data->style_sheet &&
-	((tag->name_length == 2 && !g_strncasecmp (tag->name, "li", 2)) ||
-	(tag->name_length == 1 && !g_strncasecmp (tag->name, "p", 1)))) {
+	((tag->name_length == 2 && !g_ascii_strncasecmp (tag->name, "li", 2)) ||
+	(tag->name_length == 1 && !g_ascii_strncasecmp (tag->name, "p", 1)))) {
       SwfdecTextFormat *format = swfdec_style_sheet_get_tag_format (
 	  data->style_sheet, swfdec_as_context_give_string (data->cx,
 	      g_strndup (tag->name, tag->name_length)));
commit 779b4f1faedcea9b6717122adc169d56200b83f7
Merge: 1432470... 5195c41...
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 12 21:24:29 2008 +0100

    Merge branch '0.8'
    
    Conflicts:
    
    	swfdec/swfdec_bitmap_data.c

commit 143247067febe1d20f664488c841d462aa6dc0c5
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 12 21:07:41 2008 +0100

    fix BitmapData.copyPixels crashers

diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index 1643f62..5a7d0f0 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -356,13 +356,25 @@ swfdec_rectangle_from_as_object (SwfdecRectangle *rect, SwfdecAsObject *object)
 
   /* FIXME: This function is untested */
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_x);
-  rect->x = swfdec_as_value_to_integer (cx, *val);
+  if (val)
+    rect->x = swfdec_as_value_to_integer (cx, *val);
+  else
+    rect->x = 0;
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_y);
-  rect->y = swfdec_as_value_to_integer (cx, *val);
+  if (val)
+    rect->y = swfdec_as_value_to_integer (cx, *val);
+  else
+    rect->y = 0;
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_width);
-  rect->width = swfdec_as_value_to_integer (cx, *val);
+  if (val)
+    rect->width = swfdec_as_value_to_integer (cx, *val);
+  else
+    rect->width = 0;
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_height);
-  rect->height = swfdec_as_value_to_integer (cx, *val);
+  if (val)
+    rect->height = swfdec_as_value_to_integer (cx, *val);
+  else
+    rect->height = 0;
   return rect->width > 0 && rect->height > 0;
 }
 
@@ -385,7 +397,7 @@ swfdec_bitmap_data_copyPixels (SwfdecAsContext *cx, SwfdecAsObject *object,
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
 {
   SwfdecBitmapData *bitmap, *source, *alpha = NULL;
-  SwfdecAsObject *recto, *pt, *apt = NULL, *so, *ao = NULL;
+  SwfdecAsObject *recto = NULL, *pt, *apt = NULL, *so, *ao = NULL;
   SwfdecRectangle rect;
   gboolean copy_alpha = FALSE;
   SwfdecColorTransform ctrans;
@@ -393,13 +405,13 @@ swfdec_bitmap_data_copyPixels (SwfdecAsContext *cx, SwfdecAsObject *object,
   cairo_t *cr;
   int x, y;
 
-  SWFDEC_AS_CHECK (SWFDEC_TYPE_BITMAP_DATA, &bitmap, "ooo|OOb", &so, &recto, &pt,
+  SWFDEC_AS_CHECK (SWFDEC_TYPE_BITMAP_DATA, &bitmap, "ooo|oob", &so, &recto, &pt,
       &ao, &apt, &copy_alpha);
 
   if (bitmap->surface == NULL ||
       !SWFDEC_IS_BITMAP_DATA (so->relay) ||
       (source = SWFDEC_BITMAP_DATA (so->relay))->surface == NULL ||
-      (argc > 3 && (!SWFDEC_IS_BITMAP_DATA (ao->relay) || 
+      (ao != NULL && (!SWFDEC_IS_BITMAP_DATA (ao->relay) || 
 		    (alpha = SWFDEC_BITMAP_DATA (ao->relay))->surface == NULL)) ||
       !swfdec_rectangle_from_as_object (&rect, recto))
     return;
commit 5195c41ab749afc8bdfaf1f2603281f23fc6a5d7
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 12 21:17:53 2008 +0100

    add test for copyPixels crashers

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index f9e289d..8965fb2 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -1022,6 +1022,15 @@ EXTRA_DIST = \
 	crash-0.8.0-huffmann-table-8.swf \
 	crash-0.8.0-huffmann-table-8.swf.trace \
 	crash-0.8.0-huffmann-table.xml \
+	crash-0.8.2-copyPixels-5.swf \
+	crash-0.8.2-copyPixels-5.swf.trace \
+	crash-0.8.2-copyPixels-6.swf \
+	crash-0.8.2-copyPixels-6.swf.trace \
+	crash-0.8.2-copyPixels-7.swf \
+	crash-0.8.2-copyPixels-7.swf.trace \
+	crash-0.8.2-copyPixels-8.swf \
+	crash-0.8.2-copyPixels-8.swf.trace \
+	crash-0.8.2-copyPixels.as \
 	crash-0.8.2-gotoAndPlay-5.swf \
 	crash-0.8.2-gotoAndPlay-5.swf.trace \
 	crash-0.8.2-gotoAndPlay-6.swf \
diff --git a/test/trace/crash-0.8.2-copyPixels-5.swf b/test/trace/crash-0.8.2-copyPixels-5.swf
new file mode 100644
index 0000000..442360d
Binary files /dev/null and b/test/trace/crash-0.8.2-copyPixels-5.swf differ
diff --git a/test/trace/crash-0.8.2-copyPixels-5.swf.trace b/test/trace/crash-0.8.2-copyPixels-5.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.8.2-copyPixels-6.swf b/test/trace/crash-0.8.2-copyPixels-6.swf
new file mode 100644
index 0000000..16ead00
Binary files /dev/null and b/test/trace/crash-0.8.2-copyPixels-6.swf differ
diff --git a/test/trace/crash-0.8.2-copyPixels-6.swf.trace b/test/trace/crash-0.8.2-copyPixels-6.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.8.2-copyPixels-7.swf b/test/trace/crash-0.8.2-copyPixels-7.swf
new file mode 100644
index 0000000..c433c19
Binary files /dev/null and b/test/trace/crash-0.8.2-copyPixels-7.swf differ
diff --git a/test/trace/crash-0.8.2-copyPixels-7.swf.trace b/test/trace/crash-0.8.2-copyPixels-7.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.8.2-copyPixels-8.swf b/test/trace/crash-0.8.2-copyPixels-8.swf
new file mode 100644
index 0000000..a7fe074
Binary files /dev/null and b/test/trace/crash-0.8.2-copyPixels-8.swf differ
diff --git a/test/trace/crash-0.8.2-copyPixels-8.swf.trace b/test/trace/crash-0.8.2-copyPixels-8.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.8.2-copyPixels.as b/test/trace/crash-0.8.2-copyPixels.as
new file mode 100644
index 0000000..4e9b9fc
--- /dev/null
+++ b/test/trace/crash-0.8.2-copyPixels.as
@@ -0,0 +1,7 @@
+// makeswf -v 7 -s 200x150 -r 1 -o crash-0.8.2-copyPixels.swf crash-0.8.2-copyPixels.as
+
+bd = new flash.display.BitmapData (50, 50);
+bd.copyPixels (bd, {}, {}, null);
+bd.copyPixels (bd, {}, {}, bd, {}, null);
+
+getURL ("fscommand:quit", "");
commit e8174a647557dd575aad52c5de0227cc7b20ba1a
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 12 21:07:41 2008 +0100

    fix BitmapData.copyPixels crashers

diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index 8245cff..4ef20b0 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -366,13 +366,25 @@ swfdec_rectangle_from_as_object (SwfdecRectangle *rect, SwfdecAsObject *object)
 
   /* FIXME: This function is untested */
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_x);
-  rect->x = swfdec_as_value_to_integer (cx, val);
+  if (val)
+    rect->x = swfdec_as_value_to_integer (cx, val);
+  else
+    rect->x = 0;
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_y);
-  rect->y = swfdec_as_value_to_integer (cx, val);
+  if (val)
+    rect->y = swfdec_as_value_to_integer (cx, val);
+  else
+    rect->y = 0;
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_width);
-  rect->width = swfdec_as_value_to_integer (cx, val);
+  if (val)
+    rect->width = swfdec_as_value_to_integer (cx, val);
+  else
+    rect->width = 0;
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_height);
-  rect->height = swfdec_as_value_to_integer (cx, val);
+  if (val)
+    rect->height = swfdec_as_value_to_integer (cx, val);
+  else
+    rect->height = 0;
   return rect->width > 0 && rect->height > 0;
 }
 
@@ -395,19 +407,20 @@ swfdec_bitmap_data_copyPixels (SwfdecAsContext *cx, SwfdecAsObject *object,
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
 {
   SwfdecBitmapData *bitmap, *source, *alpha = NULL;
-  SwfdecAsObject *recto, *pt, *apt = NULL;
+  SwfdecAsObject *recto = NULL, *pt, *apt = NULL, *so, *ao = NULL;
   SwfdecRectangle rect;
   gboolean copy_alpha = FALSE;
   cairo_t *cr;
   int x, y;
 
-  SWFDEC_AS_CHECK (SWFDEC_TYPE_BITMAP_DATA, &bitmap, "ooo|OOb", &source, &recto, &pt,
-      &alpha, &apt, &copy_alpha);
+  SWFDEC_AS_CHECK (SWFDEC_TYPE_BITMAP_DATA, &bitmap, "ooo|oob", &so, &recto, &pt,
+      &ao, &apt, &copy_alpha);
 
   if (bitmap->surface == NULL ||
-      !SWFDEC_IS_BITMAP_DATA (source) ||
-      source->surface == NULL ||
-      (argc > 3 && (!SWFDEC_IS_BITMAP_DATA (alpha) || alpha->surface == NULL)) ||
+      !SWFDEC_IS_BITMAP_DATA (so) ||
+      (source = SWFDEC_BITMAP_DATA (so))->surface == NULL ||
+      (ao != NULL && (!SWFDEC_IS_BITMAP_DATA (ao) || 
+		    (alpha = SWFDEC_BITMAP_DATA (ao))->surface == NULL)) ||
       !swfdec_rectangle_from_as_object (&rect, recto))
     return;
 
commit 0897270a8ce2327de66c0e20b4b42816377e5708
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 12 15:30:38 2008 +0100

    use height as height, not width

diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index a7b1728..8245cff 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -244,7 +244,7 @@ swfdec_bitmap_data_get_rectangle (SwfdecAsContext *cx, SwfdecAsObject *object,
   SWFDEC_AS_VALUE_SET_INT (&args[0], 0);
   SWFDEC_AS_VALUE_SET_INT (&args[1], 0);
   SWFDEC_AS_VALUE_SET_INT (&args[2], cairo_image_surface_get_width (bitmap->surface));
-  SWFDEC_AS_VALUE_SET_INT (&args[3], cairo_image_surface_get_width (bitmap->surface));
+  SWFDEC_AS_VALUE_SET_INT (&args[3], cairo_image_surface_get_height (bitmap->surface));
   swfdec_as_object_create (SWFDEC_AS_FUNCTION (o), 4, args, ret);
 }
 


More information about the Swfdec-commits mailing list