gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9515: Minor cleanups.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9515: Minor cleanups.
Date: Tue, 22 Jul 2008 10:09:16 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9515
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2008-07-22 10:09:16 +0200
message:
  Minor cleanups.
modified:
  server/array.cpp
  server/array.h
  server/button_character_instance.cpp
  server/edit_text_character.cpp
    ------------------------------------------------------------
    revno: 9507.1.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: workingcopy
    timestamp: Mon 2008-07-21 17:23:59 +0200
    message:
      Drop c_str() from logging, get VM from global object rather than 
singleton.
    modified:
      server/button_character_instance.cpp
      server/edit_text_character.cpp
    ------------------------------------------------------------
    revno: 9507.1.6
    committer: Benjamin Wolsey <address@hidden>
    branch nick: workingcopy
    timestamp: Mon 2008-07-21 17:54:10 +0200
    message:
      Rename typedefs so they are distinct from stdlib names.
    modified:
      server/array.cpp
      server/array.h
=== modified file 'server/array.cpp'
--- a/server/array.cpp  2008-06-17 05:17:31 +0000
+++ b/server/array.cpp  2008-07-21 15:54:10 +0000
@@ -506,10 +506,10 @@
 // Convenience function to process and extract flags from an as_value array
 // of flags (as passed to sortOn when sorting on multiple properties)
 std::deque<boost::uint8_t> 
