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,41 +994,26 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl, Button*, void)
{
const sal_uInt16* pU = pTmpRanges + 1;
if ( *pTmpRanges == *pU )
// Correct Range with multiple values
sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU;
DBG_ASSERT( nTmp <= nTmpEnd, "Range is sorted the wrong way" );
if ( nTmp > nTmpEnd )
{
// If really sorted wrongly, then set new
std::swap(nTmp, nTmpEnd);
}
while ( nTmp && nTmp <= nTmpEnd ) // guard against overflow
{
// Range which two identical values -> only set one Item
sal_uInt16 nWh = pPool->GetWhich( *pTmpRanges );
// Iterate over the Range and set the Items
sal_uInt16 nWh = pPool->GetWhich( nTmp );
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
sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU;
DBG_ASSERT( nTmp <= nTmpEnd, "Range is sorted the wrong way" );
if ( nTmp > nTmpEnd )
{
// If really sorted wrongly, then set new
sal_uInt16 nTmp1 = nTmp;
nTmp = nTmpEnd;
nTmpEnd = nTmp1;
}
while ( nTmp <= nTmpEnd )
{
// Iterate over the Range and set the Items
sal_uInt16 nWh = pPool->GetWhich( nTmp );
m_pExampleSet->ClearItem( nWh );
aTmpSet.ClearItem( nWh );
// At the Outset of InvalidateItem,
// so that the change takes effect
m_pOutSet->InvalidateItem( nWh );
nTmp++;
}
nTmp++;
}
// Go to the next pair
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