Merge pull request #1816 from noahmetzger/winfix

Fix issues detected by Coverity Scan
This commit is contained in:
zdenop 2018-08-01 14:45:00 +02:00 committed by GitHub
commit b23568f3d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -383,49 +383,57 @@ void ComputeDirection(MFEDGEPT *Start,
Delta.x = Finish->Point.x - Start->Point.x; Delta.x = Finish->Point.x - Start->Point.x;
Delta.y = Finish->Point.y - Start->Point.y; Delta.y = Finish->Point.y - Start->Point.y;
if (Delta.x == 0) if (Delta.x == 0) {
if (Delta.y < 0) { if (Delta.y < 0) {
Start->Slope = -FLT_MAX; Start->Slope = -FLT_MAX;
Start->Direction = south; Start->Direction = south;
} } else {
else {
Start->Slope = FLT_MAX; Start->Slope = FLT_MAX;
Start->Direction = north; Start->Direction = north;
} }
else { } else {
Start->Slope = Delta.y / Delta.x; Start->Slope = Delta.y / Delta.x;
if (Delta.x > 0) if (Delta.x > 0) {
if (Delta.y > 0) if (Delta.y > 0) {
if (Start->Slope > MinSlope) if (Start->Slope > MinSlope) {
if (Start->Slope < MaxSlope) if (Start->Slope < MaxSlope) {
Start->Direction = northeast; Start->Direction = northeast;
else } else {
Start->Direction = north; Start->Direction = north;
else }
} else {
Start->Direction = east; Start->Direction = east;
else if (Start->Slope < -MinSlope) }
if (Start->Slope > -MaxSlope) }
else if (Start->Slope < -MinSlope) {
if (Start->Slope > -MaxSlope) {
Start->Direction = southeast; Start->Direction = southeast;
else } else {
Start->Direction = south; Start->Direction = south;
else }
} else {
Start->Direction = east; Start->Direction = east;
else if (Delta.y > 0) }
if (Start->Slope < -MinSlope) } else if (Delta.y > 0) {
if (Start->Slope > -MaxSlope) if (Start->Slope < -MinSlope) {
if (Start->Slope > -MaxSlope) {
Start->Direction = northwest; Start->Direction = northwest;
else } else {
Start->Direction = north; Start->Direction = north;
else }
} else {
Start->Direction = west; Start->Direction = west;
else if (Start->Slope > MinSlope) }
if (Start->Slope < MaxSlope) } else if (Start->Slope > MinSlope) {
if (Start->Slope < MaxSlope) {
Start->Direction = southwest; Start->Direction = southwest;
else } else {
Start->Direction = south; Start->Direction = south;
else }
} else {
Start->Direction = west; Start->Direction = west;
} }
}
Finish->PreviousDirection = Start->Direction; Finish->PreviousDirection = Start->Direction;
} }