From 9fb9b057d65b07fcd037b31505561c5b3fe9939c Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 27 Sep 2013 23:32:53 +0200 Subject: [PATCH] cppcheck: avoid possible division by 0 Change-Id: I8ff8e72d0d25168da374d752a18210cf764ed311 --- filter/source/graphicfilter/icgm/class4.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx index 8899d73a8951..71ccf320abba 100644 --- a/filter/source/graphicfilter/icgm/class4.cxx +++ b/filter/source/graphicfilter/icgm/class4.cxx @@ -371,11 +371,10 @@ void CGM::ImplDoClass4() double fG = 2.0 * ( fA * ( aEndingPoint.Y - aIntermediatePoint.Y ) - fB * ( aEndingPoint.X - aIntermediatePoint.X ) ); - aCenterPoint.X = ( fD * fE - fB * fF ) / fG; - aCenterPoint.Y = ( fA * fF - fC * fE ) / fG; - if ( fG != 0 ) { + aCenterPoint.X = ( fD * fE - fB * fF ) / fG; + aCenterPoint.Y = ( fA * fF - fC * fE ) / fG; double fStartAngle = ImplGetOrientation( aCenterPoint, aStartingPoint ); double fInterAngle = ImplGetOrientation( aCenterPoint, aIntermediatePoint ); double fEndAngle = ImplGetOrientation( aCenterPoint, aEndingPoint ); @@ -445,11 +444,10 @@ void CGM::ImplDoClass4() double fG = 2.0 * ( fA * ( aEndingPoint.Y - aIntermediatePoint.Y ) - fB * ( aEndingPoint.X - aIntermediatePoint.X ) ); - aCenterPoint.X = ( fD * fE - fB * fF ) / fG; - aCenterPoint.Y = ( fA * fF - fC * fE ) / fG; - if ( fG != 0 ) { + aCenterPoint.X = ( fD * fE - fB * fF ) / fG; + aCenterPoint.Y = ( fA * fF - fC * fE ) / fG; double fStartAngle = ImplGetOrientation( aCenterPoint, aStartingPoint ); double fInterAngle = ImplGetOrientation( aCenterPoint, aIntermediatePoint ); double fEndAngle = ImplGetOrientation( aCenterPoint, aEndingPoint );