From 2c757293b819118780eef3a30bb4434528d38673 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 25 Jun 2012 12:50:46 +0100 Subject: reduce static_initialization_and_destruction chain Change-Id: I0c1b2f2d908c31d1510662880c13504d81445a6a --- unotools/source/config/bootstrap.cxx | 33 +-------------------------------- unotools/source/config/configitem.cxx | 3 +-- unotools/source/config/confignode.cxx | 11 +++-------- 3 files changed, 5 insertions(+), 42 deletions(-) (limited to 'unotools') diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index 07ae774c65cb..0130017cdab4 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -162,15 +162,6 @@ typedef Bootstrap::PathStatus PathStatus; sal_Unicode const cURLSeparator = '/'; -// --------------------------------------------------------------------------------------- -static -inline -OUString getURLSeparator() -{ - static OUString theSep(&cURLSeparator,1); - return theSep; -} - // --------------------------------------------------------------------------------------- // path status utility function static @@ -263,28 +254,7 @@ bool implEnsureAbsolute(OUString & _rsURL) // also strips embedded dots !! return false; } } -/* old code to strip embedded dots - static OUString const sDots(RTL_CONSTASCII_USTRINGPARAM("/..")); - - sal_Int32 nDotsIndex = _rsURL.indexOf(sDots); - while (nDotsIndex >= 0) - { - OSL_ASSERT(_rsURL.indexOf(sDots) == nDotsIndex); - - sal_Int32 nStripIndex = _rsURL.lastIndexOf(cURLSeparator,nDotsIndex); - if (nStripIndex < 0 || nStripIndex+1 == nDotsIndex) - { - OSL_TRACE("Invalid use of dots in bootstrap URL"); - return false; - } - _rsURL = _rsURL.copy(0,nStripIndex) + _rsURL.copy(nDotsIndex + sDots.getLength()); - - nDotsIndex = _rsURL.indexOf(sDots,nStripIndex); - } - return true; -} -*/ // --------------------------------------------------------------------------------------- static @@ -365,7 +335,6 @@ PathStatus getDerivedPath( ) { OUString sDerivedURL; - OSL_PRECOND(!_rData.getFrom(_sBootstrapParameter,sDerivedURL),"Setting for derived path is already defined"); OSL_PRECOND(!_sRelativeURL.isEmpty() && _sRelativeURL[0] != cURLSeparator,"Invalid Relative URL"); @@ -376,7 +345,7 @@ PathStatus getDerivedPath( { OSL_PRECOND(_aBaseURL[_aBaseURL.getLength()-1] != cURLSeparator,"Unexpected: base URL ends in slash"); - sDerivedURL = _aBaseURL + getURLSeparator() + _sRelativeURL; + sDerivedURL = rtl::OUStringBuffer(_aBaseURL).append(cURLSeparator).append(_sRelativeURL).makeStringAndClear(); // a derived (nested) URL can only exist or have a lesser status, if the parent exists if (aStatus == Bootstrap::PATH_EXISTS) diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 9c6f01eecb8f..168191e0ffc6 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -697,9 +697,8 @@ void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFormat _eF } else { - static const OUString sSetService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.SetAccess")); Reference xSVI(_xParentNode, UNO_QUERY); - if (xSVI.is() && xSVI->supportsService(sSetService)) + if (xSVI.is() && xSVI->supportsService("com.sun.star.configuration.SetAccess")) { OUString * pNames = _rNames.getArray(); for(int i = 0; i<_rNames.getLength(); ++i) diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 3c290d7ab88f..5f933e84a50a 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -488,19 +488,14 @@ namespace utl //======================================================================== namespace { - //-------------------------------------------------------------------- - static const ::rtl::OUString& lcl_getProviderServiceName( ) - { - static ::rtl::OUString s_sProviderServiceName( "com.sun.star.configuration.ConfigurationProvider" ); - return s_sProviderServiceName; - } + static const char s_sProviderServiceName[] = "com.sun.star.configuration.ConfigurationProvider"; //-------------------------------------------------------------------- Reference< XMultiServiceFactory > lcl_getConfigProvider( const ::comphelper::ComponentContext& i_rContext ) { try { - Reference< XMultiServiceFactory > xProvider( i_rContext.createComponent( lcl_getProviderServiceName() ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xProvider( i_rContext.createComponent(s_sProviderServiceName), UNO_QUERY_THROW ); return xProvider; } catch ( const Exception& ) @@ -614,7 +609,7 @@ namespace utl { try { - Reference< XMultiServiceFactory > xConfigFactory( _rxORB->createInstance( lcl_getProviderServiceName( ) ), UNO_QUERY ); + Reference< XMultiServiceFactory > xConfigFactory( _rxORB->createInstance(s_sProviderServiceName), UNO_QUERY ); if ( xConfigFactory.is() ) return createWithProvider( xConfigFactory, _rPath, _nDepth, _eMode, _bLazyWrite ); } -- cgit