diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-01-21 14:03:29 +0100 |
---|---|---|
committer | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-01-21 13:45:50 +0000 |
commit | fb6326c7be3d6705d02b9c19b574cd11d3f99932 (patch) | |
tree | 5787217d6793b5875e46f43ff7466b0514a59721 | |
parent | 793f40cc6f3b5a4752375e240c0b7c4997de15b5 (diff) |
function argument cleanup
fix for cppcheck funcArgOrderDifferent
> Function 'SearchRow' argument order different:
> declaration 'nRow, nRight, nLeft, nPref, bRight, bSimple'
> definition 'nRow, nLeft, nRight, , bRight, bSimple'
remove unused nPref argument
swap arguments where nTop was obviously bigger than
nBottom or nLeft bigger than nRight
use std::swap
no logic change intended
Change-Id: I65fd313636edcd8bca8fde2ca9b35de90d1e8ad4
Reviewed-on: https://gerrit.libreoffice.org/33372
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
-rw-r--r-- | svtools/source/contnr/imivctl.hxx | 4 | ||||
-rw-r--r-- | svtools/source/contnr/imivctl2.cxx | 30 |
2 files changed, 13 insertions, 21 deletions
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index d43208cf380c..b6ee38a5a93a 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -515,16 +515,14 @@ class IcnCursor_Impl sal_uInt16 nCol, sal_uInt16 nTop, sal_uInt16 nBottom, - sal_uInt16 nPref, bool bDown, bool bSimple ); SvxIconChoiceCtrlEntry* SearchRow( sal_uInt16 nRow, - sal_uInt16 nRight, sal_uInt16 nLeft, - sal_uInt16 nPref, + sal_uInt16 nRight, bool bRight, bool bSimple ); diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx index e9a914da71f5..0730f7a3ccae 100644 --- a/svtools/source/contnr/imivctl2.cxx +++ b/svtools/source/contnr/imivctl2.cxx @@ -111,7 +111,7 @@ void IcnCursor_Impl::Clear() } SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol, sal_uInt16 nTop, sal_uInt16 nBottom, - sal_uInt16, bool bDown, bool bSimple ) + bool bDown, bool bSimple ) { DBG_ASSERT(pCurEntry, "SearchCol: No reference entry"); IconChoiceMap::iterator mapIt = xColumns->find( nCol ); @@ -159,11 +159,8 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol, sal_uInt16 nT } if( nTop > nBottom ) - { - sal_uInt16 nTemp = nTop; - nTop = nBottom; - nBottom = nTemp; - } + std::swap(nTop, nBottom); + long nMinDistance = LONG_MAX; SvxIconChoiceCtrlEntry* pResult = nullptr; for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) @@ -190,7 +187,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(sal_uInt16 nCol, sal_uInt16 nT } SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchRow(sal_uInt16 nRow, sal_uInt16 nLeft, sal_uInt16 nRight, - sal_uInt16, bool bRight, bool bSimple ) + bool bRight, bool bSimple ) { DBG_ASSERT(pCurEntry,"SearchRow: No reference entry"); IconChoiceMap::iterator mapIt = xRows->find( nRow ); @@ -238,11 +235,8 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchRow(sal_uInt16 nRow, sal_uInt16 nL } if( nRight < nLeft ) - { - sal_uInt16 nTemp = nRight; - nRight = nLeft; - nLeft = nTemp; - } + std::swap(nRight, nLeft); + long nMinDistance = LONG_MAX; SvxIconChoiceCtrlEntry* pResult = nullptr; for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) @@ -298,9 +292,9 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoLeftRight( SvxIconChoiceCtrlEntry* pCt // neighbor in same row? if( bRight ) pResult = SearchRow( - nY, nX, sal::static_int_cast< sal_uInt16 >(nCols-1), nX, true, true ); + nY, nX, sal::static_int_cast< sal_uInt16 >(nCols-1), true, true ); else - pResult = SearchRow( nY, nX ,0, nX, false, true ); + pResult = SearchRow( nY, 0, nX, false, true ); if( pResult ) return pResult; @@ -322,7 +316,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoLeftRight( SvxIconChoiceCtrlEntry* pCt sal_uInt16 nRowMax = nY; do { - SvxIconChoiceCtrlEntry* pEntry = SearchCol((sal_uInt16)nCurCol,nRowMin,nRowMax,nY,true, false); + SvxIconChoiceCtrlEntry* pEntry = SearchCol((sal_uInt16)nCurCol, nRowMin, nRowMax, true, false); if( pEntry ) return pEntry; if( nRowMin ) @@ -417,9 +411,9 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pCtrlE // neighbor in same column? if( bDown ) pResult = SearchCol( - nX, nY, sal::static_int_cast< sal_uInt16 >(nRows-1), nY, true, true ); + nX, nY, sal::static_int_cast< sal_uInt16 >(nRows-1), true, true ); else - pResult = SearchCol( nX, nY ,0, nY, false, true ); + pResult = SearchCol( nX, 0, nY, false, true ); if( pResult ) return pResult; @@ -441,7 +435,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pCtrlE sal_uInt16 nColMax = nX; do { - SvxIconChoiceCtrlEntry* pEntry = SearchRow((sal_uInt16)nCurRow,nColMin,nColMax,nX,true, false); + SvxIconChoiceCtrlEntry* pEntry = SearchRow((sal_uInt16)nCurRow, nColMin, nColMax, true, false); if( pEntry ) return pEntry; if( nColMin ) |