gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9779: Simplify and tidy up.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9779: Simplify and tidy up.
Date: Thu, 18 Sep 2008 14:29:59 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9779
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2008-09-18 14:29:59 +0200
message:
  Simplify and tidy up.
modified:
  libcore/array.cpp
  libcore/as_object.cpp
  libcore/as_object.h
  libcore/as_value.cpp
  libcore/as_value.h
  libcore/asobj/XML_as.cpp
  libcore/asobj/XML_as.h
  libcore/debugger.cpp
  libcore/edit_text_character.cpp
  libcore/sprite_instance.cpp
  libcore/vm/ASHandlers.cpp
    ------------------------------------------------------------
    revno: 9774.1.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-09-18 13:57:28 +0200
    message:
      Drop objects initialized at the top of functions as though this
      were C and never used. Simplify return values.
    modified:
      libcore/asobj/XML_as.cpp
      libcore/asobj/XML_as.h
    ------------------------------------------------------------
    revno: 9774.1.6
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-09-18 13:59:44 +0200
    message:
      Drop set_member_default() from as_object; move to the virtual 
set_member() and
      call the base class function when that's what's meant.
      
      Drop set_std_string and set_string(const char*) from as_value. Use
      set_string everywhere.
      
      Rename type to AsType, tidy up some typedefs and declarations.
    modified:
      libcore/array.cpp
      libcore/as_object.cpp
      libcore/as_object.h
      libcore/as_value.cpp
      libcore/as_value.h
      libcore/debugger.cpp
      libcore/edit_text_character.cpp
      libcore/sprite_instance.cpp
      libcore/vm/ASHandlers.cpp
=== modified file 'libcore/array.cpp'
--- a/libcore/array.cpp 2008-09-18 09:59:32 +0000
+++ b/libcore/array.cpp 2008-09-18 11:59:44 +0000
@@ -863,7 +863,7 @@
     }
 
 
-    return as_object::set_member_default(name,val, nsname, ifFound);
+    return as_object::as_object::set_member(name,val, nsname, ifFound);
 }
 
 Array_as*

=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp     2008-09-18 09:59:32 +0000
+++ b/libcore/as_object.cpp     2008-09-18 11:59:44 +0000
@@ -540,7 +540,7 @@
 
 // Handles read_only and static properties properly.
 bool
-as_object::set_member_default(string_table::key key, const as_value& val,
+as_object::set_member(string_table::key key, const as_value& val,
        string_table::key nsname, bool ifFound)
 {
        //log_debug(_("set_member_default(%s)"), key);

=== modified file 'libcore/as_object.h'
--- a/libcore/as_object.h       2008-09-18 09:59:32 +0000
+++ b/libcore/as_object.h       2008-09-18 11:59:44 +0000
@@ -258,11 +258,6 @@
 
        /// Set a member value
        //
-       /// The default behaviour is to call set_member_default,
-       /// but this function is kept virtual to allow special
-       /// handling of property assignment in derivate class.
-       /// NOTE: This might change in the near future trough use of
-       ///       getter/setter properties instead..
        ///
        /// @param key
        ///     Id of the property. 
@@ -284,36 +279,8 @@
        ///     
        ///
        virtual bool set_member(string_table::key key, const as_value& val,
-               string_table::key nsname = 0, bool ifFound=false)
-       {
-               return set_member_default(key, val, nsname, ifFound);
-       }
+               string_table::key nsname = 0, bool ifFound=false);
 
-#if 0
-       /// Update an existing member value
-       //
-       /// NOTE that getter-setter in the inheritance chain are
-       /// considered as existing members. See with.as and Object.as
-       /// testcases under actionscript.all.
-       /// Also be aware that 'special' (non-proper) properties
-       /// are considered non-existing, this is surely true for
-       /// childs of MovieClips, also tested in with.as.
-       ///
-       /// @param key
-       ///     Id of the property. 
-       ///
-       /// @param val
-       ///     Value to assign to the named property.
-       ///
-       /// @param nsname
-       ///     Id of the namespace.
-       ///
-       /// @return a pair in which first element express wheter the property
-       ///         was found and the second wheter it was set (won't set if 
read-only).
-       ///
-       std::pair<bool,bool> update_member(string_table::key key, const 
as_value& val,
-               string_table::key nsname = 0);
-#endif
 
        virtual bool on_event(const event_id& id );
 
