mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-12 23:49:06 +08:00
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 <sw@weilnetz.de>
This commit is contained in:
parent
69a111a739
commit
2a61f6dfcd
@ -24,7 +24,6 @@
|
||||
#include "blobs.h" // for TWERD, TBLOB, TESSLINE
|
||||
#include "boxword.h" // for BoxWord
|
||||
#include "errcode.h" // for ASSERT_HOST
|
||||
#include "genblob.h" // for c_blob_comparator
|
||||
#include "host.h" // for FALSE, TRUE
|
||||
#include "normalis.h" // for kBlnXHeight, kBlnBaselineOffset
|
||||
#include "ocrclass.h" // for ETEXT_DESC
|
||||
@ -49,6 +48,23 @@ class ROW;
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
/**********************************************************************
|
||||
* c_blob_comparator()
|
||||
*
|
||||
* Blob comparator used to sort a blob list so that blobs are in increasing
|
||||
* order of left edge.
|
||||
**********************************************************************/
|
||||
|
||||
static int c_blob_comparator( // sort blobs
|
||||
const void *blob1p, // ptr to ptr to blob1
|
||||
const void *blob2p // ptr to ptr to blob2
|
||||
) {
|
||||
const C_BLOB *blob1 = *reinterpret_cast<const C_BLOB* const*>(blob1p);
|
||||
const C_BLOB *blob2 = *reinterpret_cast<const C_BLOB* const*>(blob2p);
|
||||
|
||||
return blob1->bounding_box ().left () - blob2->bounding_box ().left ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @name fix_fuzzy_spaces()
|
||||
* Walk over the page finding sequences of words joined by fuzzy spaces. Extract
|
||||
|
@ -14,7 +14,7 @@ pkginclude_HEADERS = publictypes.h
|
||||
noinst_HEADERS = \
|
||||
blamer.h blobbox.h blobs.h blread.h boxread.h boxword.h \
|
||||
ccstruct.h coutln.h crakedge.h \
|
||||
debugpixa.h detlinefit.h dppoint.h fontinfo.h genblob.h \
|
||||
debugpixa.h detlinefit.h dppoint.h fontinfo.h \
|
||||
imagedata.h \
|
||||
ipoints.h \
|
||||
linlsq.h matrix.h mod128.h normalis.h \
|
||||
@ -28,7 +28,7 @@ noinst_LTLIBRARIES = libtesseract_ccstruct.la
|
||||
|
||||
libtesseract_ccstruct_la_SOURCES = \
|
||||
blamer.cpp blobbox.cpp blobs.cpp blread.cpp boxread.cpp boxword.cpp ccstruct.cpp coutln.cpp \
|
||||
detlinefit.cpp dppoint.cpp fontinfo.cpp genblob.cpp \
|
||||
detlinefit.cpp dppoint.cpp fontinfo.cpp \
|
||||
imagedata.cpp \
|
||||
linlsq.cpp matrix.cpp mod128.cpp normalis.cpp \
|
||||
ocrblock.cpp ocrpara.cpp ocrrow.cpp otsuthr.cpp \
|
||||
|
@ -1,38 +0,0 @@
|
||||
/**********************************************************************
|
||||
* File: genblob.cpp (Formerly gblob.c)
|
||||
* Description: Generic Blob processing routines
|
||||
* Author: Phil Cheatle
|
||||
* Created: Mon Nov 25 10:53:26 GMT 1991
|
||||
*
|
||||
* (C) Copyright 1991, Hewlett-Packard Ltd.
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "genblob.h"
|
||||
#include "stepblob.h"
|
||||
|
||||
/**********************************************************************
|
||||
* c_blob_comparator()
|
||||
*
|
||||
* Blob comparator used to sort a blob list so that blobs are in increasing
|
||||
* order of left edge.
|
||||
**********************************************************************/
|
||||
|
||||
int c_blob_comparator( // sort blobs
|
||||
const void *blob1p, // ptr to ptr to blob1
|
||||
const void *blob2p // ptr to ptr to blob2
|
||||
) {
|
||||
C_BLOB *blob1 = *(C_BLOB **) blob1p;
|
||||
C_BLOB *blob2 = *(C_BLOB **) blob2p;
|
||||
|
||||
return blob1->bounding_box ().left () - blob2->bounding_box ().left ();
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/**********************************************************************
|
||||
* File: genblob.h (Formerly gblob.h)
|
||||
* Description: Generic Blob processing routines
|
||||
* Author: Phil Cheatle
|
||||
* Created: Mon Nov 25 10:53:26 GMT 1991
|
||||
*
|
||||
* (C) Copyright 1991, Hewlett-Packard Ltd.
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GENBLOB_H
|
||||
#define GENBLOB_H
|
||||
|
||||
// Sort function to sort blobs by ascending left edge.
|
||||
int c_blob_comparator(const void *blob1p, // ptr to ptr to blob1
|
||||
const void *blob2p);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user