summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/dbgui/csvsplits.cxx28
1 files changed, 15 insertions, 13 deletions
diff --git a/sc/source/ui/dbgui/csvsplits.cxx b/sc/source/ui/dbgui/csvsplits.cxx
index 11ed0bae12a7..aaa0952d6b7b 100644
--- a/sc/source/ui/dbgui/csvsplits.cxx
+++ b/sc/source/ui/dbgui/csvsplits.cxx
@@ -23,24 +23,26 @@
bool ScCsvSplits::Insert( sal_Int32 nPos )
{
- bool bValid = (nPos >= 0);
- if( bValid )
- {
- iterator aIter = ::std::lower_bound( maVec.begin(), maVec.end(), nPos );
- bValid = (aIter == maVec.end()) || (*aIter != nPos);
- if( bValid )
- aIter = maVec.insert( aIter, nPos );
- }
- return bValid;
+ if (nPos < 0)
+ return false;
+
+ const iterator aIter = ::std::lower_bound( maVec.begin(), maVec.end(), nPos );
+
+ if (aIter != maVec.end() && *aIter == nPos)
+ return false;
+
+ maVec.insert( aIter, nPos );
+ return true;
}
bool ScCsvSplits::Remove( sal_Int32 nPos )
{
sal_uInt32 nIndex = GetIndex( nPos );
- bool bValid = (nIndex != CSV_VEC_NOTFOUND);
- if( bValid )
- maVec.erase( maVec.begin() + nIndex );
- return bValid;
+ if (nIndex == CSV_VEC_NOTFOUND)
+ return false;
+
+ maVec.erase( maVec.begin() + nIndex );
+ return true;
}
void ScCsvSplits::RemoveRange( sal_Int32 nPosStart, sal_Int32 nPosEnd )