@@ -638,10 +605,6 @@
        bool unwatch(string_table::key key, string_table::key ns = 0);
 
        /// Get a member as_value by name
-       //
-       /// The default behaviour is to call set_member_default,
-       /// but this function is kept virtual to allow special
-       /// handling of property fetching in derivate class.
        ///
        /// NOTE that this method is non-const becase a property
        ///      could also be a getter/setter and we can't promise
@@ -1062,33 +1025,6 @@
        ///
        virtual void enumerateNonProperties(as_environment&) const {}
 
-       /// Set a member value
-       //
-       /// This is the default implementation, taking care of
-       /// the inheritance chain and getter/setter functions.
-       ///
-        /// The derived class should not override this method,
-        /// but instead implement its own gettersetter properties.
-       ///
-       /// @param name
-       ///     Name of the property. Must be all lowercase
-       ///     if the current VM is initialized for a  target
-       ///     up to SWF6.
-       ///
-       /// @param val
-       ///     Value to assign to the named property.
-       ///
-       /// @param ifFound
-       ///     If true, don't create a new member, but only update
-       ///     an existing one.
-       ///
-       /// @return true if the given member existed, false otherwise.
-       ///     NOTE: the return doesn't tell if the member exists after
-       ///           the call, as watch triggers might have deleted it
-       ///           after setting.
-       ///
-       bool set_member_default(string_table::key name, const as_value& val, 
-               string_table::key nsname, bool ifFound);
 
 #ifdef GNASH_USE_GC
        /// Mark all reachable resources, override from GcResource.

=== modified file 'libcore/as_value.cpp'
--- a/libcore/as_value.cpp      2008-09-17 07:27:11 +0000
+++ b/libcore/as_value.cpp      2008-09-18 11:59:44 +0000
@@ -394,7 +394,7 @@
        VM& vm = VM::get();
        int swfVersion = vm.getSWFVersion();
 
