[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/server as_value.cpp
From: |
Martin Guy |
Subject: |
[Gnash-commit] gnash/server as_value.cpp |
Date: |
Sat, 03 Mar 2007 15:44:33 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Martin Guy <martinwguy> 07/03/03 15:44:33
Modified files:
server : as_value.cpp
Log message:
Revert chenges in 1.18 that make all gui windows 0 size (!!!)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.18&r2=1.19
Patches:
Index: as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- as_value.cpp 3 Mar 2007 11:35:32 -0000 1.18
+++ as_value.cpp 3 Mar 2007 15:44:33 -0000 1.19
@@ -30,8 +30,6 @@
#include "gstring.h" // for automatic as_value::STRING => String as object
#include "Number.h" // for automatic as_value::NUMBER => Number as object
-#include <cmath>
-
using namespace std;
#ifdef WIN32
@@ -40,13 +38,6 @@
namespace gnash {
-#ifndef NAN
- // Pre-C99 compilers
-# define NAN (0.0/0.0)
-// If this makes your compiler die with div by zero,
-// use "static double zzzero = 0.0;" and "(zzzero/zzzero)"
-#endif
-
//
// as_value -- ActionScript value type
//
@@ -273,22 +264,25 @@
// gets converted; otherwise it is set to NaN.
//
// Also, "Infinity", "-Infinity", and "NaN"
- // are recognized by strtod() but not by Flash Player.
+ // are recognized.
char* tail=0;
m_number_value = strtod(m_string_value.c_str(), &tail);
if ( tail == m_string_value.c_str() || *tail != 0 )
{
// Failed conversion to Number.
- m_number_value = NAN;
+
+ // avoid divide by zero compiler warning by using a variable
+ double temp = 0.0;
+
+ // this division by zero creates a NaN value in the double
+ m_number_value = temp / temp;
}
return m_number_value;
} else if (m_type == NULLTYPE) {
- // Evan says: from my tests 0
- // Martin tries var foo = new Number(null) and gets NaN
- return NAN;
+ // Evan: from my tests
+ return 0;
} else if (m_type == BOOLEAN) {
// Evan: from my tests
- // Martin: confirmed
return (this->m_boolean_value) ? 1 : 0;
} else if (m_type == NUMBER) {
return m_number_value;
@@ -308,7 +302,7 @@
return 0.0;
} else {
- return NAN;
+ return 0.0;
}
}