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>
This commit is contained in:
@@ -89,7 +89,7 @@ size_t HIODev::read4b(void *ptr, size_t nmemb)
|
|||||||
|
|
||||||
|
|
||||||
// hfileiodev class
|
// hfileiodev class
|
||||||
HStreamIODev::HStreamIODev(HStream * stream):_stream(stream)
|
HStreamIODev::HStreamIODev(std::unique_ptr<HStream> stream):_stream(std::move(stream))
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ class HStreamIODev final: public HIODev
|
|||||||
std::unique_ptr<HStream> _stream;
|
std::unique_ptr<HStream> _stream;
|
||||||
gz_stream *_gzfp;
|
gz_stream *_gzfp;
|
||||||
public:
|
public:
|
||||||
explicit HStreamIODev(HStream* stream);
|
explicit HStreamIODev(std::unique_ptr<HStream> stream);
|
||||||
virtual ~HStreamIODev() override;
|
virtual ~HStreamIODev() override;
|
||||||
/**
|
/**
|
||||||
* Check whether the stream is available
|
* Check whether the stream is available
|
||||||
|
@@ -65,9 +65,9 @@ HWPFile::~HWPFile()
|
|||||||
hiodev.reset();
|
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();
|
return State();
|
||||||
InfoRead();
|
InfoRead();
|
||||||
FontRead();
|
FontRead();
|
||||||
@@ -92,9 +92,9 @@ int detect_hwp_version(const char *str)
|
|||||||
|
|
||||||
// HIODev wrapper
|
// 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())
|
if (!hstreamio->open())
|
||||||
{
|
{
|
||||||
|
@@ -111,7 +111,7 @@ class DLLEXPORT HWPFile
|
|||||||
* @returns 0 if success, otherwise error code
|
* @returns 0 if success, otherwise error code
|
||||||
* @see State()
|
* @see State()
|
||||||
*/
|
*/
|
||||||
int Open( HStream * );
|
int Open( std::unique_ptr<HStream> );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Say current state
|
* Say current state
|
||||||
@@ -170,7 +170,7 @@ class DLLEXPORT HWPFile
|
|||||||
/**
|
/**
|
||||||
* Reads all information of hwp file from stream
|
* 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
|
* Reads document information of hwp file from HIODev
|
||||||
*/
|
*/
|
||||||
|
@@ -132,7 +132,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportHWP(SvStream &rStream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWPFile hwpfile;
|
HWPFile hwpfile;
|
||||||
if (hwpfile.ReadHwpFile(stream.release()))
|
if (hwpfile.ReadHwpFile(std::move(stream)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
@@ -164,7 +164,7 @@ sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor)
|
|||||||
|
|
||||||
if( nTotal == 0 ) return false;
|
if( nTotal == 0 ) return false;
|
||||||
|
|
||||||
if (hwpfile.ReadHwpFile(stream.release()))
|
if (hwpfile.ReadHwpFile(std::move(stream)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_rxDocumentHandler.is())
|
if (m_rxDocumentHandler.is())
|
||||||
|
Reference in New Issue
Block a user