-       type hint = NUMBER;
+       AsType hint = NUMBER;
 
        if ( m_type == OBJECT && swfVersion > 5 && getObj()->isDateObject() )
        {
@@ -417,7 +417,7 @@
        VM& vm = VM::get();
        int swfVersion = vm.getSWFVersion();
 
-       type hint = NUMBER;
+       AsType hint = NUMBER;
 
        if ( m_type == OBJECT && swfVersion > 5 && getObj()->isDateObject() )
        {
@@ -436,7 +436,7 @@
 
 // Conversion to primitive value.
 as_value
-as_value::to_primitive(type hint) const
+as_value::to_primitive(AsType hint) const
 {
        if ( m_type != OBJECT && m_type != AS_FUNCTION ) return *this; 
        //if ( ! is_object() ) return *this; // include MOVIECLIP !!
@@ -538,7 +538,7 @@
 
 // Conversion to primitive value.
 as_value&
-as_value::convert_to_primitive(type hint) 
+as_value::convert_to_primitive(AsType hint) 
 {
        if ( m_type != OBJECT && m_type != AS_FUNCTION ) return *this; 
        //if ( ! is_object() ) return *this; // include MOVIECLIP !!

=== modified file 'libcore/as_value.h'
--- a/libcore/as_value.h        2008-09-09 09:20:50 +0000
+++ b/libcore/as_value.h        2008-09-18 11:59:44 +0000
@@ -97,8 +97,10 @@
 ///
 class DSOEXPORT as_value
 {
+
 public:
-       enum type
+
+       enum AsType
        {
                // Always make the exception type one greater than the normal 
type.
                
@@ -459,7 +461,7 @@
        ///
        /// @throw ActionTypeError if an object can't be converted to a 
primitive
        ///
-       as_value to_primitive(type hint) const;
+       as_value to_primitive(AsType hint) const;
 
        /// Convert this value to a primitive type, with a preference
        //
@@ -471,7 +473,7 @@
        ///
        /// @throw ActionTypeError if an object can't be converted to a 
primitive
        ///
-       as_value& convert_to_primitive(type hint);
+       as_value& convert_to_primitive(AsType hint);
 
        /// Force type to number.
        //
@@ -479,13 +481,13 @@
        ///     The environment to use for running the valueOf() method
        ///     for object values. If NULL, valueOf() won't be run.
        ///
-       void    convert_to_number();
+       void convert_to_number();
 
        /// Force type to string.
-       void    convert_to_string();
+       void convert_to_string();
     
        /// Force type to bool.
-       void    convert_to_boolean();
+       void convert_to_boolean();
     
        /// Force type to string.
        //
@@ -497,35 +499,25 @@
        ///
        /// @see to_string_versionioned
        ///
-       void    convert_to_string_versioned(int version);
+       void convert_to_string_versioned(int version);
 
        // These set_*()'s are more type-safe; should be used
        // in preference to generic overloaded set().  You are
        // more likely to get a warning/error if misused.
 
-       void    set_string(const std::string& str);
-
-       void    set_std_string(const std::string& str)
-       {
-               set_string(str);
-       }
-
-       void    set_string(const char* str)
-       {
-               set_string(std::string(str));
-       }
-
-       void    set_double(double val);
-
-       void    set_bool(bool val);
-
-       void    set_sprite(sprite_instance& sp);
-
-       void    set_character(character& sp);
-
-       void    set_int(int val) { set_double(val); }
-
-       void    set_nan() { set_double(NaN); }
+       void set_string(const std::string& str);
+
+       void set_double(double val);
+
+       void set_bool(bool val);
+
+       void set_sprite(sprite_instance& sp);
+
+       void set_character(character& sp);
+
+       void set_int(int val) { set_double(val); }
+
+       void set_nan() { set_double(NaN); }
 
        /// Make this value a NULL, OBJECT, MOVIECLIP or AS_FUNCTION value
        //
@@ -534,14 +526,14 @@
        /// Internally adds a reference to the ref-counted as_object, 
        /// if not-null
        ///
-       void    set_as_object(as_object* obj);
+       void set_as_object(as_object* obj);
 
-       void    set_as_object(boost::intrusive_ptr<as_object> obj);
+       void set_as_object(boost::intrusive_ptr<as_object> obj);
 
        /// Make this a NULL or AS_FUNCTION value
-       void    set_as_function(as_function* func);
+       void set_as_function(as_function* func);
 
-       void    set_undefined();
+       void set_undefined();
 
        /// Set this value to the NULL value
        void set_null();
@@ -563,15 +555,15 @@
                return ! ( *this  == v );
        }
 
-       void    operator=(const as_value& v);
-
-       bool    is_undefined() const { return (m_type == UNDEFINED); }
-
-       bool    is_null() const { return (m_type == NULLTYPE); }
-
-       bool    is_bool() const { return (m_type == BOOLEAN); }
-
-       bool    is_exception() const
+       void operator=(const as_value& v);
+
+       bool is_undefined() const { return (m_type == UNDEFINED); }
+
+       bool is_null() const { return (m_type == NULLTYPE); }
+
+       bool is_bool() const { return (m_type == BOOLEAN); }
+
+       bool is_exception() const
        { return (m_type == UNDEFINED_EXCEPT || m_type == NULLTYPE_EXCEPT
                || m_type == BOOLEAN_EXCEPT || m_type == NUMBER_EXCEPT
                || m_type == OBJECT_EXCEPT || m_type == AS_FUNCTION_EXCEPT
@@ -580,10 +572,10 @@
 
        // Flag or unflag an as_value as an exception -- this gets flagged
        // when an as_value is 'thrown'.
-       void    flag_exception() 
-       { if (!is_exception()) m_type = 
static_cast<type>(static_cast<int>(m_type) + 1); }
-       void    unflag_exception()
-       { if (is_exception()) m_type = 
static_cast<type>(static_cast<int>(m_type) - 1); }
+       void flag_exception() 
+       { if (!is_exception()) m_type = 
static_cast<AsType>(static_cast<int>(m_type) + 1); }
+       void unflag_exception()
+       { if (is_exception()) m_type = 
static_cast<AsType>(static_cast<int>(m_type) - 1); }
 
        /// Return true if this value is strictly equal to the given one
        //
@@ -634,22 +626,25 @@
        ///
        bool equalsSameType(const as_value& v) const;
 
-       type m_type;
+       AsType m_type;
 
        typedef sprite_instance* SpritePtr;
        typedef character* CharacterPtr;
        typedef boost::intrusive_ptr<as_function> AsFunPtr;
        typedef boost::intrusive_ptr<as_object> AsObjPtr;
-
-        boost::variant<  
-                        boost::blank,  // UNDEFINED or NULL
-                         double,       // NUMBER
-                         bool,         // BOOLEAN
-                         AsObjPtr,     // OBJECT,
-//                        AsFuncPtr,   // AS_FUNCTION
-                         CharacterProxy,       // MOVIECLIP
-                        std::string    // STRING 
-                      > _value;
+       
+       /// AsValueType handles the following AS types:
+       //
+       /// 1. undefined / null
+       /// 2. Number
+       /// 3. Boolean
+       /// 4. Object
+       /// 5. MovieClip
+       /// 6. String
+    typedef boost::variant<boost::blank, double,
+            bool, AsObjPtr, CharacterProxy,    std::string> AsValueType;
+    
+    AsValueType _value;
 
 
        /// Get the function pointer variant member (we assume m_type == 
FUNCTION)

=== modified file 'libcore/asobj/XML_as.cpp'
--- a/libcore/asobj/XML_as.cpp  2008-09-18 09:59:32 +0000
+++ b/libcore/asobj/XML_as.cpp  2008-09-18 11:57:28 +0000
@@ -143,41 +143,40 @@
 
 bool
 XML_as::set_member(string_table::key name, const as_value& val, 
-       string_table::key nsname, bool ifFound)
+    string_table::key nsname, bool ifFound)
 {
     if (name == NSV::PROP_STATUS)
-       {
-               // TODO: this should really be a proper property (see XML.as)
-               if ( ! val.is_number() )
-               {
-                       _status = 
static_cast<XML_as::Status>(std::numeric_limits<boost::int32_t>::min());
-               }
-               else
-               {
-                       unsigned int statusNumber = 
static_cast<int>(val.to_number());
-                       _status = XML_as::Status( 
static_cast<XML_as::Status>(statusNumber) );
-               }
-               return true;
-       }
-        else if (name == NSV::PROP_LOADED)
-        {
-               // TODO: this should really be a proper property
-                bool b = val.to_bool();
-               //log_debug(_("set_member 'loaded' (%s) became boolean %d"), 
val, b);
-                if ( b ) _loaded = 1;
-                else _loaded = 0;
-                return true;
-        }
+    {
+        // TODO: this should really be a proper property (see XML.as)
+        if ( ! val.is_number() )
+        {
+            _status = 
static_cast<ParseStatus>(std::numeric_limits<boost::int32_t>::min());
+        }
+        else
+        {
+            unsigned int statusNumber = static_cast<int>(val.to_number());
+            _status = static_cast<ParseStatus>(statusNumber);
+        }
+        return true;
+    }
+    else if (name == NSV::PROP_LOADED)
+    {
+        // TODO: this should really be a proper property
+        bool b = val.to_bool();
+        //log_debug(_("set_member 'loaded' (%s) became boolean %d"), val, b);
+        if ( b ) _loaded = 1;
+        else _loaded = 0;
+        return true;
+    }
 
-        return set_member_default(name, val, nsname, ifFound);
+    return as_object::set_member(name, val, nsname, ifFound);
 }
 
 XML_as::~XML_as()
 {
-    //GNASH_REPORT_FUNCTION;
 
     for (LoadThreadList::iterator it = _loadThreads.begin(),
-                   e = _loadThreads.end(); it != e; ++it)
+            e = _loadThreads.end(); it != e; ++it)
     {
         delete *it; // supposedly joins the thread
     }
@@ -231,10 +230,10 @@
     }
     if (node->type == XML_COMMENT_NODE)
     {
-       // Comments apparently not handled until AS3
-       // Comments in a text node are a *sibling* of the text node
-       // for libxml2.
-       return false;
+        // Comments apparently not handled until AS3
+        // Comments in a text node are a *sibling* of the text node
+        // for libxml2.
+        return false;
     }
     else if (node->type == XML_ELEMENT_NODE)
     {
@@ -250,25 +249,25 @@
 
             ptr = xmlNodeGetContent(node);
             if (ptr == NULL) return false;
-           if (node->content)
-           {
-               std::ostringstream in;
-               in << ptr;
-               // XML_PARSE_NOBLANKS seems not to be working, so here's
-               // a custom implementation of it.
-               if ( ignoreWhite() )
-               {
-                       if ( in.str().find_first_not_of(" \n\t\r") == 
std::string::npos )
-                       {
+        if (node->content)
+        {
+        std::ostringstream in;
+        in << ptr;
+        // XML_PARSE_NOBLANKS seems not to be working, so here's
+        // a custom implementation of it.
+        if ( ignoreWhite() )
+        {
+            if ( in.str().find_first_not_of(" \n\t\r") == std::string::npos )
+            {
 #ifdef DEBUG_XML_PARSE
-                               log_debug("Text node value consists in blanks 
only, discarding");
+                log_debug("Text node value consists in blanks only, 
discarding");
 #endif
-                               xmlFree(ptr);
-                               return false;
-                       }
-               }
-               element.nodeValueSet(in.str());
-           }
+                xmlFree(ptr);
+                return false;
+            }
+        }
+        element.nodeValueSet(in.str());
+        }
             xmlFree(ptr);
     }
 
@@ -280,9 +279,9 @@
         child = new XMLNode();
         child->setParent(&element);
         if ( extractNode(*child, childnode, mem) )
-       {
-               element._children.push_back(child);
-       }
+        {
+            element._children.push_back(child);
+        }
         childnode = childnode->next;
     }
 
@@ -303,10 +302,10 @@
         log_debug("\tParsing top-level node %s", cur->name);
 #endif
         if ( extractNode(*child, cur, mem) ) 
-       {
-               _children.push_back(child);
-       }
-       cur = cur->next;
+        {
+                _children.push_back(child);
+        }
+        cur = cur->next;
     }  
 
     return true;
@@ -317,9 +316,9 @@
 bool
 XML_as::parseXML(const std::string& xml_in)
 {
-    //GNASH_REPORT_FUNCTION;
 
-    if (xml_in.empty()) {
+    if (xml_in.empty())
+    {
         log_error(_("XML data is empty"));
         return false;
     }
@@ -389,7 +388,6 @@
 #endif
     lt.release();
 
-
     if ( startTimer )
     {
         boost::intrusive_ptr<builtin_function> loadsChecker = 
@@ -432,8 +430,6 @@
 
     if ( _loadThreads.empty() ) return; // nothing to do
 
-    string_table::key onDataKey = NSV::PROP_ON_DATA;
-
     for (LoadThreadList::iterator it=_loadThreads.begin();
             it != _loadThreads.end(); )
     {
@@ -441,7 +437,7 @@
 
         // TODO: notify progress 
 
-       _bytesLoaded = lt->getBytesLoaded();
+        _bytesLoaded = lt->getBytesLoaded();
         _bytesTotal = lt->getBytesTotal();
 
 #ifdef DEBUG_XML_LOADS
@@ -454,16 +450,16 @@
             boost::scoped_array<char> buf(new char[xmlsize+1]);
             size_t actuallyRead = lt->read(buf.get(), xmlsize);
             if ( actuallyRead != xmlsize )
-                       {
-                               // This would be either a bug of LoadThread or 
an expected
-                               // possibility which lacks documentation (thus 
a bug in documentation)
-                               //
+            {
+                // This would be either a bug of LoadThread or an expected
+                // possibility which lacks documentation (thus a bug in 
documentation)
+                //
 #ifdef DEBUG_XML_LOADS
-                               log_debug("LoadThread::getBytesLoaded() 
returned %d but "
+                log_debug("LoadThread::getBytesLoaded() returned %d but "
                         "::read(%d) returned %d",
-                                           xmlsize, xmlsize, actuallyRead);
+                        xmlsize, xmlsize, actuallyRead);
 #endif
-                       }
+            }
             buf[actuallyRead] = '\0';
             // Strip BOM, if any.
             // See http://savannah.gnu.org/bugs/?19915
@@ -481,7 +477,7 @@
             delete lt; // supposedly joins the thread...
 
             // might push_front on the list..
-            callMethod(onDataKey, dataVal);
+            callMethod(NSV::PROP_ON_DATA, dataVal);
 
 #ifdef DEBUG_XML_LOADS
             log_debug("Completed load, _loadThreads have now %d elements",
@@ -499,7 +495,7 @@
 #ifdef DEBUG_XML_LOADS
         log_debug("Clearing XML load checker interval timer");
 #endif
-       VM& vm = getVM();
+        VM& vm = getVM();
         vm.getRoot().clear_interval_timer(_loadCheckerTimer);
         _loadCheckerTimer=0;
     }
@@ -513,9 +509,9 @@
     log_debug("checkLoads_wrapper called");
 #endif
 
-       boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);
-       ptr->checkLoads();
-       return as_value();
+    boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);
+    ptr->checkLoads();
+    return as_value();
 }
 
 // This reads in an XML file from disk and parses into into a memory resident
@@ -554,11 +550,6 @@
     return(_loaded);
 }
 
-void
-XML_as::cleanupStackFrames(XMLNode * /* xml */)
-{
-    GNASH_REPORT_FUNCTION;
-}
 
 void
 XML_as::send()
@@ -646,11 +637,6 @@
 as_value
 xml_load(const fn_call& fn)
 {
-    as_value   method;
-    as_value   val;
-    as_value   rv = false;
-    bool          ret;
-
     boost::intrusive_ptr<XML_as> xml_obj = ensureType<XML_as>(fn.this_ptr);
   
     if ( ! fn.nargs )
@@ -658,7 +644,7 @@
         IF_VERBOSE_ASCODING_ERRORS(
         log_aserror(_("XML.load(): missing argument"));
         );
-        return rv;
+        return as_value();
     }
 
     const std::string& filespec = fn.arg(0).to_string();
@@ -667,15 +653,7 @@
 
     // Set the argument to the function event handler based on whether the load
     // was successful or failed.
-    ret = xml_obj->load(url);
-    rv = ret;
-
-    if (ret == false) {
-        return rv;
-    }
-    
-    rv = true;
-    return rv;
+    return as_value(xml_obj->load(url));
 }
 
 static void
