From 56ad826194d0b9b42ed8bde35836b0e59c46baa6 Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Sat, 30 Nov 2013 11:58:39 +0100 Subject: 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 --- connectivity/source/drivers/flat/ETable.cxx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'connectivity/source') diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 2fefbaac1eed..bcc866d48795 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 -- cgit