[Libreoffice-commits] core.git: i18nlangtag/source oox/source package/source sal/rtl sal/textenc sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jul 31 06:56:04 UTC 2021
i18nlangtag/source/languagetag/languagetag.cxx | 89 +++++++++++--------------
oox/source/core/xmlfilterbase.cxx | 2
oox/source/drawingml/table/tableproperties.cxx | 11 +--
package/source/xstor/owriteablestream.cxx | 6 -
package/source/xstor/xstorage.cxx | 6 -
package/source/zippackage/ZipPackageFolder.cxx | 6 -
package/source/zippackage/ZipPackageStream.cxx | 6 -
sal/rtl/bootstrap.cxx | 10 +-
sal/rtl/rtl_process.cxx | 6 -
sal/textenc/textenc.cxx | 10 +-
sc/source/core/tool/formulaparserpool.cxx | 8 --
11 files changed, 67 insertions(+), 93 deletions(-)
New commits:
commit a943936eeff04b60ebd0b2552bc18b42606f3321
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 30 20:54:50 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 31 08:55:29 2021 +0200
rtl::Static -> static local
in a handful cases, like a map or a vector, we don't need init on demand
at all, the default constructor can be laid out at compile time
Change-Id: Ifa3188af7a65cd475ce0f603d15a8c26bcda7e6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119710
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index 41f23973020f..07b9c6d0a666 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -49,24 +49,19 @@ struct myLtError
~myLtError() { if (p) lt_error_unref( p); }
};
-// "static" to be returned as const reference to an empty locale.
-struct theEmptyLocale : public rtl::Static< lang::Locale, theEmptyLocale > {};
}
typedef std::unordered_set< OUString > KnownTagSet;
namespace {
-struct theKnowns : public rtl::Static< KnownTagSet, theKnowns > {};
struct theMutex : public rtl::Static< osl::Mutex, theMutex > {};
}
static const KnownTagSet & getKnowns()
{
- KnownTagSet & rKnowns = theKnowns::get();
- if (rKnowns.empty())
- {
- osl::MutexGuard aGuard( theMutex::get());
- if (rKnowns.empty())
+ static const KnownTagSet theKnowns =
+ []()
{
+ KnownTagSet knownSet;
::std::vector< MsLangId::LanguagetagMapping > aDefined( MsLangId::getDefinedLanguagetags());
for (auto const& elemDefined : aDefined)
{
@@ -76,12 +71,12 @@ static const KnownTagSet & getKnowns()
::std::vector< OUString > aFallbacks( LanguageTag( elemDefined.mnLang).getFallbackStrings( true));
for (auto const& fallback : aFallbacks)
{
- rKnowns.insert(fallback);
+ knownSet.insert(fallback);
}
}
- }
- }
- return rKnowns;
+ return knownSet;
+ }();
+ return theKnowns;
}
@@ -95,10 +90,10 @@ struct compareIgnoreAsciiCaseLess
};
typedef ::std::map< OUString, LanguageTag::ImplPtr, compareIgnoreAsciiCaseLess > MapBcp47;
typedef ::std::map< LanguageType, LanguageTag::ImplPtr > MapLangID;
-struct theMapBcp47 : public rtl::Static< MapBcp47, theMapBcp47 > {};
-struct theMapLangID : public rtl::Static< MapLangID, theMapLangID > {};
-struct theDontKnow : public rtl::Static< LanguageTag::ImplPtr, theDontKnow > {};
-struct theSystemLocale : public rtl::Static< LanguageTag::ImplPtr, theSystemLocale > {};
+MapBcp47 theMapBcp47;
+MapLangID theMapLangID;
+LanguageTag::ImplPtr theDontKnow;
+LanguageTag::ImplPtr theSystemLocale;
}
@@ -598,10 +593,9 @@ LanguageTag::ImplPtr LanguageTagImpl::registerOnTheFly( LanguageType nRegisterID
osl::MutexGuard aGuard( theMutex::get());
- MapBcp47& rMapBcp47 = theMapBcp47::get();
- MapBcp47::const_iterator it( rMapBcp47.find( maBcp47));
+ MapBcp47::const_iterator it( theMapBcp47.find( maBcp47));
bool bOtherImpl = false;
- if (it != rMapBcp47.end())
+ if (it != theMapBcp47.end())
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerOnTheFly: found impl for '" << maBcp47 << "'");
pImpl = (*it).second;
@@ -621,7 +615,7 @@ LanguageTag::ImplPtr LanguageTagImpl::registerOnTheFly( LanguageType nRegisterID
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerOnTheFly: new impl for '" << maBcp47 << "'");
pImpl = std::make_shared<LanguageTagImpl>( *this);
- rMapBcp47.insert( ::std::make_pair( maBcp47, pImpl));
+ theMapBcp47.insert( ::std::make_pair( maBcp47, pImpl));
}
if (!bOtherImpl || !pImpl->mbInitializedLangID)
@@ -634,9 +628,8 @@ LanguageTag::ImplPtr LanguageTagImpl::registerOnTheFly( LanguageType nRegisterID
// different, otherwise we would end up with ambiguous assignments
// of different language tags, for example for the same primary
// LangID with "no", "nb" and "nn".
- const MapLangID& rMapLangID = theMapLangID::get();
- MapLangID::const_iterator itID( rMapLangID.find( nRegisterID));
- if (itID != rMapLangID.end())
+ MapLangID::const_iterator itID( theMapLangID.find( nRegisterID));
+ if (itID != theMapLangID.end())
{
if ((*itID).second->maBcp47 != maBcp47)
{
@@ -667,7 +660,7 @@ LanguageTag::ImplPtr LanguageTagImpl::registerOnTheFly( LanguageType nRegisterID
}
::std::pair< MapLangID::const_iterator, bool > res(
- theMapLangID::get().insert( ::std::make_pair( pImpl->mnLangID, pImpl)));
+ theMapLangID.insert( ::std::make_pair( pImpl->mnLangID, pImpl)));
if (res.second)
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerOnTheFly: cross-inserted 0x"
@@ -686,9 +679,8 @@ LanguageTag::ImplPtr LanguageTagImpl::registerOnTheFly( LanguageType nRegisterID
LanguageTag::ScriptType LanguageTag::getOnTheFlyScriptType( LanguageType nRegisterID )
{
- const MapLangID& rMapLangID = theMapLangID::get();
- MapLangID::const_iterator itID( rMapLangID.find( nRegisterID));
- if (itID != rMapLangID.end())
+ MapLangID::const_iterator itID( theMapLangID.find( nRegisterID));
+ if (itID != theMapLangID.end())
return (*itID).second->getScriptType();
else
return ScriptType::UNKNOWN;
@@ -709,7 +701,7 @@ void LanguageTag::setConfiguredSystemLanguage( LanguageType nLang )
MsLangId::LanguageTagAccess::setConfiguredSystemLanguage( nLang);
// Reset system locale to none and let registerImpl() do the rest to
// initialize a new one.
- theSystemLocale::get().reset();
+ theSystemLocale.reset();
LanguageTag aLanguageTag( LANGUAGE_SYSTEM);
aLanguageTag.registerImpl();
}
@@ -749,7 +741,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
// and take the system locale shortcut if possible.
if (mbSystemLocale)
{
- pImpl = theSystemLocale::get();
+ pImpl = theSystemLocale;
if (pImpl)
{
#if OSL_DEBUG_LEVEL > 0
@@ -774,10 +766,9 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
// Heavy usage of LANGUAGE_DONTKNOW, make it an own Impl for all the
// conversion attempts. At the same time provide a central breakpoint
// to inspect such places.
- LanguageTag::ImplPtr& rDontKnow = theDontKnow::get();
- if (!rDontKnow)
- rDontKnow = std::make_shared<LanguageTagImpl>( *this);
- pImpl = rDontKnow;
+ if (!theDontKnow)
+ theDontKnow = std::make_shared<LanguageTagImpl>( *this);
+ pImpl = theDontKnow;
#if OSL_DEBUG_LEVEL > 0
static size_t nCallsDontKnow = 0;
++nCallsDontKnow;
@@ -788,7 +779,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
else
{
// A great share are calls for a system equal locale.
- pImpl = theSystemLocale::get();
+ pImpl = theSystemLocale;
if (pImpl && pImpl->mnLangID == mnLangID)
{
#if OSL_DEBUG_LEVEL > 0
@@ -819,7 +810,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
if (mbInitializedBcp47)
{
// A great share are calls for a system equal locale.
- pImpl = theSystemLocale::get();
+ pImpl = theSystemLocale;
if (pImpl && pImpl->maBcp47 == maBcp47)
{
#if OSL_DEBUG_LEVEL > 0
@@ -852,9 +843,8 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
// Prefer LangID map as find+insert needs less comparison work.
if (mbInitializedLangID)
{
- MapLangID& rMap = theMapLangID::get();
- MapLangID::const_iterator it( rMap.find( mnLangID));
- if (it != rMap.end())
+ MapLangID::const_iterator it( theMapLangID.find( mnLangID));
+ if (it != theMapLangID.end())
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: found impl for 0x" << ::std::hex << mnLangID);
pImpl = (*it).second;
@@ -863,7 +853,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: new impl for 0x" << ::std::hex << mnLangID);
pImpl = std::make_shared<LanguageTagImpl>( *this);
- rMap.insert( ::std::make_pair( mnLangID, pImpl));
+ theMapLangID.insert( ::std::make_pair( mnLangID, pImpl));
// Try round-trip.
if (!pImpl->mbInitializedLocale)
pImpl->convertLangToLocale();
@@ -874,7 +864,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
if (!pImpl->mbInitializedBcp47)
pImpl->convertLocaleToBcp47();
::std::pair< MapBcp47::const_iterator, bool > res(
- theMapBcp47::get().insert( ::std::make_pair( pImpl->maBcp47, pImpl)));
+ theMapBcp47.insert( ::std::make_pair( pImpl->maBcp47, pImpl)));
if (res.second)
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: cross-inserted '" << pImpl->maBcp47 << "' for 0x" << ::std::hex << mnLangID);
@@ -895,9 +885,8 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
}
else if (!maBcp47.isEmpty())
{
- MapBcp47& rMap = theMapBcp47::get();
- MapBcp47::const_iterator it( rMap.find( maBcp47));
- if (it != rMap.end())
+ MapBcp47::const_iterator it( theMapBcp47.find( maBcp47));
+ if (it != theMapBcp47.end())
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: found impl for '" << maBcp47 << "'");
pImpl = (*it).second;
@@ -906,14 +895,14 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: new impl for '" << maBcp47 << "'");
pImpl = std::make_shared<LanguageTagImpl>( *this);
- ::std::pair< MapBcp47::iterator, bool > insOrig( rMap.insert( ::std::make_pair( maBcp47, pImpl)));
+ ::std::pair< MapBcp47::iterator, bool > insOrig( theMapBcp47.insert( ::std::make_pair( maBcp47, pImpl)));
// If changed after canonicalize() also add the resulting tag to
// the map.
if (pImpl->synCanonicalize())
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: canonicalized to '" << pImpl->maBcp47 << "'");
::std::pair< MapBcp47::const_iterator, bool > insCanon(
- rMap.insert( ::std::make_pair( pImpl->maBcp47, pImpl)));
+ theMapBcp47.insert( ::std::make_pair( pImpl->maBcp47, pImpl)));
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << (insCanon.second ? "" : "not ")
<< "inserted '" << pImpl->maBcp47 << "'");
// If the canonicalized tag already existed (was not inserted)
@@ -957,7 +946,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
if (bInsert)
{
::std::pair< MapLangID::const_iterator, bool > res(
- theMapLangID::get().insert( ::std::make_pair( pImpl->mnLangID, pImpl)));
+ theMapLangID.insert( ::std::make_pair( pImpl->mnLangID, pImpl)));
if (res.second)
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: cross-inserted 0x"
@@ -989,7 +978,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
// above, so add it.
if (mbSystemLocale && mbInitializedLangID)
{
- theSystemLocale::get() = pImpl;
+ theSystemLocale = pImpl;
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: added system locale 0x"
<< ::std::hex << pImpl->mnLangID << " '" << pImpl->maBcp47 << "'");
}
@@ -1699,7 +1688,11 @@ OUString LanguageTagImpl::getVariantsFromLangtag()
const css::lang::Locale & LanguageTag::getLocale( bool bResolveSystem ) const
{
if (!bResolveSystem && mbSystemLocale)
- return theEmptyLocale::get();
+ {
+ // "static" to be returned as const reference to an empty locale.
+ static const lang::Locale theEmptyLocale;
+ return theEmptyLocale;
+ }
if (!mbInitializedLocale)
syncVarsFromImpl();
if (!mbInitializedLocale)
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index b2184e7a97d8..091c5c17e12e 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -156,7 +156,7 @@ struct NamespaceIds: public rtl::StaticWithInit<
void registerNamespaces( FastParser& rParser )
{
- const Sequence< beans::Pair<OUString, sal_Int32> > ids = NamespaceIds::get();
+ const Sequence< beans::Pair<OUString, sal_Int32> >& ids = NamespaceIds::get();
// Filter out duplicates: a namespace can have multiple URLs, think of
// strict vs transitional.
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index 69117123dca8..1622b8fc22ca 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -24,7 +24,6 @@
#include <oox/drawingml/drawingmltypes.hxx>
#include <com/sun/star/table/XTable.hpp>
#include <com/sun/star/table/XMergeableCellRange.hpp>
-#include <rtl/instance.hxx>
#include <oox/core/xmlfilterbase.hxx>
#include "predefined-table-styles.cxx"
@@ -89,11 +88,6 @@ static void MergeCells( const uno::Reference< XTable >& xTable, sal_Int32 nCol,
}
}
-namespace
-{
- struct theDefaultTableStyle : public ::rtl::Static< TableStyle, theDefaultTableStyle > {};
-}
-
const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase, std::unique_ptr<TableStyle>& rTableStyleToDelete )
{
::oox::core::XmlFilterBase& rBase( const_cast< ::oox::core::XmlFilterBase& >( rFilterBase ) );
@@ -123,7 +117,10 @@ const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilt
}
if ( !pTableStyle )
- return theDefaultTableStyle::get();
+ {
+ static TableStyle theDefaultTableStyle;
+ return theDefaultTableStyle;
+ }
return *pTableStyle;
}
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 5dd673f29171..1b13d49c79db 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -48,7 +48,6 @@
#include <comphelper/sequence.hxx>
#include <rtl/digest.h>
-#include <rtl/instance.hxx>
#include <tools/diagnose_ex.h>
#include <PackageConstants.hxx>
@@ -1930,11 +1929,10 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes()
return m_pData->m_pTypeCollection->getTypes() ;
}
-namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
-
uno::Sequence< sal_Int8 > SAL_CALL OWriteStream::getImplementationId()
{
- return css::uno::Sequence<sal_Int8>();
+ static ::cppu::OImplementationId lcl_ImplId;
+ return lcl_ImplId.getImplementationId();
}
sal_Int32 SAL_CALL OWriteStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 24849a6c9062..f7e86b4234ad 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -53,7 +53,6 @@
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <rtl/instance.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/ofopxmlhelper.hxx>
@@ -2174,11 +2173,10 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes()
return m_pData->m_pTypeCollection->getTypes() ;
}
-namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
-
uno::Sequence< sal_Int8 > SAL_CALL OStorage::getImplementationId()
{
- return css::uno::Sequence<sal_Int8>();
+ static ::cppu::OImplementationId lcl_ImplId;
+ return lcl_ImplId.getImplementationId();
}
// XStorage
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index 3e1deee05592..f3099c5b31f3 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -36,7 +36,6 @@
#include <rtl/digest.h>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <EncryptedDataHeader.hxx>
-#include <rtl/instance.hxx>
using namespace com::sun::star;
using namespace com::sun::star::packages::zip::ZipConstants;
@@ -54,8 +53,6 @@ using namespace cppu;
#define THROW_WHERE ""
#endif
-namespace { struct lcl_CachedImplId : public rtl::Static< cppu::OImplementationId, lcl_CachedImplId > {}; }
-
ZipPackageFolder::ZipPackageFolder( const css::uno::Reference < css::uno::XComponentContext >& xContext,
sal_Int32 nFormat,
bool bAllowRemoveOnInsert )
@@ -153,7 +150,8 @@ void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair&
css::uno::Sequence < sal_Int8 > ZipPackageFolder::getUnoTunnelId()
{
- return lcl_CachedImplId::get().getImplementationId();
+ static cppu::OImplementationId lcl_CachedImplId;
+ return lcl_CachedImplId.getImplementationId();
}
// XNameContainer
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 19cc550a3e85..2077e2f9a77a 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -52,7 +52,6 @@
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
-#include <rtl/instance.hxx>
#include <rtl/random.h>
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
@@ -75,11 +74,10 @@ using namespace cppu;
#define THROW_WHERE ""
#endif
-namespace { struct lcl_CachedImplId : public rtl::Static< cppu::OImplementationId, lcl_CachedImplId > {}; }
-
css::uno::Sequence < sal_Int8 > ZipPackageStream::getUnoTunnelId()
{
- return lcl_CachedImplId::get().getImplementationId();
+ static cppu::OImplementationId lcl_CachedImplId;
+ return lcl_CachedImplId.getImplementationId();
}
ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index afb80dcd66cb..52ee7f38d24d 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -146,8 +146,7 @@ static bool find(
namespace
{
- struct rtl_bootstrap_set_vector :
- public rtl::Static< NameValueVector, rtl_bootstrap_set_vector > {};
+ NameValueVector rtl_bootstrap_set_vector;
}
static bool getFromCommandLineArgs(
@@ -551,7 +550,7 @@ bool Bootstrap_Impl::getAmbienceValue(
{
osl::MutexGuard g(osl::Mutex::getGlobalMutex());
- f = find(rtl_bootstrap_set_vector::get(), key, &v);
+ f = find(rtl_bootstrap_set_vector, key, &v);
}
if (f || getFromCommandLineArgs(key, &v) ||
@@ -744,8 +743,7 @@ void SAL_CALL rtl_bootstrap_set (
osl::MutexGuard guard(osl::Mutex::getGlobalMutex());
- NameValueVector& r_rtl_bootstrap_set_vector= rtl_bootstrap_set_vector::get();
- for (auto & item : r_rtl_bootstrap_set_vector)
+ for (auto & item : rtl_bootstrap_set_vector)
{
if (item.sName == name)
{
@@ -756,7 +754,7 @@ void SAL_CALL rtl_bootstrap_set (
SAL_INFO("sal.bootstrap", "explicitly getting: name=" << name << " value=" <<value);
- r_rtl_bootstrap_set_vector.emplace_back(name, value);
+ rtl_bootstrap_set_vector.emplace_back(name, value);
}
void SAL_CALL rtl_bootstrap_expandMacros_from_handle(
diff --git a/sal/rtl/rtl_process.cxx b/sal/rtl/rtl_process.cxx
index 42c24e80074d..76963dc1376b 100644
--- a/sal/rtl/rtl_process.cxx
+++ b/sal/rtl/rtl_process.cxx
@@ -21,7 +21,6 @@
#include <cstring>
-#include <rtl/instance.hxx>
#include <rtl/process.h>
#include <rtl/uuid.h>
#include <sal/types.h>
@@ -46,13 +45,12 @@ private:
sal_uInt8 uuid_[UUID_SIZE];
};
-struct theId: public rtl::Static< Id, theId > {};
-
} // end namespace
void rtl_getGlobalProcessId(sal_uInt8 * pTargetUUID)
{
- theId::get().copy(pTargetUUID);
+ static Id theId;
+ theId.copy(pTargetUUID);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/textenc/textenc.cxx b/sal/textenc/textenc.cxx
index b0856f9add1c..1d7279f849a4 100644
--- a/sal/textenc/textenc.cxx
+++ b/sal/textenc/textenc.cxx
@@ -27,7 +27,6 @@
#include <cstdlib>
#include <osl/module.hxx>
-#include <rtl/instance.hxx>
#include <rtl/textenc.h>
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
@@ -409,10 +408,6 @@ private:
#endif
-struct FullTextEncodingDataSingleton:
- public rtl::Static< FullTextEncodingData, FullTextEncodingDataSingleton >
-{};
-
}
ImplTextEncodingData const *
@@ -431,7 +426,10 @@ Impl_getTextEncodingData(rtl_TextEncoding nEncoding)
case RTL_TEXTENCODING_ISO_8859_1:
return &aImplISO88591TextEncodingData; break;
default:
- return FullTextEncodingDataSingleton::get().get(nEncoding);
+ {
+ static FullTextEncodingData gFullTextEncodingData;
+ return gFullTextEncodingData.get(nEncoding);
+ }
}
}
diff --git a/sc/source/core/tool/formulaparserpool.cxx b/sc/source/core/tool/formulaparserpool.cxx
index 5e50ea96ec4d..94c47fa903e8 100644
--- a/sc/source/core/tool/formulaparserpool.cxx
+++ b/sc/source/core/tool/formulaparserpool.cxx
@@ -23,7 +23,6 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/sheet/XFilterFormulaParser.hpp>
-#include <rtl/instance.hxx>
#include <comphelper/processfactory.hxx>
#include <sfx2/objsh.hxx>
#include <document.hxx>
@@ -101,8 +100,6 @@ Reference< XFormulaParser > ScParserFactoryMap::createFormulaParser(
return xParser;
}
-struct ScParserFactorySingleton : public ::rtl::Static< ScParserFactoryMap, ScParserFactorySingleton > {};
-
} // namespace
ScFormulaParserPool::ScFormulaParserPool( const ScDocument& rDoc ) :
@@ -132,9 +129,10 @@ Reference< XFormulaParser > ScFormulaParserPool::getFormulaParser( const OUStrin
// try to create a new parser object
if( SfxObjectShell* pDocShell = mrDoc.GetDocumentShell() ) try
{
+ static ScParserFactoryMap theScParserFactoryMap;
+
Reference< XComponent > xComponent( pDocShell->GetModel(), UNO_QUERY_THROW );
- ScParserFactoryMap& rFactoryMap = ScParserFactorySingleton::get();
- rxParser = rFactoryMap.createFormulaParser( xComponent, rNamespace );
+ rxParser = theScParserFactoryMap.createFormulaParser( xComponent, rNamespace );
}
catch( Exception& )
{
More information about the Libreoffice-commits
mailing list