summaryrefslogtreecommitdiff
path: root/xmlhelp
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-08 09:44:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-14 11:09:58 +0200
commit6a017237e01a25ce6901d1cf85ac0408f8935b11 (patch)
tree1df1d6e097ca837716f06765bf1862530d98c6f8 /xmlhelp
parent56195a4d0bbb21edeed1cea7a45283141c733f18 (diff)
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>
Diffstat (limited to 'xmlhelp')
-rw-r--r--xmlhelp/source/cxxhelp/provider/db.cxx20
-rw-r--r--xmlhelp/source/cxxhelp/provider/db.hxx7
2 files changed, 11 insertions, 16 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/db.cxx b/xmlhelp/source/cxxhelp/provider/db.cxx
index 9c3c2fa9fe2a..c99a07403104 100644
--- a/xmlhelp/source/cxxhelp/provider/db.cxx
+++ b/xmlhelp/source/cxxhelp/provider/db.cxx
@@ -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;
diff --git a/xmlhelp/source/cxxhelp/provider/db.hxx b/xmlhelp/source/cxxhelp/provider/db.hxx
index e0d7d60e9c40..b26797c80593 100644
--- a/xmlhelp/source/cxxhelp/provider/db.hxx
+++ b/xmlhelp/source/cxxhelp/provider/db.hxx
@@ -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();