[Libreoffice-commits] core.git: sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Dec 18 14:29:36 UTC 2018
sfx2/source/doc/graphhelp.cxx | 10 ++++------
sfx2/source/doc/graphhelp.hxx | 2 +-
sfx2/source/doc/sfxbasemodel.cxx | 8 ++++----
3 files changed, 9 insertions(+), 11 deletions(-)
New commits:
commit 6f8186138d560d1949f89f4a525c0bd911af203e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 18 14:20:34 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 18 15:29:14 2018 +0100
use unique_ptr in GraphicHelper::getFormatStrFromGDI_Impl
Change-Id: I54d0f2138763acf5addae53051ca842b878f5680
Reviewed-on: https://gerrit.libreoffice.org/65334
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 80fef06c55b8..1de4de916601 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -56,17 +56,15 @@
using namespace css;
-SvMemoryStream* GraphicHelper::getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, ConvertDataFormat nFormat )
+std::unique_ptr<SvMemoryStream> GraphicHelper::getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, ConvertDataFormat nFormat )
{
- SvMemoryStream* pResult = nullptr;
+ std::unique_ptr<SvMemoryStream> pResult;
if ( pGDIMeta )
{
- SvMemoryStream* pStream = new SvMemoryStream( 65535, 65535 );
+ std::unique_ptr<SvMemoryStream> pStream(new SvMemoryStream( 65535, 65535 ));
Graphic aGraph( *pGDIMeta );
if ( GraphicConverter::Export( *pStream, aGraph, nFormat ) == ERRCODE_NONE )
- pResult = pStream;
- else
- delete pStream;
+ pResult = std::move(pStream);
}
return pResult;
diff --git a/sfx2/source/doc/graphhelp.hxx b/sfx2/source/doc/graphhelp.hxx
index 490093e09be0..dd2e9217103c 100644
--- a/sfx2/source/doc/graphhelp.hxx
+++ b/sfx2/source/doc/graphhelp.hxx
@@ -33,7 +33,7 @@ class GraphicHelper
{
public:
- static SvMemoryStream* getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, ConvertDataFormat nFormat );
+ static std::unique_ptr<SvMemoryStream> getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, ConvertDataFormat nFormat );
static void* getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta );
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 601937377780..42dc41c53dc9 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2009,7 +2009,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
if (xMetaFile)
{
- std::shared_ptr<SvMemoryStream> xStream(
+ std::unique_ptr<SvMemoryStream> xStream(
GraphicHelper::getFormatStrFromGDI_Impl(
xMetaFile.get(), ConvertDataFormat::EMF ) );
if (xStream)
@@ -2044,7 +2044,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
if (xMetaFile)
{
- std::shared_ptr<SvMemoryStream> xStream(
+ std::unique_ptr<SvMemoryStream> xStream(
GraphicHelper::getFormatStrFromGDI_Impl(
xMetaFile.get(), ConvertDataFormat::WMF ) );
@@ -2085,7 +2085,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
if (xMetaFile)
{
- std::shared_ptr<SvMemoryStream> xStream(
+ std::unique_ptr<SvMemoryStream> xStream(
GraphicHelper::getFormatStrFromGDI_Impl(
xMetaFile.get(), ConvertDataFormat::BMP ) );
@@ -2107,7 +2107,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
if (xMetaFile)
{
- std::shared_ptr<SvMemoryStream> xStream(
+ std::unique_ptr<SvMemoryStream> xStream(
GraphicHelper::getFormatStrFromGDI_Impl(
xMetaFile.get(), ConvertDataFormat::PNG ) );
More information about the Libreoffice-commits
mailing list