Skip to content

Commit d28631a

Browse files
committed
Fix issues detected by Coverity Scan
CID: 1164604 (Nesting level does not match indentation) Signed-off-by: Noah Metzger <[email protected]>
1 parent 2d96c66 commit d28631a

File tree

1 file changed

+56
-48
lines changed

1 file changed

+56
-48
lines changed

src/classify/mfoutline.cpp

+56-48
Original file line numberDiff line numberDiff line change
@@ -379,54 +379,62 @@ void ComputeDirection(MFEDGEPT *Start,
379379
MFEDGEPT *Finish,
380380
float MinSlope,
381381
float MaxSlope) {
382-
FVECTOR Delta;
383-
384-
Delta.x = Finish->Point.x - Start->Point.x;
385-
Delta.y = Finish->Point.y - Start->Point.y;
386-
if (Delta.x == 0)
387-
if (Delta.y < 0) {
388-
Start->Slope = -FLT_MAX;
389-
Start->Direction = south;
390-
}
391-
else {
392-
Start->Slope = FLT_MAX;
393-
Start->Direction = north;
394-
}
395-
else {
396-
Start->Slope = Delta.y / Delta.x;
397-
if (Delta.x > 0)
398-
if (Delta.y > 0)
399-
if (Start->Slope > MinSlope)
400-
if (Start->Slope < MaxSlope)
401-
Start->Direction = northeast;
402-
else
403-
Start->Direction = north;
404-
else
405-
Start->Direction = east;
406-
else if (Start->Slope < -MinSlope)
407-
if (Start->Slope > -MaxSlope)
408-
Start->Direction = southeast;
409-
else
410-
Start->Direction = south;
411-
else
412-
Start->Direction = east;
413-
else if (Delta.y > 0)
414-
if (Start->Slope < -MinSlope)
415-
if (Start->Slope > -MaxSlope)
416-
Start->Direction = northwest;
417-
else
418-
Start->Direction = north;
419-
else
420-
Start->Direction = west;
421-
else if (Start->Slope > MinSlope)
422-
if (Start->Slope < MaxSlope)
423-
Start->Direction = southwest;
424-
else
425-
Start->Direction = south;
426-
else
427-
Start->Direction = west;
428-
}
429-
Finish->PreviousDirection = Start->Direction;
382+
FVECTOR Delta;
383+
384+
Delta.x = Finish->Point.x - Start->Point.x;
385+
Delta.y = Finish->Point.y - Start->Point.y;
386+
if (Delta.x == 0) {
387+
if (Delta.y < 0) {
388+
Start->Slope = -FLT_MAX;
389+
Start->Direction = south;
390+
} else {
391+
Start->Slope = FLT_MAX;
392+
Start->Direction = north;
393+
}
394+
} else {
395+
Start->Slope = Delta.y / Delta.x;
396+
if (Delta.x > 0) {
397+
if (Delta.y > 0) {
398+
if (Start->Slope > MinSlope) {
399+
if (Start->Slope < MaxSlope) {
400+
Start->Direction = northeast;
401+
} else {
402+
Start->Direction = north;
403+
}
404+
} else {
405+
Start->Direction = east;
406+
}
407+
}
408+
else if (Start->Slope < -MinSlope) {
409+
if (Start->Slope > -MaxSlope) {
410+
Start->Direction = southeast;
411+
} else {
412+
Start->Direction = south;
413+
}
414+
} else {
415+
Start->Direction = east;
416+
}
417+
} else if (Delta.y > 0) {
418+
if (Start->Slope < -MinSlope) {
419+
if (Start->Slope > -MaxSlope) {
420+
Start->Direction = northwest;
421+
} else {
422+
Start->Direction = north;
423+
}
424+
} else {
425+
Start->Direction = west;
426+
}
427+
} else if (Start->Slope > MinSlope) {
428+
if (Start->Slope < MaxSlope) {
429+
Start->Direction = southwest;
430+
} else {
431+
Start->Direction = south;
432+
}
433+
} else {
434+
Start->Direction = west;
435+
}
436+
}
437+
Finish->PreviousDirection = Start->Direction;
430438
}
431439

432440
/**

0 commit comments

Comments
 (0)