Kaydet (Commit) f69067fd authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1244939 Division or modulo by float zero

and

coverity#1244938 Division or modulo by float zero

Change-Id: I128b1ac10f514285152cf189af24885460c9c5ca
üst f089b4fb
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <editeng/outlobj.hxx> #include <editeng/outlobj.hxx>
#include <editeng/editobj.hxx> #include <editeng/editobj.hxx>
#include <editeng/editeng.hxx> #include <editeng/editeng.hxx>
#include <o3tl/numeric.hxx>
#include <svx/svdmodel.hxx> #include <svx/svdmodel.hxx>
#include <vector> #include <vector>
#include <numeric> #include <numeric>
...@@ -741,22 +742,27 @@ void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWDa ...@@ -741,22 +742,27 @@ void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWDa
InsertMissingOutlinePoints( rOutlinePoly, vDistances, rTextAreaBoundRect, aLocalPoly ); InsertMissingOutlinePoints( rOutlinePoly, vDistances, rTextAreaBoundRect, aLocalPoly );
InsertMissingOutlinePoints( rOutlinePoly2, vDistances2, rTextAreaBoundRect, aLocalPoly ); InsertMissingOutlinePoints( rOutlinePoly2, vDistances2, rTextAreaBoundRect, aLocalPoly );
sal_uInt16 j, _nPointCount = aLocalPoly.GetSize(); sal_uInt16 _nPointCount = aLocalPoly.GetSize();
for ( j = 0; j < _nPointCount; j++ ) if (_nPointCount)
{ {
Point& rPoint = aLocalPoly[ j ]; if (!nWidth || !nHeight)
rPoint.X() -= nLeft; throw o3tl::divide_by_zero();
rPoint.Y() -= nTop; for (sal_uInt16 j = 0; j < _nPointCount; ++j)
double fX = (double)rPoint.X() / (double)nWidth; {
double fY = (double)rPoint.Y() / (double)nHeight; Point& rPoint = aLocalPoly[ j ];
rPoint.X() -= nLeft;
double fx1, fy1, fx2, fy2; rPoint.Y() -= nTop;
GetPoint( rOutlinePoly, vDistances, fX, fx1, fy1 ); double fX = (double)rPoint.X() / (double)nWidth;
GetPoint( rOutlinePoly2, vDistances2, fX, fx2, fy2 ); double fY = (double)rPoint.Y() / (double)nHeight;
double fWidth = fx2 - fx1;
double fHeight= fy2 - fy1; double fx1, fy1, fx2, fy2;
rPoint.X() = (sal_Int32)( fx1 + fWidth * fY ); GetPoint( rOutlinePoly, vDistances, fX, fx1, fy1 );
rPoint.Y() = (sal_Int32)( fy1 + fHeight* fY ); GetPoint( rOutlinePoly2, vDistances2, fX, fx2, fy2 );
double fWidth = fx2 - fx1;
double fHeight= fy2 - fy1;
rPoint.X() = (sal_Int32)( fx1 + fWidth * fY );
rPoint.Y() = (sal_Int32)( fy1 + fHeight* fY );
}
} }
// write back polygon // write back polygon
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment