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

Noel Grandin noel at peralex.com
Fri Jun 24 08:13:20 UTC 2016


 comphelper/source/misc/simplefileaccessinteraction.cxx |    5 
 comphelper/source/misc/stillreadwriteinteraction.cxx   |    3 
 include/ucbhelper/interactionrequest.hxx               |    2 
 include/ucbhelper/interceptedinteraction.hxx           |   18 --
 include/ucbhelper/resultsetmetadata.hxx                |   39 -----
 ucbhelper/source/client/interceptedinteraction.cxx     |    6 
 ucbhelper/source/provider/interactionrequest.cxx       |    2 
 ucbhelper/source/provider/resultsetmetadata.cxx        |  111 +++--------------
 8 files changed, 23 insertions(+), 163 deletions(-)

New commits:
commit 29bea29ec1a56255455f855e2b29321553cb524c
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Jun 23 15:58:08 2016 +0200

    loplugin:singlevalfields in ucbhelper
    
    Change-Id: I738bda6e6e161fb5ea96bd496a21ccf72680cd7f
    Reviewed-on: https://gerrit.libreoffice.org/26604
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/comphelper/source/misc/simplefileaccessinteraction.cxx b/comphelper/source/misc/simplefileaccessinteraction.cxx
index c513d49..5f59921 100644
--- a/comphelper/source/misc/simplefileaccessinteraction.cxx
+++ b/comphelper/source/misc/simplefileaccessinteraction.cxx
@@ -39,35 +39,30 @@ SimpleFileAccessInteraction::SimpleFileAccessInteraction(
     aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
     aInterceptedRequest.Request <<= css::ucb::InteractiveIOException();
     aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
-    aInterceptedRequest.MatchExact = false;
     lInterceptions.push_back(aInterceptedRequest);
 
     //intercept internal error
     aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION;
     aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException();
     aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
-    aInterceptedRequest.MatchExact = false;
     lInterceptions.push_back(aInterceptedRequest);
 
     //intercept network error exception (WebDAV ucp provider)
     aInterceptedRequest.Handle = HANDLE_INTERACTIVENETWORKEXCEPTION;
     aInterceptedRequest.Request <<= css::ucb::InteractiveNetworkException();
     aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
-    aInterceptedRequest.MatchExact = false;
     lInterceptions.push_back(aInterceptedRequest);
 
     //intercept certificate validation request (WebDAV ucp provider)
     aInterceptedRequest.Handle = HANDLE_CERTIFICATEREQUEST;
     aInterceptedRequest.Request <<= css::ucb::CertificateValidationRequest();
     aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
-    aInterceptedRequest.MatchExact = false;
     lInterceptions.push_back(aInterceptedRequest);
 
     //intercept authentication request (WebDAV ucp provider)
     aInterceptedRequest.Handle = HANDLE_AUTHENTICATIONREQUEST;
     aInterceptedRequest.Request <<= css::ucb::AuthenticationRequest();
     aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get();
-    aInterceptedRequest.MatchExact = false;
     lInterceptions.push_back(aInterceptedRequest);
 
     setInterceptedHandler(xHandler);
diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx
index d1d9c2c..8b80d5c 100644
--- a/comphelper/source/misc/stillreadwriteinteraction.cxx
+++ b/comphelper/source/misc/stillreadwriteinteraction.cxx
@@ -44,19 +44,16 @@ StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference<
     aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
     aInterceptedRequest.Request <<= css::ucb::InteractiveIOException();
     aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
-    aInterceptedRequest.MatchExact = false;
     lInterceptions.push_back(aInterceptedRequest);
 
     aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION;
     aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException();
     aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
-    aInterceptedRequest.MatchExact = false;
     lInterceptions.push_back(aInterceptedRequest);
 
     aInterceptedRequest.Handle = HANDLE_AUTHENTICATIONREQUESTEXCEPTION;
     aInterceptedRequest.Request <<= css::ucb::AuthenticationRequest();
     aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get();
-    aInterceptedRequest.MatchExact = false;
     lInterceptions.push_back(aInterceptedRequest);
 
     setInterceptedHandler(xHandler);
diff --git a/include/ucbhelper/interactionrequest.hxx b/include/ucbhelper/interactionrequest.hxx
index 8aef29e..ada7a1c 100644
--- a/include/ucbhelper/interactionrequest.hxx
+++ b/include/ucbhelper/interactionrequest.hxx
@@ -346,7 +346,6 @@ class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication :
     bool m_bCanSetPassword : 1;
     bool m_bCanSetAccount  : 1;
     bool m_bCanUseSystemCredentials     : 1;
-    bool m_bDefaultUseSystemCredentials : 1;
     bool m_bUseSystemCredentials        : 1;
 
 public:
@@ -530,7 +529,6 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
   m_bCanSetPassword( bCanSetPassword ),
   m_bCanSetAccount( bCanSetAccount ),
   m_bCanUseSystemCredentials( bCanUseSystemCredentials ),
-  m_bDefaultUseSystemCredentials( false ),
   m_bUseSystemCredentials( false )
 {
 }
diff --git a/include/ucbhelper/interceptedinteraction.hxx b/include/ucbhelper/interceptedinteraction.hxx
index 50dae33..3bc55df 100644
--- a/include/ucbhelper/interceptedinteraction.hxx
+++ b/include/ucbhelper/interceptedinteraction.hxx
@@ -64,23 +64,6 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public ::cppu::WeakImplHelper
             css::uno::Type Continuation;
 
 
-            /** @short  specify, if both interactions must have the same type
-                        or can be derived from.
-
-                @descr  Interaction base on exceptions - and exceptions are real types.
-                        So they can be checked in its type. These parameter "MatchExact"
-                        influence the type-check in the following way:
-                            TRUE  => the exception will be intercepted only
-                                     if it supports exactly the same type ...
-                                     or
-                            FALSE => derived exceptions will be intercepted too.
-
-                @attention  This parameter does not influence the check of the continuation
-                            type! The continuation must be matched exactly every time ...
-             */
-            bool MatchExact;
-
-
             /** @short  its an unique identifier, which must be managed by the outside code.
 
                 @descr  If there is a derived class, which overwrites the InterceptedInteraction::intercepted()
@@ -98,7 +81,6 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public ::cppu::WeakImplHelper
              */
             InterceptedRequest()
             {
-                MatchExact = false;
                 Handle     = INVALID_HANDLE;
             }
 
diff --git a/include/ucbhelper/resultsetmetadata.hxx b/include/ucbhelper/resultsetmetadata.hxx
index 079a320..209e0da 100644
--- a/include/ucbhelper/resultsetmetadata.hxx
+++ b/include/ucbhelper/resultsetmetadata.hxx
@@ -57,18 +57,6 @@ struct ResultSetColumnData
     /** @see ResultSetMetaData::isCaseSensitive */
     bool        isCaseSensitive;
 
-    /** @see ResultSetMetaData::isSearchable */
-    bool        isSearchable;
-
-    /** @see ResultSetMetaData::isCurrency */
-    bool        isCurrency;
-
-    /** @see ResultSetMetaData::isNullable */
-    sal_Int32       isNullable;
-
-    /** @see ResultSetMetaData::isSigned */
-    bool        isSigned;
-
     /** @see ResultSetMetaData::getColumnDisplaySize */
     sal_Int32       columnDisplaySize;
 
@@ -78,12 +66,6 @@ struct ResultSetColumnData
     /** @see ResultSetMetaData::getSchemaName */
     OUString schemaName;
 
-    /** @see ResultSetMetaData::getPrecision */
-    sal_Int32       precision;
-
-    /** @see ResultSetMetaData::getScale */
-    sal_Int32       scale;
-
     /** @see ResultSetMetaData::getTableName */
     OUString tableName;
 
@@ -93,15 +75,6 @@ struct ResultSetColumnData
     /** @see ResultSetMetaData::getColumnTypeName */
     OUString columnTypeName;
 
-    /** @see ResultSetMetaData::isReadOnly */
-    bool        isReadOnly;
-
-    /** @see ResultSetMetaData::isWritable */
-    bool        isWritable;
-
-    /** @see ResultSetMetaData::isDefinitelyWritable */
-    bool        isDefinitelyWritable;
-
     /** @see ResultSetMetaData::getColumnServiceName */
     OUString columnServiceName;
 
@@ -114,16 +87,7 @@ struct ResultSetColumnData
 ResultSetColumnData::ResultSetColumnData()
 : isAutoIncrement( false ),
   isCaseSensitive( true ),
-  isSearchable( false ),
-  isCurrency( false ),
-  isNullable( css::sdbc::ColumnValue::NULLABLE ),
-  isSigned( false ),
-  columnDisplaySize( 16 ),
-  precision( -1 ),
-  scale( 0 ),
-  isReadOnly( true ),
-  isWritable( false ),
-  isDefinitelyWritable( false )
+  columnDisplaySize( 16 )
 {
 }
 
@@ -145,7 +109,6 @@ private:
 protected:
     css::uno::Reference< css::uno::XComponentContext >    m_xContext;
     css::uno::Sequence< css::beans::Property >            m_aProps;
-    bool m_bReadOnly;
 
 public:
 
diff --git a/ucbhelper/source/client/interceptedinteraction.cxx b/ucbhelper/source/client/interceptedinteraction.cxx
index fdd26ce..a03d6dc 100644
--- a/ucbhelper/source/client/interceptedinteraction.cxx
+++ b/ucbhelper/source/client/interceptedinteraction.cxx
@@ -115,11 +115,7 @@ InterceptedInteraction::EInterceptionState InterceptedInteraction::impl_intercep
         css::uno::Type aInterceptedType = rInterception.Request.getValueType();
 
         // check the request
-        bool bMatch = false;
-        if (rInterception.MatchExact)
-            bMatch = aInterceptedType.equals(aRequestType);
-        else
-            bMatch = aInterceptedType.isAssignableFrom(aRequestType); // don't change intercepted and request type here -> it will check the wrong direction!
+        bool bMatch = aInterceptedType.isAssignableFrom(aRequestType); // don't change intercepted and request type here -> it will check the wrong direction!
 
         // intercepted ...
         // Call they might existing derived class, so they can handle that by its own.
diff --git a/ucbhelper/source/provider/interactionrequest.cxx b/ucbhelper/source/provider/interactionrequest.cxx
index 38c661b..79fc870 100644
--- a/ucbhelper/source/provider/interactionrequest.cxx
+++ b/ucbhelper/source/provider/interactionrequest.cxx
@@ -758,7 +758,7 @@ InteractionSupplyAuthentication::canUseSystemCredentials(
         sal_Bool& Default )
     throw ( uno::RuntimeException, std::exception )
 {
-    Default = m_bDefaultUseSystemCredentials;
+    Default = false;
     return m_bCanUseSystemCredentials;
 }
 
diff --git a/ucbhelper/source/provider/resultsetmetadata.cxx b/ucbhelper/source/provider/resultsetmetadata.cxx
index b1b620f..0b84e84 100644
--- a/ucbhelper/source/provider/resultsetmetadata.cxx
+++ b/ucbhelper/source/provider/resultsetmetadata.cxx
@@ -83,8 +83,7 @@ ResultSetMetaData::ResultSetMetaData(
                         const Sequence< Property >& rProps )
 : m_pImpl( new ResultSetMetaData_Impl( rProps.getLength() ) ),
   m_xContext( rxContext ),
-  m_aProps( rProps ),
-  m_bReadOnly( true )
+  m_aProps( rProps )
 {
 }
 
@@ -95,8 +94,7 @@ ResultSetMetaData::ResultSetMetaData(
                         const std::vector< ResultSetColumnData >& rColumnData )
 : m_pImpl( new ResultSetMetaData_Impl( rColumnData ) ),
   m_xContext( rxContext ),
-  m_aProps( rProps ),
-  m_bReadOnly( true )
+  m_aProps( rProps )
 {
     OSL_ENSURE( rColumnData.size() == sal_uInt32( rProps.getLength() ),
                 "ResultSetMetaData ctor - different array sizes!" );
@@ -180,64 +178,34 @@ sal_Bool SAL_CALL ResultSetMetaData::isCaseSensitive( sal_Int32 column )
 
 
 // virtual
-sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 column )
+sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 /*column*/ )
     throw( SQLException, RuntimeException, std::exception )
 {
-    /*
-        Checks whether the value stored in column can be used in a
-        WHERE clause.
-     */
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return false;
-
-    return m_pImpl->m_aColumnData[ column - 1 ].isSearchable;
+    return false;
 }
 
 
 // virtual
-sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 column )
+sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 /*column*/ )
     throw( SQLException, RuntimeException, std::exception )
 {
-    /*
-        Checks whether column is a cash value.
-     */
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return false;
-
-    return m_pImpl->m_aColumnData[ column - 1 ].isCurrency;
+    return false;
 }
 
 
 // virtual
-sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 column )
+sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 /*column*/ )
     throw( SQLException, RuntimeException, std::exception )
 {
-    /*
-        Checks whether a NULL can be stored in column.
-        Possible values: see com/sun/star/sdbc/ColumnValue.idl
-     */
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return ColumnValue::NULLABLE;
-
-    return m_pImpl->m_aColumnData[ column - 1 ].isNullable;
+    return ColumnValue::NULLABLE;
 }
 
 
 // virtual
-sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 column )
+sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 /*column*/ )
     throw( SQLException, RuntimeException, std::exception )
 {
-    /*
-        Checks whether the value stored in column is a signed number.
-     */
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return false;
-
-    return m_pImpl->m_aColumnData[ column - 1 ].isSigned;
+    return false;
 }
 
 
@@ -310,37 +278,18 @@ OUString SAL_CALL ResultSetMetaData::getSchemaName( sal_Int32 column )
 
 
 // virtual
-sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 column )
+sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 /*column*/ )
     throw( SQLException, RuntimeException, std::exception )
 {
-    /*
-        For number types, getprecision gets the number of decimal digits
-        in column.
-        For character types, it gets the maximum length in characters for
-        column.
-        For binary types, it gets the maximum length in bytes for column.
-     */
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return -1;
-
-    return m_pImpl->m_aColumnData[ column - 1 ].precision;
+    return -1;
 }
 
 
 // virtual
-sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 column )
+sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 /*column*/ )
     throw( SQLException, RuntimeException, std::exception )
 {
-    /*
-        Gets the number of digits to the right of the decimal point for
-        values in column.
-     */
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return 0;
-
-    return m_pImpl->m_aColumnData[ column - 1 ].scale;
+    return 0;
 }
 
 
@@ -507,46 +456,26 @@ OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
 
 
 // virtual
-sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 column )
+sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 /*column*/ )
     throw( SQLException, RuntimeException, std::exception )
 {
-    if ( m_pImpl->m_bGlobalReadOnlyValue )
-        return m_bReadOnly;
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return true;
-
-    // autoincrement==true => readonly
-    return m_pImpl->m_aColumnData[ column - 1 ].isAutoIncrement ||
-           m_pImpl->m_aColumnData[ column - 1 ].isReadOnly;
+    return true;
 }
 
 
 // virtual
-sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 column )
+sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 /*column*/ )
     throw( SQLException, RuntimeException, std::exception )
 {
-    if ( m_pImpl->m_bGlobalReadOnlyValue )
-        return !m_bReadOnly;
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return false;
-
-    return m_pImpl->m_aColumnData[ column - 1 ].isWritable;
+    return false;
 }
 
 
 // virtual
-sal_Bool SAL_CALL ResultSetMetaData::isDefinitelyWritable( sal_Int32 column )
+sal_Bool SAL_CALL ResultSetMetaData::isDefinitelyWritable( sal_Int32 /*column*/ )
     throw( SQLException, RuntimeException, std::exception )
 {
-    if ( m_pImpl->m_bGlobalReadOnlyValue )
-        return !m_bReadOnly;
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return false;
-
-    return m_pImpl->m_aColumnData[ column - 1 ].isDefinitelyWritable;
+    return false;
 }
 
 


More information about the Libreoffice-commits mailing list