Workaround for gcc 2.95 pointer compare bug

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8402 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2004-02-04 12:24:01 +00:00
parent 281047c2bf
commit 302a00b035
5 changed files with 29 additions and 9 deletions

View 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):

View 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;

View 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

View 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

View 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();