return SvMemoryStream by std::unique_ptr
Change-Id: I60a41111e76d72a7384cbb15f2d2a73c95af8c2d Reviewed-on: https://gerrit.libreoffice.org/57280 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -85,7 +85,7 @@ public:
|
|||||||
SotStorage( bool bUCBStorage, SvStream & rStm );
|
SotStorage( bool bUCBStorage, SvStream & rStm );
|
||||||
SotStorage( SvStream * pStm, bool bDelete );
|
SotStorage( SvStream * pStm, bool bDelete );
|
||||||
|
|
||||||
SvMemoryStream * CreateMemoryStream();
|
std::unique_ptr<SvMemoryStream> CreateMemoryStream();
|
||||||
|
|
||||||
static bool IsStorageFile( const OUString & rFileName );
|
static bool IsStorageFile( const OUString & rFileName );
|
||||||
static bool IsStorageFile( SvStream* pStream );
|
static bool IsStorageFile( SvStream* pStream );
|
||||||
|
@@ -1261,7 +1261,7 @@ void PPTWriter::ImplWriteOLE( )
|
|||||||
for ( auto it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
|
for ( auto it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
|
||||||
{
|
{
|
||||||
PPTExOleObjEntry* pPtr = it->get();
|
PPTExOleObjEntry* pPtr = it->get();
|
||||||
SvMemoryStream* pStrm = nullptr;
|
std::unique_ptr<SvMemoryStream> pStrm;
|
||||||
pPtr->nOfsB = mpStrm->Tell();
|
pPtr->nOfsB = mpStrm->Tell();
|
||||||
switch ( pPtr->eType )
|
switch ( pPtr->eType )
|
||||||
{
|
{
|
||||||
@@ -1324,7 +1324,7 @@ void PPTWriter::ImplWriteOLE( )
|
|||||||
aZCodec.BeginCompression();
|
aZCodec.BeginCompression();
|
||||||
aZCodec.Compress( *pStrm, *mpStrm );
|
aZCodec.Compress( *pStrm, *mpStrm );
|
||||||
aZCodec.EndCompression();
|
aZCodec.EndCompression();
|
||||||
delete pStrm;
|
pStrm.reset();
|
||||||
mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
|
mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -456,10 +456,9 @@ SotStorage::~SotStorage()
|
|||||||
delete m_pStorStm;
|
delete m_pStorStm;
|
||||||
}
|
}
|
||||||
|
|
||||||
SvMemoryStream * SotStorage::CreateMemoryStream()
|
std::unique_ptr<SvMemoryStream> SotStorage::CreateMemoryStream()
|
||||||
{
|
{
|
||||||
SvMemoryStream * pStm = nullptr;
|
std::unique_ptr<SvMemoryStream> pStm(new SvMemoryStream( 0x8000, 0x8000 ));
|
||||||
pStm = new SvMemoryStream( 0x8000, 0x8000 );
|
|
||||||
tools::SvRef<SotStorage> aStg = new SotStorage( *pStm );
|
tools::SvRef<SotStorage> aStg = new SotStorage( *pStm );
|
||||||
if( CopyTo( aStg.get() ) )
|
if( CopyTo( aStg.get() ) )
|
||||||
{
|
{
|
||||||
@@ -468,8 +467,7 @@ SvMemoryStream * SotStorage::CreateMemoryStream()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
aStg.clear(); // release storage beforehand
|
aStg.clear(); // release storage beforehand
|
||||||
delete pStm;
|
pStm.reset();
|
||||||
pStm = nullptr;
|
|
||||||
}
|
}
|
||||||
return pStm;
|
return pStm;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user