@@ -760,7 +738,7 @@
 xml_addRequestHeader(const fn_call& fn)
 {
     
-       boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);   
+    boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);   
 
     as_value customHeaders;
     as_object* array;
@@ -875,15 +853,17 @@
 xml_createelement(const fn_call& fn)
 {
     
-    if (fn.nargs > 0) {
+    if (fn.nargs > 0)
+    {
         const std::string& text = fn.arg(0).to_string();
-       XMLNode *xml_obj = new XMLNode();
-       xml_obj->nodeNameSet(text);
-       xml_obj->nodeTypeSet(XMLNode::tText);
-       // no return code from this method
-       return as_value(xml_obj);
-       
-    } else {
+        XMLNode *xml_obj = new XMLNode;
+        xml_obj->nodeNameSet(text);
+        xml_obj->nodeTypeSet(XMLNode::tText);
+
+        return as_value(xml_obj);
+        
+    }
+    else {
         log_error(_("no text for element creation"));
     }
     return as_value();
@@ -902,11 +882,9 @@
 xml_createtextnode(const fn_call& fn)
 {
 
-    XMLNode *xml_obj;
-
     if (fn.nargs > 0) {
         const std::string& text = fn.arg(0).to_string();
-        xml_obj = new XMLNode;
+        XMLNode* xml_obj = new XMLNode;
         xml_obj->nodeValueSet(text);
         xml_obj->nodeTypeSet(XMLNode::tText);
         return as_value(xml_obj);
@@ -917,33 +895,34 @@
     return as_value();
 }
 
+
 as_value xml_getbytesloaded(const fn_call& fn)
 {
-       boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);
-       long int ret = ptr->getBytesLoaded();
-       if ( ret < 0 ) return as_value();
-       else return as_value(ret);
+    boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);
+    long int ret = ptr->getBytesLoaded();
+    if ( ret < 0 ) return as_value();
+    else return as_value(ret);
 }
 
+
 as_value xml_getbytestotal(const fn_call& fn)
 {
-       boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);
-       long int ret = ptr->getBytesTotal();
-       if ( ret < 0 ) return as_value();
-       else return as_value(ret);
+    boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);
+    long int ret = ptr->getBytesTotal();
+    if ( ret < 0 ) return as_value();
+    else return as_value(ret);
 }
 
