diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-06 10:12:29 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-10 12:23:42 +0100 |
commit | 065edb4c8e91170017df482843d0c3eb8d4db114 (patch) | |
tree | 1d030ec9868a56b375a563c9d6e6d81c6115d717 /editeng | |
parent | 0b34a5dd39e177ba99cd21b639d67ac8123b8458 (diff) |
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I0b3c407331bfa1fa0c5003250d327d4f26de3643
Reviewed-on: https://gerrit.libreoffice.org/63235
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 92 | ||||
-rw-r--r-- | editeng/source/uno/unoipset.cxx | 38 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 4 |
3 files changed, 64 insertions, 70 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index ab2ba01378db..f84fba00dfff 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -932,65 +932,63 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, // Found [ \t]+[A-Z0-9]+ until here. Test now on the paragraph separator. // all three can happen, but not more than once! const sal_Unicode* pExceptStt = nullptr; - if( !bAtStart ) + bool bContinue = true; + Flags nFlag = Flags::NONE; + do { - bool bContinue = true; - Flags nFlag = Flags::NONE; - do { - switch( *pStr ) - { + switch (*pStr) + { // Western and Asian full stop case '.': - case 0x3002 : - case 0xFF0E : + case 0x3002: + case 0xFF0E: + { + if (pStr >= pStart + 2 && *(pStr - 2) == '.') { - if (pStr >= pStart + 2 && *(pStr-2) == '.') - { - //e.g. text "f.o.o. word": Now currently considering - //capitalizing word but second last character of - //previous word is a . So probably last word is an - //anagram that ends in . and not truly the end of a - //previous sentence, so don't autocapitalize this word - return; - } - if( nFlag & Flags::FullStop ) - return; // no valid separator -> no replacement - nFlag |= Flags::FullStop; - pExceptStt = pStr; + //e.g. text "f.o.o. word": Now currently considering + //capitalizing word but second last character of + //previous word is a . So probably last word is an + //anagram that ends in . and not truly the end of a + //previous sentence, so don't autocapitalize this word + return; } - break; + if (nFlag & Flags::FullStop) + return; // no valid separator -> no replacement + nFlag |= Flags::FullStop; + pExceptStt = pStr; + } + break; case '!': - case 0xFF01 : - { - if( nFlag & Flags::ExclamationMark ) - return; // no valid separator -> no replacement - nFlag |= Flags::ExclamationMark; - } - break; + case 0xFF01: + { + if (nFlag & Flags::ExclamationMark) + return; // no valid separator -> no replacement + nFlag |= Flags::ExclamationMark; + } + break; case '?': - case 0xFF1F : - { - if( nFlag & Flags::QuestionMark) - return; // no valid separator -> no replacement - nFlag |= Flags::QuestionMark; - } - break; + case 0xFF1F: + { + if (nFlag & Flags::QuestionMark) + return; // no valid separator -> no replacement + nFlag |= Flags::QuestionMark; + } + break; default: - if( nFlag == Flags::NONE ) - return; // no valid separator -> no replacement + if (nFlag == Flags::NONE) + return; // no valid separator -> no replacement else bContinue = false; break; - } + } - if( bContinue && pStr-- == pStart ) - { - return; // no valid separator -> no replacement - } - } while( bContinue ); - if( Flags::FullStop != nFlag ) - pExceptStt = nullptr; - } + if (bContinue && pStr-- == pStart) + { + return; // no valid separator -> no replacement + } + } while (bContinue); + if (Flags::FullStop != nFlag) + pExceptStt = nullptr; if( 2 > ( pStr - pStart ) ) return; diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 71afb18871e3..27281c3ade9b 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -157,32 +157,28 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa pItem = &pPool->GetDefaultItem( pMap->nWID ); } - DBG_ASSERT( pItem, "Got no default for item!" ); - if( pItem ) - { - uno::Any aValue( rVal ); + uno::Any aValue(rVal); - const MapUnit eMapUnit = pPool ? pPool->GetMetric(pMap->nWID) : MapUnit::Map100thMM; + const MapUnit eMapUnit = pPool ? pPool->GetMetric(pMap->nWID) : MapUnit::Map100thMM; - // check for needed metric translation - if( (pMap->nMoreFlags & PropertyMoreFlags::METRIC_ITEM) && eMapUnit != MapUnit::Map100thMM ) - { - if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aValue ) ) - SvxUnoConvertFromMM( eMapUnit, aValue ); - } + // check for needed metric translation + if ((pMap->nMoreFlags & PropertyMoreFlags::METRIC_ITEM) && eMapUnit != MapUnit::Map100thMM) + { + if (!bDontConvertNegativeValues || SvxUnoCheckForPositiveValue(aValue)) + SvxUnoConvertFromMM(eMapUnit, aValue); + } - std::unique_ptr<SfxPoolItem> pNewItem( pItem->Clone() ); + std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone()); - sal_uInt8 nMemberId = pMap->nMemberId; - if( eMapUnit == MapUnit::Map100thMM ) - nMemberId &= (~CONVERT_TWIPS); + sal_uInt8 nMemberId = pMap->nMemberId; + if (eMapUnit == MapUnit::Map100thMM) + nMemberId &= (~CONVERT_TWIPS); - if( pNewItem->PutValue( aValue, nMemberId ) ) - { - // Set new item in item set - pNewItem->SetWhich( pMap->nWID ); - rSet.Put( *pNewItem ); - } + if (pNewItem->PutValue(aValue, nMemberId)) + { + // Set new item in item set + pNewItem->SetWhich(pMap->nWID); + rSet.Put(*pNewItem); } } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index f1b48747669b..68858043cca3 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -1124,7 +1124,7 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf } if( bUnknownPropertyFound ) - return !bUnknownPropertyFound; + return false; if( nWID != 0 ) eItemState = pSet->GetItemState( nWID, false ); @@ -1145,7 +1145,7 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf rState = beans::PropertyState_AMBIGUOUS_VALUE; } } - return !bUnknownPropertyFound; + return true; } void SAL_CALL SvxUnoTextRangeBase::setPropertyToDefault( const OUString& PropertyName ) |