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

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Mon Jul 17 20:34:16 UTC 2017


 xmlsecurity/inc/xmlsignaturehelper.hxx           |    1 -
 xmlsecurity/source/helper/xmlsignaturehelper.cxx |    7 +------
 xmlsecurity/source/helper/xsecctl.cxx            |    5 ++++-
 xmlsecurity/source/helper/xsecparser.cxx         |    4 ++--
 4 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit a83888e7759abd5204c76d0c3095a4d49699b834
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Mon Jul 17 20:56:45 2017 +0200

    Fix warning for loext namespace
    
    Define the namespace near the element that's using it
    
    Change-Id: If0a135a331d4f67ef2dfe4981e93110e7a1a787a
    Reviewed-on: https://gerrit.libreoffice.org/40084
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/xmlsecurity/inc/xmlsignaturehelper.hxx b/xmlsecurity/inc/xmlsignaturehelper.hxx
index 2b2a82c413c8..d527942f50f2 100644
--- a/xmlsecurity/inc/xmlsignaturehelper.hxx
+++ b/xmlsecurity/inc/xmlsignaturehelper.hxx
@@ -96,7 +96,6 @@ private:
     rtl::Reference<XSecController> mpXSecController;
     bool                        mbError;
     bool mbODFPre1_2;
-    bool mbHasGpgSignatures;
     Link<LinkParamNone*,bool>   maStartVerifySignatureHdl;
 
 private:
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index e9b5ff749aa4..c7841a5d5614 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -51,7 +51,6 @@
 
 #define NS_DOCUMENTSIGNATURES   "http://openoffice.org/2004/documentsignatures"
 #define NS_DOCUMENTSIGNATURES_ODF_1_2 "urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0"
-#define NS_DOCUMENTSIGNATURES_LOEXT "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 #define OOXML_SIGNATURE_ORIGIN "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin"
 #define OOXML_SIGNATURE_SIGNATURE "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature"
 
@@ -59,7 +58,7 @@ using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
 XMLSignatureHelper::XMLSignatureHelper( const uno::Reference< uno::XComponentContext >& rxCtx)
-    : mxCtx(rxCtx), mbODFPre1_2(false), mbHasGpgSignatures(false)
+    : mxCtx(rxCtx), mbODFPre1_2(false)
 {
     mpXSecController = new XSecController(rxCtx);
     mbError = false;
@@ -129,7 +128,6 @@ void XMLSignatureHelper::SetGpgCertificate(sal_Int32 nSecurityId,
                                            const OUString& ouGpgCert,
                                            const OUString& ouGpgOwner)
 {
-    mbHasGpgSignatures = true;
     mpXSecController->setGpgCertificate(
         nSecurityId,
         ouGpgCertDigest,
@@ -181,9 +179,6 @@ uno::Reference<xml::sax::XWriter> XMLSignatureHelper::CreateDocumentHandlerWithH
         "xmlns",
         sNamespace);
 
-    if (mbHasGpgSignatures)
-        pAttributeList->AddAttribute("xmlns:loext", NS_DOCUMENTSIGNATURES_LOEXT);
-
     xSaxWriter->startDocument();
     xSaxWriter->startElement(
         "document-signatures",
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index abe8bd1760e1..e731951369c0 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -726,10 +726,13 @@ void XSecController::exportSignature(
             // GPG or X509 key?
             if (!signatureInfo.ouGpgCertificate.isEmpty())
             {
+                pAttributeList = new SvXMLAttributeList();
+                pAttributeList->AddAttribute("xmlns:loext",
+                                             "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0");
                 /* Write PGPData element */
                 xDocumentHandler->startElement(
                     "PGPData",
-                    cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                    cssu::Reference< cssxs::XAttributeList > (pAttributeList));
                 {
                     /* Write keyid element */
                     xDocumentHandler->startElement(
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index 00054b4f3ef4..bcab9811faf7 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -194,7 +194,7 @@ void SAL_CALL XSecParser::startElement(
             m_ouGpgCertificate.clear();
             m_bInGpgCertificate = true;
         }
-        else if (aName == "PGPOwner")
+        else if (aName == "loext:PGPOwner")
         {
             m_ouGpgOwner.clear();
             m_bInGpgOwner = true;
@@ -322,7 +322,7 @@ void SAL_CALL XSecParser::endElement( const OUString& aName )
             m_pXSecController->setGpgCertificate( m_ouGpgCertificate );
             m_bInGpgCertificate = false;
         }
-        else if (aName == "PGPOwner")
+        else if (aName == "loext:PGPOwner")
         {
             m_pXSecController->setGpgOwner( m_ouGpgOwner );
             m_bInGpgOwner = false;


More information about the Libreoffice-commits mailing list