mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-11 23:19:04 +08:00
Merge pull request #1816 from noahmetzger/winfix
Fix issues detected by Coverity Scan
This commit is contained in:
commit
b23568f3d1
@ -379,54 +379,62 @@ void ComputeDirection(MFEDGEPT *Start,
|
|||||||
MFEDGEPT *Finish,
|
MFEDGEPT *Finish,
|
||||||
float MinSlope,
|
float MinSlope,
|
||||||
float MaxSlope) {
|
float MaxSlope) {
|
||||||
FVECTOR Delta;
|
FVECTOR Delta;
|
||||||
|
|
||||||
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)
|
}
|
||||||
Start->Direction = southeast;
|
else if (Start->Slope < -MinSlope) {
|
||||||
else
|
if (Start->Slope > -MaxSlope) {
|
||||||
Start->Direction = south;
|
Start->Direction = southeast;
|
||||||
else
|
} else {
|
||||||
Start->Direction = east;
|
Start->Direction = south;
|
||||||
else if (Delta.y > 0)
|
}
|
||||||
if (Start->Slope < -MinSlope)
|
} else {
|
||||||
if (Start->Slope > -MaxSlope)
|
Start->Direction = east;
|
||||||
Start->Direction = northwest;
|
}
|
||||||
else
|
} else if (Delta.y > 0) {
|
||||||
Start->Direction = north;
|
if (Start->Slope < -MinSlope) {
|
||||||
else
|
if (Start->Slope > -MaxSlope) {
|
||||||
Start->Direction = west;
|
Start->Direction = northwest;
|
||||||
else if (Start->Slope > MinSlope)
|
} else {
|
||||||
if (Start->Slope < MaxSlope)
|
Start->Direction = north;
|
||||||
Start->Direction = southwest;
|
}
|
||||||
else
|
} else {
|
||||||
Start->Direction = south;
|
Start->Direction = west;
|
||||||
else
|
}
|
||||||
Start->Direction = west;
|
} else if (Start->Slope > MinSlope) {
|
||||||
}
|
if (Start->Slope < MaxSlope) {
|
||||||
Finish->PreviousDirection = Start->Direction;
|
Start->Direction = southwest;
|
||||||
|
} else {
|
||||||
|
Start->Direction = south;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Start->Direction = west;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Finish->PreviousDirection = Start->Direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user