diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-06-16 15:24:29 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-06-16 15:26:54 +0200 |
commit | ed8a2341b9631ad312ff40d23331c66d537aad20 (patch) | |
tree | d0958ffee6239ce97cb52c5a53ed1d63b82161a8 /unotools/source | |
parent | f04c48a7e764775bdd98715e5d17845f1786bd44 (diff) |
properly prefix various global variables and hide them
Change-Id: I6b97e6a4c6ac4c0e26bcbb2b132b333920c16f19
Diffstat (limited to 'unotools/source')
-rw-r--r-- | unotools/source/config/cmdoptions.cxx | 10 | ||||
-rw-r--r-- | unotools/source/config/defaultoptions.cxx | 10 | ||||
-rw-r--r-- | unotools/source/config/extendedsecurityoptions.cxx | 10 | ||||
-rw-r--r-- | unotools/source/config/fontoptions.cxx | 10 | ||||
-rw-r--r-- | unotools/source/config/historyoptions.cxx | 10 | ||||
-rw-r--r-- | unotools/source/config/localisationoptions.cxx | 10 | ||||
-rw-r--r-- | unotools/source/config/misccfg.cxx | 6 | ||||
-rw-r--r-- | unotools/source/config/pathoptions.cxx | 6 | ||||
-rw-r--r-- | unotools/source/config/printwarningoptions.cxx | 6 | ||||
-rw-r--r-- | unotools/source/config/securityoptions.cxx | 10 | ||||
-rw-r--r-- | unotools/source/misc/syslocale.cxx | 10 |
11 files changed, 65 insertions, 33 deletions
diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx index 0fb89bee6343..c79ba2ad4168 100644 --- a/unotools/source/config/cmdoptions.cxx +++ b/unotools/source/config/cmdoptions.cxx @@ -286,18 +286,22 @@ Sequence< OUString > SvtCommandOptions_Impl::impl_GetPropertyNames() return lDisabledItems; } -std::weak_ptr<SvtCommandOptions_Impl> m_pCommandOptions; +namespace { + +std::weak_ptr<SvtCommandOptions_Impl> g_pCommandOptions; + +} SvtCommandOptions::SvtCommandOptions() { // Global access, must be guarded (multithreading!). MutexGuard aGuard( GetOwnStaticMutex() ); - m_pImpl = m_pCommandOptions.lock(); + m_pImpl = g_pCommandOptions.lock(); if( !m_pImpl ) { m_pImpl = std::make_shared<SvtCommandOptions_Impl>(); - m_pCommandOptions = m_pImpl; + g_pCommandOptions = m_pImpl; ItemHolder1::holdConfigItem(E_CMDOPTIONS); } } diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx index 82c66b8112bc..0bcba50716bd 100644 --- a/unotools/source/config/defaultoptions.cxx +++ b/unotools/source/config/defaultoptions.cxx @@ -104,7 +104,11 @@ private: // global ---------------------------------------------------------------- -std::weak_ptr<SvtDefaultOptions_Impl> pOptions; +namespace { + +std::weak_ptr<SvtDefaultOptions_Impl> g_pOptions; + +} typedef OUString SvtDefaultOptions_Impl:: *PathStrPtr; @@ -326,11 +330,11 @@ SvtDefaultOptions::SvtDefaultOptions() { // Global access, must be guarded (multithreading) ::osl::MutexGuard aGuard( lclMutex::get() ); - pImpl = pOptions.lock(); + pImpl = g_pOptions.lock(); if ( !pImpl ) { pImpl = std::make_shared<SvtDefaultOptions_Impl>(); - pOptions = pImpl; + g_pOptions = pImpl; ItemHolder1::holdConfigItem(E_DEFAULTOPTIONS); } } diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx index 1fb58bdbe773..1037d586f83e 100644 --- a/unotools/source/config/extendedsecurityoptions.cxx +++ b/unotools/source/config/extendedsecurityoptions.cxx @@ -239,18 +239,22 @@ Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetPropertyNames() return seqPropertyNames; } -std::weak_ptr<SvtExtendedSecurityOptions_Impl> m_pExtendedSecurityOptions; +namespace { + +std::weak_ptr<SvtExtendedSecurityOptions_Impl> g_pExtendedSecurityOptions; + +} SvtExtendedSecurityOptions::SvtExtendedSecurityOptions() { // Global access, must be guarded (multithreading!). MutexGuard aGuard( GetInitMutex() ); - m_pImpl = m_pExtendedSecurityOptions.lock(); + m_pImpl = g_pExtendedSecurityOptions.lock(); if( !m_pImpl ) { m_pImpl = std::make_shared<SvtExtendedSecurityOptions_Impl>(); - m_pExtendedSecurityOptions = m_pImpl; + g_pExtendedSecurityOptions = m_pImpl; ItemHolder1::holdConfigItem(E_EXTENDEDSECURITYOPTIONS); } } diff --git a/unotools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx index 4aa7732e7135..61b9c54e9948 100644 --- a/unotools/source/config/fontoptions.cxx +++ b/unotools/source/config/fontoptions.cxx @@ -243,18 +243,22 @@ Sequence< OUString > SvtFontOptions_Impl::impl_GetPropertyNames() return seqPropertyNames; } -std::weak_ptr<SvtFontOptions_Impl> m_pFontOptions; +namespace { + +std::weak_ptr<SvtFontOptions_Impl> g_pFontOptions; + +} SvtFontOptions::SvtFontOptions() { // Global access, must be guarded (multithreading!). MutexGuard aGuard( impl_GetOwnStaticMutex() ); - m_pImpl = m_pFontOptions.lock(); + m_pImpl = g_pFontOptions.lock(); if( !m_pImpl ) { m_pImpl = std::make_shared<SvtFontOptions_Impl>(); - m_pFontOptions = m_pImpl; + g_pFontOptions = m_pImpl; ItemHolder1::holdConfigItem(E_FONTOPTIONS); } } diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx index 1cd25871da49..6dd84417ff7c 100644 --- a/unotools/source/config/historyoptions.cxx +++ b/unotools/source/config/historyoptions.cxx @@ -523,17 +523,21 @@ void SvtHistoryOptions_Impl::DeleteItem(EHistoryType eHistory, const OUString& s } } -std::weak_ptr<SvtHistoryOptions_Impl> m_pHistoryOptions; +namespace { + +std::weak_ptr<SvtHistoryOptions_Impl> g_pHistoryOptions; + +} SvtHistoryOptions::SvtHistoryOptions() { MutexGuard aGuard(theHistoryOptionsMutex::get()); - m_pImpl = m_pHistoryOptions.lock(); + m_pImpl = g_pHistoryOptions.lock(); if( !m_pImpl ) { m_pImpl = std::make_shared<SvtHistoryOptions_Impl>(); - m_pHistoryOptions = m_pImpl; + g_pHistoryOptions = m_pImpl; ItemHolder1::holdConfigItem(E_HISTORYOPTIONS); } } diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx index 87ceaedf172e..6716a034820c 100644 --- a/unotools/source/config/localisationoptions.cxx +++ b/unotools/source/config/localisationoptions.cxx @@ -218,18 +218,22 @@ Sequence< OUString > SvtLocalisationOptions_Impl::GetPropertyNames() return seqPropertyNames; } -std::weak_ptr<SvtLocalisationOptions_Impl> m_pLocalisationOptions; +namespace { + +std::weak_ptr<SvtLocalisationOptions_Impl> g_pLocalisationOptions; + +} SvtLocalisationOptions::SvtLocalisationOptions() { // Global access, must be guarded (multithreading!). MutexGuard aGuard( GetOwnStaticMutex() ); - m_pImpl = m_pLocalisationOptions.lock(); + m_pImpl = g_pLocalisationOptions.lock(); if( !m_pImpl ) { m_pImpl = std::make_shared<SvtLocalisationOptions_Impl>(); - m_pLocalisationOptions = m_pImpl; + g_pLocalisationOptions = m_pImpl; ItemHolder1::holdConfigItem(E_LOCALISATIONOPTIONS); } } diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx index 094945b0a60d..d50542c2fe69 100644 --- a/unotools/source/config/misccfg.cxx +++ b/unotools/source/config/misccfg.cxx @@ -33,7 +33,7 @@ namespace utl { class SfxMiscCfg; -std::weak_ptr<SfxMiscCfg> m_pOptions; +std::weak_ptr<SfxMiscCfg> g_pOptions; class SfxMiscCfg : public utl::ConfigItem { @@ -186,11 +186,11 @@ MiscCfg::MiscCfg( ) { // Global access, must be guarded (multithreading) ::osl::MutexGuard aGuard( LocalSingleton::get() ); - m_pImpl = m_pOptions.lock(); + m_pImpl = g_pOptions.lock(); if ( !m_pImpl ) { m_pImpl = std::make_shared<SfxMiscCfg>(); - m_pOptions = m_pImpl; + g_pOptions = m_pImpl; ItemHolder1::holdConfigItem(E_MISCCFG); } diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index 28632caba4c4..d5963e76c107 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -162,7 +162,7 @@ class SvtPathOptions_Impl // global ---------------------------------------------------------------- -static std::weak_ptr<SvtPathOptions_Impl> pOptions; +static std::weak_ptr<SvtPathOptions_Impl> g_pOptions; // functions ------------------------------------------------------------- struct PropertyStruct @@ -446,11 +446,11 @@ SvtPathOptions::SvtPathOptions() { // Global access, must be guarded (multithreading) ::osl::MutexGuard aGuard( lclMutex::get() ); - pImpl = pOptions.lock(); + pImpl = g_pOptions.lock(); if ( !pImpl ) { pImpl = std::make_shared<SvtPathOptions_Impl>(); - pOptions = pImpl; + g_pOptions = pImpl; ItemHolder1::holdConfigItem(E_PATHOPTIONS); } } diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx index 42b1059759eb..e325f63b92c5 100644 --- a/unotools/source/config/printwarningoptions.cxx +++ b/unotools/source/config/printwarningoptions.cxx @@ -221,18 +221,18 @@ Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames() return seqPropertyNames; } -std::weak_ptr<SvtPrintWarningOptions_Impl> m_pPrintWarningOptions; +std::weak_ptr<SvtPrintWarningOptions_Impl> g_pPrintWarningOptions; SvtPrintWarningOptions::SvtPrintWarningOptions() { // Global access, must be guarded (multithreading!). MutexGuard aGuard( GetOwnStaticMutex() ); - m_pImpl = m_pPrintWarningOptions.lock(); + m_pImpl = g_pPrintWarningOptions.lock(); if( !m_pImpl ) { m_pImpl = std::make_shared<SvtPrintWarningOptions_Impl>(); - m_pPrintWarningOptions = m_pImpl; + g_pPrintWarningOptions = m_pImpl; ItemHolder1::holdConfigItem(E_PRINTWARNINGOPTIONS); } } diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index d89ba665646f..af8be604c5e1 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -930,18 +930,22 @@ Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames() return seqPropertyNames; } -std::weak_ptr<SvtSecurityOptions_Impl> m_pSecurityOptions; +namespace { + +std::weak_ptr<SvtSecurityOptions_Impl> g_pSecurityOptions; + +} SvtSecurityOptions::SvtSecurityOptions() { // Global access, must be guarded (multithreading!). MutexGuard aGuard( GetInitMutex() ); - m_pImpl = m_pSecurityOptions.lock(); + m_pImpl = g_pSecurityOptions.lock(); if( !m_pImpl ) { m_pImpl = std::make_shared<SvtSecurityOptions_Impl>(); - m_pSecurityOptions = m_pImpl; + g_pSecurityOptions = m_pImpl; ItemHolder1::holdConfigItem(E_SECURITYOPTIONS); } diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx index b0cef62e7ee9..b212100a6b06 100644 --- a/unotools/source/misc/syslocale.cxx +++ b/unotools/source/misc/syslocale.cxx @@ -34,7 +34,11 @@ using namespace osl; using namespace com::sun::star; -std::weak_ptr<SvtSysLocale_Impl> pSysLocale; +namespace { + +std::weak_ptr<SvtSysLocale_Impl> g_pSysLocale; + +} class SvtSysLocale_Impl : public utl::ConfigurationListener { @@ -113,11 +117,11 @@ void SvtSysLocale_Impl::setDateAcceptancePatternsConfig() SvtSysLocale::SvtSysLocale() { MutexGuard aGuard( GetMutex() ); - pImpl = pSysLocale.lock(); + pImpl = g_pSysLocale.lock(); if ( !pImpl ) { pImpl = std::make_shared<SvtSysLocale_Impl>(); - pSysLocale = pImpl; + g_pSysLocale = pImpl; } } |