diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-11-30 11:58:39 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-11-30 12:03:20 +0100 |
commit | 56ad826194d0b9b42ed8bde35836b0e59c46baa6 (patch) | |
tree | 2b1274fb6e05baab8714f5ee4e39d25c473a4a84 /connectivity | |
parent | 3a89da0b66b35e4ea322bbaea6b0dbcc183c3082 (diff) |
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
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/flat/ETable.cxx | 17 |
1 files changed, 4 insertions, 13 deletions
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 |