Skip to content

Commit

Permalink
ccstruct/ocrblock.cpp: Fix compiler warnings
Browse files Browse the repository at this point in the history
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 <sw@weilnetz.de>
  • Loading branch information
stweil committed Sep 3, 2018
1 parent 59b637e commit 4f32b8f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
8 changes: 3 additions & 5 deletions src/ccstruct/ocrblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ BLOCK::BLOCK(const char *name, //< filename
* Sort Comparator: Return <0 if row1 top < row2 top
*/

int decreasing_top_order( //
const void *row1,
const void *row2) {
return (*(ROW **) row2)->bounding_box ().top () -
(*(ROW **) row1)->bounding_box ().top ();
static int decreasing_top_order(const void *row1, const void *row2) {
return (*reinterpret_cast<ROW* const*>(row2))->bounding_box().top() -
(*reinterpret_cast<ROW* const*>(row1))->bounding_box().top();
}


Expand Down
2 changes: 0 additions & 2 deletions src/ccstruct/ocrblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,6 @@ class BLOCK:public ELIST_LINK
ICOORD median_size_; //< Median size of blobs.
};

int decreasing_top_order(const void *row1, const void *row2);

// A function to print segmentation stats for the given block list.
void PrintSegmentationStats(BLOCK_LIST* block_list);

Expand Down
2 changes: 0 additions & 2 deletions src/ccstruct/pdblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,4 @@ class DLLSYM BLOCK_LINE_IT
BLOCK_RECT_IT rect_it; //< rectangle iterator
};

int decreasing_top_order(const void *row1,
const void *row2);
#endif

0 comments on commit 4f32b8f

Please sign in to comment.