summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/redundantcast.cxx16
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx5
-rw-r--r--sw/source/ui/vba/vbaparagraphformat.cxx4
3 files changed, 16 insertions, 9 deletions
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 66b81941e579..b6db47495a6d 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -65,6 +65,18 @@ char const * printExprValueKind(ExprValueKind k) {
llvm_unreachable("unknown ExprValueKind");
}
+enum class AlgebraicType { None, Integer, FloatingPoint };
+
+AlgebraicType algebraicType(clang::Type const & type) {
+ if (type.isIntegralOrEnumerationType()) {
+ return AlgebraicType::Integer;
+ } else if (type.isRealFloatingType()) {
+ return AlgebraicType::FloatingPoint;
+ } else {
+ return AlgebraicType::None;
+ }
+}
+
class RedundantCast:
public RecursiveASTVisitor<RedundantCast>, public loplugin::RewritePlugin
{
@@ -252,8 +264,8 @@ bool RedundantCast::VisitImplicitCastExpr(const ImplicitCastExpr * expr) {
case CK_IntegralToFloating:
if (auto e = dyn_cast<ExplicitCastExpr>(expr->getSubExpr()->IgnoreParenImpCasts())) {
if ((isa<CXXStaticCastExpr>(e) || isa<CXXFunctionalCastExpr>(e))
- && (e->getSubExprAsWritten()->getType().getCanonicalType().getTypePtr()
- == expr->getType().getCanonicalType().getTypePtr()))
+ && (algebraicType(*e->getSubExprAsWritten()->getType())
+ == algebraicType(*expr->getType())))
{
report(
DiagnosticsEngine::Warning,
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index b3d1c996a4f2..56fba266c325 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1790,13 +1790,8 @@ void EnhancedCustomShape2d::CreateSubPath(
tools::Rectangle aRect( GetPoint( seqCoordinates[ rSrcPt ], true, true ), GetPoint( seqCoordinates[ rSrcPt + 1 ], true, true ) );
if ( aRect.GetWidth() && aRect.GetHeight() )
{
- Point aCenter( aRect.Center() );
Point aStart( GetPoint( seqCoordinates[ static_cast<sal_uInt16>( rSrcPt + nXor ) ], true, true ) );
Point aEnd( GetPoint( seqCoordinates[ static_cast<sal_uInt16>( rSrcPt + ( nXor ^ 1 ) ) ], true, true ) );
- aStart.setX( static_cast<sal_Int32>( static_cast<double>( aStart.X() - aCenter.X() ) ) + aCenter.X() );
- aStart.setY( static_cast<sal_Int32>( static_cast<double>( aStart.Y() - aCenter.Y() ) ) + aCenter.Y() );
- aEnd.setX( static_cast<sal_Int32>( static_cast<double>( aEnd.X() - aCenter.X() ) ) + aCenter.X() );
- aEnd.setY( static_cast<sal_Int32>( static_cast<double>( aEnd.Y() - aCenter.Y() ) ) + aCenter.Y() );
aNewB2DPolygon.append(CreateArc( aRect, aStart, aEnd, bClockwise));
}
rSrcPt += 4;
diff --git a/sw/source/ui/vba/vbaparagraphformat.cxx b/sw/source/ui/vba/vbaparagraphformat.cxx
index 400488882b91..33f16d6f9d55 100644
--- a/sw/source/ui/vba/vbaparagraphformat.cxx
+++ b/sw/source/ui/vba/vbaparagraphformat.cxx
@@ -341,12 +341,12 @@ style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacing( float _lineSpace, sa
aLineSpacing.Mode = style::LineSpacingMode::PROP;
aLineSpacing.Height = PERCENT100;
}
- else if( _lineSpace == sal_Int16( CHARACTER_INDENT_FACTOR * 1.5 ) )
+ else if( _lineSpace == CHARACTER_INDENT_FACTOR * 1.5 ) // no rounding issues, == 18
{
aLineSpacing.Mode = style::LineSpacingMode::PROP;
aLineSpacing.Height = PERCENT150;
}
- else if( _lineSpace == sal_Int16( CHARACTER_INDENT_FACTOR * 2 ) )
+ else if( _lineSpace == CHARACTER_INDENT_FACTOR * 2 )
{
aLineSpacing.Mode = style::LineSpacingMode::PROP;
aLineSpacing.Height = PERCENT200;