mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-05 10:49:01 +08:00
ccstruct/polyblk.cpp: Fix compiler warnings
Compiler warnings from clang: src/ccstruct/polyblk.cpp:194:16: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/polyblk.cpp:195:16: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/polyblk.cpp:292:45: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/polyblk.cpp:30:9: warning: macro is not used [-Wunused-macros] src/ccstruct/polyblk.cpp:348:8: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/polyblk.cpp:358:12: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/polyblk.cpp:362:26: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/polyblk.cpp:383:21: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/polyblk.cpp:383:36: warning: cast from 'const void *' to 'ICOORDELT **' drops const qualifier [-Wcast-qual] src/ccstruct/polyblk.cpp:384:21: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/polyblk.cpp:384:36: warning: cast from 'const void *' to 'ICOORDELT **' drops const qualifier [-Wcast-qual] Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
4f32b8fd05
commit
4934b2e8eb
@ -27,7 +27,6 @@
|
||||
#include "config_auto.h"
|
||||
#endif
|
||||
|
||||
#define PBLOCK_LABEL_SIZE 150
|
||||
#define INTERSECTING INT16_MAX
|
||||
|
||||
int lessthan(const void *first, const void *second);
|
||||
@ -191,8 +190,8 @@ void POLY_BLOCK::rotate(FCOORD rotation) {
|
||||
pos.set_x (pt->x ());
|
||||
pos.set_y (pt->y ());
|
||||
pos.rotate (rotation);
|
||||
pt->set_x ((int16_t) (floor (pos.x () + 0.5)));
|
||||
pt->set_y ((int16_t) (floor (pos.y () + 0.5)));
|
||||
pt->set_x(static_cast<int16_t>(floor(pos.x() + 0.5)));
|
||||
pt->set_y(static_cast<int16_t>(floor(pos.y() + 0.5)));
|
||||
pts.forward ();
|
||||
}
|
||||
while (!pts.at_first ());
|
||||
@ -289,7 +288,7 @@ void POLY_BLOCK::fill(ScrollView* window, ScrollView::Color colour) {
|
||||
// Last pixel is start pixel + length.
|
||||
width = s_it.data ()->y ();
|
||||
window->SetCursor(s_it.data ()->x (), y);
|
||||
window->DrawTo(s_it.data ()->x () + (float) width, y);
|
||||
window->DrawTo(s_it.data()->x() + static_cast<float>(width), y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -343,9 +342,7 @@ ICOORDELT_LIST *PB_LINE_IT::get_line(int16_t y) {
|
||||
ICOORDELT_IT v, r;
|
||||
ICOORDELT_LIST *result;
|
||||
ICOORDELT *x, *current, *previous;
|
||||
float fy, fx;
|
||||
|
||||
fy = (float) (y + 0.5);
|
||||
float fy = y + 0.5f;
|
||||
result = new ICOORDELT_LIST ();
|
||||
r.set_to_list (result);
|
||||
v.set_to_list (block->points ());
|
||||
@ -355,11 +352,10 @@ ICOORDELT_LIST *PB_LINE_IT::get_line(int16_t y) {
|
||||
|| ((v.data_relative (-1)->y () <= y) && (v.data ()->y () > y))) {
|
||||
previous = v.data_relative (-1);
|
||||
current = v.data ();
|
||||
fx = (float) (0.5 + previous->x () +
|
||||
(current->x () - previous->x ()) * (fy -
|
||||
previous->y ()) /
|
||||
(current->y () - previous->y ()));
|
||||
x = new ICOORDELT ((int16_t) fx, 0);
|
||||
float fx = 0.5f + previous->x() +
|
||||
(current->x() - previous->x()) * (fy - previous->y()) /
|
||||
(current->y() - previous->y());
|
||||
x = new ICOORDELT(static_cast<int16_t>(fx), 0);
|
||||
r.add_to_end (x);
|
||||
}
|
||||
}
|
||||
@ -380,8 +376,8 @@ ICOORDELT_LIST *PB_LINE_IT::get_line(int16_t y) {
|
||||
|
||||
|
||||
int lessthan(const void *first, const void *second) {
|
||||
ICOORDELT *p1 = (*(ICOORDELT **) first);
|
||||
ICOORDELT *p2 = (*(ICOORDELT **) second);
|
||||
const ICOORDELT *p1 = *reinterpret_cast<const ICOORDELT* const*>(first);
|
||||
const ICOORDELT *p2 = *reinterpret_cast<const ICOORDELT* const*>(second);
|
||||
|
||||
if (p1->x () < p2->x ())
|
||||
return (-1);
|
||||
|
Loading…
Reference in New Issue
Block a user