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

Stephan Bergmann sbergman at redhat.com
Fri Aug 16 03:35:14 PDT 2013


 comphelper/source/misc/docpasswordrequest.cxx |   40 --------------------------
 include/comphelper/docpasswordrequest.hxx     |   18 +----------
 2 files changed, 2 insertions(+), 56 deletions(-)

New commits:
commit 889da158066e3d0e6bced748d0dd4c7730cf8912
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 16 12:31:07 2013 +0200

    Use cppu::WeakImplHelper
    
    ...and get rid of hand-coded queryInterface implementations that use
    dynamic_cast.  My claim at <http://lists.cs.uiuc.edu/pipermail/cfe-commits/
    Week-of-Mon-20130812/086127.html> "ubsan: check type_info equality via strcmp"
    that "there should not be uses of dynamic_cast involving [UNO] classes in the
    LibreOffice code base" made me wonder...
    
    Change-Id: Ic7702fd00b8e5c79399124c0acf12c80bc71a86f

diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx
index a674f72..c0a59a7 100644
--- a/comphelper/source/misc/docpasswordrequest.cxx
+++ b/comphelper/source/misc/docpasswordrequest.cxx
@@ -106,26 +106,6 @@ SimplePasswordRequest::~SimplePasswordRequest()
 {
 }
 
-/*uno::*/Any SAL_CALL SimplePasswordRequest::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException)
-{
-    return ::cppu::queryInterface ( rType,
-            // OWeakObject interfaces
-            dynamic_cast< XInterface* > ( (XInteractionRequest *) this ),
-            static_cast< XWeak* > ( this ),
-            // my own interfaces
-            static_cast< XInteractionRequest*  > ( this ) );
-}
-
-void SAL_CALL SimplePasswordRequest::acquire(  ) throw ()
-{
-    OWeakObject::acquire();
-}
-
-void SAL_CALL SimplePasswordRequest::release(  ) throw ()
-{
-    OWeakObject::release();
-}
-
 sal_Bool SimplePasswordRequest::isPassword() const
 {
     return mpPassword->isSelected();
@@ -182,26 +162,6 @@ DocPasswordRequest::~DocPasswordRequest()
 {
 }
 
-/*uno::*/Any SAL_CALL DocPasswordRequest::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException)
-{
-    return ::cppu::queryInterface ( rType,
-            // OWeakObject interfaces
-            dynamic_cast< XInterface* > ( (XInteractionRequest *) this ),
-            static_cast< XWeak* > ( this ),
-            // my own interfaces
-            static_cast< XInteractionRequest*  > ( this ) );
-}
-
-void SAL_CALL DocPasswordRequest::acquire(  ) throw ()
-{
-    OWeakObject::acquire();
-}
-
-void SAL_CALL DocPasswordRequest::release(  ) throw ()
-{
-    OWeakObject::release();
-}
-
 sal_Bool DocPasswordRequest::isPassword() const
 {
     return mpPassword->isSelected();
diff --git a/include/comphelper/docpasswordrequest.hxx b/include/comphelper/docpasswordrequest.hxx
index 54a32f5..ffeaacb 100644
--- a/include/comphelper/docpasswordrequest.hxx
+++ b/include/comphelper/docpasswordrequest.hxx
@@ -24,8 +24,6 @@
 #include <com/sun/star/task/PasswordRequestMode.hpp>
 #include <com/sun/star/task/XInteractionRequest.hpp>
 #include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/weak.hxx>
-
 
 namespace comphelper {
 
@@ -44,18 +42,12 @@ enum DocPasswordRequestType
 // ============================================================================
 
 class COMPHELPER_DLLPUBLIC SimplePasswordRequest :
-        public ::com::sun::star::task::XInteractionRequest,
-        public ::cppu::OWeakObject
+        public cppu::WeakImplHelper1<css::task::XInteractionRequest>
 {
 public:
     explicit    SimplePasswordRequest( com::sun::star::task::PasswordRequestMode eMode );
     virtual     ~SimplePasswordRequest();
 
-    // XInterface / OWeakObject
-    virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL acquire(  ) throw ();
-    virtual void SAL_CALL release(  ) throw ();
-
     sal_Bool            isPassword() const;
 
     OUString     getPassword() const;
@@ -78,8 +70,7 @@ private:
     string for a document.
  */
 class COMPHELPER_DLLPUBLIC DocPasswordRequest :
-        public ::com::sun::star::task::XInteractionRequest,
-        public ::cppu::OWeakObject
+        public cppu::WeakImplHelper1<css::task::XInteractionRequest>
 {
 public:
     explicit            DocPasswordRequest(
@@ -89,11 +80,6 @@ public:
                             sal_Bool bPasswordToModify = sal_False );
     virtual             ~DocPasswordRequest();
 
-    // XInterface / OWeakObject
-    virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL acquire(  ) throw ();
-    virtual void SAL_CALL release(  ) throw ();
-
     sal_Bool            isPassword() const;
 
     OUString     getPassword() const;


More information about the Libreoffice-commits mailing list