+
 as_value xml_parsexml(const fn_call& fn)
 {
 
-    as_value   method;
-    as_value   val;    
     boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);
 
     if (fn.nargs < 1)
     {
         IF_VERBOSE_ASCODING_ERRORS(
-        log_aserror("XML.parseXML() needs one argument");
+            log_aserror("XML.parseXML() needs one argument");
         );
         return as_value();
     }
@@ -972,7 +951,7 @@
 static as_value
 xml_sendAndLoad(const fn_call& fn)
 {
-    GNASH_REPORT_FUNCTION;
+
     boost::intrusive_ptr<XML_as> ptr = ensureType<XML_as>(fn.this_ptr);
     
     if ( fn.nargs < 2 )
@@ -981,7 +960,7 @@
         std::stringstream ss;
         fn.dump_args(ss);
         log_aserror(_("XML.sendAndLoad(%s): missing arguments"),
-               ss.str());
+        ss.str());
         );
         return as_value(false);
     }
@@ -1041,8 +1020,7 @@
 // extern (used by Global.cpp)
 void xml_class_init(as_object& global)
 {
-//    GNASH_REPORT_FUNCTION;
-    // This is going to be the global XML "class"/"function"
+
     static boost::intrusive_ptr<builtin_function> cl;
 
     if ( cl == NULL )
@@ -1050,7 +1028,6 @@
         cl=new builtin_function(&xml_new, getXMLInterface());
     }
     
