diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-12 11:23:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-16 08:21:36 +0200 |
commit | d911b3d37d13e84e0c6cb8eb990e58a0939a6f6a (patch) | |
tree | 96b7982104f483923a4e4adca76e49e43eac6f05 /store | |
parent | a0b3e81aeb10488c4746360dc1669f3aed71cb67 (diff) |
loplugin:useuniqueptr in OStorePageBIOS
update the plugin to check all methods for deleting fields.
Also remove the dead checks for new failing here, can never have worked,
because it is not calling the std::nothrow variant.
Change-Id: I139410e42f83ae2db0cd38ceee81c8b4c310268c
Reviewed-on: https://gerrit.libreoffice.org/52881
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'store')
-rw-r--r-- | store/source/storbios.cxx | 11 | ||||
-rw-r--r-- | store/source/storbios.hxx | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 38673f7b8165..1a34da60d420 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -591,10 +591,9 @@ storeError OStorePageBIOS::initialize_Impl ( if (eAccessMode != storeAccessMode::Create) { // Load SuperBlock page. - if ((m_pSuper = new SuperBlockPage()) == nullptr) - return store_E_OutOfMemory; + m_pSuper.reset(new SuperBlockPage()); - eErrCode = read (0, m_pSuper, SuperBlockPage::theSize); + eErrCode = read (0, m_pSuper.get(), SuperBlockPage::theSize); if (eErrCode == store_E_None) { // Verify SuperBlock page (with repair). @@ -630,8 +629,7 @@ storeError OStorePageBIOS::initialize_Impl ( rnPageSize = ((rnPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); // Create initial page (w/ SuperBlock). - if ((m_pSuper = new(rnPageSize) SuperBlockPage(rnPageSize)) == nullptr) - return store_E_OutOfMemory; + m_pSuper.reset(new(rnPageSize) SuperBlockPage(rnPageSize)); eErrCode = m_pSuper->save (*this, rnPageSize); } if (eErrCode == store_E_None) @@ -670,8 +668,7 @@ void OStorePageBIOS::cleanup_Impl() } // Release SuperBlock page. - delete m_pSuper; - m_pSuper = nullptr; + m_pSuper.reset(); // Release PageCache. m_xCache.clear(); diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx index bea29f9f37fa..8c2abd54f5a7 100644 --- a/store/source/storbios.hxx +++ b/store/source/storbios.hxx @@ -120,7 +120,7 @@ private: rtl::Reference<ILockBytes> m_xLockBytes; osl::Mutex m_aMutex; - SuperBlockPage * m_pSuper; + std::unique_ptr<SuperBlockPage> m_pSuper; bool m_bWriteable; |