]> git.lyx.org Git - features.git/commitdiff
Workaround for gcc 2.95 pointer compare bug
authorMartin Vermeer <martin.vermeer@hut.fi>
Wed, 4 Feb 2004 12:24:01 +0000 (12:24 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Wed, 4 Feb 2004 12:24:01 +0000 (12:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8402 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/cursor.C
src/cursor.h
src/mathed/ChangeLog
src/mathed/math_nestinset.C

index c00d227cfce2c5fc5b652a188d7e67cc4fb9ed40..c56c9595e5b0985fc7171a9e55c7a9cef10a56f4 100644 (file)
@@ -1,4 +1,8 @@
 
+2004-02-04  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * cursor.[Ch]: workaround gcc 2.95 pointer comparison bug
+
 2004-02-04  André Pönitz  <poenitz@gmx.net>
 
        * BufferView.[Ch] (insertInset):
index 244329093a47b6767712911872b37073c39bc487..02c83938ac1f3265b25249fb4d2bf1e4df1b80ab 100644 (file)
@@ -860,7 +860,7 @@ bool LCursor::openable(MathAtom const & t)
        // we can't move into anything new during selection
        if (depth() == anchor_.size())
                return false;
-       if (t.nucleus() != anchor_[depth()].inset())
+       if (!ptr_cmp(t.nucleus(), anchor_[depth()].inset()))
                return false;
 
        return true;
index 0951333da97d878c1449e99fdd301da982ac948f..baff40685231d1fedcf3397c4e866e33841a2211 100644 (file)
@@ -33,6 +33,17 @@ class PainterInfo;
 class MathUnknownInset;
 class MathGridInset;
 
+
+// only needed for gcc 2.95, remove when support terminated
+
+
+template <typename A, typename B>
+bool ptr_cmp(A const * a, B const * b)
+{
+return a == b;
+}
+
+
 // this is used for traversing math insets
 typedef std::vector<CursorSlice> CursorBase;
 /// move on one step
index 9192fa70fd97d0b8515acb5abcd47e50d63638c8..f8619979ab74e6de61b280ecc843527f4952ac50 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-04  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * math_nestinset.C: workaround gcc 2.95 pointer comparison bug,
+       reverse below
+
 2004-02-03  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * math_nestinset.C: use const_cast to get to compile for stlport
index ac815f1d68e61497842ba1891dedeca477e71246..f5096870ad0b2b56c914a2b72f80a16e5156efa7 100644 (file)
@@ -72,7 +72,7 @@ MathArray const & MathNestInset::cell(idx_type i) const
 void MathNestInset::getCursorPos(CursorSlice const & cur,
        int & x, int & y) const
 {
-       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        MathArray const & ar = cur.cell();
        x = ar.xo() + ar.pos2x(cur.pos());
        y = ar.yo();
@@ -99,7 +99,7 @@ void MathNestInset::metrics(MetricsInfo const & mi) const
 
 bool MathNestInset::idxNext(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (cur.idx() == cur.lastidx())
                return false;
        ++cur.idx();
@@ -116,7 +116,7 @@ bool MathNestInset::idxRight(LCursor & cur) const
 
 bool MathNestInset::idxPrev(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (cur.idx() == 0)
                return false;
        --cur.idx();
@@ -133,7 +133,7 @@ bool MathNestInset::idxLeft(LCursor & cur) const
 
 bool MathNestInset::idxFirst(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (nargs() == 0)
                return false;
        cur.idx() = 0;
@@ -144,7 +144,7 @@ bool MathNestInset::idxFirst(LCursor & cur) const
 
 bool MathNestInset::idxLast(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (nargs() == 0)
                return false;
        cur.idx() = cur.lastidx();
@@ -155,7 +155,7 @@ bool MathNestInset::idxLast(LCursor & cur) const
 
 bool MathNestInset::idxHome(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() ==  const_cast<MathNestInset *>(this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (cur.pos() == 0)
                return false;
        cur.pos() = 0;
@@ -165,7 +165,7 @@ bool MathNestInset::idxHome(LCursor & cur) const
 
 bool MathNestInset::idxEnd(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() ==  const_cast<MathNestInset *>(this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (cur.lastpos() == cur.lastpos())
                return false;
        cur.pos() = cur.lastpos();
@@ -202,7 +202,7 @@ void MathNestInset::drawSelection(PainterInfo & pi, int x, int y) const
        LCursor & cur = pi.base.bv->cursor();
        if (!cur.selection())
                return;
-       if (cur.inset() != const_cast<MathNestInset *>(this))
+       if (!ptr_cmp(cur.inset(), this))
                return;
        CursorSlice & s1 = cur.selBegin();
        CursorSlice & s2 = cur.selEnd();