-    // Register _global.String
     global.init_member("XML", cl.get());
 
 }
@@ -1072,10 +1049,10 @@
 void
 XML_as::clear()
 {
-       // TODO: should set childs's parent to NULL ?
-       _children.clear();
+    // TODO: should set childs's parent to NULL ?
+    _children.clear();
 
-       _attributes.clear();
+    _attributes.clear();
 }
 
 /*private*/
@@ -1083,10 +1060,10 @@
 XML_as::ignoreWhite() const
 {
 
-       string_table::key propnamekey = 
VM::get().getStringTable().find("ignoreWhite");
-       as_value val;
-       if (!const_cast<XML_as*>(this)->get_member(propnamekey, &val) ) return 
false;
-       return val.to_bool();
+    string_table::key propnamekey = 
VM::get().getStringTable().find("ignoreWhite");
+    as_value val;
+    if (!const_cast<XML_as*>(this)->get_member(propnamekey, &val) ) return 
false;
+    return val.to_bool();
 }
 
 /*private*/
@@ -1094,17 +1071,17 @@
 XML_as::getXMLOptions() const
 {
     int options = XML_PARSE_NOENT
-               //| XML_PARSE_RECOVER -- don't recover now, we'll call 
xmlParseBalancedChunkRecover later
-               //| XML_PARSE_NOWARNING
-               //| XML_PARSE_NOERROR
-               | XML_PARSE_NOCDATA;
+        //| XML_PARSE_RECOVER -- don't recover now, we'll call 
xmlParseBalancedChunkRecover later
+        //| XML_PARSE_NOWARNING
+            //| XML_PARSE_NOERROR
+        | XML_PARSE_NOCDATA;
     // Using libxml2 to convert CDATA nodes to text seems to be what is
     // required.
     
     if ( ignoreWhite() )
     {
-           // This doesn't seem to work, so the blanks skipping
-           // is actually implemented in XML::extractNode instead.
+        // This doesn't seem to work, so the blanks skipping
+        // is actually implemented in XML::extractNode instead.
             //log_debug("Adding XML_PARSE_NOBLANKS to options");
             options |= XML_PARSE_NOBLANKS;
     }

=== modified file 'libcore/asobj/XML_as.h'
--- a/libcore/asobj/XML_as.h    2008-09-18 08:40:46 +0000
+++ b/libcore/asobj/XML_as.h    2008-09-18 11:57:28 +0000
@@ -46,7 +46,7 @@
 {
 public:
 
-    typedef enum {
+    enum ParseStatus {
 
             /// Parsing was successful
             sOK = 0,
@@ -78,7 +78,7 @@
             /// Missing start tag (orphaned close tag)
             sECLOSETAG = -10
 
-    } Status;
+    };
 
 
     XML_as();
@@ -134,8 +134,6 @@
 
     void change_stack_frame(int frame, gnash::as_object *xml, 
gnash::as_environment *env);
 
-    void cleanupStackFrames( XMLNode *data);
-
     XMLNode *createElement(const char *name);
 
     XMLNode *createTextNode(const char *name);
@@ -181,7 +179,7 @@
     //  1 if successfully loaded
     int _loaded;
 
-    Status _status;    
+    ParseStatus _status;       
 
     /// Initialize an XMLNode from an xmlNodePtr
     //

=== modified file 'libcore/debugger.cpp'
--- a/libcore/debugger.cpp      2008-09-09 00:30:54 +0000
+++ b/libcore/debugger.cpp      2008-09-18 11:59:44 +0000
@@ -164,25 +164,25 @@
                        // change a parameter on the stack
                    case 's':
                        cin >> index >> val;
-                       asval.set_std_string(val);
+                       asval.set_string(val);
                        this->changeStackValue(index, asval);
                        break;
                        // change a local variable
                    case 'v':
                        cin >> var >> val;
-                       asval.set_std_string(val);
+                       asval.set_string(val);
                        this->changeLocalVariable(var, asval);
                        break;
                        // change a local register
                    case 'r':
                        cin >> index >> val;
-                       asval.set_std_string(val);
+                       asval.set_string(val);
                        this->changeLocalRegister(index, asval);
                        break;
                        // change a global register
                    case 'g':
                        cin >> index >> val;
-                       asval.set_std_string(val);
+                       asval.set_string(val);
                        this->changeGlobalRegister(index, asval);
                        break;
                    default:

=== modified file 'libcore/edit_text_character.cpp'
--- a/libcore/edit_text_character.cpp   2008-09-18 09:59:32 +0000
+++ b/libcore/edit_text_character.cpp   2008-09-18 11:59:44 +0000
@@ -1052,7 +1052,7 @@
        }       // end switch
 
 
-       return set_member_default(name, val, nsname, ifFound);
+       return as_object::set_member(name, val, nsname, ifFound);
 }
 
 bool

