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

Noel Grandin noelgrandin at gmail.com
Mon Jun 13 06:54:10 UTC 2016


 xmlsecurity/source/component/documentdigitalsignatures.cxx |    6 +++---
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx     |    6 +++---
 xmlsecurity/source/dialogs/macrosecurity.cxx               |    2 +-
 xmlsecurity/source/helper/documentsignaturehelper.cxx      |    2 +-
 xmlsecurity/source/helper/xmlsignaturehelper.cxx           |   10 +++++-----
 xmlsecurity/source/helper/xsecctl.cxx                      |    4 ++--
 xmlsecurity/source/helper/xsecparser.cxx                   |    2 +-
 xmlsecurity/source/helper/xsecsign.cxx                     |    2 +-
 xmlsecurity/source/helper/xsecverify.cxx                   |    4 ++--
 9 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit c2d195447feb4d7f8ab6642a8d05bfb85797eb05
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun Jun 12 14:47:53 2016 +0200

    Convert DBG_ASSERT in xmlsecurity
    
    Change-Id: Ideec43617ff214b7e0dcbb0a1969955b34ee19e4
    Reviewed-on: https://gerrit.libreoffice.org/26196
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index d57fc6b..0692192 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -224,7 +224,7 @@ bool DocumentDigitalSignatures::ImplViewSignatures(
         nullptr, mxCtx, eMode, bReadOnly, m_sODFVersion,
         m_bHasDocumentSignature);
     bool bInit = aSignaturesDialog->Init();
