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 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 _stream; gz_stream *_gzfp; public: - explicit HStreamIODev(HStream* stream); + explicit HStreamIODev(std::unique_ptr 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 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 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 ); /** * 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 ); /** * 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())