=== modified file 'libcore/sprite_instance.cpp'
--- a/libcore/sprite_instance.cpp       2008-09-18 09:59:32 +0000
+++ b/libcore/sprite_instance.cpp       2008-09-18 11:59:44 +0000
@@ -2991,7 +2991,7 @@
   // Try textfield variables
   //
   // FIXME: Turn textfield variables into Getter/Setters (Properties)
-  //        so that set_member_default will do this automatically.
+  //        so that as_object::set_member will do this automatically.
   //        The problem is that setting a TextVariable named after
   //        a builtin property will prevent *any* setting for the
   //        property (ie: have a textfield use _x as variable name and
@@ -3018,7 +3018,7 @@
 #endif
 
   // If that didn't work call the default set_member
-  if (  set_member_default(name, val, nsname, ifFound) ) found=true;
+  if (as_object::set_member(name, val, nsname, ifFound)) found=true;
 
   return found;
 }

=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2008-09-16 17:28:57 +0000
+++ b/libcore/vm/ASHandlers.cpp 2008-09-18 11:59:44 +0000
@@ -2990,7 +2990,7 @@
     boost::intrusive_ptr<sprite_instance> sp = env.top(0).to_sprite();
     if ( sp )
     {
-        env.top(0).set_std_string(sp->getTarget());
+        env.top(0).set_string(sp->getTarget());
     }
     else
     {


reply via email to

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