Kaydet (Commit) 2877e5a9 authored tarafından Michael Stahl's avatar Michael Stahl

package: PVS-Studio V595 'm_pData' pointer could be null

... just convert its explicitly deleted member to unique_ptr.

Change-Id: I826257ff512632a2aedd53a7ce5e4bedf49c3cfe
üst cd347b3b
......@@ -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()));
}
}
}
......
......@@ -43,10 +43,12 @@
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <list>
#include <memory>
#include "ocompinstream.hxx"
#include "mutexholder.hxx"
......@@ -65,10 +67,6 @@ struct PreCreationStruct
};
namespace cppu {
class OTypeCollection;
}
namespace package {
bool PackageEncryptionDatasEqual( const ::comphelper::SequenceAsHashMap& aHash1, const ::comphelper::SequenceAsHashMap& aHash2 );
}
......@@ -76,14 +74,14 @@ namespace package {
struct WSInternalData_Impl
{
SotMutexHolderRef m_rSharedMutexRef;
::cppu::OTypeCollection* m_pTypeCollection;
::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners
sal_Int32 m_nStorageType;
// the mutex reference MUST NOT be empty
WSInternalData_Impl( const SotMutexHolderRef& rMutexRef, sal_Int32 nStorageType )
: m_rSharedMutexRef( rMutexRef )
, m_pTypeCollection( NULL )
, m_pTypeCollection()
, m_aListenersContainer( rMutexRef->GetMutex() )
, m_nStorageType( nStorageType )
{}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment