Make one-time comparator a lambda.
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run

This commit is contained in:
Egor Pugin 2024-11-23 00:11:16 +03:00
parent b3e0c8e3a0
commit 66cf74f2dd

View File

@ -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) {