package/inc/ZipOutputStream.hxx | 2 +- package/source/zipapi/ZipOutputStream.cxx | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-)
New commits: commit 3d5fde2064c4c63797ba03269cd405096a2dba04 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sat Aug 11 10:23:06 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 15 08:38:18 2018 +0200 loplugin:useuniqueptr in consumeScheduledThreadEntry Change-Id: I9c0b05081915712089d363a476d6354cfba2461d Reviewed-on: https://gerrit.libreoffice.org/59010 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx index 3f86f07883ca..814413da041e 100644 --- a/package/inc/ZipOutputStream.hxx +++ b/package/inc/ZipOutputStream.hxx @@ -79,7 +79,7 @@ private: void writeEXT( const ZipEntry &rEntry ); // ScheduledThread handling helpers - void consumeScheduledThreadEntry(ZipOutputEntry* pCandidate); + void consumeScheduledThreadEntry(std::unique_ptr<ZipOutputEntry> pCandidate); void consumeFinishedScheduledThreadEntries(); public: diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx index c98876fdc6c1..8fc1f581ac49 100644 --- a/package/source/zipapi/ZipOutputStream.cxx +++ b/package/source/zipapi/ZipOutputStream.cxx @@ -91,7 +91,7 @@ void ZipOutputStream::rawCloseEntry( bool bEncrypt ) m_pCurrentEntry = nullptr; } -void ZipOutputStream::consumeScheduledThreadEntry(ZipOutputEntry* pCandidate) +void ZipOutputStream::consumeScheduledThreadEntry(std::unique_ptr<ZipOutputEntry> pCandidate) { //Any exceptions thrown in the threads were caught and stored for now const std::exception_ptr& rCaughtException(pCandidate->getParallelDeflateException()); @@ -99,7 +99,6 @@ void ZipOutputStream::consumeScheduledThreadEntry(ZipOutputEntry* pCandidate) { m_aDeflateException = rCaughtException; // store it for later throwing // the exception handler in DeflateThread should have cleaned temp file - delete pCandidate; return; } @@ -123,22 +122,21 @@ void ZipOutputStream::consumeScheduledThreadEntry(ZipOutputEntry* pCandidate) pCandidate->getZipPackageStream()->successfullyWritten(pCandidate->getZipEntry()); pCandidate->deleteBufferFile(); - delete pCandidate; } void ZipOutputStream::consumeFinishedScheduledThreadEntries() { std::vector< ZipOutputEntry* > aNonFinishedEntries; - for(auto aIter = m_aEntries.begin(); aIter != m_aEntries.end(); ++aIter) + for(ZipOutputEntry* pEntry : m_aEntries) { - if((*aIter)->isFinished()) + if(pEntry->isFinished()) { - consumeScheduledThreadEntry(*aIter); + consumeScheduledThreadEntry(std::unique_ptr<ZipOutputEntry>(pEntry)); } else { - aNonFinishedEntries.push_back(*aIter); + aNonFinishedEntries.push_back(pEntry); } } @@ -171,7 +169,7 @@ void ZipOutputStream::finish() { ZipOutputEntry* pCandidate = m_aEntries.back(); m_aEntries.pop_back(); - consumeScheduledThreadEntry(pCandidate); + consumeScheduledThreadEntry(std::unique_ptr<ZipOutputEntry>(pCandidate)); } sal_Int32 nOffset= static_cast < sal_Int32 > (m_aChucker.GetPosition()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits