From 8132d7f9d71d9f6418855d2d6241dae804beeb8b Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 10 Jun 2016 15:52:05 +0200 Subject: o3tl::tryGet on a temporary is dangerous ...so rename to o3tl::tryAccess to make it more obvious that the returned proxy points into the internals of the given Any, and forbid calling o3tl::tryAccess on a temporary Change-Id: Ia412c6b2b06693811b9b7f0076a08bbf97142df9 --- connectivity/source/commontools/dbexception.cxx | 10 ++--- connectivity/source/commontools/dbtools.cxx | 52 +++++++++++----------- .../source/commontools/warningscontainer.cxx | 2 +- .../source/drivers/postgresql/pq_tools.cxx | 24 +++++----- 4 files changed, 44 insertions(+), 44 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx index 38251b71eee2..d1b6baf56411 100644 --- a/connectivity/source/commontools/dbexception.cxx +++ b/connectivity/source/commontools/dbexception.cxx @@ -175,14 +175,14 @@ bool SQLExceptionInfo::isKindOf(TYPE _eType) const SQLExceptionInfo::operator const css::sdbc::SQLException*() const { OSL_ENSURE(isKindOf(TYPE::SQLException), "SQLExceptionInfo::operator SQLException* : invalid call !"); - return o3tl::doGet(m_aContent); + return o3tl::doAccess(m_aContent); } SQLExceptionInfo::operator const css::sdb::SQLContext*() const { OSL_ENSURE(isKindOf(TYPE::SQLContext), "SQLExceptionInfo::operator SQLException* : invalid call !"); - return o3tl::doGet(m_aContent); + return o3tl::doAccess(m_aContent); } @@ -213,7 +213,7 @@ void SQLExceptionInfo::append( TYPE _eType, const OUString& _rErrorMessage, cons break; } - SQLException& pAppendException = const_cast(*o3tl::forceGet(aAppend)); + SQLException& pAppendException = const_cast(*o3tl::forceAccess(aAppend)); pAppendException.Message = _rErrorMessage; pAppendException.SQLState = _rSQLState; pAppendException.ErrorCode = _nErrorCode; @@ -230,7 +230,7 @@ void SQLExceptionInfo::append( TYPE _eType, const OUString& _rErrorMessage, cons if ( !isAssignableFrom( aSQLExceptionType, pChainIterator->getValueType() ) ) break; - pLastException = const_cast< SQLException* >( o3tl::doGet( *pChainIterator ) ); + pLastException = const_cast< SQLException* >( o3tl::doAccess( *pChainIterator ) ); pChainIterator = &pLastException->NextException; } @@ -314,7 +314,7 @@ const css::sdbc::SQLException* SQLExceptionIteratorHelper::next() return pReturn; } - m_pCurrent = o3tl::doGet< SQLException >( m_pCurrent->NextException ); + m_pCurrent = o3tl::doAccess< SQLException >( m_pCurrent->NextException ); // no finally determine the proper type of the exception const Type aTypeContext( ::cppu::UnoType< SQLContext >::get() ); diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index b71ff9aa8cd0..701c64d7e63d 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -1156,14 +1156,14 @@ try { Any aDate( xOldProps->getPropertyValue(sPropDefaultDate) ); if (aDate.hasValue()) - aNewDefault <<= DBTypeConversion::toDouble(*o3tl::doGet(aDate)); + aNewDefault <<= DBTypeConversion::toDouble(*o3tl::doAccess(aDate)); } if (hasProperty(sPropDefaultTime, xOldProps)) { Any aTime( xOldProps->getPropertyValue(sPropDefaultTime) ); if (aTime.hasValue()) - aNewDefault <<= DBTypeConversion::toDouble(*o3tl::doGet