[Libreoffice-commits] core.git: include/xmloff xmloff/source

Arkadiy Illarionov (via logerrit) logerrit at kemper.freedesktop.org
Sat Sep 14 07:58:34 UTC 2019


 include/xmloff/xmlimp.hxx                   |    1 +
 xmloff/source/core/xmlimp.cxx               |    9 ++++++---
 xmloff/source/transform/MutableAttrList.cxx |    9 ++++++---
 xmloff/source/transform/MutableAttrList.hxx |    1 +
 xmloff/source/transform/OOo2Oasis.cxx       |   15 ++++++++-------
 xmloff/source/transform/OOo2Oasis.hxx       |    1 +
 xmloff/source/transform/Oasis2OOo.cxx       |   15 ++++++++-------
 xmloff/source/transform/Oasis2OOo.hxx       |    1 +
 8 files changed, 32 insertions(+), 20 deletions(-)

New commits:
commit 5c4ba7cb99a7d4e4eefaa132e64d08fdc82ba759
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Sat Sep 7 16:03:28 2019 +0300
Commit:     Arkadiy Illarionov <qarkai at gmail.com>
CommitDate: Sat Sep 14 09:57:48 2019 +0200

    tdf#39593 use isUnoTunnelId in xmloff
    
    Add getUnoTunnelId methods.
    
    Change-Id: I80d3568e65ac66ee65ad589755a20270a27e62a7
    Reviewed-on: https://gerrit.libreoffice.org/78744
    Tested-by: Jenkins
    Reviewed-by: Arkadiy Illarionov <qarkai at gmail.com>

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index d609ae099888..78bc26a7c234 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -343,6 +343,7 @@ public:
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
 
     // XUnoTunnel
+    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() throw();
     virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
 
     // XServiceInfo
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 6c832c7bc8d5..ba715329736a 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -449,12 +449,15 @@ namespace
     class theSvXMLImportUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvXMLImportUnoTunnelId> {};
 }
 
+const css::uno::Sequence<sal_Int8>& SvXMLImport::getUnoTunnelId() throw()
+{
+    return theSvXMLImportUnoTunnelId::get().getSeq();
+}
+
 // XUnoTunnel
 sal_Int64 SAL_CALL SvXMLImport::getSomething( const uno::Sequence< sal_Int8 >& rId )
 {
-    if( rId.getLength() == 16 &&
-        0 == memcmp( theSvXMLImportUnoTunnelId::get().getSeq().getConstArray(),
-                     rId.getConstArray(), 16 ) )
+    if( isUnoTunnelId<SvXMLImport>(rId) )
     {
         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
     }
diff --git a/xmloff/source/transform/MutableAttrList.cxx b/xmloff/source/transform/MutableAttrList.cxx
index ae06de27d3c0..38c500ce23f2 100644
--- a/xmloff/source/transform/MutableAttrList.cxx
+++ b/xmloff/source/transform/MutableAttrList.cxx
@@ -66,13 +66,16 @@ namespace
     class theXMLMutableAttributeListUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theXMLMutableAttributeListUnoTunnelId> {};
 }
 
+const css::uno::Sequence<sal_Int8>& XMLMutableAttributeList::getUnoTunnelId() throw()
+{
+    return theXMLMutableAttributeListUnoTunnelId::get().getSeq();
+}
+
 // XUnoTunnel
 sal_Int64 SAL_CALL XMLMutableAttributeList::getSomething(
         const Sequence< sal_Int8 >& rId )
 {
-    if( rId.getLength() == 16 &&
-        0 == memcmp( theXMLMutableAttributeListUnoTunnelId::get().getSeq().getConstArray(),
-                     rId.getConstArray(), 16 ) )
+    if( isUnoTunnelId<XMLMutableAttributeList>(rId) )
     {
         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
     }
diff --git a/xmloff/source/transform/MutableAttrList.hxx b/xmloff/source/transform/MutableAttrList.hxx
index dd311560c655..ed8950042bee 100644
--- a/xmloff/source/transform/MutableAttrList.hxx
+++ b/xmloff/source/transform/MutableAttrList.hxx
@@ -47,6 +47,7 @@ public:
     virtual ~XMLMutableAttributeList() override;
 
     // XUnoTunnel
+    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() throw();
     virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
 
     // css::xml::sax::XAttributeList
diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx
index d2c2ea35f23c..e5060c3846cd 100644
--- a/xmloff/source/transform/OOo2Oasis.cxx
+++ b/xmloff/source/transform/OOo2Oasis.cxx
@@ -1934,19 +1934,20 @@ namespace
     class theOOo2OasisTransformerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theOOo2OasisTransformerUnoTunnelId> {};
 }
 
