loplugin:useuniqueptr in helpdatafileproxy::Hdf
Change-Id: I4324a290b826d76f89319f556aededb30d921f8d Reviewed-on: https://gerrit.libreoffice.org/54166 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -68,13 +68,13 @@ void Hdf::createHashMap( bool bOptimizeForPerformance )
|
||||
{
|
||||
if( m_pStringToDataMap != nullptr )
|
||||
return;
|
||||
m_pStringToDataMap = new StringToDataMap;
|
||||
m_pStringToDataMap.reset(new StringToDataMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_pStringToValPosMap != nullptr )
|
||||
return;
|
||||
m_pStringToValPosMap = new StringToValPosMap;
|
||||
m_pStringToValPosMap.reset(new StringToValPosMap);
|
||||
}
|
||||
|
||||
Reference< XInputStream > xIn = m_xSFA->openFileRead( m_aFileURL );
|
||||
@@ -123,19 +123,15 @@ void Hdf::createHashMap( bool bOptimizeForPerformance )
|
||||
|
||||
void Hdf::releaseHashMap()
|
||||
{
|
||||
if( m_pStringToDataMap != nullptr )
|
||||
{
|
||||
delete m_pStringToDataMap;
|
||||
m_pStringToDataMap = nullptr;
|
||||
}
|
||||
if( m_pStringToValPosMap != nullptr )
|
||||
{
|
||||
delete m_pStringToValPosMap;
|
||||
m_pStringToValPosMap = nullptr;
|
||||
}
|
||||
m_pStringToDataMap.reset();
|
||||
m_pStringToValPosMap.reset();
|
||||
}
|
||||
|
||||
|
||||
Hdf::~Hdf()
|
||||
{
|
||||
}
|
||||
|
||||
bool Hdf::getValueForKey( const OString& rKey, HDFData& rValue )
|
||||
{
|
||||
bool bSuccess = false;
|
||||
|
@@ -52,8 +52,8 @@ namespace helpdatafileproxy {
|
||||
class Hdf
|
||||
{
|
||||
OUString m_aFileURL;
|
||||
StringToDataMap* m_pStringToDataMap;
|
||||
StringToValPosMap* m_pStringToValPosMap;
|
||||
std::unique_ptr<StringToDataMap> m_pStringToDataMap;
|
||||
std::unique_ptr<StringToValPosMap> m_pStringToValPosMap;
|
||||
css::uno::Reference< css::ucb::XSimpleFileAccess3 >
|
||||
m_xSFA;
|
||||
|
||||
@@ -81,8 +81,7 @@ namespace helpdatafileproxy {
|
||||
{
|
||||
OSL_ASSERT(comphelper::isFileUrl(rFileURL));
|
||||
}
|
||||
~Hdf()
|
||||
{ releaseHashMap(); }
|
||||
~Hdf();
|
||||
|
||||
void createHashMap( bool bOptimizeForPerformance );
|
||||
void releaseHashMap();
|
||||
|
Reference in New Issue
Block a user