summaryrefslogtreecommitdiff
path: root/svx
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 /svx
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 'svx')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx2
-rw-r--r--svx/source/dialog/imapwnd.cxx2
-rw-r--r--svx/source/dialog/pagectrl.cxx2
-rw-r--r--svx/source/sdr/attribute/sdrallfillattributeshelper.cxx14
-rw-r--r--svx/source/svdraw/svdograf.cxx2
-rw-r--r--svx/source/table/tablertfimporter.cxx2
6 files changed, 12 insertions, 12 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 33eb60a9dd37..7bf8383ab8f6 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -869,7 +869,7 @@ double EnhancedCustomShape2d::GetEquationValueAsDouble( const sal_Int32 nIndex )
static sal_uInt32 nLevel = 0;
if ( nIndex < static_cast<sal_Int32>(vNodesSharedPtr.size()) )
{
- if ( vNodesSharedPtr[ nIndex ].get() ) {
+ if ( vNodesSharedPtr[ nIndex ] ) {
nLevel ++;
try
{
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index bd95ca8237f3..2caa529e12bc 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -363,7 +363,7 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj )
IMapObjectPtr pIMapObj = pUserData->GetObject();
bool bActive = true;
- if ( pIMapObj.get() )
+ if ( pIMapObj )
{
aURL = pIMapObj->GetURL();
aAltText = pIMapObj->GetAltText();
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index 6b9259c19328..f7eae17dbca1 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -337,7 +337,7 @@ void SvxPageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext,
drawinglayer::primitive2d::Primitive2DContainer aSequence;
// create fill geometry if there is something to fill
- if (rFillAttributes.get() && rFillAttributes->isUsed())
+ if (rFillAttributes && rFillAttributes->isUsed())
{
aSequence = rFillAttributes->getPrimitive2DSequence(aPaintRange, aDefineRange);
}
diff --git a/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
index 039311e9739e..57945facb4bb 100644
--- a/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
+++ b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
@@ -45,8 +45,8 @@ namespace drawinglayer::attribute
basegfx::utils::createPolygonFromRect(
maLastPaintRange)),
maLastDefineRange,
- maFillAttribute.get() ? *maFillAttribute : drawinglayer::attribute::SdrFillAttribute(),
- maFillGradientAttribute.get() ? *maFillGradientAttribute : drawinglayer::attribute::FillGradientAttribute());
+ maFillAttribute ? *maFillAttribute : drawinglayer::attribute::SdrFillAttribute(),
+ maFillGradientAttribute ? *maFillGradientAttribute : drawinglayer::attribute::FillGradientAttribute());
}
}
@@ -86,7 +86,7 @@ namespace drawinglayer::attribute
bool SdrAllFillAttributesHelper::isUsed() const
{
// only depends on fill, FillGradientAttribute alone defines no fill
- return maFillAttribute.get() && !maFillAttribute->isDefault();
+ return maFillAttribute && !maFillAttribute->isDefault();
}
bool SdrAllFillAttributesHelper::isTransparent() const
@@ -96,7 +96,7 @@ namespace drawinglayer::attribute
return true;
}
- if(maFillGradientAttribute.get() && !maFillGradientAttribute->isDefault())
+ if(maFillGradientAttribute && !maFillGradientAttribute->isDefault())
{
return true;
}
@@ -113,7 +113,7 @@ namespace drawinglayer::attribute
const drawinglayer::attribute::SdrFillAttribute& SdrAllFillAttributesHelper::getFillAttribute() const
{
- if(!maFillAttribute.get())
+ if(!maFillAttribute)
{
const_cast< SdrAllFillAttributesHelper* >(this)->maFillAttribute =
std::make_shared<drawinglayer::attribute::SdrFillAttribute>();
@@ -124,7 +124,7 @@ namespace drawinglayer::attribute
const drawinglayer::attribute::FillGradientAttribute& SdrAllFillAttributesHelper::getFillGradientAttribute() const
{
- if(!maFillGradientAttribute.get())
+ if(!maFillGradientAttribute)
{
const_cast< SdrAllFillAttributesHelper* >(this)->maFillGradientAttribute =
std::make_shared<drawinglayer::attribute::FillGradientAttribute>();
@@ -154,7 +154,7 @@ namespace drawinglayer::attribute
{
basegfx::BColor aRetval(rFallback);
- if(maFillAttribute.get() && !maFillAttribute->isDefault())
+ if(maFillAttribute && !maFillAttribute->isDefault())
{
const drawinglayer::attribute::FillGradientAttribute& rFillGradientAttribute = maFillAttribute->getGradient();
const drawinglayer::attribute::FillHatchAttribute& rFillHatchAttribute = maFillAttribute->getHatch();
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 3f836d4123cd..be60f5697ca1 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -838,7 +838,7 @@ bool SdrGrafObj::HasGDIMetaFile() const
bool SdrGrafObj::isEmbeddedVectorGraphicData() const
{
- return GraphicType::Bitmap == GetGraphicType() && GetGraphic().getVectorGraphicData().get();
+ return GraphicType::Bitmap == GetGraphicType() && GetGraphic().getVectorGraphicData();
}
GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedVectorGraphicData() const
diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx
index f8484a81c2e6..fb3af5dd82ed 100644
--- a/svx/source/table/tablertfimporter.cxx
+++ b/svx/source/table/tablertfimporter.cxx
@@ -307,7 +307,7 @@ void SdrTableRTFParser::FillTable()
RTFCellInfoPtr xCellInfo( (*xColumn)[nIdx] );
CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
- if( xCell.is() && xCellInfo.get() )
+ if( xCell.is() && xCellInfo )
{
const SfxPoolItem *pPoolItem = nullptr;
if( xCellInfo->maItemSet.GetItemState(SDRATTR_TABLE_BORDER,false,&pPoolItem)==SfxItemState::SET)