Kaydet (Commit) d4b4f5f1 authored tarafından Mike Kaganski's avatar Mike Kaganski

Remove useless special handling of single-value ranges

... as they are treated by generic code just fine.
A check added to guard against overflow (0xFFFF + 1 -> 0).

Change-Id: Ibef85191eab82002981e12f83f313f3d122da74c
Reviewed-on: https://gerrit.libreoffice.org/50163Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst b7e8ae27
...@@ -994,18 +994,6 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl, Button*, void) ...@@ -994,18 +994,6 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl, Button*, void)
{ {
const sal_uInt16* pU = pTmpRanges + 1; const sal_uInt16* pU = pTmpRanges + 1;
if ( *pTmpRanges == *pU )
{
// Range which two identical values -> only set one Item
sal_uInt16 nWh = pPool->GetWhich( *pTmpRanges );
m_pExampleSet->ClearItem( nWh );
aTmpSet.ClearItem( nWh );
// At the Outset of InvalidateItem,
// so that the change takes effect
m_pOutSet->InvalidateItem( nWh );
}
else
{
// Correct Range with multiple values // Correct Range with multiple values
sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU; sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU;
DBG_ASSERT( nTmp <= nTmpEnd, "Range is sorted the wrong way" ); DBG_ASSERT( nTmp <= nTmpEnd, "Range is sorted the wrong way" );
...@@ -1013,12 +1001,10 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl, Button*, void) ...@@ -1013,12 +1001,10 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl, Button*, void)
if ( nTmp > nTmpEnd ) if ( nTmp > nTmpEnd )
{ {
// If really sorted wrongly, then set new // If really sorted wrongly, then set new
sal_uInt16 nTmp1 = nTmp; std::swap(nTmp, nTmpEnd);
nTmp = nTmpEnd;
nTmpEnd = nTmp1;
} }
while ( nTmp <= nTmpEnd ) while ( nTmp && nTmp <= nTmpEnd ) // guard against overflow
{ {
// Iterate over the Range and set the Items // Iterate over the Range and set the Items
sal_uInt16 nWh = pPool->GetWhich( nTmp ); sal_uInt16 nWh = pPool->GetWhich( nTmp );
...@@ -1029,7 +1015,6 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl, Button*, void) ...@@ -1029,7 +1015,6 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl, Button*, void)
m_pOutSet->InvalidateItem( nWh ); m_pOutSet->InvalidateItem( nWh );
nTmp++; nTmp++;
} }
}
// Go to the next pair // Go to the next pair
pTmpRanges += 2; pTmpRanges += 2;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment