include/xmloff/xmlnumfe.hxx | 4 svl/source/config/cjkoptions.cxx | 34 +++---- svl/source/items/itempool.cxx | 30 +++--- svl/source/items/srchitem.cxx | 74 +++++++-------- svl/source/items/style.cxx | 52 +++++----- svl/source/misc/inethist.cxx | 26 ++--- svl/source/misc/sharecontrolfile.cxx | 34 +++---- svl/source/misc/strmadpt.cxx | 68 +++++++------- svl/source/numbers/zforlist.cxx | 34 +++---- svl/source/numbers/zformat.cxx | 94 +++++++++---------- svl/source/passwordcontainer/passwordcontainer.cxx | 102 ++++++++++----------- xmloff/source/style/xmlnumfe.cxx | 26 ++--- 12 files changed, 289 insertions(+), 289 deletions(-)
New commits: commit 6a579702b1128372aa30c86156996e57ba73b2c8 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Jan 24 10:51:30 2018 +0200 loplugin:flatten in svl Change-Id: Id5c62c00aa8349468c0d547616424b2637533e7f Reviewed-on: https://gerrit.libreoffice.org/48485 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index 405e8b93eb7c..58c9e0090626 100644 --- a/svl/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -116,7 +116,7 @@ SvtCJKOptions_Impl::SvtCJKOptions_Impl() : void SvtCJKOptions_Impl::SetAll(bool bSet) { if ( - !bROCJKFont && + !(!bROCJKFont && !bROVerticalText && !bROAsianTypography && !bROJapaneseFind && @@ -124,23 +124,23 @@ void SvtCJKOptions_Impl::SetAll(bool bSet) !bROChangeCaseMap && !bRODoubleLines && !bROEmphasisMarks && - !bROVerticalCallOut + !bROVerticalCallOut) ) - { - bCJKFont=bSet; - bVerticalText=bSet; - bAsianTypography=bSet; - bJapaneseFind=bSet; - bRuby=bSet; - bChangeCaseMap=bSet; - bDoubleLines=bSet; - bEmphasisMarks=bSet; - bVerticalCallOut=bSet; - - SetModified(); - Commit(); - NotifyListeners(ConfigurationHints::NONE); - } + return; + + bCJKFont=bSet; + bVerticalText=bSet; + bAsianTypography=bSet; + bJapaneseFind=bSet; + bRuby=bSet; + bChangeCaseMap=bSet; + bDoubleLines=bSet; + bEmphasisMarks=bSet; + bVerticalCallOut=bSet; + + SetModified(); + Commit(); + NotifyListeners(ConfigurationHints::NONE); } void SvtCJKOptions_Impl::Load() diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 4357342dd499..3abc22b96003 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -344,24 +344,24 @@ SfxItemPool::~SfxItemPool() void SfxItemPool::Free(SfxItemPool* pPool) { - if(pPool) + if(!pPool) + return; + + // tell all the registered SfxItemPoolUsers that the pool is in destruction + std::vector<SfxItemPoolUser*> aListCopy(pPool->pImpl->maSfxItemPoolUsers.begin(), pPool->pImpl->maSfxItemPoolUsers.end()); + for(std::vector<SfxItemPoolUser*>::const_iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); ++aIterator) { - // tell all the registered SfxItemPoolUsers that the pool is in destruction - std::vector<SfxItemPoolUser*> aListCopy(pPool->pImpl->maSfxItemPoolUsers.begin(), pPool->pImpl->maSfxItemPoolUsers.end()); - for(std::vector<SfxItemPoolUser*>::const_iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); ++aIterator) - { - SfxItemPoolUser* pSfxItemPoolUser = *aIterator; - DBG_ASSERT(pSfxItemPoolUser, "corrupt SfxItemPoolUser list (!)"); - pSfxItemPoolUser->ObjectInDestruction(*pPool); - } + SfxItemPoolUser* pSfxItemPoolUser = *aIterator; + DBG_ASSERT(pSfxItemPoolUser, "corrupt SfxItemPoolUser list (!)"); + pSfxItemPoolUser->ObjectInDestruction(*pPool); + } - // Clear the vector. This means that user do not need to call RemoveSfxItemPoolUser() - // when they get called from ObjectInDestruction(). - pPool->pImpl->maSfxItemPoolUsers.clear(); + // Clear the vector. This means that user do not need to call RemoveSfxItemPoolUser() + // when they get called from ObjectInDestruction(). + pPool->pImpl->maSfxItemPoolUsers.clear(); - // delete pool - delete pPool; - } + // delete pool + delete pPool; } diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index 86e93f1c8bbe..945ecc1aeded 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -163,43 +163,43 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : rFlags |= TransliterationFlags::IGNORE_DIACRITICS_CTL ; if ( aOpt.IsIgnoreKashida_CTL()) rFlags |= TransliterationFlags::IGNORE_KASHIDA_CTL ; - if ( m_bAsianOptions ) - { - if ( aOpt.IsMatchHiraganaKatakana()) - rFlags |= TransliterationFlags::IGNORE_KANA; - if ( aOpt.IsMatchContractions()) - rFlags |= TransliterationFlags::ignoreSize_ja_JP; - if ( aOpt.IsMatchMinusDashChoon()) - rFlags |= TransliterationFlags::ignoreMinusSign_ja_JP; - if ( aOpt.IsMatchRepeatCharMarks()) - rFlags |= TransliterationFlags::ignoreIterationMark_ja_JP; - if ( aOpt.IsMatchVariantFormKanji()) - rFlags |= TransliterationFlags::ignoreTraditionalKanji_ja_JP; - if ( aOpt.IsMatchOldKanaForms()) - rFlags |= TransliterationFlags::ignoreTraditionalKana_ja_JP; - if ( aOpt.IsMatchDiziDuzu()) - rFlags |= TransliterationFlags::ignoreZiZu_ja_JP; - if ( aOpt.IsMatchBavaHafa()) - rFlags |= TransliterationFlags::ignoreBaFa_ja_JP; - if ( aOpt.IsMatchTsithichiDhizi()) - rFlags |= TransliterationFlags::ignoreTiJi_ja_JP; - if ( aOpt.IsMatchHyuiyuByuvyu()) - rFlags |= TransliterationFlags::ignoreHyuByu_ja_JP; - if ( aOpt.IsMatchSesheZeje()) - rFlags |= TransliterationFlags::ignoreSeZe_ja_JP; - if ( aOpt.IsMatchIaiya()) - rFlags |= TransliterationFlags::ignoreIandEfollowedByYa_ja_JP; - if ( aOpt.IsMatchKiku()) - rFlags |= TransliterationFlags::ignoreKiKuFollowedBySa_ja_JP; - if ( aOpt.IsIgnorePunctuation()) - rFlags |= TransliterationFlags::ignoreSeparator_ja_JP; - if ( aOpt.IsIgnoreWhitespace()) - rFlags |= TransliterationFlags::ignoreSpace_ja_JP; - if ( aOpt.IsIgnoreProlongedSoundMark()) - rFlags |= TransliterationFlags::ignoreProlongedSoundMark_ja_JP; - if ( aOpt.IsIgnoreMiddleDot()) - rFlags |= TransliterationFlags::ignoreMiddleDot_ja_JP; - } + if ( !m_bAsianOptions ) + return; + + if ( aOpt.IsMatchHiraganaKatakana()) + rFlags |= TransliterationFlags::IGNORE_KANA; + if ( aOpt.IsMatchContractions()) + rFlags |= TransliterationFlags::ignoreSize_ja_JP; + if ( aOpt.IsMatchMinusDashChoon()) + rFlags |= TransliterationFlags::ignoreMinusSign_ja_JP; + if ( aOpt.IsMatchRepeatCharMarks()) + rFlags |= TransliterationFlags::ignoreIterationMark_ja_JP; + if ( aOpt.IsMatchVariantFormKanji()) + rFlags |= TransliterationFlags::ignoreTraditionalKanji_ja_JP; + if ( aOpt.IsMatchOldKanaForms()) + rFlags |= TransliterationFlags::ignoreTraditionalKana_ja_JP; + if ( aOpt.IsMatchDiziDuzu()) + rFlags |= TransliterationFlags::ignoreZiZu_ja_JP; + if ( aOpt.IsMatchBavaHafa()) + rFlags |= TransliterationFlags::ignoreBaFa_ja_JP; + if ( aOpt.IsMatchTsithichiDhizi()) + rFlags |= TransliterationFlags::ignoreTiJi_ja_JP; + if ( aOpt.IsMatchHyuiyuByuvyu()) + rFlags |= TransliterationFlags::ignoreHyuByu_ja_JP; + if ( aOpt.IsMatchSesheZeje()) + rFlags |= TransliterationFlags::ignoreSeZe_ja_JP; + if ( aOpt.IsMatchIaiya()) + rFlags |= TransliterationFlags::ignoreIandEfollowedByYa_ja_JP; + if ( aOpt.IsMatchKiku()) + rFlags |= TransliterationFlags::ignoreKiKuFollowedBySa_ja_JP; + if ( aOpt.IsIgnorePunctuation()) + rFlags |= TransliterationFlags::ignoreSeparator_ja_JP; + if ( aOpt.IsIgnoreWhitespace()) + rFlags |= TransliterationFlags::ignoreSpace_ja_JP; + if ( aOpt.IsIgnoreProlongedSoundMark()) + rFlags |= TransliterationFlags::ignoreProlongedSoundMark_ja_JP; + if ( aOpt.IsIgnoreMiddleDot()) + rFlags |= TransliterationFlags::ignoreMiddleDot_ja_JP; } diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 9d3692b9b987..2e43e1f8a3a7 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -736,32 +736,32 @@ SfxStyleSheetBase* SfxStyleSheetBasePool::Next() void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p ) { - if( p ) - { - // Reference to keep p alive until after Broadcast call! - rtl::Reference<SfxStyleSheetBase> xP(p); - bool bWasRemoved = pImpl->mxIndexedStyleSheets->RemoveStyleSheet(xP); - if( bWasRemoved ) - { - // Adapt all styles which have this style as parant - ChangeParent( p->GetName(), p->GetParent() ); - - // #120015# Do not dispose, the removed StyleSheet may still be used in - // existing SdrUndoAttrObj incarnations. Rely on refcounting for disposal, - // this works well under normal conditions (checked breaking and counting - // on SfxStyleSheetBase constructors and destructors) - - // css::uno::Reference< css::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), css::uno::UNO_QUERY ); - // if( xComp.is() ) try - // { - // xComp->dispose(); - // } - // catch( css::uno::Exception& ) - // { - // } - Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetErased, *p ) ); - } - } + if( !p ) + return; + + // Reference to keep p alive until after Broadcast call! + rtl::Reference<SfxStyleSheetBase> xP(p); + bool bWasRemoved = pImpl->mxIndexedStyleSheets->RemoveStyleSheet(xP); + if( !bWasRemoved ) + return; + + // Adapt all styles which have this style as parant + ChangeParent( p->GetName(), p->GetParent() ); + + // #120015# Do not dispose, the removed StyleSheet may still be used in + // existing SdrUndoAttrObj incarnations. Rely on refcounting for disposal, + // this works well under normal conditions (checked breaking and counting + // on SfxStyleSheetBase constructors and destructors) + + // css::uno::Reference< css::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), css::uno::UNO_QUERY ); + // if( xComp.is() ) try + // { + // xComp->dispose(); + // } + // catch( css::uno::Exception& ) + // { + // } + Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetErased, *p ) ); } void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p ) diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx index 46d298acf310..c4d5daeea374 100644 --- a/svl/source/misc/inethist.cxx +++ b/svl/source/misc/inethist.cxx @@ -355,22 +355,22 @@ void INetURLHistory::NormalizeUrl_Impl (INetURLObject &rUrl) void INetURLHistory::PutUrl_Impl (const INetURLObject &rUrl) { DBG_ASSERT (m_pImpl, "PutUrl_Impl(): no Implementation"); - if (m_pImpl) - { - INetURLObject aHistUrl (rUrl); - NormalizeUrl_Impl (aHistUrl); + if (!m_pImpl) + return; - m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE)); - Broadcast (INetURLHistoryHint (&rUrl)); + INetURLObject aHistUrl (rUrl); + NormalizeUrl_Impl (aHistUrl); - if (aHistUrl.HasMark()) - { - aHistUrl.SetURL (aHistUrl.GetURLNoMark(INetURLObject::DecodeMechanism::NONE), - INetURLObject::EncodeMechanism::NotCanonical); + m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE)); + Broadcast (INetURLHistoryHint (&rUrl)); - m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE)); - Broadcast (INetURLHistoryHint (&aHistUrl)); - } + if (aHistUrl.HasMark()) + { + aHistUrl.SetURL (aHistUrl.GetURLNoMark(INetURLObject::DecodeMechanism::NONE), + INetURLObject::EncodeMechanism::NotCanonical); + + m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE)); + Broadcast (INetURLHistoryHint (&aHistUrl)); } } diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index fbae7224497a..d9ef69f9844e 100644 --- a/svl/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -123,25 +123,25 @@ void ShareControlFile::Close() { // if it is called outside of destructor the mutex must be locked - if ( m_xStream.is() ) + if ( !m_xStream.is() ) + return; + + try { - try - { - if ( m_xInputStream.is() ) - m_xInputStream->closeInput(); - if ( m_xOutputStream.is() ) - m_xOutputStream->closeOutput(); - } - catch( uno::Exception& ) - {} - - m_xStream.clear(); - m_xInputStream.clear(); - m_xOutputStream.clear(); - m_xSeekable.clear(); - m_xTruncate.clear(); - m_aUsersData.clear(); + if ( m_xInputStream.is() ) + m_xInputStream->closeInput(); + if ( m_xOutputStream.is() ) + m_xOutputStream->closeOutput(); } + catch( uno::Exception& ) + {} + + m_xStream.clear(); + m_xInputStream.clear(); + m_xOutputStream.clear(); + m_xSeekable.clear(); + m_xTruncate.clear(); + m_aUsersData.clear(); } diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index cb5852865c88..07e9b62fe310 100644 --- a/svl/source/misc/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -570,45 +570,47 @@ void SvDataPipe_Impl::write(sal_Int8 const * pBuffer, sal_uInt32 nSize) } } - if (nRemain > 0) - for (;;) - { - sal_uInt32 nBlock - = std::min(sal_uInt32(m_pWritePage->m_aBuffer + m_nPageSize - - m_pWritePage->m_pEnd), - nRemain); - memcpy(m_pWritePage->m_pEnd, pBuffer, nBlock); - m_pWritePage->m_pEnd += nBlock; - pBuffer += nBlock; - nRemain -= nBlock; + if (nRemain <= 0) + return; - if (nRemain == 0) - break; + for (;;) + { + sal_uInt32 nBlock + = std::min(sal_uInt32(m_pWritePage->m_aBuffer + m_nPageSize + - m_pWritePage->m_pEnd), + nRemain); + memcpy(m_pWritePage->m_pEnd, pBuffer, nBlock); + m_pWritePage->m_pEnd += nBlock; + pBuffer += nBlock; + nRemain -= nBlock; - if (m_pWritePage->m_pNext == m_pFirstPage) - { - if (m_nPages == std::numeric_limits< sal_uInt32 >::max()) - break; + if (nRemain == 0) + break; - Page * pNew - = static_cast< Page * >(rtl_allocateMemory( - sizeof (Page) + m_nPageSize - - 1)); - pNew->m_pPrev = m_pWritePage; - pNew->m_pNext = m_pWritePage->m_pNext; + if (m_pWritePage->m_pNext == m_pFirstPage) + { + if (m_nPages == std::numeric_limits< sal_uInt32 >::max()) + break; - m_pWritePage->m_pNext->m_pPrev = pNew; - m_pWritePage->m_pNext = pNew; - ++m_nPages; - } + Page * pNew + = static_cast< Page * >(rtl_allocateMemory( + sizeof (Page) + m_nPageSize + - 1)); + pNew->m_pPrev = m_pWritePage; + pNew->m_pNext = m_pWritePage->m_pNext; - m_pWritePage->m_pNext->m_nOffset = m_pWritePage->m_nOffset - + m_nPageSize; - m_pWritePage = m_pWritePage->m_pNext; - m_pWritePage->m_pStart = m_pWritePage->m_aBuffer; - m_pWritePage->m_pRead = m_pWritePage->m_aBuffer; - m_pWritePage->m_pEnd = m_pWritePage->m_aBuffer; + m_pWritePage->m_pNext->m_pPrev = pNew; + m_pWritePage->m_pNext = pNew; + ++m_nPages; } + + m_pWritePage->m_pNext->m_nOffset = m_pWritePage->m_nOffset + + m_nPageSize; + m_pWritePage = m_pWritePage->m_pNext; + m_pWritePage->m_pStart = m_pWritePage->m_aBuffer; + m_pWritePage->m_pRead = m_pWritePage->m_aBuffer; + m_pWritePage->m_pEnd = m_pWritePage->m_aBuffer; + } } SvDataPipe_Impl::SeekResult SvDataPipe_Impl::setReadPosition(sal_uInt32 diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index c9ae9e373b94..c22807fc9cd4 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -323,26 +323,26 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang ) void SvNumberFormatter::ChangeIntl(LanguageType eLnge) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); - if (ActLnge != eLnge) - { - ActLnge = eLnge; + if (ActLnge == eLnge) + return; - maLanguageTag.reset( eLnge ); - pCharClass->setLanguageTag( maLanguageTag ); - xLocaleData.changeLocale( maLanguageTag ); - xCalendar.changeLocale( maLanguageTag.getLocale() ); - xTransliteration.changeLocale( eLnge ); + ActLnge = eLnge; - // cached locale data items, initialize BEFORE calling ChangeIntl below - const LocaleDataWrapper* pLoc = GetLocaleData(); - aDecimalSep = pLoc->getNumDecimalSep(); - aDecimalSepAlt = pLoc->getNumDecimalSepAlt(); - aThousandSep = pLoc->getNumThousandSep(); - aDateSep = pLoc->getDateSep(); + maLanguageTag.reset( eLnge ); + pCharClass->setLanguageTag( maLanguageTag ); + xLocaleData.changeLocale( maLanguageTag ); + xCalendar.changeLocale( maLanguageTag.getLocale() ); + xTransliteration.changeLocale( eLnge ); - pFormatScanner->ChangeIntl(); - pStringScanner->ChangeIntl(); - } + // cached locale data items, initialize BEFORE calling ChangeIntl below + const LocaleDataWrapper* pLoc = GetLocaleData(); + aDecimalSep = pLoc->getNumDecimalSep(); + aDecimalSepAlt = pLoc->getNumDecimalSepAlt(); + aThousandSep = pLoc->getNumThousandSep(); + aDateSep = pLoc->getDateSep(); + + pFormatScanner->ChangeIntl(); + pStringScanner->ChangeIntl(); } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 20aa5eb1d3b3..2223e151e521 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -3258,28 +3258,28 @@ void SvNumberformat::SwitchToOtherCalendar( OUString& rOrgCalendar, double& fOrgDateTime ) const { CalendarWrapper& rCal = GetCal(); - if ( rCal.getUniqueID() == GREGORIAN ) + if ( rCal.getUniqueID() != GREGORIAN ) + return; + + using namespace ::com::sun::star::i18n; + css::uno::Sequence< OUString > xCals = rCal.getAllCalendars( + rLoc().getLanguageTag().getLocale() ); + sal_Int32 nCnt = xCals.getLength(); + if ( nCnt <= 1 ) + return; + + for ( sal_Int32 j=0; j < nCnt; j++ ) { - using namespace ::com::sun::star::i18n; - css::uno::Sequence< OUString > xCals = rCal.getAllCalendars( - rLoc().getLanguageTag().getLocale() ); - sal_Int32 nCnt = xCals.getLength(); - if ( nCnt > 1 ) + if ( xCals[j] != GREGORIAN ) { - for ( sal_Int32 j=0; j < nCnt; j++ ) + if ( !rOrgCalendar.getLength() ) { - if ( xCals[j] != GREGORIAN ) - { - if ( !rOrgCalendar.getLength() ) - { - rOrgCalendar = rCal.getUniqueID(); - fOrgDateTime = rCal.getDateTime(); - } - rCal.loadCalendar( xCals[j], rLoc().getLanguageTag().getLocale() ); - rCal.setDateTime( fOrgDateTime ); - break; // for - } + rOrgCalendar = rCal.getUniqueID(); + fOrgDateTime = rCal.getDateTime(); } + rCal.loadCalendar( xCals[j], rLoc().getLanguageTag().getLocale() ); + rCal.setDateTime( fOrgDateTime ); + break; // for } } } @@ -4881,37 +4881,37 @@ static void lcl_SvNumberformat_AddLimitStringImpl( OUString& rStr, SvNumberformatLimitOps eOp, double fLimit, const OUString& rDecSep ) { - if ( eOp != NUMBERFORMAT_OP_NO ) + if ( eOp == NUMBERFORMAT_OP_NO ) + return; + + switch ( eOp ) { - switch ( eOp ) - { - case NUMBERFORMAT_OP_EQ : - rStr = "[="; - break; - case NUMBERFORMAT_OP_NE : - rStr = "[<>"; - break; - case NUMBERFORMAT_OP_LT : - rStr = "[<"; - break; - case NUMBERFORMAT_OP_LE : - rStr = "[<="; - break; - case NUMBERFORMAT_OP_GT : - rStr = "[>"; - break; - case NUMBERFORMAT_OP_GE : - rStr = "[>="; - break; - default: - SAL_WARN( "svl.numbers", "unsupported number format" ); - break; - } - rStr += ::rtl::math::doubleToUString( fLimit, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - rDecSep[0], true); - rStr += "]"; + case NUMBERFORMAT_OP_EQ : + rStr = "[="; + break; + case NUMBERFORMAT_OP_NE : + rStr = "[<>"; + break; + case NUMBERFORMAT_OP_LT : + rStr = "[<"; + break; + case NUMBERFORMAT_OP_LE : + rStr = "[<="; + break; + case NUMBERFORMAT_OP_GT : + rStr = "[>"; + break; + case NUMBERFORMAT_OP_GE : + rStr = "[>="; + break; + default: + SAL_WARN( "svl.numbers", "unsupported number format" ); + break; } + rStr += ::rtl::math::doubleToUString( fLimit, + rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, + rDecSep[0], true); + rStr += "]"; } void lcl_insertLCID( OUStringBuffer& rFormatStr, sal_uInt32 nLCID, sal_Int32 nPosInsertLCID ) diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 4e04fd1071e5..6becfd9be78d 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -867,38 +867,38 @@ void SAL_CALL PasswordContainer::remove( const OUString& aURL, const OUString& a ::osl::MutexGuard aGuard( mMutex ); OUString aUrl( aURL ); - if( !m_aContainer.empty() ) + if( m_aContainer.empty() ) + return; + + PassMap::iterator aIter = m_aContainer.find( aUrl ); + + if( aIter == m_aContainer.end() ) { - PassMap::iterator aIter = m_aContainer.find( aUrl ); + if( aUrl.endsWith("/") ) + aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); + else + aUrl += "/"; - if( aIter == m_aContainer.end() ) - { - if( aUrl.endsWith("/") ) - aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); - else - aUrl += "/"; + aIter = m_aContainer.find( aUrl ); + } - aIter = m_aContainer.find( aUrl ); - } + if( aIter == m_aContainer.end() ) + return; - if( aIter != m_aContainer.end() ) + for( std::vector< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter ) + if( aNPIter->GetUserName() == aName ) { - for( std::vector< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter ) - if( aNPIter->GetUserName() == aName ) - { - if( aNPIter->HasPasswords( PERSISTENT_RECORD ) && m_pStorageFile ) - m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) + if( aNPIter->HasPasswords( PERSISTENT_RECORD ) && m_pStorageFile ) + m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) - // the iterator will not be used any more so it can be removed directly - aIter->second.erase( aNPIter ); + // the iterator will not be used any more so it can be removed directly + aIter->second.erase( aNPIter ); - if( aIter->second.empty() ) - m_aContainer.erase( aIter ); + if( aIter->second.empty() ) + m_aContainer.erase( aIter ); - return; - } + return; } - } } @@ -907,44 +907,44 @@ void SAL_CALL PasswordContainer::removePersistent( const OUString& aURL, const O ::osl::MutexGuard aGuard( mMutex ); OUString aUrl( aURL ); - if( !m_aContainer.empty() ) + if( m_aContainer.empty() ) + return; + + PassMap::iterator aIter = m_aContainer.find( aUrl ); + + if( aIter == m_aContainer.end() ) { - PassMap::iterator aIter = m_aContainer.find( aUrl ); + if( aUrl.endsWith("/") ) + aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); + else + aUrl += "/"; - if( aIter == m_aContainer.end() ) - { - if( aUrl.endsWith("/") ) - aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); - else - aUrl += "/"; + aIter = m_aContainer.find( aUrl ); + } - aIter = m_aContainer.find( aUrl ); - } + if( aIter == m_aContainer.end() ) + return; - if( aIter != m_aContainer.end() ) + for( std::vector< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter ) + if( aNPIter->GetUserName() == aName ) { - for( std::vector< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter ) - if( aNPIter->GetUserName() == aName ) - { - if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) - { - // TODO/LATER: should the password be converted to MemoryPassword? - aNPIter->RemovePasswords( PERSISTENT_RECORD ); + if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) + { + // TODO/LATER: should the password be converted to MemoryPassword? + aNPIter->RemovePasswords( PERSISTENT_RECORD ); - if ( m_pStorageFile ) - m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) - } + if ( m_pStorageFile ) + m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) + } - if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) - aIter->second.erase( aNPIter ); + if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) + aIter->second.erase( aNPIter ); - if( aIter->second.empty() ) - m_aContainer.erase( aIter ); + if( aIter->second.empty() ) + m_aContainer.erase( aIter ); - return; - } + return; } - } } void SAL_CALL PasswordContainer::removeAllPersistent() commit fe4de616a4a7cc1d5a2ab701e84477f73a47c61a Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Jan 17 17:01:45 2018 +0200 loplugin:useuniqueptr in SvXMLNumFmtExport Change-Id: I720450a4bee17673907fba2e9a34879d2a98bcae Reviewed-on: https://gerrit.libreoffice.org/48481 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx index 79df5c853f5d..75c3b133c036 100644 --- a/include/xmloff/xmlnumfe.hxx +++ b/include/xmloff/xmlnumfe.hxx @@ -52,8 +52,8 @@ private: SvNumberFormatter* pFormatter; OUStringBuffer sTextContent; std::unique_ptr<SvXMLNumUsedList_Impl> pUsedList; - CharClass* pCharClass; - LocaleDataWrapper* pLocaleData; + std::unique_ptr<CharClass> pCharClass; + std::unique_ptr<LocaleDataWrapper> pLocaleData; SAL_DLLPRIVATE void AddCalendarAttr_Impl( const OUString& rCalendar ); SAL_DLLPRIVATE void AddStyleAttr_Impl( bool bLong ); diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 1fd79f01be4e..cc7dc555a106 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -229,17 +229,17 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( if ( pFormatter ) { - pCharClass = new CharClass( pFormatter->GetComponentContext(), - pFormatter->GetLanguageTag() ); - pLocaleData = new LocaleDataWrapper( pFormatter->GetComponentContext(), - pFormatter->GetLanguageTag() ); + pCharClass.reset( new CharClass( pFormatter->GetComponentContext(), + pFormatter->GetLanguageTag() ) ); + pLocaleData.reset( new LocaleDataWrapper( pFormatter->GetComponentContext(), + pFormatter->GetLanguageTag() ) ); } else { LanguageTag aLanguageTag( MsLangId::getSystemLanguage() ); - pCharClass = new CharClass( rExport.getComponentContext(), aLanguageTag ); - pLocaleData = new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ); + pCharClass.reset( new CharClass( rExport.getComponentContext(), aLanguageTag ) ); + pLocaleData.reset( new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ) ); } pUsedList.reset(new SvXMLNumUsedList_Impl); @@ -263,17 +263,17 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( if ( pFormatter ) { - pCharClass = new CharClass( pFormatter->GetComponentContext(), - pFormatter->GetLanguageTag() ); - pLocaleData = new LocaleDataWrapper( pFormatter->GetComponentContext(), - pFormatter->GetLanguageTag() ); + pCharClass.reset( new CharClass( pFormatter->GetComponentContext(), + pFormatter->GetLanguageTag() ) ); + pLocaleData.reset( new LocaleDataWrapper( pFormatter->GetComponentContext(), + pFormatter->GetLanguageTag() ) ); } else { LanguageTag aLanguageTag( MsLangId::getSystemLanguage() ); - pCharClass = new CharClass( rExport.getComponentContext(), aLanguageTag ); - pLocaleData = new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ); + pCharClass.reset( new CharClass( rExport.getComponentContext(), aLanguageTag ) ); + pLocaleData.reset( new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ) ); } pUsedList.reset(new SvXMLNumUsedList_Impl); @@ -281,8 +281,6 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( SvXMLNumFmtExport::~SvXMLNumFmtExport() { - delete pLocaleData; - delete pCharClass; } // helper methods _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits