[Libreoffice-commits] core.git: starmath/source svx/source

Onur Yilmaz (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 28 13:54:43 UTC 2020


 starmath/source/view.cxx                              |    8 ++++----
 starmath/source/visitors.cxx                          |    2 +-
 svx/source/dialog/_bmpmask.cxx                        |    2 +-
 svx/source/dialog/_contdlg.cxx                        |    2 +-
 svx/source/dialog/framelinkarray.cxx                  |    8 ++++----
 svx/source/sdr/animation/scheduler.cxx                |    2 +-
 svx/source/sdr/contact/viewcontactofsdrobj.cxx        |    2 +-
 svx/source/sdr/contact/viewobjectcontactofpageobj.cxx |    4 ++--
 svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx |    4 ++--
 9 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 2065cbf576e7d3257e7da2151419404928326df3
Author:     Onur Yilmaz <onuryilmaz0750 at gmail.com>
AuthorDate: Mon Jan 27 12:04:16 2020 +0300
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Jan 28 14:54:10 2020 +0100

    tdf#96505: Get rid of cargo cult long integer literals
    
    I checked return values.
    Long variables didn't affect the calculation.
    
    Change-Id: I1d5b5cffa291c20f7940dc14efa05cc64f3ff1ed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87499
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 54e6122c8873..a76a6e82b83b 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1197,8 +1197,8 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri
                 Size     OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(),
                                                             aOutRect.GetHeight()), MapMode(MapUnit::Map100thMM)));
                 Size     GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MapUnit::Map100thMM)));
-                sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(long(Fraction(OutputSize.Width()  * 100L, GraphicSize.Width())),
-                                                                          long(Fraction(OutputSize.Height() * 100L, GraphicSize.Height()))));
+                sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(long(Fraction(OutputSize.Width()  * 100, GraphicSize.Width())),
+                                                                          long(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
                 nZ -= 10;
                 Fraction aFraction (std::max(MINZOOM, std::min(MAXZOOM, nZ)), 100);
 
@@ -2019,8 +2019,8 @@ void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet)
             Size       OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(),
                                                               OutputRect.GetHeight()), aMap));
             Size       GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap));
-            sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(long(Fraction(OutputSize.Width()  * 100L, GraphicSize.Width())),
-                                                                      long(Fraction(OutputSize.Height() * 100L, GraphicSize.Height()))));
+            sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(long(Fraction(OutputSize.Width()  * 100, GraphicSize.Width())),
+                                                                      long(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
             mpGraphic->SetZoom (nZ);
             break;
         }
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index a950046162bf..dcf36497a4eb 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -406,7 +406,7 @@ void SmDrawingVisitor::Visit( SmRootSymbolNode* pNode )
     // _unscaled_ font height to be used, we use that to calculate the
     // bar height. Thus it is independent of the arguments height.
     // ( see display of sqrt QQQ versus sqrt stack{Q#Q#Q#Q} )
-    long nBarHeight = pNode->GetWidth( ) * 7L / 100L;
+    long nBarHeight = pNode->GetWidth( ) * 7 / 100;
     long nBarWidth = pNode->GetBodyWidth( ) + pNode->GetBorderWidth( );
     Point aBarOffset( pNode->GetWidth( ), +pNode->GetBorderWidth( ) );
     Point aBarPos( maPosition + aBarOffset );
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index 38c931434fd2..27c5d3a4de07 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -676,7 +676,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
         // Prepare Color comparison array
         for( i = 0; i < nCount; i++ )
         {
-            long nTol = ( pTols[i] * 255L ) / 100L;
+            long nTol = ( pTols[i] * 255 ) / 100;
 
             long nVal = static_cast<long>(pSrcCols[i].GetRed());
             pMinR[i] = std::max( nVal - nTol, 0L );
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 1ca714868c17..fe08cad1fed7 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -631,7 +631,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow&, rWnd, void )
         if( aGraphic.GetType() == GraphicType::Bitmap )
         {
             const Bitmap & rBmp( aGraphic.GetBitmapEx().GetBitmap() );
-            const long  nTol = static_cast<long>(m_xMtfTolerance->get_value(FieldUnit::PERCENT) * 255L / 100L);
+            const long  nTol = static_cast<long>(m_xMtfTolerance->get_value(FieldUnit::PERCENT) * 255 / 100);
 
             aMask = rBmp.CreateMask( rColor, nTol );
 
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index c94bd5817233..752778bff896 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -246,10 +246,10 @@ ArrayImpl::ArrayImpl( size_t nWidth, size_t nHeight ) :
 {
     // default-construct all vectors
     maCells.resize( mnWidth * mnHeight );
-    maWidths.resize( mnWidth, 0L );
-    maHeights.resize( mnHeight, 0L );
-    maXCoords.resize( mnWidth + 1, 0L );
-    maYCoords.resize( mnHeight + 1, 0L );
+    maWidths.resize( mnWidth, 0 );
+    maHeights.resize( mnHeight, 0 );
+    maXCoords.resize( mnWidth + 1, 0 );
+    maYCoords.resize( mnHeight + 1, 0 );
 }
 
 const Cell& ArrayImpl::GetCell( size_t nCol, size_t nRow ) const
diff --git a/svx/source/sdr/animation/scheduler.cxx b/svx/source/sdr/animation/scheduler.cxx
index a9e93d01ce45..0efac9e6fac0 100644
--- a/svx/source/sdr/animation/scheduler.cxx
+++ b/svx/source/sdr/animation/scheduler.cxx
@@ -100,7 +100,7 @@ namespace sdr::animation
             {
                 mnDeltaTime = mvEvents.front()->GetTime() - mnTime;
 
-                if(0L != mnDeltaTime)
+                if(0 != mnDeltaTime)
                 {
                     SetTimeout(mnDeltaTime);
                     Start();
diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
index cf5bd082f74e..72025557c5f0 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -72,7 +72,7 @@ sal_uInt32 ViewContactOfSdrObj::GetObjectCount() const
         return GetSdrObject().GetSubList()->GetObjCount();
     }
 
-    return 0L;
+    return 0;
 }
 
 ViewContact& ViewContactOfSdrObj::GetViewContact(sal_uInt32 nIndex) const
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index 5da45eabed5c..aac38032875b 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -229,11 +229,11 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageObj::crea
             const basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(aPageBound));
 
             // add replacement fill
-            xPageContent[0L] = drawinglayer::primitive2d::Primitive2DReference(
+            xPageContent[0] = drawinglayer::primitive2d::Primitive2DReference(
                 new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), aDocColor.getBColor()));
 
             // add replacement border
-            xPageContent[1L] = drawinglayer::primitive2d::Primitive2DReference(
+            xPageContent[1] = drawinglayer::primitive2d::Primitive2DReference(
                 new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aBorderColor.getBColor()));
         }
         else
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
index 1e6102f114dc..fc9c06959044 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
@@ -464,8 +464,8 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageGrid::cre
         const Size aFine(rView.GetGridFine());
         const double fWidthX(aRaw.getWidth());
         const double fWidthY(aRaw.getHeight());
-        const sal_uInt32 nSubdivisionsX(aFine.getWidth() ? aRaw.getWidth() / aFine.getWidth() : 0L);
-        const sal_uInt32 nSubdivisionsY(aFine.getHeight() ? aRaw.getHeight() / aFine.getHeight() : 0L);
+        const sal_uInt32 nSubdivisionsX(aFine.getWidth() ? aRaw.getWidth() / aFine.getWidth() : 0);
+        const sal_uInt32 nSubdivisionsY(aFine.getHeight() ? aRaw.getHeight() / aFine.getHeight() : 0);
 
         xRetval.resize(1);
         xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::GridPrimitive2D(


More information about the Libreoffice-commits mailing list