summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-04-06 21:40:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-07 20:09:58 +0200
commit86cadd43f002959d6cfcb7b3e4066076f6d05997 (patch)
tree45833a5083e69fe54d6298338245f27f16c17a69
parent78b53fc86dcf97df9d00828788611527e78d40a6 (diff)
rtl::Static -> function local static
Change-Id: Iee030633d2e2b020f38797d0d323680fa552b81a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113713 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.cxx22
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx10
-rw-r--r--i18nlangtag/source/languagetag/languagetag.cxx5
3 files changed, 15 insertions, 22 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 0d0f609cf013..a3c33f6d639d 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -79,19 +79,6 @@ namespace dp_gui {
#define SHARED_PACKAGE_MANAGER "shared"
#define BUNDLED_PACKAGE_MANAGER "bundled"
-namespace {
-
-struct StrAllFiles : public rtl::StaticWithInit< OUString, StrAllFiles >
-{
- OUString operator () () {
- const SolarMutexGuard guard;
- std::locale loc = Translate::Create("fps");
- return Translate::get(STR_FILTERNAME_ALL, loc);
- }
-};
-
-}
-
// ExtBoxWithBtns_Impl
class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
{
@@ -662,8 +649,15 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
}
}
+ static const OUString StrAllFiles = []()
+ {
+ const SolarMutexGuard guard;
+ std::locale loc = Translate::Create("fps");
+ return Translate::get(STR_FILTERNAME_ALL, loc);
+ }();
+
// All files at top:
- xFilePicker->appendFilter( StrAllFiles::get(), "*.*" );
+ xFilePicker->appendFilter( StrAllFiles, "*.*" );
xFilePicker->appendFilter( DpResId(RID_STR_ALL_SUPPORTED), supportedFilters.makeStringAndClear() );
// then supported ones:
for (auto const& elem : title2filter)
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index aafa45e239e0..d24811621d72 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -70,11 +70,7 @@ struct UnoRc : public rtl::StaticWithInit<
}
};
-struct OfficePipeId : public rtl::StaticWithInit<OUString, OfficePipeId> {
- OUString operator () ();
-};
-
-OUString OfficePipeId::operator () ()
+OUString generateOfficePipeId()
{
OUString userPath;
::utl::Bootstrap::PathStatus aLocateResult =
@@ -113,7 +109,9 @@ OUString OfficePipeId::operator () ()
bool existsOfficePipe()
{
- OUString const & pipeId = OfficePipeId::get();
+ static OUString OfficePipeId = generateOfficePipeId();
+
+ OUString const & pipeId = OfficePipeId;
if (pipeId.isEmpty())
return false;
::osl::Security sec;
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index 850e404e363c..a5a5dea7d0af 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -51,7 +51,6 @@ struct myLtError
// "statics" to be returned as const reference to an empty locale and string.
struct theEmptyLocale : public rtl::Static< lang::Locale, theEmptyLocale > {};
-struct theEmptyBcp47 : public rtl::Static< OUString, theEmptyBcp47 > {};
}
typedef std::unordered_set< OUString > KnownTagSet;
@@ -1561,8 +1560,10 @@ const OUString & LanguageTagImpl::getBcp47() const
const OUString & LanguageTag::getBcp47( bool bResolveSystem ) const
{
+ static const OUString theEmptyBcp47 = u"";
+
if (!bResolveSystem && mbSystemLocale)
- return theEmptyBcp47::get();
+ return theEmptyBcp47;
if (!mbInitializedBcp47)
syncVarsFromImpl();
if (!mbInitializedBcp47)