[Swfdec] 3 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_html_parser.c libswfdec/swfdec_sprite_movie_as.c libswfdec/swfdec_text_field_movie.c

Pekka Lampila medar at kemper.freedesktop.org
Fri Oct 19 04:04:34 PDT 2007


 libswfdec/swfdec_as_interpret.c     |    2 +-
 libswfdec/swfdec_html_parser.c      |    9 +++------
 libswfdec/swfdec_sprite_movie_as.c  |    4 ++--
 libswfdec/swfdec_text_field_movie.c |   12 ++++++------
 4 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit bf55dadb198606ae4b5e22929f79bbd8b6e3db63
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Fri Oct 19 14:04:14 2007 +0300

    Don't crash in couple of places when resource != NULL and decoder == NULL
    
    Hopefully this is the right fix

diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index b608f31..4f8130c 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -285,7 +285,7 @@ swfdec_action_wait_for_frame (SwfdecAsContext *cx, guint action, const guint8 *d
   frame = data[0] || (data[1] << 8);
   jump = data[2];
   resource = swfdec_movie_get_own_resource (movie);
-  if (resource) {
+  if (resource && resource->decoder) {
     SwfdecDecoder *dec = resource->decoder;
     loaded = dec->frames_loaded;
     if (loaded == dec->frames_total)
diff --git a/libswfdec/swfdec_sprite_movie_as.c b/libswfdec/swfdec_sprite_movie_as.c
index 00e9be2..301f2c0 100644
--- a/libswfdec/swfdec_sprite_movie_as.c
+++ b/libswfdec/swfdec_sprite_movie_as.c
@@ -72,7 +72,7 @@ swfdec_sprite_movie_getBytesLoaded (SwfdecAsContext *cx, SwfdecAsObject *object,
   SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "");
 
   resource = swfdec_movie_get_own_resource (movie);
-  if (resource) {
+  if (resource && resource->decoder) {
     SWFDEC_AS_VALUE_SET_INT (rval, resource->decoder->bytes_loaded);
   } else {
     SWFDEC_AS_VALUE_SET_INT (rval, 0);
@@ -90,7 +90,7 @@ swfdec_sprite_movie_getBytesTotal (SwfdecAsContext *cx, SwfdecAsObject *object,
   SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "");
 
   resource = swfdec_movie_get_own_resource (movie);
-  if (resource) {
+  if (resource && resource->decoder) {
     SWFDEC_AS_VALUE_SET_INT (rval, resource->decoder->bytes_total);
   } else {
     SWFDEC_AS_VALUE_SET_INT (rval, 0);
commit 60570600ac9407169e371f4186108f348e4c4ffe
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Fri Oct 19 13:39:17 2007 +0300

    TextField's HTML parsing: Include the added \r in to the created text format

diff --git a/libswfdec/swfdec_html_parser.c b/libswfdec/swfdec_html_parser.c
index 47cd412..5d058df 100644
--- a/libswfdec/swfdec_html_parser.c
+++ b/libswfdec/swfdec_html_parser.c
@@ -246,8 +246,6 @@ swfdec_text_field_movie_html_parse_tag (ParserData *data, const char *p)
     if (tag != NULL && name_length == tag->name_length &&
 	!g_strncasecmp (name, tag->name, name_length))
     {
-      tag->end_index = data->text->len;
-
       if (data->cx->version == 6) {
 	if ((name_length == 1 && !g_strncasecmp (name, "p", 1)) ||
 	    (name_length == 2 && !g_strncasecmp (name, "li", 2))) {
@@ -255,6 +253,8 @@ swfdec_text_field_movie_html_parse_tag (ParserData *data, const char *p)
 	}
       }
 
+      tag->end_index = data->text->len;
+
       data->tags_open = g_slist_remove (data->tags_open, tag);
       data->tags_closed = g_slist_prepend (data->tags_closed, tag);
     }
commit 0e9a542dee29e14e3bc4c26ffcb4711c6dec4090
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Fri Oct 19 12:23:46 2007 +0300

    Don't parse kerning in TextField's html input. Fix font closing tag's position

diff --git a/libswfdec/swfdec_html_parser.c b/libswfdec/swfdec_html_parser.c
index cba7aa7..47cd412 100644
--- a/libswfdec/swfdec_html_parser.c
+++ b/libswfdec/swfdec_html_parser.c
@@ -136,10 +136,7 @@ swfdec_text_field_movie_html_tag_set_attribute (ParserTag *tag,
       swfdec_as_object_set_variable (object, SWFDEC_AS_STR_letterSpacing,
 	  &val);
     }
-    else if (name_length == 7 && !g_strncasecmp (name, "kerning", 7))
-    {
-      swfdec_as_object_set_variable (object, SWFDEC_AS_STR_kerning, &val);
-    }
+    // special case: Don't parse kerning
   }
   else if (tag->name_length == 1 && !g_strncasecmp (tag->name, "a", 1))
   {
diff --git a/libswfdec/swfdec_text_field_movie.c b/libswfdec/swfdec_text_field_movie.c
index 4272c7c..737357b 100644
--- a/libswfdec/swfdec_text_field_movie.c
+++ b/libswfdec/swfdec_text_field_movie.c
@@ -1352,12 +1352,6 @@ swfdec_text_field_movie_html_text_append_paragraph (SwfdecTextFieldMovie *text,
 	break;
       }
     }
-    if (iter_font != NULL) {
-      while (fonts != iter_font) {
-	string = g_string_append (string, "</FONT>");
-	fonts = g_slist_remove (fonts, fonts->data);
-      }
-    }
     if (format_prev->underline)
       string = g_string_append (string, "</U>");
     if (format_prev->italic)
@@ -1366,6 +1360,12 @@ swfdec_text_field_movie_html_text_append_paragraph (SwfdecTextFieldMovie *text,
       string = g_string_append (string, "</B>");
     if (format_prev->url != SWFDEC_AS_STR_EMPTY)
       string = g_string_append (string, "</A>");
+    if (iter_font != NULL) {
+      while (fonts != iter_font) {
+	string = g_string_append (string, "</FONT>");
+	fonts = g_slist_remove (fonts, fonts->data);
+      }
+    }
 
     // Open tags
     format_font = (SwfdecTextFormat *)fonts->data;


More information about the Swfdec mailing list