-get_multi_flags(as_array_object::const_iterator itBegin, 
-    as_array_object::const_iterator itEnd, bool* uniq, bool* index)
+get_multi_flags(as_array_object::ArrayConstIterator itBegin, 
+    as_array_object::ArrayConstIterator itEnd, bool* uniq, bool* index)
 {
-    as_array_object::const_iterator it = itBegin;
+    as_array_object::ArrayConstIterator it = itBegin;
     std::deque<boost::uint8_t> flgs;
 
     // extract fUniqueSort and fReturnIndexedArray from first flag
@@ -561,7 +561,7 @@
     std::deque<indexed_as_value> indexed_elements;
     int i = 0;
 
-    for (const_iterator it = elements.begin(), e = elements.end();
+    for (ArrayConstIterator it = elements.begin(), e = elements.end();
         it != e; ++it)
     {
         indexed_elements.push_back(indexed_as_value(*it, i++));
@@ -569,13 +569,13 @@
     return indexed_elements;
 }
 
-as_array_object::const_iterator
+as_array_object::ArrayConstIterator
 as_array_object::begin()
 {
     return elements.begin();
 }
 
-as_array_object::const_iterator
+as_array_object::ArrayConstIterator
 as_array_object::end()
 {
     return elements.end();
@@ -661,7 +661,7 @@
     // We create another container, as we want to fill the gaps
     // There could likely be an in-place version for this, but
     // filling the gaps would need more care
-    container newelements(sz);
+    ArrayContainer newelements(sz);
 
     for (size_t i=0, n=sz-1; i<sz; ++i, --n)
     {
@@ -761,7 +761,7 @@
 bool
 as_array_object::removeFirst(const as_value& v)
 {
-    for (iterator it = elements.begin(), e = elements.end(); it != e; ++it)
+    for (ArrayIterator it = elements.begin(), e = elements.end(); it != e; 
++it)
     {
         if ( v.equals(*it) )
         {
@@ -783,7 +783,7 @@
     if ( index >= 0 ) // a valid index was requested
     {
         size_t i = index;
-        const_iterator it = elements.find(i);
+        ArrayConstIterator it = elements.find(i);
         if ( it != elements.end() && it.index() == i )
         {
             *val = *it;
@@ -803,7 +803,7 @@
     if ( index >= 0 ) // a valid index was requested
     {
         size_t i = index;
-        const_iterator it = elements.find(i);
+        ArrayConstIterator it = elements.find(i);
         if ( it != elements.end() && it.index() == i )
         {
             return true;
@@ -822,7 +822,7 @@
     if ( index >= 0 ) // a valid index was requested
     {
         size_t i = index;
-        const_iterator it = elements.find(i);
+        ArrayConstIterator it = elements.find(i);
         if ( it != elements.end() && it.index() == i )
         {
             elements.erase_element(i);
@@ -1078,7 +1078,7 @@
         std::deque<as_cmp_fn> cmp;
         std::deque<as_cmp_fn> eq;
 
-        for (as_array_object::const_iterator it = props->begin();
+        for (as_array_object::ArrayConstIterator it = props->begin();
             it != props->end(); ++it)
         {
             string_table::key s = 
st.find(PROPNAME((*it).to_string_versioned(version)));
@@ -1099,7 +1099,7 @@
                 ensureType<as_array_object>(fn.arg(1).to_object());
             if (farray->size() == optnum)
             {
-                as_array_object::const_iterator 
+                as_array_object::ArrayConstIterator 
                     fBegin = farray->begin(),
                     fEnd = farray->end();
 
@@ -1570,7 +1570,7 @@
     // TODO: only actually defined elements should be pushed on the env
     //       but we currently have no way to distinguish between defined
     //       and non-defined elements
-    for (const_iterator it = elements.begin(),
+    for (ArrayConstIterator it = elements.begin(),
         itEnd = elements.end(); it != itEnd; ++it)
     {
             env.push(as_value(it.index()));
@@ -1580,7 +1580,7 @@
 void
 as_array_object::shiftElementsLeft(unsigned int count)
 {
-    container& v = elements;
+    ArrayContainer& v = elements;
 
     if ( count >= v.size() )
     {
@@ -1590,7 +1590,7 @@
 
     for (unsigned int i=0; i<count; ++i) v.erase_element(i);
 
-    for (container::iterator i=v.begin(), e=v.end(); i!=e; ++i)
+    for (ArrayIterator i=v.begin(), e=v.end(); i!=e; ++i)
     {
         int currentIndex = i.index();
         int newIndex = currentIndex-count;
@@ -1602,10 +1602,10 @@
 void
 as_array_object::shiftElementsRight(unsigned int count)
 {
-    container& v = elements;
+    ArrayContainer& v = elements;
 
     v.resize(v.size()+count);
-        for (container::reverse_iterator i=v.rbegin(), e=v.rend(); i!=e; ++i)
+        for (ArrayContainer::reverse_iterator i=v.rbegin(), e=v.rend(); i!=e; 
++i)
     {
         int currentIndex = i.index();
         int newIndex = currentIndex+count;
@@ -1624,7 +1624,7 @@
 
     size_t newsize = sz-count;
     if ( replace ) newsize += replace->size();
-    container newelements(newsize);
+    ArrayContainer newelements(newsize);
 
     size_t ni=0;
 
@@ -1659,7 +1659,7 @@
 void
 as_array_object::markReachableResources() const
 {
-    for (const_iterator i=elements.begin(), e=elements.end(); i!=e; ++i)
+    for (ArrayConstIterator i=elements.begin(), e=elements.end(); i!=e; ++i)
     {
         (*i).setReachable();
     }

=== modified file 'server/array.h'
--- a/server/array.h    2008-06-17 05:17:31 +0000
+++ b/server/array.h    2008-07-21 15:54:10 +0000
@@ -62,16 +62,16 @@
 
 public:
 
+       typedef boost::numeric::ublas::mapped_vector<as_value> ArrayContainer;
+
+       typedef ArrayContainer::const_iterator ArrayConstIterator;
+       typedef ArrayContainer::iterator ArrayIterator;
+
+       typedef std::list<as_value> ValueList;
+
+
        enum { itemBlank, itemValue };
 
-       //typedef boost::variant<blank, as_value> ValOrNone;
-       //typedef std::deque<ValOrNone> container;
-
-       typedef boost::numeric::ublas::mapped_vector<as_value> container;
-
-       typedef container::const_iterator const_iterator;
-       typedef container::iterator iterator;
-
        /// Visit all elements 
        //
        /// The visitor class will have to expose a visit(as_value&) method
@@ -80,10 +80,10 @@
        {
                // NOTE: we copy the elements as the visitor might call 
arbitrary code
                //       possibly modifying the container itself.
-               container copy = elements;
+               ArrayContainer copy = elements;
 
                // iterating this way will skip holes
-               for (iterator i=copy.begin(), ie=copy.end(); i!=ie; ++i)
+               for (ArrayIterator i=copy.begin(), ie=copy.end(); i!=ie; ++i)
                        v.visit(*i);
        }
 
@@ -119,9 +119,9 @@
 
        std::deque<indexed_as_value> get_indexed_elements();
 
-       const_iterator begin();
+       ArrayConstIterator begin();
 
-       const_iterator end();
+       ArrayConstIterator end();
 
        /// Push an element to the end of the array
        //
@@ -250,8 +250,6 @@
                // instead of the queue. We want to sort a copy anyway
                // to avoid the comparator changing the original container.
                //
-
-               typedef std::list<as_value> ValueList;
                ValueList nelem;
                ContainerFiller<ValueList> filler(nelem);
                visitAll(filler);
@@ -398,7 +396,7 @@
 
 private:
 
-       container elements;
+       ArrayContainer elements;
 
        // this function is used internally by set_member and get_member
        // it takes a string that is the member name of the array and returns -1

=== modified file 'server/button_character_instance.cpp'
--- a/server/button_character_instance.cpp      2008-07-08 09:36:41 +0000
+++ b/server/button_character_instance.cpp      2008-07-21 15:23:59 +0000
@@ -504,7 +504,7 @@
 
        default:
                //abort();      // missed a case?
-               log_error(_("Unhandled button event %s"), 
event.get_function_name().c_str());
+               log_error(_("Unhandled button event %s"), 
event.get_function_name());
                break;
        };
        
@@ -578,21 +578,21 @@
        std::auto_ptr<ExecutableCode> code ( get_event_handler(event) );
        if ( code.get() )
        {
-               //log_debug(_("Got statically-defined handler for event: %s"), 
event.get_function_name().c_str());
+               //log_debug(_("Got statically-defined handler for event: %s"), 
event.get_function_name());
                mr.pushAction(code, movie_root::apDOACTION);
                //code->execute();
        }
-       //else log_debug(_("No statically-defined handler for event: %s"), 
event.get_function_name().c_str());
+       //else log_debug(_("No statically-defined handler for event: %s"), 
event.get_function_name());
 
        // Call conventional attached method.
        boost::intrusive_ptr<as_function> method = 
getUserDefinedEventHandler(event.get_function_key());
        if ( method )
        {
-               //log_debug(_("Got user-defined handler for event: %s"), 
event.get_function_name().c_str());
+               //log_debug(_("Got user-defined handler for event: %s"), 
event.get_function_name());
                mr.pushAction(method, this, movie_root::apDOACTION);
                //call_method0(as_value(method.get()), &(get_environment()), 
this);
        }
-       //else log_debug(_("No statically-defined handler for event: %s"), 
event.get_function_name().c_str());
+       //else log_debug(_("No statically-defined handler for event: %s"), 
event.get_function_name());
 }
 
 void 
@@ -977,7 +977,7 @@
                if ( ! ch ) continue;
                if ( ch->isUnloaded() ) continue;
                if ( ch->unload() ) childsHaveUnload = true;
-               //log_debug("Button child %s (%s) unloaded", 
ch->getTarget().c_str(), typeName(*ch).c_str());
+               //log_debug("Button child %s (%s) unloaded", ch->getTarget(), 
typeName(*ch));
        }
 
        // NOTE: we don't need to ::unload or ::destroy here
@@ -1083,7 +1083,7 @@
           "the name of an existing character "
           "in its display list.  "
           "The member will hide the "
-          "character"), name.c_str());
+          "character"), name);
     }
     );
 #endif

=== modified file 'server/edit_text_character.cpp'
--- a/server/edit_text_character.cpp    2008-07-09 07:33:34 +0000
+++ b/server/edit_text_character.cpp    2008-07-21 15:23:59 +0000
@@ -1821,7 +1821,7 @@
 
        if ( cl == NULL )
        {
-               VM& vm = VM::get();
+               VM& vm = global.getVM();
 
                as_object* iface = getTextFieldInterface();
                cl=new builtin_function(&textfield_ctor, iface);


reply via email to

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