gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-171-g463fe40
Date: Wed, 02 Mar 2011 19:47:13 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  463fe406bcf6b5ff05cb24d3d930379245b0b9de (commit)
      from  30a2b7acc6d0c5abe706d61416049d41922a41b0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=463fe406bcf6b5ff05cb24d3d930379245b0b9de


commit 463fe406bcf6b5ff05cb24d3d930379245b0b9de
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Mar 2 19:38:45 2011 +0100

    Drop last raw pointer containers and code for cleaning them
    up.

diff --git a/libbase/GnashAlgorithm.h b/libbase/GnashAlgorithm.h
index 7b11c8b..c2ab59d 100644
--- a/libbase/GnashAlgorithm.h
+++ b/libbase/GnashAlgorithm.h
@@ -85,42 +85,6 @@ arraySize(T(&)[N])
     return N;
 }
 
-
-/// Delete a pointer safely
-//
-/// Any depth of pointers-to-pointers (up to maximum template recursion) can
-/// be passed to this struct. The type of the pointee is deduced and passed
-/// to boost::checked_deleter, which ensures that the type is fully known
-/// at the point of deletion. It does not, of course, check that the pointer
-/// was allocated with new, so this isn't completely idiot-proof.
-template<typename T>
-struct CheckedDeleter
-{
-};
-
-template<typename T>
-struct CheckedDeleter<T**>
-{
-    /// Typedef for use in boost::bind.
-    typedef typename CheckedDeleter<T*>::result_type result_type;
-
-    void operator()(T** p) const {
-        CheckedDeleter<T*>()(*p);
-    }
-};
-
-template<typename T>
-struct CheckedDeleter<T*>
-{
-    /// Typedef for use in boost::bind.
-    typedef void result_type;
-
-    void operator()(T* p) const {
-        boost::checked_delete<T>(p);
-    }
-};
-
-
 /// Call a functor on the second element of each element in a range.
 //
 /// @tparam T           An iterator type satisfying the requirements of a
@@ -137,22 +101,6 @@ foreachSecond(T begin, T end, U op)
     std::for_each(begin, end, boost::bind(op, boost::bind(S(), _1)));
 }
 
-/// Safely call delete on each element in a range.
-//
-/// This checks that the type is fully known, but cannot check whether the
-/// pointer was allocated with new. Pointers allocated with new[] or any other
-/// allocation function should never be passed to this function.
-//
-/// @param begin        The start of the range to call delete on.
-/// @param end          The end of the range to call delete on.
-template<typename T>
-void
-deleteChecked(T begin, T end)
-{
-    typedef typename std::iterator_traits<T>::value_type value_type;
-    std::for_each(begin, end, CheckedDeleter<value_type>());
-}
-
 } // namespace gnash
 
 #endif
diff --git a/libcore/asobj/NetStream_as.cpp b/libcore/asobj/NetStream_as.cpp
index 2a3d261..3323bf7 100644
--- a/libcore/asobj/NetStream_as.cpp
+++ b/libcore/asobj/NetStream_as.cpp
@@ -1513,20 +1513,18 @@ BufferedAudioStreamer::fetch(boost::int16_t* samples, 
unsigned int nSamples, boo
             break;
         }
 
-        CursoredBuffer* samples = _audioQueue.front();
+        CursoredBuffer& samples = _audioQueue.front();
 
-        assert( ! (samples->m_size%2) ); 
-        int n = std::min<int>(samples->m_size, len);
-        std::copy(samples->m_ptr, samples->m_ptr+n, stream);
+        assert( ! (samples.m_size%2) ); 
+        int n = std::min<int>(samples.m_size, len);
+        std::copy(samples.m_ptr, samples.m_ptr+n, stream);
 
         stream += n;
-        samples->m_ptr += n;
-        samples->m_size -= n;
+        samples.m_ptr += n;
+        samples.m_size -= n;
         len -= n;
 