-    DBG_ASSERT( bInit, "Error initializing security context!" );
+    SAL_WARN_IF( !bInit, "xmlsecurity", "Error initializing security context!" );
     if ( bInit )
     {
         aSignaturesDialog->SetStorage( rxStorage );
@@ -281,7 +281,7 @@ DocumentDigitalSignatures::ImplVerifySignatures(
 
     bool bInit = aSignatureHelper.Init();
 
-    DBG_ASSERT( bInit, "Error initializing security context!" );
+    SAL_WARN_IF( !bInit, "xmlsecurity", "Error initializing security context!" );
 
     if ( !bInit )
         return Sequence< css::security::DocumentSignatureInformation >(0);
@@ -404,7 +404,7 @@ void DocumentDigitalSignatures::showCertificate(
 
     bool bInit = aSignatureHelper.Init();
 
-    DBG_ASSERT( bInit, "Error initializing security context!" );
+    SAL_WARN_IF( !bInit, "xmlsecurity", "Error initializing security context!" );
 
     if ( bInit )
     {
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index fa0b180..b20be6c 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -201,7 +201,7 @@ bool DigitalSignaturesDialog::Init()
 {
     bool bInit = maSignatureManager.maSignatureHelper.Init();
 
-    DBG_ASSERT( bInit, "Error initializing security context!" );
+    SAL_WARN_IF( !bInit, "xmlsecurity", "Error initializing security context!" );
 
     if ( bInit )
     {
@@ -455,7 +455,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
             if (!xCert.is())
                 xCert = xSecEnv->getCertificate( rInfo.ouX509IssuerName, xSerialNumberAdapter->toSequence( rInfo.ouX509SerialNumber ) );
 
-            DBG_ASSERT( xCert.is(), "Certificate not found and can't be created!" );
+            SAL_WARN_IF( !xCert.is(), "xmlsecurity", "Certificate not found and can't be created!" );
 
             OUString aSubject;
             OUString aIssuer;
@@ -587,7 +587,7 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails()
         if (!xCert.is())
             xCert = xSecEnv->getCertificate( rInfo.ouX509IssuerName, xSerialNumberAdapter->toSequence( rInfo.ouX509SerialNumber ) );
 
-        DBG_ASSERT( xCert.is(), "Error getting Certificate!" );
+        SAL_WARN_IF( !xCert.is(), "xmlsecurity", "Error getting Certificate!" );
         if ( xCert.is() )
         {
             ScopedVclPtrInstance< CertificateViewer > aViewer( this, maSignatureManager.maSignatureHelper.GetSecurityEnvironment(), xCert, false );
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index 9d7950e3..36e4c61 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -230,7 +230,7 @@ IMPL_LINK_NOARG_TYPED(MacroSecurityTrustedSourcesTP, ViewCertPBHdl, Button*, voi
         if ( !xCert.is() )
             xCert = mpDlg->mxSecurityEnvironment->createCertificateFromAscii( maTrustedAuthors[nSelected][2] ) ;
 
-        DBG_ASSERT( xCert.is(), "*MacroSecurityTrustedSourcesTP::ViewCertPBHdl(): Certificate not found and can't be created!" );
+        SAL_WARN_IF( !xCert.is(), "xmlsecurity", "*MacroSecurityTrustedSourcesTP::ViewCertPBHdl(): Certificate not found and can't be created!" );
 
         if ( xCert.is() )
         {
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index d50a4fc..7886153 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -383,7 +383,7 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream(
         catch(css::io::IOException& )
         {
             // Doesn't have to exist...
-            DBG_ASSERT( nOpenMode == css::embed::ElementModes::READ, "Error creating signature stream..." );
+            SAL_WARN_IF( nOpenMode != css::embed::ElementModes::READ, "xmlsecurity", "Error creating signature stream..." );
         }
     }
     else if(xNameAccess->hasByName("[Content_Types].xml"))
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index b1d1554..b4dd0c1 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -74,8 +74,8 @@ XMLSignatureHelper::~XMLSignatureHelper()
 
 bool XMLSignatureHelper::Init()
 {
-    DBG_ASSERT( !mxSEInitializer.is(), "XMLSignatureHelper::Init - mxSEInitializer already set!" );
-    DBG_ASSERT( !mxSecurityContext.is(), "XMLSignatureHelper::Init - mxSecurityContext already set!" );
+    SAL_WARN_IF( mxSEInitializer.is(), "xmlsecurity", "XMLSignatureHelper::Init - mxSEInitializer already set!" );
+    SAL_WARN_IF( mxSecurityContext.is(), "xmlsecurity", "XMLSignatureHelper::Init - mxSecurityContext already set!" );
 
     mxSEInitializer = css::xml::crypto::SEInitializer::create( mxCtx );
 
@@ -89,9 +89,9 @@ void XMLSignatureHelper::SetStorage(
     const Reference < css::embed::XStorage >& rxStorage,
     const OUString& sODFVersion)
 {
-    DBG_ASSERT( !mxUriBinding.is(), "SetStorage - UriBinding already set!" );
+    SAL_WARN_IF( mxUriBinding.is(), "xmlsecurity", "SetStorage - UriBinding already set!" );
     mxUriBinding = new UriBindingHelper( rxStorage );
-    DBG_ASSERT(rxStorage.is(), "SetStorage - empty storage!");
+    SAL_WARN_IF(!rxStorage.is(), "xmlsecurity", "SetStorage - empty storage!");
     mbODFPre1_2 = DocumentSignatureHelper::isODFPre_1_2(sODFVersion);
 }
 
@@ -256,7 +256,7 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const css::uno::Reference< css:
 {
     mbError = false;
 
-    DBG_ASSERT(xInputStream.is(), "input stream missing");
+    SAL_WARN_IF(!xInputStream.is(), "xmlsecurity", "input stream missing");
 
     /*
      * prepare ParserInputSrouce
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index c3482ad..85d607c 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -417,7 +417,7 @@ cssu::Reference< css::io::XInputStream >
 {
         cssu::Reference< css::io::XInputStream > xObjectInputStream;
 
-    DBG_ASSERT( m_xUriBinding.is(), "Need XUriBinding!" );
+    SAL_WARN_IF( !m_xUriBinding.is(), "xmlsecurity", "Need XUriBinding!" );
 
     xObjectInputStream = m_xUriBinding->getUriBinding(objectURL);
 
@@ -864,7 +864,7 @@ SignatureInformation XSecController::getSignatureInformation( sal_Int32 nSecurit
 {
     SignatureInformation aInf( 0 );
     int nIndex = findSignatureInfor(nSecurityId);
-    DBG_ASSERT( nIndex != -1, "getSignatureInformation - SecurityId is invalid!" );
+    SAL_WARN_IF( nIndex == -1, "xmlsecurity", "getSignatureInformation - SecurityId is invalid!" );
     if ( nIndex != -1)
     {
         aInf = m_vInternalSignatureInformations[nIndex].signatureInfor;
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index 3118f3e..f823a7e 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -107,7 +107,7 @@ void SAL_CALL XSecParser::startElement(
         else if ( aName == TAG_REFERENCE )
         {
             OUString ouUri = xAttribs->getValueByName(ATTR_URI);
-            DBG_ASSERT( ouUri != nullptr, "URI == NULL" );
+            SAL_WARN_IF( ouUri == nullptr, "xmlsecurity", "URI == NULL" );
 
             if (ouUri.startsWith(CHAR_FRAGMENT))
             {
diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx
index 795c990..a048fbb 100644
--- a/xmlsecurity/source/helper/xsecsign.cxx
+++ b/xmlsecurity/source/helper/xsecsign.cxx
@@ -306,7 +306,7 @@ bool XSecController::WriteSignature(
 {
     bool rc = false;
 
-    DBG_ASSERT( xDocumentHandler.is(), "I really need a document handler!" );
+    SAL_WARN_IF( !xDocumentHandler.is(), "xmlsecurity", "I really need a document handler!" );
 
     /*
      * chain the SAXEventKeeper to the SAX chain
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx
index a60b4c5..7651e4a 100644
--- a/xmlsecurity/source/helper/xsecverify.cxx
+++ b/xmlsecurity/source/helper/xsecverify.cxx
@@ -327,7 +327,7 @@ void XSecController::setPropertyId( OUString& ouPropertyId )
 /* public: for signature verify */
 void XSecController::collectToVerify( const OUString& referenceId )
 {
-    /* DBG_ASSERT( m_xSAXEventKeeper.is(), "the SAXEventKeeper is NULL" ); */
+    /* SAL_WARN_IF( !m_xSAXEventKeeper.is(), "xmlsecurity", "the SAXEventKeeper is NULL" ); */
 
     if ( m_nStatusOfSecurityComponents == INITIALIZED )
     /*
@@ -392,7 +392,7 @@ void XSecController::collectToVerify( const OUString& referenceId )
 
 void XSecController::addSignature( sal_Int32 nSignatureId )
 {
-    DBG_ASSERT( m_xSecParser.is(), "No XSecParser initialized" );
+    SAL_WARN_IF( !m_xSecParser.is(), "xmlsecurity", "No XSecParser initialized" );
 
     m_nReservedSignatureId = nSignatureId;
     m_bVerifyCurrentSignature = true;


More information about the Libreoffice-commits mailing list