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

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Thu Feb 23 14:16:26 UTC 2017


 xmlsecurity/source/dialogs/certificatechooser.cxx |   66 +++++++++++-----------
 1 file changed, 33 insertions(+), 33 deletions(-)

New commits:
commit f827e119a34e7c1d1a31911f226f02dd64e05410
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Feb 22 12:18:57 2017 +0100

    Reduce indentation
    
    Change-Id: Ie4578e45205ebf206a752651901f488a7edd648d
    Reviewed-on: https://gerrit.libreoffice.org/34541
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index f7ba620..53ceb0d 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -157,47 +157,47 @@ OUString CertificateChooser::UsageInClearText(int bits)
 
 void CertificateChooser::ImplInitialize()
 {
-    if ( !mbInitialized )
+    if ( mbInitialized )
+        return;
+
+    try
     {
-        try
-        {
-            maCerts = mxSecurityEnvironment->getPersonalCertificates();
-        }
-        catch (security::NoPasswordException&)
-        {
-        }
+        maCerts = mxSecurityEnvironment->getPersonalCertificates();
+    }
+    catch (security::NoPasswordException&)
+    {
+    }
 
-        uno::Reference< css::security::XSerialNumberAdapter> xSerialNumberAdapter =
-            css::security::SerialNumberAdapter::create(mxCtx);
+    uno::Reference< css::security::XSerialNumberAdapter> xSerialNumberAdapter =
+        css::security::SerialNumberAdapter::create(mxCtx);
 
-        sal_Int32 nCertificates = maCerts.getLength();
-        for( sal_Int32 nCert = nCertificates; nCert; )
-        {
-            uno::Reference< security::XCertificate > xCert = maCerts[ --nCert ];
-            // Check if we have a private key for this...
-            long nCertificateCharacters = mxSecurityEnvironment->getCertificateCharacters(xCert);
-
-            if (!(nCertificateCharacters & security::CertificateCharacters::HAS_PRIVATE_KEY))
-            {
-                ::comphelper::removeElementAt( maCerts, nCert );
-                nCertificates = maCerts.getLength();
-            }
-        }
+    sal_Int32 nCertificates = maCerts.getLength();
+    for( sal_Int32 nCert = nCertificates; nCert; )
+    {
+        uno::Reference< security::XCertificate > xCert = maCerts[ --nCert ];
+        // Check if we have a private key for this...
+        long nCertificateCharacters = mxSecurityEnvironment->getCertificateCharacters(xCert);
 
-        // fill list of certificates; the first entry will be selected
-        for ( sal_Int32 nC = 0; nC < nCertificates; ++nC )
+        if (!(nCertificateCharacters & security::CertificateCharacters::HAS_PRIVATE_KEY))
         {
-            SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() )
-                + "\t" + XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() )
-                + "\t" + UsageInClearText( maCerts[ nC ]->getCertificateUsage() )
-                + "\t" + XmlSec::GetDateString( maCerts[ nC ]->getNotValidAfter() ) );
-            pEntry->SetUserData( reinterpret_cast<void*>(nC) ); // missuse user data as index
+            ::comphelper::removeElementAt( maCerts, nCert );
+            nCertificates = maCerts.getLength();
         }
+    }
 
-        // enable/disable buttons
-        CertificateHighlightHdl( nullptr );
-        mbInitialized = true;
+    // fill list of certificates; the first entry will be selected
+    for ( sal_Int32 nC = 0; nC < nCertificates; ++nC )
+    {
+        SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() )
+            + "\t" + XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() )
+            + "\t" + UsageInClearText( maCerts[ nC ]->getCertificateUsage() )
+            + "\t" + XmlSec::GetDateString( maCerts[ nC ]->getNotValidAfter() ) );
+        pEntry->SetUserData( reinterpret_cast<void*>(nC) ); // missuse user data as index
     }
+
+    // enable/disable buttons
+    CertificateHighlightHdl( nullptr );
+    mbInitialized = true;
 }
 
 


More information about the Libreoffice-commits mailing list