loplugin:refcounting in ucb

Change-Id: Ib62c99b9cb71adda5c94d268f726949117163ede
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111200
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel
2021-02-19 13:15:56 +01:00
committed by Noel Grandin
parent 3f95cbcda1
commit de9d840743
8 changed files with 24 additions and 44 deletions
+2 -3
View File
@@ -543,10 +543,9 @@ Reference< XStream > OFileAccess::openFileReadWrite( const OUString& FileURL )
{
// Create file...
SvMemoryStream aStream(0,0);
::utl::OInputStreamWrapper* pInput = new ::utl::OInputStreamWrapper( aStream );
Reference< XInputStream > xInput( pInput );
rtl::Reference<::utl::OInputStreamWrapper> pInput = new ::utl::OInputStreamWrapper( aStream );
InsertCommandArgument aInsertArg;
aInsertArg.Data = xInput;
aInsertArg.Data = pInput;
aInsertArg.ReplaceExisting = false;
aCmdArg <<= aInsertArg;
+4 -6
View File
@@ -19,6 +19,7 @@
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ref.hxx>
#include <tools/diagnose_ex.h>
#include <com/sun/star/lang/NoSupportException.hpp>
@@ -546,8 +547,7 @@ BaseContent::createNewContent( const ContentInfo& Info )
else
dstUncPath = m_aUncPath;
BaseContent* p = new BaseContent( m_pMyShell, dstUncPath, bFolder );
return Reference< XContent >( p );
return new BaseContent( m_pMyShell, dstUncPath, bFolder );
}
@@ -591,8 +591,7 @@ BaseContent::getParent()
if( err )
return Reference< XInterface >( nullptr );
FileContentIdentifier* p = new FileContentIdentifier( ParentUnq );
Reference< XContentIdentifier > Identifier( p );
rtl::Reference<FileContentIdentifier> Identifier = new FileContentIdentifier( ParentUnq );
try
{
@@ -1133,8 +1132,7 @@ BaseContent::cEXC( const OUString& aNewName )
Reference< XContentIdentifier > xOldRef = m_xContentIdentifier;
m_aUncPath = aNewName;
FileContentIdentifier* pp = new FileContentIdentifier( aNewName );
m_xContentIdentifier.set( pp );
m_xContentIdentifier = new FileContentIdentifier( aNewName );
std::unique_ptr<ContentEventNotifier> p;
if( m_pContentEventListeners )
+5 -9
View File
@@ -19,6 +19,7 @@
#include <com/sun/star/ucb/ContentAction.hpp>
#include <com/sun/star/beans/PropertySetInfoChange.hpp>
#include <rtl/ref.hxx>
#include "filnot.hxx"
#include "filid.hxx"
#include "bc.hxx"
@@ -58,8 +59,7 @@ ContentEventNotifier::ContentEventNotifier( TaskManager* pMyShell,
void ContentEventNotifier::notifyChildInserted( const OUString& aChildName )
{
FileContentIdentifier* p = new FileContentIdentifier( aChildName );
uno::Reference< XContentIdentifier > xChildId( p );
rtl::Reference<FileContentIdentifier> xChildId = new FileContentIdentifier( aChildName );
uno::Reference< XContent > xChildContent = m_pMyShell->m_pProvider->queryContent( xChildId );
@@ -96,21 +96,17 @@ void ContentEventNotifier::notifyDeleted()
void ContentEventNotifier::notifyRemoved( const OUString& aChildName )
{
FileContentIdentifier* p = new FileContentIdentifier( aChildName );
uno::Reference< XContentIdentifier > xChildId( p );
rtl::Reference<FileContentIdentifier> xChildId = new FileContentIdentifier( aChildName );
BaseContent* pp = new BaseContent( m_pMyShell,xChildId,aChildName );
rtl::Reference<BaseContent> pp = new BaseContent( m_pMyShell,xChildId,aChildName );
{
osl::MutexGuard aGuard( pp->m_aMutex );
pp->m_nState |= BaseContent::Deleted;
}
uno::Reference< XContent > xDeletedContent( pp );
ContentEvent aEvt( m_xCreatorContent,
ContentAction::REMOVED,
xDeletedContent,
pp,
m_xCreatorId );
for( const auto& r : m_sListeners )
+3 -9
View File
@@ -600,17 +600,13 @@ XResultSet_impl::getMetaData()
// @@@ #82177# - Determine correct value!
aColumnData[ n ].isCaseSensitive = false;
::ucbhelper::ResultSetMetaData* p =
new ::ucbhelper::ResultSetMetaData(
return new ::ucbhelper::ResultSetMetaData(
m_pMyShell->m_xContext,
m_sProperty,
aColumnData );
return uno::Reference< sdbc::XResultSetMetaData >( p );
}
::ucbhelper::ResultSetMetaData* p =
new ::ucbhelper::ResultSetMetaData( m_pMyShell->m_xContext, m_sProperty );
return uno::Reference< sdbc::XResultSetMetaData >( p );
return new ::ucbhelper::ResultSetMetaData( m_pMyShell->m_xContext, m_sProperty );
}
@@ -630,9 +626,7 @@ XResultSet_impl::getPropertySetInfo()
seq[1].Type = cppu::UnoType<sal_Bool>::get();
seq[1].Attributes = beans::PropertyAttribute::READONLY;
XPropertySetInfo_impl* p = new XPropertySetInfo_impl( m_pMyShell,
seq );
return uno::Reference< beans::XPropertySetInfo > ( p );
return new XPropertySetInfo_impl( m_pMyShell, seq );
}
+4 -8
View File
@@ -804,8 +804,7 @@ TaskManager::ls( sal_Int32 CommandId,
uno::Reference< XCommandInfo >
TaskManager::info_c()
{
XCommandInfo_impl* p = new XCommandInfo_impl( this );
return uno::Reference< XCommandInfo >( p );
return new XCommandInfo_impl( this );
}
@@ -820,8 +819,7 @@ uno::Reference< beans::XPropertySetInfo >
TaskManager::info_p( const OUString& aUnqPath )
{
osl::MutexGuard aGuard( m_aMutex );
XPropertySetInfo_impl* p = new XPropertySetInfo_impl( this,aUnqPath );
return uno::Reference< beans::XPropertySetInfo >( p );
return new XPropertySetInfo_impl( this,aUnqPath );
}
@@ -1108,8 +1106,7 @@ TaskManager::getv( sal_Int32 CommandId,
});
}
XRow_impl* p = new XRow_impl( this,seq );
return uno::Reference< sdbc::XRow >( p );
return new XRow_impl( this,seq );
}
@@ -2531,8 +2528,7 @@ TaskManager::getv(
});
}
XRow_impl* p = new XRow_impl( this,seq );
row = uno::Reference< sdbc::XRow >( p );
row = new XRow_impl( this,seq );
return true;
}
+2 -4
View File
@@ -189,8 +189,7 @@ FileProvider::createContentIdentifier(
const OUString& ContentId )
{
init();
FileContentIdentifier* p = new FileContentIdentifier( ContentId,false );
return Reference< XContentIdentifier >( p );
return new FileContentIdentifier( ContentId,false );
}
@@ -329,8 +328,7 @@ void FileProvider::initProperties()
// static const sal_Int32 DOS_NOTATION = (sal_Int32)2;
// static const sal_Int32 MAC_NOTATION = (sal_Int32)3;
XPropertySetInfoImpl2* p = new XPropertySetInfoImpl2();
m_xPropertySetInfo.set( p );
m_xPropertySetInfo = new XPropertySetInfoImpl2();
}
+1 -3
View File
@@ -508,9 +508,7 @@ void SAL_CALL ResultSetBase::removeVetoableChangeListener(
uno::Reference< sdbc::XResultSetMetaData > SAL_CALL
ResultSetBase::getMetaData()
{
::ucbhelper::ResultSetMetaData* p =
new ::ucbhelper::ResultSetMetaData( m_xContext, m_sProperty );
return uno::Reference< sdbc::XResultSetMetaData >( p );
return new ::ucbhelper::ResultSetMetaData( m_xContext, m_sProperty );
}
+3 -2
View File
@@ -215,9 +215,10 @@ StorageElementFactory::createStorage( const OUString & rUri,
return xStorage;
}
aIt->second = new Storage( m_xContext, this, aUriKey, xParentStorage, xStorage );
rtl::Reference<Storage> pNewStorage = new Storage( m_xContext, this, aUriKey, xParentStorage, xStorage );
aIt->second = pNewStorage.get();
aIt->second->m_aContainerIt = aIt;
return aIt->second;
return pNewStorage;
}
}