diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-20 13:49:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-21 12:11:18 +0200 |
commit | c4558e4b7b3defe7a128e16781eaececc416195a (patch) | |
tree | 1aacd34300ad3dca8e551e1110bc8b771bf96625 /hwpfilter | |
parent | 079abbaefa0ce600958e8e6a2b15c58deec14990 (diff) |
loplugin:useuniqueptr in HStreamIODev
Change-Id: I81ab91bce2a83603b25922593c1fd764b5c0b003
Reviewed-on: https://gerrit.libreoffice.org/59358
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'hwpfilter')
-rw-r--r-- | hwpfilter/source/hiodev.cxx | 2 | ||||
-rw-r--r-- | hwpfilter/source/hiodev.h | 2 | ||||
-rw-r--r-- | hwpfilter/source/hwpfile.cxx | 8 | ||||
-rw-r--r-- | hwpfilter/source/hwpfile.h | 4 | ||||
-rw-r--r-- | hwpfilter/source/hwpreader.cxx | 4 |
5 files changed, 10 insertions, 10 deletions
diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx index fcdc98b24109..7fd808906c69 100644 --- a/hwpfilter/source/hiodev.cxx +++ b/hwpfilter/source/hiodev.cxx @@ -89,7 +89,7 @@ size_t HIODev::read4b(void *ptr, size_t nmemb) // hfileiodev class -HStreamIODev::HStreamIODev(HStream * stream):_stream(stream) +HStreamIODev::HStreamIODev(std::unique_ptr<HStream> stream):_stream(std::move(stream)) { init(); } diff --git a/hwpfilter/source/hiodev.h b/hwpfilter/source/hiodev.h index 5f12454da99e..b6f2c7aa2be7 100644 --- a/hwpfilter/source/hiodev.h +++ b/hwpfilter/source/hiodev.h @@ -78,7 +78,7 @@ class HStreamIODev final: public HIODev std::unique_ptr<HStream> _stream; gz_stream *_gzfp; public: - explicit HStreamIODev(HStream* stream); + explicit HStreamIODev(std::unique_ptr<HStream> stream); virtual ~HStreamIODev() override; /** * Check whether the stream is available diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index d3bd660e77fd..a61b3e08921b 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -65,9 +65,9 @@ HWPFile::~HWPFile() hiodev.reset(); } -int HWPFile::ReadHwpFile(HStream * stream) +int HWPFile::ReadHwpFile(std::unique_ptr<HStream> stream) { - if (Open(stream) != HWP_NoError) + if (Open(std::move(stream)) != HWP_NoError) return State(); InfoRead(); FontRead(); @@ -92,9 +92,9 @@ int detect_hwp_version(const char *str) // HIODev wrapper -int HWPFile::Open(HStream * stream) +int HWPFile::Open(std::unique_ptr<HStream> stream) { - HStreamIODev *hstreamio = new HStreamIODev(stream); + HStreamIODev *hstreamio = new HStreamIODev(std::move(stream)); if (!hstreamio->open()) { diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h index 4f68543f5b13..36655105a9f5 100644 --- a/hwpfilter/source/hwpfile.h +++ b/hwpfilter/source/hwpfile.h @@ -111,7 +111,7 @@ class DLLEXPORT HWPFile * @returns 0 if success, otherwise error code * @see State() */ - int Open( HStream * ); + int Open( std::unique_ptr<HStream> ); /** * Say current state @@ -170,7 +170,7 @@ class DLLEXPORT HWPFile /** * Reads all information of hwp file from stream */ - int ReadHwpFile( HStream *); + int ReadHwpFile( std::unique_ptr<HStream> ); /** * Reads document information of hwp file from HIODev */ diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index b3e8ba9f7d8b..947d00affb4f 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -132,7 +132,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportHWP(SvStream &rStream) } HWPFile hwpfile; - if (hwpfile.ReadHwpFile(stream.release())) + if (hwpfile.ReadHwpFile(std::move(stream))) return false; } catch (...) @@ -164,7 +164,7 @@ sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) if( nTotal == 0 ) return false; - if (hwpfile.ReadHwpFile(stream.release())) + if (hwpfile.ReadHwpFile(std::move(stream))) return false; if (m_rxDocumentHandler.is()) |