summaryrefslogtreecommitdiff
path: root/package/source/xstor/owriteablestream.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-03-12 18:16:57 +0100
committerMichael Stahl <mstahl@redhat.com>2015-03-12 20:22:11 +0100
commit2877e5a9c7507acc9282e70323259b5c043dda0c (patch)
treea2290b768df9b7c70ce59878037903c6883567c8 /package/source/xstor/owriteablestream.cxx
parentcd347b3b34343d696a3c90352ff91eb64a1057b0 (diff)
package: PVS-Studio V595 'm_pData' pointer could be null
... just convert its explicitly deleted member to unique_ptr. Change-Id: I826257ff512632a2aedd53a7ce5e4bedf49c3cfe
Diffstat (limited to 'package/source/xstor/owriteablestream.cxx')
-rw-r--r--package/source/xstor/owriteablestream.cxx31
1 files changed, 14 insertions, 17 deletions
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 31a99df4d141..cf20db3e4d38 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -1728,9 +1728,6 @@ OWriteStream::~OWriteStream()
}
}
- if ( m_pData && m_pData->m_pTypeCollection )
- delete m_pData->m_pTypeCollection;
-
delete m_pData;
}
@@ -1922,11 +1919,11 @@ void SAL_CALL OWriteStream::release() throw()
uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes()
throw( uno::RuntimeException, std::exception )
{
- if ( m_pData->m_pTypeCollection == NULL )
+ if (! m_pData->m_pTypeCollection)
{
::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() );
- if ( m_pData->m_pTypeCollection == NULL )
+ if (! m_pData->m_pTypeCollection)
{
if ( m_bTransacted )
{
@@ -1946,13 +1943,13 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes()
, cppu::UnoType<embed::XTransactedObject>::get()
, cppu::UnoType<embed::XTransactionBroadcaster>::get());
- m_pData->m_pTypeCollection = new ::cppu::OTypeCollection
+ m_pData->m_pTypeCollection.reset(new ::cppu::OTypeCollection
( cppu::UnoType<beans::XPropertySet>::get()
- , aTmpCollection.getTypes() );
+ , aTmpCollection.getTypes()));
}
else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML )
{
- m_pData->m_pTypeCollection = new ::cppu::OTypeCollection
+ m_pData->m_pTypeCollection.reset(new ::cppu::OTypeCollection
( cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<io::XInputStream>::get()
, cppu::UnoType<io::XOutputStream>::get()
@@ -1964,11 +1961,11 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes()
, cppu::UnoType<embed::XExtendedStorageStream>::get()
, cppu::UnoType<embed::XTransactedObject>::get()
, cppu::UnoType<embed::XTransactionBroadcaster>::get()
- , cppu::UnoType<beans::XPropertySet>::get());
+ , cppu::UnoType<beans::XPropertySet>::get()));
}
else // if ( m_pData->m_nStorageType == embed::StorageFormats::ZIP )
{
- m_pData->m_pTypeCollection = new ::cppu::OTypeCollection
+ m_pData->m_pTypeCollection.reset(new ::cppu::OTypeCollection
( cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<io::XInputStream>::get()
, cppu::UnoType<io::XOutputStream>::get()
@@ -1979,14 +1976,14 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes()
, cppu::UnoType<embed::XExtendedStorageStream>::get()
, cppu::UnoType<embed::XTransactedObject>::get()
, cppu::UnoType<embed::XTransactionBroadcaster>::get()
- , cppu::UnoType<beans::XPropertySet>::get());
+ , cppu::UnoType<beans::XPropertySet>::get()));
}
}
else
{
if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE )
{
- m_pData->m_pTypeCollection = new ::cppu::OTypeCollection
+ m_pData->m_pTypeCollection.reset(new ::cppu::OTypeCollection
( cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<io::XInputStream>::get()
, cppu::UnoType<io::XOutputStream>::get()
@@ -1996,11 +1993,11 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes()
, cppu::UnoType<lang::XComponent>::get()
, cppu::UnoType<embed::XEncryptionProtectedSource2>::get()
, cppu::UnoType<embed::XEncryptionProtectedSource>::get()
- , cppu::UnoType<beans::XPropertySet>::get());
+ , cppu::UnoType<beans::XPropertySet>::get()));
}
else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML )
{
- m_pData->m_pTypeCollection = new ::cppu::OTypeCollection
+ m_pData->m_pTypeCollection.reset(new ::cppu::OTypeCollection
( cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<io::XInputStream>::get()
, cppu::UnoType<io::XOutputStream>::get()
@@ -2009,11 +2006,11 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes()
, cppu::UnoType<io::XTruncate>::get()
, cppu::UnoType<lang::XComponent>::get()
, cppu::UnoType<embed::XRelationshipAccess>::get()
- , cppu::UnoType<beans::XPropertySet>::get());
+ , cppu::UnoType<beans::XPropertySet>::get()));
}
else // if ( m_pData->m_nStorageType == embed::StorageFormats::ZIP )
{
- m_pData->m_pTypeCollection = new ::cppu::OTypeCollection
+ m_pData->m_pTypeCollection.reset(new ::cppu::OTypeCollection
( cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<io::XInputStream>::get()
, cppu::UnoType<io::XOutputStream>::get()
@@ -2021,7 +2018,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes()
, cppu::UnoType<io::XSeekable>::get()
, cppu::UnoType<io::XTruncate>::get()
, cppu::UnoType<lang::XComponent>::get()
- , cppu::UnoType<beans::XPropertySet>::get());
+ , cppu::UnoType<beans::XPropertySet>::get()));
}
}
}