[Libreoffice-commits] core.git: 2 commits - hwpfilter/source ucb/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 7 06:48:37 UTC 2018
hwpfilter/source/drawing.h | 4 ++--
hwpfilter/source/hwpfile.cxx | 16 +++++-----------
hwpfilter/source/hwpfile.h | 2 +-
ucb/source/ucp/webdav-neon/NeonSession.cxx | 8 +++-----
4 files changed, 11 insertions(+), 19 deletions(-)
New commits:
commit 6c96bc3cbe109c97cddda9b357c1857fbcb4700c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 6 11:26:14 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 7 08:48:17 2018 +0200
loplugin:useuniqueptr in NeonSession
Change-Id: I8ff5c031ddd6cf6546c6e4eee60cbe9f60d4fb5f
Reviewed-on: https://gerrit.libreoffice.org/60114
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index 903ca27a7720..2d391f69ae06 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -1056,8 +1056,8 @@ void NeonSession::PROPPATCH( const OUString & inPath,
// Generate the list of properties we want to set.
int nPropCount = inValues.size();
- ne_proppatch_operation* pItems
- = new ne_proppatch_operation[ nPropCount + 1 ];
+ std::unique_ptr<ne_proppatch_operation[]> pItems(
+ new ne_proppatch_operation[ nPropCount + 1 ]);
for ( n = 0; n < nPropCount; ++n )
{
const ProppatchValue & rValue = inValues[ n ];
@@ -1136,7 +1136,7 @@ void NeonSession::PROPPATCH( const OUString & inPath,
theRetVal = ne_proppatch( m_pHttpSession,
OUStringToOString(
inPath, RTL_TEXTENCODING_UTF8 ).getStr(),
- pItems );
+ pItems.get() );
}
for ( n = 0; n < nPropCount; ++n )
@@ -1146,8 +1146,6 @@ void NeonSession::PROPPATCH( const OUString & inPath,
free( const_cast<char *>(pItems[ n ].value) );
}
- delete [] pItems;
-
HandleError( theRetVal, inPath, rEnv );
}
commit cf67ffaacba130a0c572f26cbd14a7492d9b53b8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 6 11:25:33 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 7 08:48:12 2018 +0200
loplugin:useuniqueptr in HWPFile
Change-Id: I0eb3f09b5ca82ce4810aafbb7d5d53f1faa00e3f
Reviewed-on: https://gerrit.libreoffice.org/60111
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/hwpfilter/source/drawing.h b/hwpfilter/source/drawing.h
index 806a48748bf7..5c2746da0099 100644
--- a/hwpfilter/source/drawing.h
+++ b/hwpfilter/source/drawing.h
@@ -626,12 +626,12 @@ static HWPPara *LoadParaList()
return nullptr;
HWPFile *hwpf = GetCurrentDoc();
- HIODev *hio = hwpf->SetIODevice(hmem);
+ std::unique_ptr<HIODev> hio = hwpf->SetIODevice(std::unique_ptr<HIODev>(hmem));
std::vector< HWPPara* > plist;
hwpf->ReadParaList(plist);
- hwpf->SetIODevice(hio);
+ hwpf->SetIODevice(std::move(hio));
return plist.size()? plist.front() : nullptr;
}
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index a61b3e08921b..b1a4760d7644 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -94,17 +94,14 @@ int detect_hwp_version(const char *str)
int HWPFile::Open(std::unique_ptr<HStream> stream)
{
- HStreamIODev *hstreamio = new HStreamIODev(std::move(stream));
+ std::unique_ptr<HStreamIODev> hstreamio(new HStreamIODev(std::move(stream)));
if (!hstreamio->open())
{
- delete hstreamio;
-
return SetState(HWP_EMPTY_FILE);
}
- HIODev *pPrev = SetIODevice(hstreamio);
- delete pPrev;
+ SetIODevice(std::move(hstreamio));
char idstr[HWPIDLen];
@@ -185,13 +182,10 @@ void HWPFile::SetCompressed(bool flag)
}
-HIODev *HWPFile::SetIODevice(HIODev * new_hiodev)
+std::unique_ptr<HIODev> HWPFile::SetIODevice(std::unique_ptr<HIODev> new_hiodev)
{
- HIODev *old_hiodev = hiodev.release();
-
- hiodev.reset( new_hiodev );
-
- return old_hiodev;
+ std::swap(hiodev, new_hiodev);
+ return new_hiodev;
}
diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h
index 36655105a9f5..88e2151a5c9a 100644
--- a/hwpfilter/source/hwpfile.h
+++ b/hwpfilter/source/hwpfile.h
@@ -165,7 +165,7 @@ class DLLEXPORT HWPFile
/**
* Sets current HIODev
*/
- HIODev *SetIODevice( HIODev *hiodev );
+ std::unique_ptr<HIODev> SetIODevice( std::unique_ptr<HIODev> hiodev );
/**
* Reads all information of hwp file from stream
More information about the Libreoffice-commits
mailing list