[Swfdec] 2 commits - libswfdec/swfdec_text_format.c libswfdec/swfdec_xml.c libswfdec/swfdec_xml.h

Benjamin Otte company at kemper.freedesktop.org
Thu Oct 11 14:20:19 PDT 2007


 libswfdec/swfdec_text_format.c |   10 ++++++++--
 libswfdec/swfdec_xml.c         |    9 ++++++++-
 libswfdec/swfdec_xml.h         |    2 +-
 3 files changed, 17 insertions(+), 4 deletions(-)

New commits:
diff-tree 2adb53ebb5ba9d6dbe8993ab64f70f6fad919895 (from 90c5b254605f93fe97116e5032627075a1013957)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 23:23:08 2007 +0200

    make PPC happy

diff --git a/libswfdec/swfdec_xml.c b/libswfdec/swfdec_xml.c
index 06a4101..253d07f 100644
--- a/libswfdec/swfdec_xml.c
+++ b/libswfdec/swfdec_xml.c
@@ -21,6 +21,7 @@
 #include "config.h"
 #endif
 
+#include <math.h>
 #include <string.h>
 
 #include "swfdec_xml.h"
@@ -320,6 +321,8 @@ static void
 swfdec_xml_set_status (SwfdecAsContext *cx, SwfdecAsObject *object,
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
 {
+  double d;
+
   if (!SWFDEC_IS_XML (object))
     return;
 
@@ -334,7 +337,11 @@ swfdec_xml_set_status (SwfdecAsContext *
   if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]))
     swfdec_as_value_to_string (cx, &argv[0]);
 
-  SWFDEC_XML (object)->status = swfdec_as_value_to_number (cx, &argv[0]);
+  d = swfdec_as_value_to_number (cx, &argv[0]);
+  if (!isfinite (d))
+    SWFDEC_XML (object)->status = G_MININT32;
+  else
+    SWFDEC_XML (object)->status = (int) d;
 }
 
 static const char *
diff --git a/libswfdec/swfdec_xml.h b/libswfdec/swfdec_xml.h
index c06562d..e0e8cc8 100644
--- a/libswfdec/swfdec_xml.h
+++ b/libswfdec/swfdec_xml.h
@@ -55,7 +55,7 @@ struct _SwfdecXml {
   SwfdecXmlNode		xml_node;
 
   gboolean		ignoreWhite;
-  SwfdecXmlParseStatus	status;
+  int			status;
   const char		*xmlDecl;
   const char		*docTypeDecl;
 
diff-tree 90c5b254605f93fe97116e5032627075a1013957 (from cd10b0bf08549c0002ff4dfc996736aa773eca68)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 23:06:36 2007 +0200

    PPC fixes
    
    I don't think the casts are sane now, but at least they work on 32bit PPC.

diff --git a/libswfdec/swfdec_text_format.c b/libswfdec/swfdec_text_format.c
index a023b13..273e611 100644
--- a/libswfdec/swfdec_text_format.c
+++ b/libswfdec/swfdec_text_format.c
@@ -212,7 +212,10 @@ swfdec_text_format_value_to_integer (Swf
       return -2147483648;
     } else {
       if (is_unsigned) {
-	return (unsigned)d;
+	if (!isfinite (d))
+	  return 0;
+	else
+	  return (unsigned)d;
       } else {
 	if (!allow_negative && (int)d < 0) {
 	  return 0;
@@ -223,7 +226,10 @@ swfdec_text_format_value_to_integer (Swf
     }
   } else {
     if (is_unsigned) {
-      return (unsigned)n;
+      if (!isfinite (d))
+	return 0;
+      else
+	return (unsigned)n;
     } else {
       if (!allow_negative && n < 0) {
 	return 0;


More information about the Swfdec mailing list