reduce static_initialization_and_destruction chain

Change-Id: Ib2642e19d9148acca27227b0d91de4e8855178aa
This commit is contained in:
Caolán McNamara
2012-05-16 23:54:14 +01:00
parent 1d0f8a1bfb
commit 0e9c60d596
3 changed files with 11 additions and 21 deletions

View File

@@ -45,28 +45,19 @@ const sal_Unicode Locale::SEPERATOR_CV_LINUX = (sal_Unicode)'.';
//----------------------------------------------- //-----------------------------------------------
const Locale Locale::X_DEFAULT() const Locale Locale::X_DEFAULT()
{ {
static Locale aLocale( return Locale(::rtl::OUString("x"), ::rtl::OUString("default"));
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x")),
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default")));
return aLocale;
} }
//----------------------------------------------- //-----------------------------------------------
const Locale Locale::EN_US() const Locale Locale::EN_US()
{ {
static Locale aLocale( return Locale(::rtl::OUString("en"), ::rtl::OUString("US"));
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")),
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")));
return aLocale;
} }
//----------------------------------------------- //-----------------------------------------------
const Locale Locale::X_NOTRANSLATE() const Locale Locale::X_NOTRANSLATE()
{ {
static Locale aLocale( return Locale(::rtl::OUString("x"), ::rtl::OUString("notranslate"));
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x")),
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("notranslate")));
return aLocale;
} }
//----------------------------------------------- //-----------------------------------------------

View File

@@ -144,8 +144,7 @@ void SAL_CALL ConfigFlush::removeRefreshListener(const css::uno::Reference< css:
//----------------------------------------------- //-----------------------------------------------
::rtl::OUString ConfigFlush::impl_getImplementationName() ::rtl::OUString ConfigFlush::impl_getImplementationName()
{ {
static ::rtl::OUString IMPLNAME( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.filter.config.ConfigFlush" )); return ::rtl::OUString("com.sun.star.comp.filter.config.ConfigFlush");
return IMPLNAME;
} }
//----------------------------------------------- //-----------------------------------------------

View File

@@ -1632,8 +1632,6 @@ void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::containe
CacheItem& rItem) CacheItem& rItem)
throw(css::uno::Exception) throw(css::uno::Exception)
{ {
static ::rtl::OUString FORMATNAME_VAR( RTL_CONSTASCII_USTRINGPARAM( "%productname%" ));
static ::rtl::OUString FORMATVERSION_VAR( RTL_CONSTASCII_USTRINGPARAM( "%formatversion%" ));
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
::osl::ResettableMutexGuard aLock(m_aLock); ::osl::ResettableMutexGuard aLock(m_aLock);
@@ -1652,6 +1650,8 @@ void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::containe
::comphelper::SequenceAsVector< ::rtl::OUString >::const_iterator pLocale ; ::comphelper::SequenceAsVector< ::rtl::OUString >::const_iterator pLocale ;
::comphelper::SequenceAsHashMap lUINames; ::comphelper::SequenceAsHashMap lUINames;
const char FORMATNAME_VAR[] = "%productname%";
const char FORMATVERSION_VAR[] = "%formatversion%";
// patch %PRODUCTNAME and %FORMATNAME // patch %PRODUCTNAME and %FORMATNAME
for ( pLocale = lLocales.begin(); for ( pLocale = lLocales.begin();
pLocale != lLocales.end() ; pLocale != lLocales.end() ;
@@ -1666,14 +1666,14 @@ void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::containe
sal_Int32 nIndex = sValue.indexOf(FORMATNAME_VAR); sal_Int32 nIndex = sValue.indexOf(FORMATNAME_VAR);
while(nIndex != -1) while(nIndex != -1)
{ {
sValue = sValue.replaceAt(nIndex, FORMATNAME_VAR.getLength(), sFormatName); sValue = sValue.replaceAt(nIndex, RTL_CONSTASCII_LENGTH(FORMATNAME_VAR), sFormatName);
nIndex = sValue.indexOf(FORMATNAME_VAR, nIndex); nIndex = sValue.indexOf(FORMATNAME_VAR, nIndex);
} }
// replace %formatversion% // replace %formatversion%
nIndex = sValue.indexOf(FORMATVERSION_VAR); nIndex = sValue.indexOf(FORMATVERSION_VAR);
while(nIndex != -1) while(nIndex != -1)
{ {
sValue = sValue.replaceAt(nIndex, FORMATVERSION_VAR.getLength(), sFormatVersion); sValue = sValue.replaceAt(nIndex, RTL_CONSTASCII_LENGTH(FORMATVERSION_VAR), sFormatVersion);
nIndex = sValue.indexOf(FORMATVERSION_VAR, nIndex); nIndex = sValue.indexOf(FORMATVERSION_VAR, nIndex);
} }
@@ -2298,9 +2298,6 @@ void FilterCache::impl_interpretDataVal4Filter(const ::rtl::OUString& sValue,
void FilterCache::impl_readOldFormat() void FilterCache::impl_readOldFormat()
throw(css::uno::Exception) throw(css::uno::Exception)
{ {
static ::rtl::OUString TYPES_SET( RTL_CONSTASCII_USTRINGPARAM( "Types" ));
static ::rtl::OUString FILTER_SET( RTL_CONSTASCII_USTRINGPARAM( "Filters" ));
// Attention: Opening/Reading of this old configuration format has to be handled gracefully. // Attention: Opening/Reading of this old configuration format has to be handled gracefully.
// Its optional and shouldnt disturb our normal work! // Its optional and shouldnt disturb our normal work!
// E.g. we must check, if the package exists ... // E.g. we must check, if the package exists ...
@@ -2318,6 +2315,8 @@ void FilterCache::impl_readOldFormat()
catch(const css::uno::Exception&) catch(const css::uno::Exception&)
{ return; } { return; }
::rtl::OUString TYPES_SET("Types");
// May be there is no type set ... // May be there is no type set ...
if (xCfg->hasByName(TYPES_SET)) if (xCfg->hasByName(TYPES_SET))
{ {
@@ -2329,6 +2328,7 @@ void FilterCache::impl_readOldFormat()
m_lTypes[pItems[i]] = impl_readOldItem(xSet, E_TYPE, pItems[i]); m_lTypes[pItems[i]] = impl_readOldItem(xSet, E_TYPE, pItems[i]);
} }
::rtl::OUString FILTER_SET("Filters");
// May be there is no filter set ... // May be there is no filter set ...
if (xCfg->hasByName(FILTER_SET)) if (xCfg->hasByName(FILTER_SET))
{ {