diff --git a/src/ccstruct/polyblk.cpp b/src/ccstruct/polyblk.cpp index bf2bc171..993e10b6 100644 --- a/src/ccstruct/polyblk.cpp +++ b/src/ccstruct/polyblk.cpp @@ -34,8 +34,6 @@ namespace tesseract { #define INTERSECTING INT16_MAX -int lessthan(const ICOORDELT *first, const ICOORDELT *second); - POLY_BLOCK::POLY_BLOCK(ICOORDELT_LIST *points, PolyBlockType t) { ICOORDELT_IT v = &vertices; @@ -357,7 +355,15 @@ ICOORDELT_LIST *PB_LINE_IT::get_line(TDimension y) { } if (!r.empty()) { - r.sort(lessthan); + r.sort([](const ICOORDELT *p1, const ICOORDELT *p2) { + if (p1->x() < p2->x()) { + return (-1); + } else if (p1->x() > p2->x()) { + return (1); + } else { + return (0); + } + }); for (r.mark_cycle_pt(); !r.cycled_list(); r.forward()) { x = r.data(); } @@ -371,16 +377,6 @@ ICOORDELT_LIST *PB_LINE_IT::get_line(TDimension y) { return result; } -int lessthan(const ICOORDELT *p1, const ICOORDELT *p2) { - if (p1->x() < p2->x()) { - return (-1); - } else if (p1->x() > p2->x()) { - return (1); - } else { - return (0); - } -} - #ifndef GRAPHICS_DISABLED /// Returns a color to draw the given type. ScrollView::Color POLY_BLOCK::ColorForPolyBlockType(PolyBlockType type) {