gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/as_value.cpp server/asob...


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog server/as_value.cpp server/asob...
Date: Mon, 21 Jan 2008 15:02:33 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/01/21 15:02:33

Modified files:
        .              : ChangeLog 
        server         : as_value.cpp 
        server/asobj   : System.cpp 

Log message:
                * server/asobj/System.cpp: correct typo in server string, clean 
up.
                * server/as_value.cpp: Drop check for infinity after 
boost::lexical_cast
                  from string to double (it can't happen), clean up.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5443&r2=1.5444
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.111&r2=1.112
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/System.cpp?cvsroot=gnash&r1=1.19&r2=1.20

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5443
retrieving revision 1.5444
diff -u -b -r1.5443 -r1.5444
--- ChangeLog   21 Jan 2008 12:58:34 -0000      1.5443
+++ ChangeLog   21 Jan 2008 15:02:32 -0000      1.5444
@@ -1,3 +1,9 @@
+2008-01-21 Benjamin Wolsey <address@hidden>
+
+       * server/asobj/System.cpp: correct typo in server string, clean up.
+       * server/as_value.cpp: Drop check for infinity after boost::lexical_cast
+         from string to double (it can't happen), clean up.
+
 2008-01-21 Sandro Santilli <address@hidden>
 
        * server/sprite_instance.cpp (pointInVisibleShape): even if we're a

Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -b -r1.111 -r1.112
--- server/as_value.cpp 9 Jan 2008 11:41:01 -0000       1.111
+++ server/as_value.cpp 21 Jan 2008 15:02:33 -0000      1.112
@@ -42,9 +42,6 @@
 #include <sstream>
 #include <iomanip>
 
-
-using namespace std;
-
 #ifdef WIN32
 #      define snprintf _snprintf
 #endif
@@ -169,7 +166,9 @@
                                // specification, but seems required for 
compatibility with the
                                // reference player.
 #if GNASH_DEBUG_CONVERSION_TO_PRIMITIVE
-                               log_debug(" %s.to_primitive(STRING) returned 
%s", to_debug_string().c_str(), ret.to_debug_string().c_str());
+                               log_debug(" %s.to_primitive(STRING) returned 
%s", 
+                                               to_debug_string().c_str(),
+                                               ret.to_debug_string().c_str());
 #endif
                                if ( ret.is_string() ) return ret.to_string();
                        }
@@ -402,23 +401,16 @@
             try 
             { 
                 double d = boost::lexical_cast<double>(getStr());
-
-                if ( isinf(d) ) 
-                {
-                    if(swfversion <= 4)  
-                        return (double)0.0;
-                    else    
-                        return (double)NAN;
-                }
-
                 return d;
             } 
             catch (boost::bad_lexical_cast &) 
+            // There is no standard textual representation of infinity in the
+            // C++ standard, so boost throws a bad_lexical_cast for 'inf',
+            // just like for any other non-numerical text. This is correct
+            // behaviour.
             {
-                if(swfversion <= 4)  
-                    return (double)0.0;
-                else    
-                    return (double)NAN;
+               if(swfversion <= 4) return (double)0.0;
+               else return (double)NAN;
             }
         }
 
@@ -1195,7 +1187,7 @@
 
 // Convert numeric value to string value, following ECMA-262 specification
 std::string
-as_value::doubleToString(double _val)
+as_value::doubleToString(double val)
 {
        // Printing formats:
        //
@@ -1271,57 +1263,57 @@
 
        // Handle non-numeric values.
        // "printf" gives "nan", "inf", "-inf", so we check explicitly
-       if(isnan(_val))
+       if(isnan(val))
        {
                return "NaN";
        }
-       else if(isinf(_val))
+       else if(isinf(val))
        {
-               return _val < 0 ? "-Infinity" : "Infinity";
+               return val < 0 ? "-Infinity" : "Infinity";
        }
-       else if(_val == 0.0 || _val == -0.0)
+       else if(val == 0.0 || val == -0.0)
        {
                return "0";
        }
 
-       ostringstream _ostr;
-       std::string _str;
+       std::ostringstream ostr;
+       std::string str;
        
        // ActionScript always expects dot as decimal point?
-       _ostr.imbue(std::locale("C")); 
+       ostr.imbue(std::locale("C")); 
        
        // force to decimal notation for this range (because the reference 
player does)
-       if (fabs(_val) < 0.0001 && fabs(_val) >= 0.00001)
+       if (fabs(val) < 0.0001 && fabs(val) >= 0.00001)
        {
                // All nineteen digits (4 zeros + up to 15 significant digits)
-               _ostr << fixed << std::setprecision(19) << _val;
+               ostr << std::fixed << std::setprecision(19) << val;
                
-               _str = _ostr.str();
+               str = ostr.str();
                
                // Because 'fixed' also adds trailing zeros, remove them.
-               std::string::size_type pos = _str.find_last_not_of('0');
+               std::string::size_type pos = str.find_last_not_of('0');
                if (pos != std::string::npos) {
-                       _str.erase(pos + 1);
+                       str.erase(pos + 1);
                }
                
        }
        
        else
        {
-               _ostr << std::setprecision(15) << _val;
+               ostr << std::setprecision(15) << val;
                
-               _str = _ostr.str();
+               str = ostr.str();
                
                // Remove a leading zero from 2-digit exponent if any
-               std::string::size_type pos = _str.find("e", 0);
+               std::string::size_type pos = str.find("e", 0);
 
-               if (pos != std::string::npos && _str.at(pos + 2) == '0') {
-                       _str.erase(pos + 2, 1);
+               if (pos != std::string::npos && str.at(pos + 2) == '0') {
+                       str.erase(pos + 2, 1);
                }
                
        }
 
-       return _str;
+       return str;
        
 }
 

Index: server/asobj/System.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/System.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/asobj/System.cpp     13 Dec 2007 01:08:06 -0000      1.19
+++ server/asobj/System.cpp     21 Jan 2008 15:02:33 -0000      1.20
@@ -60,24 +60,23 @@
 static as_object*
 getSystemCapabilitiesInterface()
 {
-       static RcInitFile& rcfile = RcInitFile::getDefaultInstance();
+       RcInitFile& rcfile = RcInitFile::getDefaultInstance();
 
        // "LNX 9,0,22,0", "MAC 8,0,99,0"
        // Override in gnashrc
-       static const std::string version = VM::get().getPlayerVersion();
+       const std::string version = VM::get().getPlayerVersion();
 
        // Flash 7: "StandAlone", "External", "PlugIn", "ActiveX"
        // TODO: Implement properly
-       static const std::string playerType = "StandAlone";
+       const std::string playerType = "StandAlone";
 
        // "Windows XP", "Windows 2000", "Windows NT", "Windows 98/ME", 
"Windows 95", "Windows CE", "Linux", "MacOS"
        // Override in gnashrc
-       static const std::string os = VM::get().getOSName();
+       const std::string os = VM::get().getOSName();
 
        // "Macromedia Windows", "Macromedia Linux", "Macromedia MacOS"
        // Override in gnashrc
-       static const std::string manufacturer = 
rcfile.getFlashSystemManufacturer();
-
+       const std::string manufacturer = rcfile.getFlashSystemManufacturer();
 
        /* Human Interface */
        
@@ -85,14 +84,12 @@
        // TODO: Chinese should be either zh-CN or zh-TW
        // TODO: Are there more than the 20 officially documented? 
        // TODO: Other / unknown should return 'xu'. 
-       static const std::string language = VM::get().getSystemLanguage();
-
+       const std::string language = VM::get().getSystemLanguage();
 
        /* Media */
                
        // Is audio available?
-       static const bool hasAudio = (get_sound_handler() != NULL);
-
+       const bool hasAudio = (get_sound_handler() != NULL);
 
        /* A URL-encoded string to send system info to a server.*/
        /* Boolean values are represented as t or f.            */
@@ -108,7 +105,7 @@
                        + "&PT=" + playerType
                        + "&L=" + language
                        + "&AVD="       // avHardwareDisable (bool)
-                       + "&ACC"        // hasAccessibility (bool)
+                       + "&ACC="       // hasAccessibility (bool)
                        + "&AE="        // hasAudioEncoder (bool)
                        + "&EV="        // hasEmbeddedVideo (bool)
                        + "&IME="       // hasIME (bool)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]