[Libreoffice-commits] core.git: chart2/source compilerplugins/clang editeng/source sw/source xmlscript/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Apr 6 11:42:17 UTC 2017


 chart2/source/view/charttypes/GL3DBarChart.cxx  |    4 ++--
 chart2/source/view/main/GL3DRenderer.cxx        |    6 +++---
 chart2/source/view/main/VButton.cxx             |    2 +-
 compilerplugins/clang/redundantcast.cxx         |    3 ++-
 editeng/source/items/textitem.cxx               |    2 +-
 sw/source/filter/ww8/ww8par3.cxx                |    2 +-
 xmlscript/source/xmldlg_imexp/xmldlg_export.cxx |    6 +++---
 7 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit f1945405b08cad5138345882cb68c64edeeabdae
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Apr 6 11:58:38 2017 +0200

    loplugin:redundantcast check for c-style float casts
    
    Change-Id: I86b6f58887cb398a80698f8d8564b5bc3f55eabb
    Reviewed-on: https://gerrit.libreoffice.org/36198
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 33e6b1f367fb..0f96e878bb04 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -841,8 +841,8 @@ void GL3DBarChart::create3DShapes(const std::vector<std::unique_ptr<VDataSeries>
         //if scroll the bars, set the speed and distance first
         if (mbScrollFlg)
         {
-            mpRenderer->SetScrollSpeed((float)(BAR_SIZE_X + BAR_DISTANCE_X) / (float)miScrollRate);
-            mpRenderer->SetScrollDistance((float)(BAR_SIZE_X + BAR_DISTANCE_X));
+            mpRenderer->SetScrollSpeed((BAR_SIZE_X + BAR_DISTANCE_X) / (float)miScrollRate);
+            mpRenderer->SetScrollDistance(BAR_SIZE_X + BAR_DISTANCE_X);
         }
         spawnRenderThread(new RenderBenchMarkThread(this));
     }
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index c00bd18f6521..fe4e7e8e9449 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -1416,7 +1416,7 @@ void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D
     {
         // the height of rounded corner is higher than the cube than use the org scale matrix
    //     yScale /= (float)(1 + BOTTOM_THRESHOLD);
-        zScale /= (float)(m_RoundBarMesh.bottomThreshold);
+        zScale /= m_RoundBarMesh.bottomThreshold;
         PosVecf3 scale = {xyScale, xyScale, zScale};
         glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
         glm::mat4 aScaleMatrix = glm::scale(glm::vec3(scale.x, scale.y, scale.z));
@@ -1505,7 +1505,7 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
     {
         // the height of rounded corner is higher than the cube than use the org scale matrix
         //yScale /= (float)(1 + BOTTOM_THRESHOLD);
-        zScale /= (float)(m_RoundBarMesh.bottomThreshold);
+        zScale /= m_RoundBarMesh.bottomThreshold;
         glm::mat4 orgTrans = glm::translate(glm::vec3(0.0, 0.0, -1.0));
         glm::mat4 scale = glm::scale(glm::vec3(xyScale, xyScale, zScale));
         //MoveModelf(trans, angle, scale);
@@ -2306,7 +2306,7 @@ void OpenGL3DRenderer::GetBatchTopAndFlatInfo(const Extrude3DInfo &extrude3D)
     {
         // the height of rounded corner is higher than the cube than use the org scale matrix
         //yScale /= (float)(1 + BOTTOM_THRESHOLD);
-        zScale /= (float)(m_RoundBarMesh.bottomThreshold);
+        zScale /= m_RoundBarMesh.bottomThreshold;
         glm::mat4 scale = glm::scale(glm::vec3(xyScale, xyScale, zScale));
         //MoveModelf(trans, angle, scale);
         glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
diff --git a/chart2/source/view/main/VButton.cxx b/chart2/source/view/main/VButton.cxx
index 406de6abe96f..996ceff2c288 100644
--- a/chart2/source/view/main/VButton.cxx
+++ b/chart2/source/view/main/VButton.cxx
@@ -49,7 +49,7 @@ void VButton::createShapes(const awt::Point& rPosition,
     PropertyMapper::getTextLabelMultiPropertyLists(xTextProp, *pPropNames, *pPropValues);
 
     tPropertyNameValueMap aTextValueMap;
-    aTextValueMap["CharHeight"] <<= (float)10.0f;
+    aTextValueMap["CharHeight"] <<= 10.0f;
     aTextValueMap["FillColor"] <<= (sal_Int32)0xe6e6e6;
     aTextValueMap["FillStyle"] <<= drawing::FillStyle_SOLID;
     aTextValueMap["LineColor"] <<= (sal_Int32)0xcccccc;
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 845876425c7e..59e21657f548 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -306,7 +306,8 @@ bool RedundantCast::VisitCStyleCastExpr(CStyleCastExpr const * expr) {
             << t1 << t2 << expr->getSourceRange();
         return true;
     }
-    bool bBuiltinType = t1->isSpecificBuiltinType(BuiltinType::Bool) || t1->isSpecificBuiltinType(BuiltinType::Double);
+    bool bBuiltinType = t1->isSpecificBuiltinType(BuiltinType::Bool) || t1->isSpecificBuiltinType(BuiltinType::Double)
+                        || t1->isSpecificBuiltinType(BuiltinType::Float);
     if ((bBuiltinType || loplugin::TypeCheck(t1).Typedef()) && t1 == t2)
     {
         // Ignore FD_ISSET expanding to "...(SOCKET)(fd)..." in some Microsoft
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index f3380c46fe89..3b4ef530d88a 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -649,7 +649,7 @@ bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
         break;
         case MID_WEIGHT:
         {
-            rVal <<= (float)( vcl::unohelper::ConvertFontWeight( GetValue() ) );
+            rVal <<= vcl::unohelper::ConvertFontWeight( GetValue() );
         }
         break;
     }
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 5da3e3770f27..b033133b5953 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -2353,7 +2353,7 @@ awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const OUString &rString,
             break;
 
         case RES_CHRATR_WEIGHT:
-            aTmp <<= (float)vcl::unohelper::ConvertFontWeight(
+            aTmp <<= vcl::unohelper::ConvertFontWeight(
                                         static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
             aFont.SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
             break;
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 742509a14957..ec7398e38d2f 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -261,12 +261,12 @@ Reference< xml::sax::XAttributeList > Style::createElement()
         // dialog:font-charwidth CDATA #IMPLIED
         if (def_descr.CharacterWidth != _descr.CharacterWidth)
         {
-            pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-charwidth", OUString::number( (float)_descr.CharacterWidth ) );
+            pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-charwidth", OUString::number( _descr.CharacterWidth ) );
         }
         // dialog:font-weight CDATA #IMPLIED
         if (def_descr.Weight != _descr.Weight)
         {
-            pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-weight", OUString::number( (float)_descr.Weight ) );
+            pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-weight", OUString::number( _descr.Weight ) );
         }
         // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED
         if (def_descr.Slant != _descr.Slant)
@@ -379,7 +379,7 @@ Reference< xml::sax::XAttributeList > Style::createElement()
         // dialog:font-orientation CDATA #IMPLIED
         if (def_descr.Orientation != _descr.Orientation)
         {
-            pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-orientation", OUString::number( (float)_descr.Orientation ) );
+            pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-orientation", OUString::number( _descr.Orientation ) );
         }
         // dialog:font-kerning %boolean; #IMPLIED
         if (bool(def_descr.Kerning) != bool(_descr.Kerning))


More information about the Libreoffice-commits mailing list