summaryrefslogtreecommitdiff
path: root/connectivity/source/commontools/paramwrapper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/commontools/paramwrapper.cxx')
-rw-r--r--connectivity/source/commontools/paramwrapper.cxx34
1 files changed, 13 insertions, 21 deletions
diff --git a/connectivity/source/commontools/paramwrapper.cxx b/connectivity/source/commontools/paramwrapper.cxx
index a914115d895b..e25a3e7b4905 100644
--- a/connectivity/source/commontools/paramwrapper.cxx
+++ b/connectivity/source/commontools/paramwrapper.cxx
@@ -28,7 +28,8 @@
#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
-#include <tools/diagnose_ex.h>
+#include <o3tl/safeint.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/enumhelper.hxx>
#define PROPERTY_ID_VALUE 1000
@@ -158,7 +159,7 @@ namespace dbtools::param
aProperties = m_xDelegatorPSI->getProperties();
sal_Int32 nProperties( aProperties.getLength() );
aProperties.realloc( nProperties + 1 );
- aProperties[ nProperties ] = Property(
+ aProperties.getArray()[ nProperties ] = Property(
"Value",
PROPERTY_ID_VALUE,
::cppu::UnoType< Any >::get(),
@@ -214,11 +215,7 @@ namespace dbtools::param
}
catch( SQLException& e )
{
- WrappedTargetException aExceptionWrapper;
- aExceptionWrapper.Context = e.Context;
- aExceptionWrapper.Message = e.Message;
- aExceptionWrapper.TargetException <<= e;
- throw aExceptionWrapper;
+ throw WrappedTargetException(e.Message, e.Context, css::uno::Any(e));
}
}
else
@@ -257,13 +254,11 @@ namespace dbtools::param
}
ParameterWrapperContainer::ParameterWrapperContainer()
- :ParameterWrapperContainer_Base( m_aMutex )
{
}
ParameterWrapperContainer::ParameterWrapperContainer( const Reference< XSingleSelectQueryAnalyzer >& _rxComposer )
- :ParameterWrapperContainer_Base( m_aMutex )
{
Reference< XParametersSupplier > xSuppParams( _rxComposer, UNO_QUERY_THROW );
Reference< XIndexAccess > xParameters( xSuppParams->getParameters(), css::uno::UNO_SET_THROW );
@@ -283,7 +278,7 @@ namespace dbtools::param
Type SAL_CALL ParameterWrapperContainer::getElementType()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
return cppu::UnoType<XPropertySet>::get();
}
@@ -291,7 +286,7 @@ namespace dbtools::param
sal_Bool SAL_CALL ParameterWrapperContainer::hasElements()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
return !m_aParameters.empty();
}
@@ -299,7 +294,7 @@ namespace dbtools::param
sal_Int32 SAL_CALL ParameterWrapperContainer::getCount()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
return m_aParameters.size();
}
@@ -307,19 +302,19 @@ namespace dbtools::param
Any SAL_CALL ParameterWrapperContainer::getByIndex( sal_Int32 _nIndex )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
- if ( ( _nIndex < 0 ) || ( _nIndex >= static_cast<sal_Int32>(m_aParameters.size()) ) )
+ if ( ( _nIndex < 0 ) || ( o3tl::make_unsigned(_nIndex) >= m_aParameters.size() ) )
throw IndexOutOfBoundsException();
- return makeAny( Reference< XPropertySet >( m_aParameters[ _nIndex ] ) );
+ return Any( Reference< XPropertySet >( m_aParameters[ _nIndex ] ) );
}
Reference< XEnumeration > ParameterWrapperContainer::createEnumeration()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
return new ::comphelper::OEnumerationByIndex( static_cast< XIndexAccess* >( this ) );
@@ -328,16 +323,13 @@ namespace dbtools::param
void ParameterWrapperContainer::impl_checkDisposed_throw()
{
- if ( rBHelper.bDisposed )
+ if ( m_bDisposed )
throw DisposedException( OUString(), *this );
}
- void SAL_CALL ParameterWrapperContainer::disposing()
+ void ParameterWrapperContainer::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- impl_checkDisposed_throw();
-
for (const auto& rxParam : m_aParameters)
{
rxParam->dispose();