Skip to content

Commit 2a61f6d

Browse files
committed
Fix compiler warnings in c_blob_comparator and make it a local function
Compiler warnings from clang: src/ccstruct/genblob.cpp:34:20: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/genblob.cpp:34:32: warning: cast from 'const void *' to 'C_BLOB **' drops const qualifier [-Wcast-qual] src/ccstruct/genblob.cpp:35:20: warning: use of old-style cast [-Wold-style-cast] src/ccstruct/genblob.cpp:35:32: warning: cast from 'const void *' to 'C_BLOB **' drops const qualifier [-Wcast-qual] The function c_blob_comparator is only used in fixspace.cpp, so move it to that file, make it a local function, and remove genblob.cpp and genblob.h which are no longer needed. Signed-off-by: Stefan Weil <[email protected]>
1 parent 69a111a commit 2a61f6d

File tree

4 files changed

+19
-68
lines changed

4 files changed

+19
-68
lines changed

src/ccmain/fixspace.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "blobs.h" // for TWERD, TBLOB, TESSLINE
2525
#include "boxword.h" // for BoxWord
2626
#include "errcode.h" // for ASSERT_HOST
27-
#include "genblob.h" // for c_blob_comparator
2827
#include "host.h" // for FALSE, TRUE
2928
#include "normalis.h" // for kBlnXHeight, kBlnBaselineOffset
3029
#include "ocrclass.h" // for ETEXT_DESC
@@ -49,6 +48,23 @@ class ROW;
4948

5049
namespace tesseract {
5150

51+
/**********************************************************************
52+
* c_blob_comparator()
53+
*
54+
* Blob comparator used to sort a blob list so that blobs are in increasing
55+
* order of left edge.
56+
**********************************************************************/
57+
58+
static int c_blob_comparator( // sort blobs
59+
const void *blob1p, // ptr to ptr to blob1
60+
const void *blob2p // ptr to ptr to blob2
61+
) {
62+
const C_BLOB *blob1 = *reinterpret_cast<const C_BLOB* const*>(blob1p);
63+
const C_BLOB *blob2 = *reinterpret_cast<const C_BLOB* const*>(blob2p);
64+
65+
return blob1->bounding_box ().left () - blob2->bounding_box ().left ();
66+
}
67+
5268
/**
5369
* @name fix_fuzzy_spaces()
5470
* Walk over the page finding sequences of words joined by fuzzy spaces. Extract

src/ccstruct/Makefile.am

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pkginclude_HEADERS = publictypes.h
1414
noinst_HEADERS = \
1515
blamer.h blobbox.h blobs.h blread.h boxread.h boxword.h \
1616
ccstruct.h coutln.h crakedge.h \
17-
debugpixa.h detlinefit.h dppoint.h fontinfo.h genblob.h \
17+
debugpixa.h detlinefit.h dppoint.h fontinfo.h \
1818
imagedata.h \
1919
ipoints.h \
2020
linlsq.h matrix.h mod128.h normalis.h \
@@ -28,7 +28,7 @@ noinst_LTLIBRARIES = libtesseract_ccstruct.la
2828

2929
libtesseract_ccstruct_la_SOURCES = \
3030
blamer.cpp blobbox.cpp blobs.cpp blread.cpp boxread.cpp boxword.cpp ccstruct.cpp coutln.cpp \
31-
detlinefit.cpp dppoint.cpp fontinfo.cpp genblob.cpp \
31+
detlinefit.cpp dppoint.cpp fontinfo.cpp \
3232
imagedata.cpp \
3333
linlsq.cpp matrix.cpp mod128.cpp normalis.cpp \
3434
ocrblock.cpp ocrpara.cpp ocrrow.cpp otsuthr.cpp \

src/ccstruct/genblob.cpp

-38
This file was deleted.

src/ccstruct/genblob.h

-27
This file was deleted.

0 commit comments

Comments
 (0)