gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10709: Fix paranoia build again.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10709: Fix paranoia build again.
Date: Tue, 17 Mar 2009 07:51:23 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10709
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-03-17 07:51:23 +0100
message:
  Fix paranoia build again.
modified:
  libcore/DisplayList.cpp
  libcore/DisplayList.h
    ------------------------------------------------------------
    revno: 10706.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Tue 2009-03-17 07:47:45 +0100
    message:
      Fix paranoia build again.
    modified:
      libcore/DisplayList.cpp
      libcore/DisplayList.h
=== modified file 'libcore/DisplayList.cpp'
--- a/libcore/DisplayList.cpp   2009-03-16 13:10:47 +0000
+++ b/libcore/DisplayList.cpp   2009-03-17 06:47:45 +0000
@@ -72,6 +72,13 @@
     int _depth;
 };
 
+struct DepthGreaterThan
+{
+    bool operator()(const DisplayItem& a, const DisplayItem& b) {
+        return a->get_depth() > b->get_depth();
+    }
+};
+
 struct DepthLessThan
 {
     bool operator()(const DisplayItem& a, const DisplayItem& b) {
@@ -995,9 +1002,17 @@
 {
     if (_charsByDepth.empty()) return true;
     return std::adjacent_find(_charsByDepth.begin(), _charsByDepth.end(),
-            DepthLessThan()) == _charsByDepth.end();
-}
-
+            DepthGreaterThan()) == _charsByDepth.end();
+}
+
+
+#if GNASH_PARANOIA_LEVEL > 1 && !defined(NDEBUG)
+DisplayList::const_iterator
+DisplayList::nonRemoved() const
+{
+    return beginNonRemoved(_charsByDepth);
+}
+#endif
 
 namespace {
 

=== modified file 'libcore/DisplayList.h'
--- a/libcore/DisplayList.h     2009-03-16 13:10:47 +0000
+++ b/libcore/DisplayList.h     2009-03-17 06:47:45 +0000
@@ -73,29 +73,6 @@
     /// Output operator
        friend std::ostream& operator<< (std::ostream&, const DisplayList&);
 
-       void testInvariant() const
-       {
-#if GNASH_PARANOIA_LEVEL > 1
-#ifndef NDEBUG
-               DisplayList sorted = *this;
-
-        // check no duplicated depths above non-removed zone.
-               std::set<int> depths;
-               for (const_iterator it = beginNonRemoved(_charsByDepth),
-                itEnd = _charsByDepth.end(); it != itEnd; ++it) {
-
-                       boost::intrusive_ptr<character> ch = *it;
-                       int depth = ch->get_depth();
-                       if (!depths.insert(depth).second) {
-                               log_debug("Depth %d is duplicated in 
DisplayList %p",
-                        depth, (const void*)this);
-                std::abort();
-                       }
-               }
-               assert(isSorted()); // check we didn't screw up ordering
-#endif
-#endif // GNASH_PARANOIA_LEVEL > 1
-       }
 
        /// \brief
        /// Place a new character at the specified depth,
@@ -345,6 +322,32 @@
        bool operator!=(const DisplayList& other) const {
         return _charsByDepth != other._charsByDepth;
     }
+       
+#if GNASH_PARANOIA_LEVEL > 1 && !defined(NDEBUG)
+    DisplayList::const_iterator nonRemoved() const;
+
+    void testInvariant() const
+       {
+               DisplayList sorted = *this;
+
+        // check no duplicated depths above non-removed zone.
+               std::set<int> depths;
+               for (const_iterator it = nonRemoved(),
+                itEnd = _charsByDepth.end(); it != itEnd; ++it) {
+
+                       boost::intrusive_ptr<character> ch = *it;
+                       int depth = ch->get_depth();
+                       if (!depths.insert(depth).second) {
+                               log_debug("Depth %d is duplicated in 
DisplayList %p",
+                        depth, (const void*)this);
+                std::abort();
+                       }
+               }
+               assert(isSorted()); // check we didn't screw up ordering
+       }
+#else
+    void testInvariant() const {}
+#endif 
 
 private:
 


reply via email to

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