-        if (samples->m_size == 0)
-        {
-            delete samples;
+        if (samples.m_size == 0) {
             _audioQueue.pop_front();
         }
 
@@ -1563,9 +1561,6 @@ void
 BufferedAudioStreamer::cleanAudioQueue()
 {
     boost::mutex::scoped_lock lock(_audioQueueMutex);
-
-    deleteChecked(_audioQueue.begin(), _audioQueue.end());
-
     _audioQueue.clear();
 }
 
diff --git a/libcore/asobj/NetStream_as.h b/libcore/asobj/NetStream_as.h
index 6e94d29..6d8e75f 100644
--- a/libcore/asobj/NetStream_as.h
+++ b/libcore/asobj/NetStream_as.h
@@ -25,21 +25,18 @@
 #define __STDC_CONSTANT_MACROS
 #endif
 
+#include <boost/intrusive_ptr.hpp>
+#include <string>
+#include <boost/ptr_container/ptr_deque.hpp>
+#include <boost/scoped_ptr.hpp>
+
 #include "MediaParser.h"
 #include "PlayHead.h" // for composition
-
 #include "VideoDecoder.h" // for visibility of dtor
 #include "AudioDecoder.h" // for visibility of dtor
-
 #include "VirtualClock.h"
-
 #include "Relay.h" // for ActiveRelay inheritance
 
-#include <boost/intrusive_ptr.hpp>
-#include <string>
-#include <deque>
-#include <boost/scoped_ptr.hpp>
-
 // Forward declarations
 namespace gnash {
     class CharacterProxy;
@@ -110,7 +107,7 @@ public:
         boost::uint8_t* m_ptr;
     };
 
-    typedef std::deque<CursoredBuffer*> AudioQueue;
+    typedef boost::ptr_deque<CursoredBuffer> AudioQueue;
 
     // Delete all samples in the audio queue.
     void cleanAudioQueue();
diff --git a/librender/agg/Renderer_agg_style.h 
b/librender/agg/Renderer_agg_style.h
index 360436b..4350d4f 100644
--- a/librender/agg/Renderer_agg_style.h
+++ b/librender/agg/Renderer_agg_style.h
@@ -23,6 +23,7 @@
 // be cached somewhere.
 
 #include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
 #include <agg_gradient_lut.h>
 #include <agg_color_rgba.h>
 #include <agg_color_gray.h>
@@ -440,13 +441,12 @@ public:
     {}
     
     ~StyleHandler() {
-        deleteChecked(_styles.begin(), _styles.end());
     }
 
     /// Called by AGG to ask if a certain style is a solid color
     bool is_solid(unsigned style) const {
       assert(style < _styles.size());
-      return _styles[style]->solid(); 
+      return _styles[style].solid(); 
     }
     
     /// Adds a new solid fill color style
@@ -515,7 +515,7 @@ public:
     agg::rgba8 color(unsigned style) const 
     {
         if (style < _styles.size())
-            return _styles[style]->color();
+            return _styles[style].color();
 
         return m_transparent;
     }
@@ -524,7 +524,7 @@ public:
     void generate_span(agg::rgba8* span, int x, int y,
         unsigned len, unsigned style)
     {
-      _styles[style]->generate_span(span,x,y,len);
+      _styles[style].generate_span(span,x,y,len);
     }
 
 
@@ -551,7 +551,7 @@ public:
         _styles.push_back(st);
     }
 
-    std::vector<AggStyle*> _styles;
+    boost::ptr_vector<AggStyle> _styles;
     agg::rgba8 m_transparent;
 
 }; 

-----------------------------------------------------------------------

Summary of changes:
 libbase/GnashAlgorithm.h           |   52 ------------------------------------
 libcore/asobj/NetStream_as.cpp     |   19 +++++--------
 libcore/asobj/NetStream_as.h       |   15 ++++------
 librender/agg/Renderer_agg_style.h |   10 +++---
 4 files changed, 18 insertions(+), 78 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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