summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-05-26 20:42:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-05-26 22:33:02 +0200
commitfe6cce01c88d045a1fcf09acf049c34c22299b02 (patch)
treec118594a43386096bca55179f31b2b61e64dfa48 /vcl
parentb894a3d7f991dd248dfd8935b31da8bccfd130b2 (diff)
Fix loplugin:simplifypointertobool for libstdc++ std::shared_ptr
...where the get member function is defined on a std::__shared_ptr base class, so loplugin:simplifypointertobool used to miss those until now. (While e.g. using libc++ on macOS found those cases.) 366d08f2f6d4de922f6099c62bb81b49d89e0a68 "new loplugin:simplifypointertobool" was mistaken in breaking isSmartPointerType(const clang::Type* t) out of isSmartPointerType(const Expr* e); c874294ad9fb178df47c66875bfbdec466e39763 "Fix detection of std::unique_ptr/shared_ptr in loplugin:redundantpointerops" had introduced that indivisible two-step algorithm on purpose. The amount of additional hits (on Linux) apparently asked for turning loplugin:simplifypointertobool into a rewriting plugin. Which in turn showed that the naive adivce to just "drop the get()" is not sufficient in places that are not contextually converted to bool, as those places need to be wrapped in a bool(...) functional cast now. If the expression was already wrapped in parentheses, those could be reused as part of the functional cast, but implementing that showed that such cases are not yet found at all by the existing loplugin:simplifypointertobool. Lets leave that TODO for another commit. Besides the changes to compilerplugins/ itself, this change has been generated fully automatically with the rewriting plugin on Linux. Change-Id: I83107d6f634fc9ac232986f49044d7017df83e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94888 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'vcl')
-rw-r--r--vcl/opengl/salbmp.cxx2
-rw-r--r--vcl/qa/cppunit/graphicfilter/filters-test.cxx2
-rw-r--r--vcl/source/gdi/impgraph.cxx34
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx6
-rw-r--r--vcl/source/gdi/region.cxx2
-rw-r--r--vcl/source/graphic/UnoGraphicProvider.cxx2
7 files changed, 26 insertions, 26 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index abb9731b6d45..cd3a56a7ae00 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -569,7 +569,7 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode )
if( nMode != BitmapAccessMode::Info )
{
- if (!mpUserBuffer.get())
+ if (!mpUserBuffer)
{
if( !AllocateUserData() )
return nullptr;
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
index f6e14e55ecd8..26f743cfa311 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
@@ -72,7 +72,7 @@ bool VclFiltersTest::load(const OUString &,
// other format will work (what may be wanted). For the test framework it was indirectly
// intended to trigger an error when load in the sense of deep data interpretation fails,
// so we need to trigger this here
- if (aGraphic.getVectorGraphicData().get())
+ if (aGraphic.getVectorGraphicData())
{
if (aGraphic.getVectorGraphicData()->getRange().isEmpty())
{
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 54abc46a0dad..e06663706d6e 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -209,7 +209,7 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
}
ImpGraphic::ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr)
-: meType( rVectorGraphicDataPtr.get() ? GraphicType::Bitmap : GraphicType::NONE ),
+: meType( rVectorGraphicDataPtr ? GraphicType::Bitmap : GraphicType::NONE ),
mnSizeBytes( 0 ),
mbSwapOut( false ),
mbDummyContext ( false ),
@@ -344,7 +344,7 @@ bool ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const
case GraphicType::Bitmap:
{
- if(maVectorGraphicData.get())
+ if(maVectorGraphicData)
{
if(maVectorGraphicData == rImpGraphic.maVectorGraphicData)
{
@@ -489,7 +489,7 @@ bool ImpGraphic::ImplIsTransparent() const
{
bRet = maSwapInfo.mbIsTransparent;
}
- else if (meType == GraphicType::Bitmap && !maVectorGraphicData.get())
+ else if (meType == GraphicType::Bitmap && !maVectorGraphicData)
{
bRet = mpAnimation ? mpAnimation->IsTransparent() : maBitmapEx.IsTransparent();
}
@@ -505,7 +505,7 @@ bool ImpGraphic::ImplIsAlpha() const
{
bRet = maSwapInfo.mbIsAlpha;
}
- else if (maVectorGraphicData.get())
+ else if (maVectorGraphicData)
{
bRet = true;
}
@@ -562,7 +562,7 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
if( meType == GraphicType::Bitmap )
{
- if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
+ if(maVectorGraphicData && maBitmapEx.IsEmpty())
{
// use maBitmapEx as local buffer for rendered svg
const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
@@ -671,7 +671,7 @@ BitmapEx ImpGraphic::ImplGetBitmapEx(const GraphicConversionParameters& rParamet
if( meType == GraphicType::Bitmap )
{
- if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
+ if(maVectorGraphicData && maBitmapEx.IsEmpty())
{
// use maBitmapEx as local buffer for rendered svg
const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
@@ -723,7 +723,7 @@ const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
{
ensureAvailable();
if (!maMetaFile.GetActionSize()
- && maVectorGraphicData.get()
+ && maVectorGraphicData
&& (VectorGraphicDataType::Emf == maVectorGraphicData->getVectorGraphicDataType()
|| VectorGraphicDataType::Wmf == maVectorGraphicData->getVectorGraphicDataType()))
{
@@ -758,7 +758,7 @@ const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
// survive copying (change this if not wanted)
ImpGraphic* pThat = const_cast< ImpGraphic* >(this);
- if(maVectorGraphicData.get() && !maBitmapEx)
+ if(maVectorGraphicData && !maBitmapEx)
{
// use maBitmapEx as local buffer for rendered svg
pThat->maBitmapEx = getVectorGraphicReplacement();
@@ -814,7 +814,7 @@ Size ImpGraphic::ImplGetPrefSize() const
case GraphicType::Bitmap:
{
- if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
+ if(maVectorGraphicData && maBitmapEx.IsEmpty())
{
if (!maExPrefSize.getWidth() || !maExPrefSize.getHeight())
{
@@ -866,7 +866,7 @@ void ImpGraphic::ImplSetPrefSize( const Size& rPrefSize )
{
// used when importing a writer FlyFrame with SVG as graphic, added conversion
// to allow setting the PrefSize at the BitmapEx to hold it
- if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
+ if(maVectorGraphicData && maBitmapEx.IsEmpty())
{
maExPrefSize = rPrefSize;
}
@@ -912,7 +912,7 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const
case GraphicType::Bitmap:
{
- if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
+ if(maVectorGraphicData && maBitmapEx.IsEmpty())
{
// svg not yet buffered in maBitmapEx, return default PrefMapMode
aMapMode = MapMode(MapUnit::Map100thMM);
@@ -951,7 +951,7 @@ void ImpGraphic::ImplSetPrefMapMode( const MapMode& rPrefMapMode )
case GraphicType::Bitmap:
{
- if(maVectorGraphicData.get())
+ if(maVectorGraphicData)
{
// ignore for Vector Graphic Data. If this is really used (except the grfcache)
// it can be extended by using maBitmapEx as buffer for getVectorGraphicReplacement()
@@ -989,7 +989,7 @@ sal_uLong ImpGraphic::ImplGetSizeBytes() const
if( meType == GraphicType::Bitmap )
{
- if(maVectorGraphicData.get())
+ if(maVectorGraphicData)
{
std::pair<VectorGraphicData::State, size_t> tmp(maVectorGraphicData->getSizeBytes());
if (VectorGraphicData::State::UNPARSED == tmp.first)
@@ -1024,7 +1024,7 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
case GraphicType::Bitmap:
{
- if(maVectorGraphicData.get() && !maBitmapEx)
+ if(maVectorGraphicData && !maBitmapEx)
{
// use maEx as local buffer for rendered svg
const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
@@ -1061,7 +1061,7 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
case GraphicType::Bitmap:
{
- if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
+ if(maVectorGraphicData && maBitmapEx.IsEmpty())
{
// use maEx as local buffer for rendered svg
const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
@@ -1208,7 +1208,7 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
{
if( meType == GraphicType::Bitmap )
{
- if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
+ if(maVectorGraphicData && maBitmapEx.IsEmpty())
{
// use maBitmapEx as local buffer for rendered svg
maBitmapEx = getVectorGraphicReplacement();
@@ -1820,7 +1820,7 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
case GraphicType::Bitmap:
{
- if(rImpGraphic.getVectorGraphicData().get())
+ if(rImpGraphic.getVectorGraphicData())
{
// stream out Vector Graphic defining data (length, byte array and evtl. path)
// this is used e.g. in swapping out graphic data and in transporting it over UNO API
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index b067475c7620..da7e78dcbcd9 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -389,8 +389,8 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
case PDFExtOutDevDataSync::CreateControl:
{
std::shared_ptr< PDFWriter::AnyWidget > pControl( mControls.front() );
- SAL_WARN_IF( !pControl.get(), "vcl", "PageSyncData::PlaySyncPageAct: invalid widget!" );
- if ( pControl.get() )
+ SAL_WARN_IF( !pControl, "vcl", "PageSyncData::PlaySyncPageAct: invalid widget!" );
+ if ( pControl )
rWriter.CreateControl( *pControl );
mControls.pop_front();
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 10758d84d639..a09a5fcf5599 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9193,7 +9193,7 @@ void PDFWriterImpl::createEmbeddedFile(const Graphic& rGraphic, ReferenceXObject
// no pdf data.
rEmit.m_nBitmapObject = nBitmapObject;
- if (!rGraphic.getVectorGraphicData().get() || rGraphic.getVectorGraphicData()->getVectorGraphicDataType() != VectorGraphicDataType::Pdf)
+ if (!rGraphic.getVectorGraphicData() || rGraphic.getVectorGraphicData()->getVectorGraphicDataType() != VectorGraphicDataType::Pdf)
return;
sal_uInt32 nLength = rGraphic.getVectorGraphicData()->getVectorGraphicDataArrayLength();
@@ -9268,7 +9268,7 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const
{
m_aJPGs.emplace( m_aJPGs.begin() );
JPGEmit& rEmit = m_aJPGs.front();
- if (!rGraphic.getVectorGraphicData().get() || rGraphic.getVectorGraphicData()->getVectorGraphicDataType() != VectorGraphicDataType::Pdf || m_aContext.UseReferenceXObject)
+ if (!rGraphic.getVectorGraphicData() || rGraphic.getVectorGraphicData()->getVectorGraphicDataType() != VectorGraphicDataType::Pdf || m_aContext.UseReferenceXObject)
rEmit.m_nObject = createObject();
rEmit.m_aID = aID;
rEmit.m_pStream = std::move( pStream );
@@ -9372,7 +9372,7 @@ const BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx& i_rBitmap, co
m_aBitmaps.push_front( BitmapEmit() );
m_aBitmaps.front().m_aID = aID;
m_aBitmaps.front().m_aBitmap = aBitmap;
- if (!rGraphic.getVectorGraphicData().get() || rGraphic.getVectorGraphicData()->getVectorGraphicDataType() != VectorGraphicDataType::Pdf || m_aContext.UseReferenceXObject)
+ if (!rGraphic.getVectorGraphicData() || rGraphic.getVectorGraphicData()->getVectorGraphicDataType() != VectorGraphicDataType::Pdf || m_aContext.UseReferenceXObject)
m_aBitmaps.front().m_nObject = createObject();
createEmbeddedFile(rGraphic, m_aBitmaps.front().m_aReferenceXObject, m_aBitmaps.front().m_nObject);
it = m_aBitmaps.begin();
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index 460a30d5203a..4ebabaa5b0b5 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -227,7 +227,7 @@ namespace vcl {
bool vcl::Region::IsEmpty() const
{
- return !mbIsNull && !mpB2DPolyPolygon.get() && !mpPolyPolygon.get() && !mpRegionBand.get();
+ return !mbIsNull && !mpB2DPolyPolygon && !mpPolyPolygon && !mpRegionBand;
}
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx
index 9c7173158184..d8c6e774d363 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -596,7 +596,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, const uno::Sequence< beans::Prope
}
if ( rGraphic.GetType() == GraphicType::Bitmap )
{
- if(rGraphic.getVectorGraphicData().get())
+ if(rGraphic.getVectorGraphicData())
{
// embedded Vector Graphic Data, no need to scale. Also no method to apply crop data currently
}