gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/array.cpp server/array.h


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog server/array.cpp server/array.h
Date: Tue, 17 Jun 2008 06:17:33 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/06/17 06:17:33

Modified files:
        .              : ChangeLog 
        server         : array.cpp array.h 

Log message:
                * server/array.{cpp,h}: drop unused variable, reduce calls to 
.size()
                  and .end(). Replace std::auto_ptr with boost::intrusive_ptr.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6948&r2=1.6949
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.cpp?cvsroot=gnash&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.h?cvsroot=gnash&r1=1.48&r2=1.49

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6948
retrieving revision 1.6949
diff -u -b -r1.6948 -r1.6949
--- ChangeLog   16 Jun 2008 16:58:48 -0000      1.6948
+++ ChangeLog   17 Jun 2008 06:17:31 -0000      1.6949
@@ -1,3 +1,8 @@
+2008-06-17 Benjamin Wolsey <address@hidden>
+
+       * server/array.{cpp,h}: drop unused variable, reduce calls to .size()
+         and .end(). Replace std::auto_ptr with boost::intrusive_ptr.
+
 2008-06-16 Sandro Santilli <address@hidden>
 
        * libmedia/ffmpeg/sound_handler_sdl.{cpp,h}: don't fail to initialize

Index: server/array.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/array.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- server/array.cpp    16 Jun 2008 14:49:02 -0000      1.112
+++ server/array.cpp    17 Jun 2008 06:17:32 -0000      1.113
@@ -36,7 +36,6 @@
 #include <string>
 #include <algorithm>
 #include <cmath>
-#include <memory> // for auto_ptr
 #include <boost/algorithm/string/case_conv.hpp>
 
 //#define GNASH_DEBUG 
@@ -437,13 +436,12 @@
                if ( _cmps.empty() ) return false;
 
                std::deque<as_cmp_fn>::iterator cmp = _cmps.begin();
-               Props::iterator pit;
 
                // why do we cast ao/bo to objects here ?
                boost::intrusive_ptr<as_object> ao = a.to_object();
                boost::intrusive_ptr<as_object> bo = b.to_object();
                
-               for (pit = _prps.begin(); pit != _prps.end(); ++pit, ++cmp)
+        for (Props::iterator pit = _prps.begin(), pend = _prps.end(); pit != 
pend; ++pit, ++cmp)
                {
                        as_value av, bv;
 
@@ -475,13 +473,12 @@
                if ( _cmps.empty() ) return false;
 
                Comps::const_iterator cmp = _cmps.begin();
-               Props::iterator pit;
 
                // why do we cast ao/bo to objects here ?
                boost::intrusive_ptr<as_object> ao = a.to_object();
                boost::intrusive_ptr<as_object> bo = b.to_object();
 
-               for (pit = _prps.begin(); pit != _prps.end(); ++pit, ++cmp)
+        for (Props::iterator pit = _prps.begin(), pend = _prps.end(); pit != 
pend; ++pit, ++cmp)
                {
                        as_value av, bv;
                        ao->get_member(*pit, &av);
@@ -564,8 +561,8 @@
        std::deque<indexed_as_value> indexed_elements;
        int i = 0;
 
-       for (const_iterator it = elements.begin();
-               it != elements.end(); ++it)
+    for (const_iterator it = elements.begin(), e = elements.end();
+        it != e; ++it)
        {
                indexed_elements.push_back(indexed_as_value(*it, i++));
        }
@@ -711,7 +708,9 @@
 as_array_object::concat(const as_array_object& other)
 {
        for (size_t i=0, e=other.size(); i<e; i++)
+    {
                push(other.at(i));
+    }
 }
 
 std::string
@@ -733,14 +732,14 @@
        else return elements[index];
 }
 
-std::auto_ptr<as_array_object>
+boost::intrusive_ptr<as_array_object>
 as_array_object::slice(unsigned int start, unsigned int one_past_end)
 {
        assert(one_past_end >= start);
        assert(one_past_end <= size());
        assert(start <= size());
 
-       std::auto_ptr<as_array_object> newarray(new as_array_object);
+    boost::intrusive_ptr<as_array_object> newarray(new as_array_object);
 
 #ifdef GNASH_DEBUG
        log_debug(_("Array.slice(%u, %u) called"), start, one_past_end);
@@ -762,7 +761,7 @@
 bool
 as_array_object::removeFirst(const as_value& v)
 {
-       for (iterator it = elements.begin(); it != elements.end(); ++it)
+    for (iterator it = elements.begin(), e = elements.end(); it != e; ++it)
        {
                if ( v.equals(*it) )
                {
@@ -1035,7 +1034,7 @@
 {
        boost::intrusive_ptr<as_array_object> array = 
                ensureType<as_array_object>(fn.this_ptr);
-       as_environment& env = fn.env();
+
        bool do_unique = false, do_index = false;
        boost::uint8_t flags = 0;
 
@@ -1381,10 +1380,10 @@
        if ( endindex < startindex ) endindex = startindex;
        else if ( static_cast<size_t>(endindex)  > arraysize ) endindex = 
arraysize;
 
-       std::auto_ptr<as_array_object> newarray(array->slice(
+    boost::intrusive_ptr<as_array_object> newarray(array->slice(
                startindex, endindex));
 
-       return as_value(newarray.release());            
+    return as_value(newarray.get());        
 }
 
 static as_value
@@ -1631,7 +1630,9 @@
 
        // add initial portion
        for (size_t i=0; i<start; ++i )
+    {
                newelements[ni++] = elements[i];
+    }
 
        // add replacement, if any
        if ( replace )

Index: server/array.h
===================================================================
RCS file: /sources/gnash/gnash/server/array.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- server/array.h      27 Apr 2008 18:13:14 -0000      1.48
+++ server/array.h      17 Jun 2008 06:17:32 -0000      1.49
@@ -187,7 +187,7 @@
        ///     index to one-past element to include in result
        ///     0-based index.
        ///
-       std::auto_ptr<as_array_object> slice(
+       boost::intrusive_ptr<as_array_object> slice(
                unsigned int start, unsigned int one_past_end);
 
        /// Remove first element matching the given value




reply via email to

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