diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-22 11:49:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-22 15:47:48 +0200 |
commit | 8ea426bfa978d338683bf4c715d358187a527ccd (patch) | |
tree | cc3c3dbbfc10f18c19bf2f7d9b210fd1cff56f22 | |
parent | d1099ec6220e098b9d7e263c9b7f873997ea9e30 (diff) |
no need to allocate the error separately in GraphicFilter
Change-Id: I26c43cb72580d9cc384b3c4b70e43f47d3db0198
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119367
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/vcl/graphicfilter.hxx | 13 | ||||
-rw-r--r-- | sd/source/filter/grf/sdgrffilter.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 8 |
4 files changed, 10 insertions, 17 deletions
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index d153c9d97648..833007e28088 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -256,14 +256,6 @@ public: static OUString GetImportFormatShortName( GraphicFileFormat nFormat ); }; -/** Information about errors during the GraphicFilter operation. */ -struct FilterErrorEx -{ - ErrCode nStreamError; - - FilterErrorEx() : nStreamError( ERRCODE_NONE ) {} -}; - /** Class to import and export graphic formats. */ class VCL_DLLPUBLIC GraphicFilter { @@ -341,7 +333,7 @@ public: // Setting sizeLimit limits how much will be read from the stream. Graphic ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit = 0, const Size* pSizeHint = nullptr); - const FilterErrorEx& GetLastError() const { return *pErrorEx;} + const ErrCode& GetLastError() const { return *mxErrorEx;} void ResetLastError(); Link<ConvertData&,bool> GetFilterCallback() const; @@ -393,7 +385,8 @@ private: DECL_LINK( FilterCallback, ConvertData&, bool ); - std::unique_ptr<FilterErrorEx> pErrorEx; + /** Information about errors during the GraphicFilter operation. */ + std::optional<ErrCode> mxErrorEx; bool bUseConfig; }; diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 103cc37ca606..ebceaee3b10a 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -149,7 +149,7 @@ bool SdGRFFilter::Import() ErrCode nReturn = pIStm ? rGraphicFilter.ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : ErrCode(1); if( nReturn ) - HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError().nStreamError ); + HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError() ); else { if( mrDocument.GetPageCount() == 0 ) @@ -292,7 +292,7 @@ bool SdGRFFilter::Export() if ( !bRet && xInteractionHandler.is() ) SdGRFFilter::HandleGraphicFilterError( static_cast< SdGRFFilter_ImplInteractionHdl* >( xInteractionHandler.get() )->GetErrorCode(), - rGraphicFilter.GetLastError().nStreamError ); + rGraphicFilter.GetLastError() ); } } } diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 01434b40f141..07d1417e0161 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -190,7 +190,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq ) } else { - SdGRFFilter::HandleGraphicFilterError( nError, GraphicFilter::GetGraphicFilter().GetLastError().nStreamError ); + SdGRFFilter::HandleGraphicFilterError( nError, GraphicFilter::GetGraphicFilter().GetLastError() ); } } diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 9ffd3601d714..1be4c82e7c4e 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -335,7 +335,7 @@ GraphicFilter::~GraphicFilter() delete pConfig; } - pErrorEx.reset(); + mxErrorEx.reset(); } void GraphicFilter::ImplInit() @@ -358,12 +358,12 @@ void GraphicFilter::ImplInit() osl::FileBase::getSystemPathFromFileURL(url, aFilterPath); } - pErrorEx.reset( new FilterErrorEx ); + mxErrorEx = ERRCODE_NONE; } ErrCode GraphicFilter::ImplSetError( ErrCode nError, const SvStream* pStm ) { - pErrorEx->nStreamError = pStm ? pStm->GetError() : ERRCODE_NONE; + mxErrorEx = pStm ? pStm->GetError() : ERRCODE_NONE; return nError; } @@ -1850,7 +1850,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r void GraphicFilter::ResetLastError() { - pErrorEx->nStreamError = ERRCODE_NONE; + mxErrorEx = ERRCODE_NONE; } Link<ConvertData&,bool> GraphicFilter::GetFilterCallback() const |