From 66e25cfe4f50c142077a54f005d09cee2bb63dab Mon Sep 17 00:00:00 2001 From: Arnaud VERSINI Date: Sun, 25 Jun 2023 20:13:36 +0200 Subject: xmlsecurity : remove unneccessary static variables Change-Id: Ie7ecba234f33cc09ebd4cf5a390919acb4bc7e08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153567 Tested-by: Jenkins Reviewed-by: Noel Grandin --- xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'xmlsecurity/source') diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index ed73366234df..2a3cd3049a13 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -19,6 +19,7 @@ #include +#include #include #include @@ -115,7 +116,8 @@ namespace m_nODF = nTmp; } - const std::vector aGUIServersWindows = { u"Gpg4win\\kleopatra.exe", +#ifdef _WIN32 + constexpr std::array aGUIServers = { u"Gpg4win\\kleopatra.exe", u"Gpg4win\\bin\\kleopatra.exe", u"GNU\\GnuPG\\kleopatra.exe", u"GNU\\GnuPG\\launch-gpa.exe", @@ -124,7 +126,10 @@ namespace u"GNU\\GnuPG\\bin\\kleopatra.exe", u"GNU\\GnuPG\\bin\\launch-gpa.exe", u"GNU\\GnuPG\\bin\\gpa.exe"}; - const std::vector aGUIServersNix = { u"kleopatra", u"seahorse", u"gpa", u"kgpg" }; +#else + constexpr std::array aGUIServers = { u"kleopatra", u"seahorse", u"gpa", u"kgpg" }; +#endif + } DigitalSignaturesDialog::DigitalSignaturesDialog( @@ -490,7 +495,6 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, RemoveButtonHdl, weld::Button&, void) bool DigitalSignaturesDialog::IsThereCertificateMgr() { - static std::vector aGUIServers; #ifdef _WIN32 static const OUString aPath = [] { sal::systools::CoTaskMemAllocated sPath; @@ -502,18 +506,13 @@ bool DigitalSignaturesDialog::IsThereCertificateMgr() }(); if (aPath.isEmpty()) return false; - aGUIServers = aGUIServersWindows; #else const char* cPath = getenv("PATH"); if (!cPath) return false; OUString aPath(cPath, strlen(cPath), osl_getThreadTextEncoding()); - aGUIServers = aGUIServersNix; #endif - if (aGUIServers.empty()) - return false; - OUString sFoundGUIServer, sExecutable; for ( auto const &rServer : aGUIServers ) @@ -531,7 +530,6 @@ bool DigitalSignaturesDialog::IsThereCertificateMgr() IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, weld::Button&, void) { - static std::vector aGUIServers; #ifdef _WIN32 // FIXME: call GpgME::dirInfo("bindir") somewhere in // SecurityEnvironmentGpg or whatnot @@ -546,13 +544,11 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, weld::Button&, void) }(); if (aPath.isEmpty()) return; - aGUIServers = aGUIServersWindows; #else const char* cPath = getenv("PATH"); if (!cPath) return; OUString aPath(cPath, strlen(cPath), osl_getThreadTextEncoding()); - aGUIServers = aGUIServersNix; #endif if (aGUIServers.empty()) -- cgit