diff --git a/src/ccmain/equationdetect.cpp b/src/ccmain/equationdetect.cpp index d1bb762a78..45f5d3be53 100644 --- a/src/ccmain/equationdetect.cpp +++ b/src/ccmain/equationdetect.cpp @@ -22,6 +22,7 @@ #endif #include +#include // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H @@ -1198,7 +1199,7 @@ void EquationDetect::ExpandSeedVertical( // Search iteratively. ColPartition *part = nullptr; GenericVector parts; - int skipped_min_top = INT_MAX, skipped_max_bottom = -1; + int skipped_min_top = std::numeric_limits::max(), skipped_max_bottom = -1; while ((part = search.NextVerticalSearch(search_bottom)) != nullptr) { if (part == seed) { continue; @@ -1361,9 +1362,9 @@ bool EquationDetect::IsMathBlockSatellite( const TBOX& part_box(part->bounding_box()); // Find the top/bottom nearest neighbor of part. ColPartition *neighbors[2]; - int y_gaps[2] = {INT_MAX, INT_MAX}; + int y_gaps[2] = {std::numeric_limits::max(), std::numeric_limits::max()}; // The horizontal boundary of the neighbors. - int neighbors_left = INT_MAX, neighbors_right = 0; + int neighbors_left = std::numeric_limits::max(), neighbors_right = 0; for (int i = 0; i < 2; ++i) { neighbors[i] = SearchNNVertical(i != 0, part); if (neighbors[i]) { @@ -1380,7 +1381,7 @@ bool EquationDetect::IsMathBlockSatellite( if (neighbors[0] == neighbors[1]) { // This happens when part is inside neighbor. neighbors[1] = nullptr; - y_gaps[1] = INT_MAX; + y_gaps[1] = std::numeric_limits::max(); } // Check if part is within [neighbors_left, neighbors_right]. @@ -1419,7 +1420,7 @@ ColPartition* EquationDetect::SearchNNVertical( const TBOX& part_box(part->bounding_box()); int y = search_bottom ? part_box.bottom() : part_box.top(); search.StartVerticalSearch(part_box.left(), part_box.right(), y); - int min_y_gap = INT_MAX; + int min_y_gap = std::numeric_limits::max(); while ((neighbor = search.NextVerticalSearch(search_bottom)) != nullptr) { if (neighbor == part || !IsTextOrEquationType(neighbor->type())) { continue; diff --git a/src/ccutil/scanutils.cpp b/src/ccutil/scanutils.cpp index a1035af482..f47546aed0 100644 --- a/src/ccutil/scanutils.cpp +++ b/src/ccutil/scanutils.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,7 @@ enum Ranks { RANK_INT = 0, RANK_LONG = 1, RANK_LONGLONG = 2, - RANK_PTR = INT_MAX // Special value used for pointers + RANK_PTR = std::numeric_limits::max() // Special value used for pointers }; const enum Ranks kMinRank = RANK_CHAR;