[Libreoffice-commits] core.git: 2 commits - xmlsecurity/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 20 17:51:48 UTC 2018


 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx                |   63 ++++------
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |    4 
 2 files changed, 33 insertions(+), 34 deletions(-)

New commits:
commit fc6dd83ba24a9fed9c61caddfba701d6835bc80c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 19 16:13:27 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 20 19:51:39 2018 +0200

    pvs-studio: Expression 'pCertContext' is always true.
    
    Change-Id: Iefd9b082e44dc22e9bd7fb2856f44c8db6d8482f
    Reviewed-on: https://gerrit.libreoffice.org/62051
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index 2a545ba568b5..5e6dfcb93a99 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -589,8 +589,8 @@ uno::Reference< XCertificate > SecurityEnvironment_MSCryptImpl::getCertificate(
     if( certInfo.Issuer.pbData ) free( certInfo.Issuer.pbData ) ;
 
     if( pCertContext != nullptr ) {
-        xcert = MswcryCertContextToXCert( pCertContext ) ;
-        if( pCertContext ) CertFreeCertificateContext( pCertContext ) ;
+        xcert = MswcryCertContextToXCert(pCertContext);
+        CertFreeCertificateContext(pCertContext);
     } else {
         xcert = nullptr ;
     }
commit f9ccf6216022dcaf70bd01e51feb5c88b5f03731
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 19 16:22:08 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 20 19:51:27 2018 +0200

    rework to check cPath against nullptr only on !WNT
    
    Change-Id: Iaca0d47b07f4b31b70ddeccb87f0f84019be81cd
    Reviewed-on: https://gerrit.libreoffice.org/62055
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 61300fdf6156..98f9bd1da127 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -501,41 +501,40 @@ IMPL_STATIC_LINK(DigitalSignaturesDialog, CertMgrButtonHdl, Button*, pButton, vo
 #else
     const OUString aGUIServers[] = { OUString("kleopatra"), OUString("seahorse"),  OUString("gpa"), OUString("kgpg") };
     const char* cPath = getenv("PATH");
+    if (!cPath)
+        return;
 #endif
 
-    if (cPath)
+    OUString aPath(cPath, strlen(cPath), osl_getThreadTextEncoding());
+    OUString sFoundGUIServer, sExecutable;
+
+    for ( auto const &rServer : aGUIServers )
+    {
+        osl::FileBase::RC searchError = osl::File::searchFileURL(rServer, aPath, sFoundGUIServer );
+        if (searchError == osl::FileBase::E_None)
+        {
+            osl::File::getSystemPathFromFileURL( sFoundGUIServer, sExecutable );
+            break;
+        }
+
+    }
+
+    if ( !sExecutable.isEmpty() )
+    {
+        uno::Reference< uno::XComponentContext > xContext =
+            ::comphelper::getProcessComponentContext();
+        uno::Reference< css::system::XSystemShellExecute > xSystemShell(
+                 css::system::SystemShellExecute::create(xContext) );
+
+        xSystemShell->execute( sExecutable, OUString(),
+            css::system::SystemShellExecuteFlags::DEFAULTS );
+    }
+    else
     {
-       OUString aPath(cPath, strlen(cPath), osl_getThreadTextEncoding());
-       OUString sFoundGUIServer, sExecutable;
-
-       for ( auto const &rServer : aGUIServers )
-       {
-           osl::FileBase::RC searchError = osl::File::searchFileURL(rServer, aPath, sFoundGUIServer );
-           if (searchError == osl::FileBase::E_None)
-           {
-               osl::File::getSystemPathFromFileURL( sFoundGUIServer, sExecutable );
-               break;
-           }
-
-       }
-
-       if ( !sExecutable.isEmpty() )
-       {
-           uno::Reference< uno::XComponentContext > xContext =
-               ::comphelper::getProcessComponentContext();
-           uno::Reference< css::system::XSystemShellExecute > xSystemShell(
-                    css::system::SystemShellExecute::create(xContext) );
-
-           xSystemShell->execute( sExecutable, OUString(),
-               css::system::SystemShellExecuteFlags::DEFAULTS );
-       }
-       else
-       {
-           std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pButton->GetFrameWeld(),
-                                                         VclMessageType::Info, VclButtonsType::Ok,
-                                                         XsResId(STR_XMLSECDLG_NO_CERT_MANAGER)));
-           xInfoBox->run();
-       }
+        std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pButton->GetFrameWeld(),
+                                                      VclMessageType::Info, VclButtonsType::Ok,
+                                                      XsResId(STR_XMLSECDLG_NO_CERT_MANAGER)));
+        xInfoBox->run();
     }
 }
 


More information about the Libreoffice-commits mailing list