xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   18 ++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

New commits:
commit 66e25cfe4f50c142077a54f005d09cee2bb63dab
Author:     Arnaud VERSINI <arnaud.vers...@libreoffice.org>
AuthorDate: Sun Jun 25 20:13:36 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jun 26 07:56:01 2023 +0200

    xmlsecurity : remove unneccessary static variables
    
    Change-Id: Ie7ecba234f33cc09ebd4cf5a390919acb4bc7e08
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153567
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

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 <sal/config.h>
 
+#include <array>
 #include <string_view>
 
 #include <digitalsignaturesdialog.hxx>
@@ -115,7 +116,8 @@ namespace
 
         m_nODF = nTmp;
     }
-    const std::vector<std::u16string_view> aGUIServersWindows = { 
u"Gpg4win\\kleopatra.exe",
+#ifdef _WIN32
+    constexpr std::array<std::u16string_view, 9> 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<std::u16string_view> aGUIServersNix = { u"kleopatra", 
u"seahorse", u"gpa", u"kgpg" };
+#else
+    constexpr std::array<std::u16string_view, 4> 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<std::u16string_view> aGUIServers;
 #ifdef _WIN32
     static const OUString aPath = [] {
         sal::systools::CoTaskMemAllocated<wchar_t> 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<std::u16string_view> 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())

Reply via email to