From d28631a274b97239a83ff1aaa257246a65c322d7 Mon Sep 17 00:00:00 2001 From: Noah Metzger Date: Wed, 1 Aug 2018 14:29:07 +0200 Subject: [PATCH] Fix issues detected by Coverity Scan CID: 1164604 (Nesting level does not match indentation) Signed-off-by: Noah Metzger --- src/classify/mfoutline.cpp | 104 ++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/src/classify/mfoutline.cpp b/src/classify/mfoutline.cpp index d848519cce..c121f1a889 100644 --- a/src/classify/mfoutline.cpp +++ b/src/classify/mfoutline.cpp @@ -379,54 +379,62 @@ void ComputeDirection(MFEDGEPT *Start, MFEDGEPT *Finish, float MinSlope, float MaxSlope) { - FVECTOR Delta; - - Delta.x = Finish->Point.x - Start->Point.x; - Delta.y = Finish->Point.y - Start->Point.y; - if (Delta.x == 0) - if (Delta.y < 0) { - Start->Slope = -FLT_MAX; - Start->Direction = south; - } - else { - Start->Slope = FLT_MAX; - Start->Direction = north; - } - else { - Start->Slope = Delta.y / Delta.x; - if (Delta.x > 0) - if (Delta.y > 0) - if (Start->Slope > MinSlope) - if (Start->Slope < MaxSlope) - Start->Direction = northeast; - else - Start->Direction = north; - else - Start->Direction = east; - else if (Start->Slope < -MinSlope) - if (Start->Slope > -MaxSlope) - Start->Direction = southeast; - else - Start->Direction = south; - else - Start->Direction = east; - else if (Delta.y > 0) - if (Start->Slope < -MinSlope) - if (Start->Slope > -MaxSlope) - Start->Direction = northwest; - else - Start->Direction = north; - else - Start->Direction = west; - else if (Start->Slope > MinSlope) - if (Start->Slope < MaxSlope) - Start->Direction = southwest; - else - Start->Direction = south; - else - Start->Direction = west; - } - Finish->PreviousDirection = Start->Direction; + FVECTOR Delta; + + Delta.x = Finish->Point.x - Start->Point.x; + Delta.y = Finish->Point.y - Start->Point.y; + if (Delta.x == 0) { + if (Delta.y < 0) { + Start->Slope = -FLT_MAX; + Start->Direction = south; + } else { + Start->Slope = FLT_MAX; + Start->Direction = north; + } + } else { + Start->Slope = Delta.y / Delta.x; + if (Delta.x > 0) { + if (Delta.y > 0) { + if (Start->Slope > MinSlope) { + if (Start->Slope < MaxSlope) { + Start->Direction = northeast; + } else { + Start->Direction = north; + } + } else { + Start->Direction = east; + } + } + else if (Start->Slope < -MinSlope) { + if (Start->Slope > -MaxSlope) { + Start->Direction = southeast; + } else { + Start->Direction = south; + } + } else { + Start->Direction = east; + } + } else if (Delta.y > 0) { + if (Start->Slope < -MinSlope) { + if (Start->Slope > -MaxSlope) { + Start->Direction = northwest; + } else { + Start->Direction = north; + } + } else { + Start->Direction = west; + } + } else if (Start->Slope > MinSlope) { + if (Start->Slope < MaxSlope) { + Start->Direction = southwest; + } else { + Start->Direction = south; + } + } else { + Start->Direction = west; + } + } + Finish->PreviousDirection = Start->Direction; } /**