Skip to content

Commit 4f32b8f

Browse files
committed
ccstruct/ocrblock.cpp: Fix compiler warnings
Compiler warnings from clang: src/ccstruct/ocrblock.cpp:74:12: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/ocrblock.cpp:74:21: warning: cast from 'const void *' to 'ROW **' drops const qualifier [-Wcast-qual] src/ccstruct/ocrblock.cpp:75:16: warning: cast from 'const void *' to 'ROW **' drops const qualifier [-Wcast-qual] src/ccstruct/ocrblock.cpp:75:7: warning: use of old-style cast [-Wold-style-cast] Make also the function decreasing_top_order a local function as it is only used locally and remove its global declarations (2 locations). Signed-off-by: Stefan Weil <[email protected]>
1 parent 59b637e commit 4f32b8f

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/ccstruct/ocrblock.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ BLOCK::BLOCK(const char *name, //< filename
6868
* Sort Comparator: Return <0 if row1 top < row2 top
6969
*/
7070

71-
int decreasing_top_order( //
72-
const void *row1,
73-
const void *row2) {
74-
return (*(ROW **) row2)->bounding_box ().top () -
75-
(*(ROW **) row1)->bounding_box ().top ();
71+
static int decreasing_top_order(const void *row1, const void *row2) {
72+
return (*reinterpret_cast<ROW* const*>(row2))->bounding_box().top() -
73+
(*reinterpret_cast<ROW* const*>(row1))->bounding_box().top();
7674
}
7775

7876

src/ccstruct/ocrblock.h

-2
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@ class BLOCK:public ELIST_LINK
211211
ICOORD median_size_; //< Median size of blobs.
212212
};
213213

214-
int decreasing_top_order(const void *row1, const void *row2);
215-
216214
// A function to print segmentation stats for the given block list.
217215
void PrintSegmentationStats(BLOCK_LIST* block_list);
218216

src/ccstruct/pdblock.h

-2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,4 @@ class DLLSYM BLOCK_LINE_IT
171171
BLOCK_RECT_IT rect_it; //< rectangle iterator
172172
};
173173

174-
int decreasing_top_order(const void *row1,
175-
const void *row2);
176174
#endif

0 commit comments

Comments
 (0)