+const css::uno::Sequence<sal_Int8>& OOo2OasisTransformer::getUnoTunnelId() throw()
+{
+    return theOOo2OasisTransformerUnoTunnelId::get().getSeq();
+}
+
 // XUnoTunnel
 sal_Int64 SAL_CALL OOo2OasisTransformer::getSomething( const Sequence< sal_Int8 >& rId )
 {
-    if( rId.getLength() == 16
-        && 0 == memcmp( theOOo2OasisTransformerUnoTunnelId::get().getSeq().getConstArray(),
-                        rId.getConstArray(), 16 ) )
+    if( isUnoTunnelId<OOo2OasisTransformer>(rId) )
     {
         return reinterpret_cast< sal_Int64 >( this );
     }
-    else
-    {
-        return sal_Int64(0);
-    }
+
+    return sal_Int64(0);
 }
 
 // XServiceInfo
diff --git a/xmloff/source/transform/OOo2Oasis.hxx b/xmloff/source/transform/OOo2Oasis.hxx
index 7d6244f35aff..7b476447104b 100644
--- a/xmloff/source/transform/OOo2Oasis.hxx
+++ b/xmloff/source/transform/OOo2Oasis.hxx
@@ -79,6 +79,7 @@ public:
     virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  ) override;
 
     // XUnoTunnel
+    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() throw();
     virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
 
     // XImporter
diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx
index ff1f6cb346ed..6959d2b55608 100644
--- a/xmloff/source/transform/Oasis2OOo.cxx
+++ b/xmloff/source/transform/Oasis2OOo.cxx
@@ -1926,19 +1926,20 @@ namespace
     class theOasis2OOoTransformerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theOasis2OOoTransformerUnoTunnelId> {};
 }
 
+const css::uno::Sequence<sal_Int8>& Oasis2OOoTransformer::getUnoTunnelId() throw()
+{
+    return theOasis2OOoTransformerUnoTunnelId::get().getSeq();
+}
+
 // XUnoTunnel
 sal_Int64 SAL_CALL Oasis2OOoTransformer::getSomething( const Sequence< sal_Int8 >& rId )
 {
-    if( rId.getLength() == 16
-        && 0 == memcmp( theOasis2OOoTransformerUnoTunnelId::get().getSeq().getConstArray(),
-                        rId.getConstArray(), 16 ) )
+    if( isUnoTunnelId<Oasis2OOoTransformer>(rId) )
     {
         return reinterpret_cast< sal_Int64 >( this );
     }
-    else
-    {
-        return sal_Int64(0);
-    }
+
+    return sal_Int64(0);
 }
 
 // XServiceInfo
diff --git a/xmloff/source/transform/Oasis2OOo.hxx b/xmloff/source/transform/Oasis2OOo.hxx
index 6ac5b332faa4..7a5d9c0ac632 100644
--- a/xmloff/source/transform/Oasis2OOo.hxx
+++ b/xmloff/source/transform/Oasis2OOo.hxx
@@ -50,6 +50,7 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
 
     // XUnoTunnel
+    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() throw();
     virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
 
     virtual OUString GetEventName( const OUString& rName,


More information about the Libreoffice-commits mailing list