diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-14 10:49:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-15 06:58:07 +0100 |
commit | 2e0763633719f9f2a009956ace3e30d79d236ff9 (patch) | |
tree | 182f46c76430529ae2cc8c87023ff76287ee1569 | |
parent | 11f85d828a16b1beee5c476bd4d8d21c3e450592 (diff) |
use unique_ptr in sw
Change-Id: I02026ffd808fa4939666c791c476cd0c0632cde3
Reviewed-on: https://gerrit.libreoffice.org/66319
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 5 |
2 files changed, 10 insertions, 11 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index f938fd78d117..18642cc06621 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -5771,10 +5771,10 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) m_pStrm->Seek(0); size_t nUnencryptedHdr = (8 == m_xWwFib->m_nVersion) ? 0x44 : 0x34; - sal_uInt8 *pIn = new sal_uInt8[nUnencryptedHdr]; - nUnencryptedHdr = m_pStrm->ReadBytes(pIn, nUnencryptedHdr); - aDecryptMain.WriteBytes(pIn, nUnencryptedHdr); - delete [] pIn; + std::unique_ptr<sal_uInt8[]> pIn(new sal_uInt8[nUnencryptedHdr]); + nUnencryptedHdr = m_pStrm->ReadBytes(pIn.get(), nUnencryptedHdr); + aDecryptMain.WriteBytes(pIn.get(), nUnencryptedHdr); + pIn.reset(); DecryptXOR(aCtx, *m_pStrm, aDecryptMain); @@ -5838,14 +5838,14 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) m_pStrm->Seek(0); std::size_t nUnencryptedHdr = 0x44; - sal_uInt8 *pIn = new sal_uInt8[nUnencryptedHdr]; - nUnencryptedHdr = m_pStrm->ReadBytes(pIn, nUnencryptedHdr); + std::unique_ptr<sal_uInt8[]> pIn(new sal_uInt8[nUnencryptedHdr]); + nUnencryptedHdr = m_pStrm->ReadBytes(pIn.get(), nUnencryptedHdr); DecryptRC4(*xCtx, *m_pStrm, aDecryptMain); aDecryptMain.Seek(0); - aDecryptMain.WriteBytes(pIn, nUnencryptedHdr); - delete [] pIn; + aDecryptMain.WriteBytes(pIn.get(), nUnencryptedHdr); + pIn.reset(); pTempTable = MakeTemp(aDecryptTable); DecryptRC4(*xCtx, *m_pTableStream, aDecryptTable); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 4ff133dca23a..ef2bc17f0986 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -3270,7 +3270,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) // In an ideal world we could handle the tab stop between the number and // the entry correctly, but I currently have no clue how to obtain // the tab stop position. It is _not_ set at the paragraph style. - SwForm* pForm = nullptr; + std::unique_ptr<SwForm> pForm; for (SwWW8StyInf & rSI : m_vColl) { if (rSI.IsOutlineNumbered()) @@ -3282,7 +3282,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) ++nStyleLevel; if ( !pForm ) - pForm = new SwForm( pBase->GetTOXForm() ); + pForm.reset(new SwForm( pBase->GetTOXForm() )); SwFormTokens aPattern = pForm->GetPattern(nStyleLevel); SwFormTokens::iterator aIt = @@ -3302,7 +3302,6 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) if ( pForm ) { pBase->SetTOXForm( *pForm ); - delete pForm; } } |