From 24c17dab2f10ad1b7ba342fbd40dc65b7d8f9b24 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Wed, 12 Jun 2019 12:18:07 +0300 Subject: tdf#39593 extract UnoTunnelId comparison to template function Change-Id: Ia2b5dea273c8de7b8c54e74780193a8d4cba7b45 Reviewed-on: https://gerrit.libreoffice.org/73874 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- animations/source/animcore/animcore.cxx | 2 +- editeng/source/uno/unofield.cxx | 3 +-- editeng/source/uno/unotext.cxx | 6 ++---- include/comphelper/servicehelper.hxx | 13 +++++++++---- include/toolkit/controls/unocontrolmodel.hxx | 2 +- sc/source/ui/app/drwtrans.cxx | 3 +-- sc/source/ui/app/transobj.cxx | 3 +-- sc/source/ui/unoobj/dapiuno.cxx | 4 +--- sc/source/ui/unoobj/docuno.cxx | 4 +--- sc/source/ui/unoobj/nameuno.cxx | 4 +--- sc/source/ui/unoobj/textuno.cxx | 4 +--- sc/source/ui/vba/vbaworksheet.cxx | 3 +-- sd/source/ui/app/sdxfer.cxx | 3 +-- sd/source/ui/dlg/sdtreelb.cxx | 3 +-- sd/source/ui/framework/factories/Pane.cxx | 3 +-- sd/source/ui/framework/factories/ViewShellWrapper.cxx | 3 +-- sd/source/ui/unoidl/DrawController.cxx | 3 +-- sd/source/ui/unoidl/unopage.cxx | 3 +-- starmath/source/mathmlexport.cxx | 4 +--- starmath/source/mathmlimport.cxx | 4 +--- starmath/source/unomodel.cxx | 6 ++---- svx/source/fmcomp/gridcell.cxx | 4 +--- svx/source/unodraw/unoshape.cxx | 2 +- sw/inc/unobaseclass.hxx | 5 ++--- sw/source/core/unocore/TextCursorHelper.cxx | 10 ++++------ sw/source/core/unocore/unochart.cxx | 4 +--- sw/source/core/unocore/unodraw.cxx | 4 +--- sw/source/core/unocore/unoframe.cxx | 4 +--- sw/source/core/unocore/unoport.cxx | 4 +--- sw/source/core/unocore/unoportenum.cxx | 4 +--- sw/source/core/unocore/unosett.cxx | 8 ++------ sw/source/core/unocore/unosrch.cxx | 4 +--- sw/source/core/unocore/unotbl.cxx | 11 +++-------- sw/source/filter/xml/xmlexp.cxx | 4 +--- sw/source/filter/xml/xmlimp.cxx | 4 +--- sw/source/uibase/dochdl/swdtflvr.cxx | 3 +-- sw/source/uibase/uno/unoatxt.cxx | 12 ++++-------- sw/source/uibase/uno/unodispatch.cxx | 6 ++---- sw/source/uibase/uno/unotxdoc.cxx | 6 ++---- sw/source/uibase/uno/unotxvw.cxx | 10 ++++------ toolkit/source/controls/grid/gridcolumn.cxx | 3 ++- toolkit/source/controls/unocontrolmodel.cxx | 4 ++-- vcl/source/graphic/UnoGraphic.cxx | 3 ++- vcl/source/treelist/transfer.cxx | 3 +-- xmloff/source/core/unoatrcn.cxx | 3 +-- xmlsecurity/source/gpg/CertificateImpl.cxx | 2 +- xmlsecurity/source/gpg/SecurityEnvironment.cxx | 2 +- .../source/xmlsec/nss/securityenvironment_nssimpl.cxx | 2 +- xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx | 2 +- 49 files changed, 77 insertions(+), 139 deletions(-) diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index 9078b2fe4649..b7e28dc15c6d 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -1935,7 +1935,7 @@ void SAL_CALL AnimationNode::removeChangesListener( const Reference< XChangesLis // XUnoTunnel ::sal_Int64 SAL_CALL AnimationNode::getSomething( const Sequence< ::sal_Int8 >& rId ) { - if( rId.getLength() == 16 && memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) == 0 ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index ab1b0927dceb..94ca091bead8 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -245,8 +245,7 @@ const css::uno::Sequence< sal_Int8 > & SvxUnoTextField::getUnoTunnelId() throw() sal_Int64 SAL_CALL SvxUnoTextField::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 095a26d65976..a8d80c2fb881 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -2180,8 +2180,7 @@ const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() throw() sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } @@ -2259,8 +2258,7 @@ const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() throw() sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/include/comphelper/servicehelper.hxx b/include/comphelper/servicehelper.hxx index 82c3585a9a7a..435a4c4ff5b7 100644 --- a/include/comphelper/servicehelper.hxx +++ b/include/comphelper/servicehelper.hxx @@ -51,6 +51,13 @@ namespace comphelper { } +template +inline bool isUnoTunnelId(const css::uno::Sequence< sal_Int8 >& rId) +{ + return rId.getLength() == 16 + && memcmp( T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) == 0; +} + /** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function that gives access to your implementation for a given interface reference, if possible. @@ -83,8 +90,7 @@ const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \ UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\ sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \ { \ - if( rId.getLength() == 16 && memcmp( getUnoTunnelId().getConstArray(), \ - rId.getConstArray(), 16 ) == 0 ) \ + if( isUnoTunnelId(rId) ) \ { \ return sal::static_int_cast(reinterpret_cast(this)); \ } \ @@ -95,8 +101,7 @@ sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 > UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\ sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \ { \ - if( rId.getLength() == 16 && memcmp( getUnoTunnelId().getConstArray(), \ - rId.getConstArray(), 16 ) == 0 ) \ + if( isUnoTunnelId(rId) ) \ { \ return sal::static_int_cast(reinterpret_cast(this)); \ } \ diff --git a/include/toolkit/controls/unocontrolmodel.hxx b/include/toolkit/controls/unocontrolmodel.hxx index 28f834b220df..f171a59c364b 100644 --- a/include/toolkit/controls/unocontrolmodel.hxx +++ b/include/toolkit/controls/unocontrolmodel.hxx @@ -132,7 +132,7 @@ public: css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; // css::lang::XUnoTunnel - static const css::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() throw(); sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) override; // css::util::XCloneable diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 8805c63efe80..d159243adb1a 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -750,8 +750,7 @@ const css::uno::Sequence< sal_Int8 >& ScDrawTransferObj::getUnoTunnelId() sal_Int64 SAL_CALL ScDrawTransferObj::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && - ( 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId(rId) ) { nRet = reinterpret_cast< sal_Int64 >( this ); } diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 88d5637222e5..0040c12437e1 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -927,8 +927,7 @@ const css::uno::Sequence< sal_Int8 >& ScTransferObj::getUnoTunnelId() sal_Int64 SAL_CALL ScTransferObj::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && - ( 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId(rId) ) { nRet = reinterpret_cast< sal_Int64 >( this ); } diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 195b2a1b4ac8..3d37f6f9d3d4 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1024,9 +1024,7 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotDescriptorBase::getDataLayoutFi sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething( const Sequence& rId ) { - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if ( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 30067f6ada2d..bbca0b5b6de0 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2855,9 +2855,7 @@ uno::Sequence SAL_CALL ScModelObj::getSupportedServiceNames() sal_Int64 SAL_CALL ScModelObj::getSomething( const uno::Sequence& rId ) { - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if ( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx index e2fb3da5b154..42e6a836a1b2 100644 --- a/sc/source/ui/unoobj/nameuno.cxx +++ b/sc/source/ui/unoobj/nameuno.cxx @@ -426,9 +426,7 @@ uno::Sequence SAL_CALL ScNamedRangeObj::getSupportedServiceNames() sal_Int64 SAL_CALL ScNamedRangeObj::getSomething( const uno::Sequence& rId ) { - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if ( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index c62d834a4475..59f1b724442f 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -137,9 +137,7 @@ uno::Reference SAL_CALL ScHeaderFooterContentObj::getRightText() sal_Int64 SAL_CALL ScHeaderFooterContentObj::getSomething( const uno::Sequence& rId ) { - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if ( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index 3ff470e89467..f579abf7005f 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -1042,8 +1042,7 @@ ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::A sal_Int64 SAL_CALL ScVbaWorksheet::getSomething(const uno::Sequence & rId) { - if (rId.getLength() == 16 && - 0 == memcmp( ScVbaWorksheet::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 )) + if (isUnoTunnelId(rId)) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index fbee5519085e..5d042ff64c5a 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -707,8 +707,7 @@ sal_Int64 SAL_CALL SdTransferable::getSomething( const css::uno::Sequence< sal_I { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && - ( 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId(rId) ) { nRet = sal::static_int_cast(reinterpret_cast(this)); } diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index e2707d03928c..10af8fb6559b 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -142,8 +142,7 @@ sal_Int64 SAL_CALL SdPageObjsTLB::SdPageObjsTransferable::getSomething( const cs { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && - ( 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId(rId) ) { nRet = static_cast(reinterpret_cast(this)); } diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx index 0245cdbb357f..265eb5636952 100644 --- a/sd/source/ui/framework/factories/Pane.cxx +++ b/sd/source/ui/framework/factories/Pane.cxx @@ -151,8 +151,7 @@ sal_Int64 SAL_CALL Pane::getSomething (const Sequence& rId) { sal_Int64 nResult = 0; - if (rId.getLength() == 16 - && memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0) + if (isUnoTunnelId(rId)) { nResult = reinterpret_cast(this); } diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index b63941541982..37cce7586b4f 100644 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -225,8 +225,7 @@ sal_Int64 SAL_CALL ViewShellWrapper::getSomething (const Sequence& rId { sal_Int64 nResult = 0; - if (rId.getLength() == 16 - && memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0) + if (isUnoTunnelId(rId)) { nResult = reinterpret_cast(this); } diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index 2ed605bc2bf9..558d9f5fb3fd 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -573,8 +573,7 @@ sal_Int64 SAL_CALL DrawController::getSomething (const Sequence& rId) { sal_Int64 nResult = 0; - if (rId.getLength() == 16 - && memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0) + if (isUnoTunnelId(rId)) { nResult = sal::static_int_cast(reinterpret_cast(this)); } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 6e7bca18d24f..4b2982ca115f 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -332,8 +332,7 @@ const css::uno::Sequence< sal_Int8 > & SdGenericDrawPage::getUnoTunnelId() throw sal_Int64 SAL_CALL SdGenericDrawPage::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index aa850f62f29b..3c0d3ff891c4 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -352,9 +352,7 @@ SmXMLExport::SmXMLExport( sal_Int64 SAL_CALL SmXMLExport::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if ( isUnoTunnelId(rId) ) return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); return SvXMLExport::getSomething( rId ); diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 28b3800f9a7f..946c8e240a7c 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -458,9 +458,7 @@ Math_XMLOasisSettingsImporter_get_implementation(uno::XComponentContext* pCtx, sal_Int64 SAL_CALL SmXMLImport::getSomething( const uno::Sequence< sal_Int8 >&rId ) { - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if ( isUnoTunnelId(rId) ) return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); return SvXMLImport::getSomething( rId ); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index c271f079d9d3..db7668ad08c6 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -365,11 +365,9 @@ const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId() sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); + return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); } return SfxBaseModel::getSomething( rId ); diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index db802b41a2d6..09251caaee8d 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -4545,9 +4545,7 @@ sal_Int64 SAL_CALL FmXFilterCell::getSomething( const Sequence< sal_Int8 >& _rId { sal_Int64 nReturn(0); - if ( (_rIdentifier.getLength() == 16) - && (0 == memcmp( getUnoTunnelId().getConstArray(), _rIdentifier.getConstArray(), 16 )) - ) + if ( isUnoTunnelId(_rIdentifier) ) { nReturn = reinterpret_cast(this); } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index d7f665bc9253..7dee8bc71e30 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -297,7 +297,7 @@ const css::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() throw() sal_Int64 SAL_CALL SvxShape::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx index 674901c36a12..5ca6bd074873 100644 --- a/sw/inc/unobaseclass.hxx +++ b/sw/inc/unobaseclass.hxx @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -114,9 +115,7 @@ namespace sw { UnoTunnelImpl(const css::uno::Sequence< sal_Int8 > & rId, C *const pThis) { - if ((rId.getLength() == 16) && - (0 == memcmp(C::getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16))) + if (isUnoTunnelId(rId)) { return ::sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(pThis) ); diff --git a/sw/source/core/unocore/TextCursorHelper.cxx b/sw/source/core/unocore/TextCursorHelper.cxx index df4a49001ba4..f8bf5dd9a026 100644 --- a/sw/source/core/unocore/TextCursorHelper.cxx +++ b/sw/source/core/unocore/TextCursorHelper.cxx @@ -37,12 +37,10 @@ const uno::Sequence< sal_Int8 > & OTextCursorHelper::getUnoTunnelId() sal_Int64 SAL_CALL OTextCursorHelper::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } + if( isUnoTunnelId(rId) ) + { + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); + } return 0; } diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index db84c2e13a2c..895cf5b7e5c3 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1901,9 +1901,7 @@ const uno::Sequence< sal_Int8 > & SwChartDataSequence::getUnoTunnelId() sal_Int64 SAL_CALL SwChartDataSequence::getSomething( const uno::Sequence< sal_Int8 > &rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index f3f4dfbf4115..69eefbb45a06 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -850,9 +850,7 @@ const uno::Sequence< sal_Int8 > & SwXShape::getUnoTunnelId() sal_Int64 SAL_CALL SwXShape::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 2481e6d4b661..5ed7b51c6cc6 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1174,9 +1174,7 @@ const ::uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId() sal_Int64 SAL_CALL SwXFrame::getSomething( const ::uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index e97e65b32f98..3e580633b0ab 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -787,9 +787,7 @@ const uno::Sequence< sal_Int8 > & SwXTextPortion::getUnoTunnelId() sal_Int64 SwXTextPortion::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index b80c9d5dd8ac..bf7fca58e5fc 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -310,9 +310,7 @@ const uno::Sequence< sal_Int8 > & SwXTextPortionEnumeration::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextPortionEnumeration::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) ); } diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index f58685cd2ba6..2da70bd5cdcc 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1040,9 +1040,7 @@ const uno::Sequence< sal_Int8 > & SwXNumberingRules::getUnoTunnelId() // return implementation specific data sal_Int64 SwXNumberingRules::getSomething( const uno::Sequence< sal_Int8 > & rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } @@ -2555,9 +2553,7 @@ const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx index c324ab47d1b8..603c4063e5d4 100644 --- a/sw/source/core/unocore/unosrch.cxx +++ b/sw/source/core/unocore/unosrch.cxx @@ -463,9 +463,7 @@ const uno::Sequence< sal_Int8 > & SwXTextSearch::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextSearch::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 57d645baf495..48438301f112 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -773,9 +773,7 @@ const uno::Sequence< sal_Int8 > & SwXCell::getUnoTunnelId() sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } @@ -2018,8 +2016,7 @@ const uno::Sequence< sal_Int8 > & SwXTextTable::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextTable::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if(rId.getLength() == 16 - && 0 == memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16)) + if(isUnoTunnelId(rId)) { return sal::static_int_cast(reinterpret_cast(this)); } @@ -3222,9 +3219,7 @@ const uno::Sequence< sal_Int8 > & SwXCellRange::getUnoTunnelId() sal_Int64 SAL_CALL SwXCellRange::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 20457677a024..28745ab2f023 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -489,9 +489,7 @@ const Sequence< sal_Int8 > & SwXMLExport::getUnoTunnelId() throw() sal_Int64 SAL_CALL SwXMLExport::getSomething( const Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index fcfdd47b6231..1c633585c8d1 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -471,9 +471,7 @@ const Sequence< sal_Int8 > & SwXMLImport::getUnoTunnelId() throw() sal_Int64 SAL_CALL SwXMLImport::getSomething( const Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 0d5a46119ab3..a786c4e352b3 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -3898,8 +3898,7 @@ const Sequence< sal_Int8 >& SwTransferable::getUnoTunnelId() sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId ) { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && - ( 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId(rId) ) { nRet = sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) ); } diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 4987717d9a25..1e3fe183463b 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -222,11 +222,9 @@ const uno::Sequence< sal_Int8 > & SwXAutoTextGroup::getUnoTunnelId() sal_Int64 SAL_CALL SwXAutoTextGroup::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); } return 0; } @@ -689,11 +687,9 @@ const uno::Sequence< sal_Int8 > & SwXAutoTextEntry::getUnoTunnelId() sal_Int64 SAL_CALL SwXAutoTextEntry::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); } return 0; } diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx index 40353c7baba3..822b467d35ad 100644 --- a/sw/source/uibase/uno/unodispatch.cxx +++ b/sw/source/uibase/uno/unodispatch.cxx @@ -163,11 +163,9 @@ const uno::Sequence< sal_Int8 > & SwXDispatchProviderInterceptor::getUnoTunnelId sal_Int64 SwXDispatchProviderInterceptor::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) { - if( aIdentifier.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - aIdentifier.getConstArray(), 16 ) ) + if( isUnoTunnelId(aIdentifier) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); } return 0; } diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 3299a6f043e9..6dd0738d85d1 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -298,11 +298,9 @@ const Sequence< sal_Int8 > & SwXTextDocument::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); } if( rId.getLength() == 16 && 0 == memcmp( SfxObjectShell::getUnoTunnelId().getConstArray(), diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 9bc4abcfd985..dd04e6f53a5f 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -1680,12 +1680,10 @@ const uno::Sequence< sal_Int8 > & SwXTextViewCursor::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextViewCursor::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); - } + if( isUnoTunnelId(rId) ) + { + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + } return OTextCursorHelper::getSomething(rId); } diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx index 5b52b183daf4..5cada204bc77 100644 --- a/toolkit/source/controls/grid/gridcolumn.cxx +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -285,7 +286,7 @@ namespace toolkit sal_Int64 SAL_CALL GridColumn::getSomething( const Sequence< sal_Int8 >& i_identifier ) { - if ( ( i_identifier.getLength() == 16 ) && ( i_identifier == getUnoTunnelId() ) ) + if ( isUnoTunnelId(i_identifier) ) return ::sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) ); return 0; } diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 8b9b09fe489f..b81f7ae49d83 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -433,14 +433,14 @@ namespace class theUnoControlModelUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theUnoControlModelUnoTunnelId> {}; } -const css::uno::Sequence< sal_Int8 >& UnoControlModel::GetUnoTunnelId() throw() +const css::uno::Sequence< sal_Int8 >& UnoControlModel::getUnoTunnelId() throw() { return theUnoControlModelUnoTunnelId::get().getSeq(); } sal_Int64 UnoControlModel::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) { - if( ( rIdentifier.getLength() == 16 ) && ( memcmp( UnoControlModel::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) == 0 ) ) + if( isUnoTunnelId(rIdentifier) ) return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); return 0; diff --git a/vcl/source/graphic/UnoGraphic.cxx b/vcl/source/graphic/UnoGraphic.cxx index f546389663b1..447d8d451921 100644 --- a/vcl/source/graphic/UnoGraphic.cxx +++ b/vcl/source/graphic/UnoGraphic.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -183,7 +184,7 @@ uno::Sequence SAL_CALL Graphic::getMaskDIB() sal_Int64 SAL_CALL Graphic::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - return( ( rId.getLength() == 16 && 0 == memcmp( ::Graphic::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ? + return( ( isUnoTunnelId<::Graphic>(rId) ) ? reinterpret_cast(&maGraphic) : 0 ); } diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index a0727a2f464a..e187dd9e8876 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -503,8 +503,7 @@ sal_Int64 SAL_CALL TransferableHelper::getSomething( const Sequence< sal_Int8 >& { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && - ( 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId(rId) ) { nRet = sal::static_int_cast(reinterpret_cast(this)); } diff --git a/xmloff/source/core/unoatrcn.cxx b/xmloff/source/core/unoatrcn.cxx index 7af1bf24d72c..8c858cca2ca2 100644 --- a/xmloff/source/core/unoatrcn.cxx +++ b/xmloff/source/core/unoatrcn.cxx @@ -99,8 +99,7 @@ const css::uno::Sequence< sal_Int8 > & SvUnoAttributeContainer::getUnoTunnelId() sal_Int64 SAL_CALL SvUnoAttributeContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId(rId) ) { return sal::static_int_cast(reinterpret_cast(this)); } diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx index 3b005629ba7a..525706e26748 100644 --- a/xmlsecurity/source/gpg/CertificateImpl.cxx +++ b/xmlsecurity/source/gpg/CertificateImpl.cxx @@ -197,7 +197,7 @@ sal_Int32 SAL_CALL CertificateImpl::getCertificateUsage() /* XUnoTunnel */ sal_Int64 SAL_CALL CertificateImpl::getSomething(const Sequence< sal_Int8 >& aIdentifier) { - if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { + if( isUnoTunnelId(aIdentifier) ) { return sal::static_int_cast(reinterpret_cast(this)); } return 0 ; diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx index 42fa728d83f4..468738f34c33 100644 --- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx +++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx @@ -92,7 +92,7 @@ SecurityEnvironmentGpg::~SecurityEnvironmentGpg() /* XUnoTunnel */ sal_Int64 SAL_CALL SecurityEnvironmentGpg::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { + if( isUnoTunnelId(aIdentifier) ) { return sal::static_int_cast(reinterpret_cast(this)); } return 0 ; diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 6892052011b2..4c03131c07f2 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -154,7 +154,7 @@ Sequence< OUString > SAL_CALL SecurityEnvironment_NssImpl::getSupportedServiceNa /* XUnoTunnel */ sal_Int64 SAL_CALL SecurityEnvironment_NssImpl::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { + if( isUnoTunnelId(aIdentifier) ) { return sal::static_int_cast(reinterpret_cast(this)); } return 0 ; diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index 374c9f83671e..1a323d33f32f 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -343,7 +343,7 @@ SECKEYPrivateKey* X509Certificate_NssImpl::getPrivateKey() /* XUnoTunnel */ sal_Int64 SAL_CALL X509Certificate_NssImpl::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { + if( isUnoTunnelId(aIdentifier) ) { return sal::static_int_cast(reinterpret_cast(this)); } return 0 ; -- cgit