summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-10-21 12:31:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-10-21 14:58:51 +0200
commit29489b33b435683021b72cb2bce27aba8cb7a430 (patch)
tree8e4e1c59d56d5ed0d0ca4d088419067041e4553a /unotools
parenta4244c0f05b95ded277a3a7ed217bf0451daa996 (diff)
loplugin:flatten
Change-Id: I3b4226a9d089ec9aedab95d96e50a068f57a76c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123991 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/historyoptions.cxx26
-rw-r--r--unotools/source/config/moduleoptions.cxx20
-rw-r--r--unotools/source/ucbhelper/tempfile.cxx26
3 files changed, 36 insertions, 36 deletions
diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx
index 62de1e70d1c4..c317aff79918 100644
--- a/unotools/source/config/historyoptions.cxx
+++ b/unotools/source/config/historyoptions.cxx
@@ -396,21 +396,21 @@ static void TruncateList(
xList->getByName(s_sItemList) >>= xItemList;
const sal_uInt32 nLength = xOrderList->getElementNames().getLength();
- if (nSize < nLength)
- {
- for (sal_uInt32 i=nLength-1; i>=nSize; --i)
- {
- uno::Reference<beans::XPropertySet> xSet;
- OUString sTmp;
- const OUString sRemove = OUString::number(i);
- xOrderList->getByName(sRemove) >>= xSet;
- xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp;
- xItemList->removeByName(sTmp);
- xOrderList->removeByName(sRemove);
- }
+ if (nSize >= nLength)
+ return;
- ::comphelper::ConfigurationHelper::flush(xCfg);
+ for (sal_uInt32 i=nLength-1; i>=nSize; --i)
+ {
+ uno::Reference<beans::XPropertySet> xSet;
+ OUString sTmp;
+ const OUString sRemove = OUString::number(i);
+ xOrderList->getByName(sRemove) >>= xSet;
+ xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp;
+ xItemList->removeByName(sTmp);
+ xOrderList->removeByName(sRemove);
}
+
+ ::comphelper::ConfigurationHelper::flush(xCfg);
}
diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx
index 35018b8b88c7..e73165ff4b18 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -781,18 +781,18 @@ SvtModuleOptions::SvtModuleOptions()
{
// no need to take the mutex yet, shared_ptr/weak_ptr are thread-safe
m_pImpl = g_pModuleOptions.lock();
+ if( m_pImpl )
+ return;
+
+ // take the mutex, so we don't accidentally create more than one
+ ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+
+ m_pImpl = g_pModuleOptions.lock();
if( !m_pImpl )
{
- // take the mutex, so we don't accidentally create more than one
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
-
- m_pImpl = g_pModuleOptions.lock();
- if( !m_pImpl )
- {
- m_pImpl = std::make_shared<SvtModuleOptions_Impl>();
- g_pModuleOptions = m_pImpl;
- ItemHolder1::holdConfigItem(EItem::ModuleOptions);
- }
+ m_pImpl = std::make_shared<SvtModuleOptions_Impl>();
+ g_pModuleOptions = m_pImpl;
+ ItemHolder1::holdConfigItem(EItem::ModuleOptions);
}
}
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index b53a56c60c02..22ce434b0e3e 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -385,20 +385,20 @@ TempFile::TempFile(TempFile && other) noexcept :
TempFile::~TempFile()
{
- if ( bKillingFileEnabled )
+ if ( !bKillingFileEnabled )
+ return;
+
+ // if we're going to delete this file, no point in flushing it when closing
+ if (pStream && !aName.isEmpty())
+ static_cast<SvFileStream*>(pStream.get())->SetDontFlushOnClose(true);
+ pStream.reset();
+ if ( bIsDirectory )
{
- // if we're going to delete this file, no point in flushing it when closing
- if (pStream && !aName.isEmpty())
- static_cast<SvFileStream*>(pStream.get())->SetDontFlushOnClose(true);
- pStream.reset();
- if ( bIsDirectory )
- {
- comphelper::DirectoryHelper::deleteDirRecursively(aName);
- }
- else
- {
- File::remove( aName );
- }
+ comphelper::DirectoryHelper::deleteDirRecursively(aName);
+ }
+ else
+ {
+ File::remove( aName );
}
}