summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-03-01 17:30:16 +0000
committerCaolán McNamara <caolanm@redhat.com>2023-03-01 19:37:05 +0000
commitf6633ad610173d6e22a29124d1903f9e5032ea29 (patch)
tree4f158edef186c68d6628b460d029f3546635b948 /package
parent3e8862b98cbeac6b23a8fd08ead3386f91a4529f (diff)
cid#1521559 pass arg as ref to prove no Dereference before null check
and cid#1521561 Dereference before null check and drop pointless null check Change-Id: I2e99733eb5f1861bb02f6d8ec7a44ace4ded16cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148070 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'package')
-rw-r--r--package/source/xstor/owriteablestream.cxx26
-rw-r--r--package/source/xstor/owriteablestream.hxx4
2 files changed, 14 insertions, 16 deletions
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 859facc6fad2..d41e363137d0 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -1238,9 +1238,9 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
rtl::Reference<OWriteStream> tmp;
if ( !xStream.is() )
- tmp = new OWriteStream( this, bHierarchyAccess );
+ tmp = new OWriteStream( *this, bHierarchyAccess );
else
- tmp = new OWriteStream( this, xStream, bHierarchyAccess );
+ tmp = new OWriteStream( *this, xStream, bHierarchyAccess );
m_pAntiImpl = tmp.get();
return tmp;
@@ -1525,37 +1525,35 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora
// OWriteStream implementation
-OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, bool bTransacted )
-: m_pImpl( pImpl )
-, m_xSharedMutex( pImpl->m_xMutex )
-, m_aListenersContainer( pImpl->m_xMutex->GetMutex() )
+OWriteStream::OWriteStream( OWriteStream_Impl& rImpl, bool bTransacted )
+: m_pImpl( &rImpl )
+, m_xSharedMutex( rImpl.m_xMutex )
+, m_aListenersContainer( rImpl.m_xMutex->GetMutex() )
, m_nStorageType( m_pImpl->m_nStorageType )
, m_bInStreamDisconnected( false )
, m_bInitOnDemand( true )
, m_nInitPosition( 0 )
, m_bTransacted( bTransacted )
{
- OSL_ENSURE( pImpl, "No base implementation!" );
OSL_ENSURE( m_pImpl->m_xMutex.is(), "No mutex!" );
- if ( !m_pImpl || !m_pImpl->m_xMutex.is() )
+ if ( !m_pImpl->m_xMutex.is() )
throw uno::RuntimeException(); // just a disaster
}
-OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStream > const & xStream, bool bTransacted )
-: m_pImpl( pImpl )
-, m_xSharedMutex( pImpl->m_xMutex )
-, m_aListenersContainer( pImpl->m_xMutex->GetMutex() )
+OWriteStream::OWriteStream( OWriteStream_Impl& rImpl, uno::Reference< io::XStream > const & xStream, bool bTransacted )
+: m_pImpl( &rImpl )
+, m_xSharedMutex( rImpl.m_xMutex )
+, m_aListenersContainer( rImpl.m_xMutex->GetMutex() )
, m_nStorageType( m_pImpl->m_nStorageType )
, m_bInStreamDisconnected( false )
, m_bInitOnDemand( false )
, m_nInitPosition( 0 )
, m_bTransacted( bTransacted )
{
- OSL_ENSURE( pImpl && xStream.is(), "No base implementation!" );
OSL_ENSURE( m_pImpl->m_xMutex.is(), "No mutex!" );
- if ( !m_pImpl || !m_pImpl->m_xMutex.is() )
+ if ( !m_pImpl->m_xMutex.is() )
throw uno::RuntimeException(); // just a disaster
if ( xStream.is() )
diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx
index 6b8e886e6748..e04b50c99341 100644
--- a/package/source/xstor/owriteablestream.hxx
+++ b/package/source/xstor/owriteablestream.hxx
@@ -253,8 +253,8 @@ protected:
bool m_bTransacted;
- OWriteStream( OWriteStream_Impl* pImpl, bool bTransacted );
- OWriteStream( OWriteStream_Impl* pImpl, css::uno::Reference< css::io::XStream > const & xStream, bool bTransacted );
+ OWriteStream( OWriteStream_Impl& rImpl, bool bTransacted );
+ OWriteStream( OWriteStream_Impl& rImpl, css::uno::Reference< css::io::XStream > const & xStream, bool bTransacted );
void CloseOutput_Impl();