flat text DB: fix move by bookmark
To test whether the range [a,b( is *before* e,
compare e to b, not to a.
This makes a difference when a==b, which happens for row 0 (header)
when there is no header.
Change-Id: I629b71936f82a468febe0360909264dd80304437
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 2fefbaa..bcc866d 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -756,22 +756,13 @@ void OFlatTable::refreshHeader()
// -----------------------------------------------------------------------------
namespace
{
template< typename Tp, typename Te> struct PairFirstLess
template< typename Tp, typename Te> struct RangeBefore
{
bool operator() (const Tp &p, const Te &e)
{
return p.first < e;
assert(p.first <= p.second);
return p.second <= e;
}
#ifdef DBG_UTIL
bool operator() (const Te &e, const Tp &p)
{
return e < p.first;
}
bool operator() (const Tp &p1, const Tp &p2)
{
return p1.first < p2.first;
}
#endif
};
}
// -----------------------------------------------------------------------------
@@ -910,7 +901,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
vector< TRowPositionInFile >::const_iterator aFind = lower_bound(m_aRowPosToFilePos.begin(),
m_aRowPosToFilePos.end(),
nOffset,
PairFirstLess< TRowPositionInFile, sal_Int32 >());
RangeBefore< TRowPositionInFile, sal_Int32 >());
if(aFind == m_aRowPosToFilePos.end() || aFind->first != nOffset)
//invalid bookmark