mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
Replace ASSERT_HOST in genericvector.h
genericvector.h used a mix of assert and ASSERT_HOST. By using assert only, it does no longer depend on errcode.h which defines the ASSERT_HOST macro. Other files which still use ASSERT_HOST now need an explicit include statement for errcode.h. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
2bb4c4ed44
commit
44450094c3
@ -18,6 +18,7 @@
|
||||
**********************************************************************/
|
||||
|
||||
#include "dppoint.h"
|
||||
#include "errcode.h"
|
||||
#include "tprintf.h"
|
||||
|
||||
namespace tesseract {
|
||||
|
@ -21,6 +21,7 @@
|
||||
#ifndef TESSERACT_CCSTRUCT_FONTINFO_H_
|
||||
#define TESSERACT_CCSTRUCT_FONTINFO_H_
|
||||
|
||||
#include "errcode.h"
|
||||
#include "genericvector.h"
|
||||
#include "host.h"
|
||||
#include "unichar.h"
|
||||
|
@ -45,8 +45,9 @@ OF THIS IMPLIED TEMPORAL ORDERING OF THE FLAGS!!!!
|
||||
#include <assert.h>
|
||||
#endif
|
||||
#include <memory>
|
||||
#include "bits16.h"
|
||||
#include "params.h"
|
||||
#include "bits16.h"
|
||||
#include "errcode.h"
|
||||
#include "params.h"
|
||||
|
||||
enum REJ_FLAGS {
|
||||
/* Reject modes which are NEVER overridden */
|
||||
|
@ -22,13 +22,14 @@
|
||||
#include "config_auto.h"
|
||||
#endif
|
||||
|
||||
#include "statistc.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include "helpers.h"
|
||||
#include "scrollview.h"
|
||||
#include "tprintf.h"
|
||||
#include "statistc.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include "errcode.h"
|
||||
#include "helpers.h"
|
||||
#include "scrollview.h"
|
||||
#include "tprintf.h"
|
||||
|
||||
using tesseract::KDPairInc;
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <cstdlib>
|
||||
|
||||
#include "tesscallback.h"
|
||||
#include "errcode.h"
|
||||
#include "helpers.h"
|
||||
#include "ndminx.h"
|
||||
#include "serialis.h"
|
||||
@ -708,7 +707,7 @@ void GenericVector<T>::init_to_size(int size, T t) {
|
||||
// Return the object from an index.
|
||||
template <typename T>
|
||||
T &GenericVector<T>::get(int index) const {
|
||||
ASSERT_HOST(index >= 0 && index < size_used_);
|
||||
assert(index >= 0 && index < size_used_);
|
||||
return data_[index];
|
||||
}
|
||||
|
||||
@ -720,20 +719,20 @@ T &GenericVector<T>::operator[](int index) const {
|
||||
|
||||
template <typename T>
|
||||
T &GenericVector<T>::back() const {
|
||||
ASSERT_HOST(size_used_ > 0);
|
||||
assert(size_used_ > 0);
|
||||
return data_[size_used_ - 1];
|
||||
}
|
||||
// Returns the last object and removes it.
|
||||
template <typename T>
|
||||
T GenericVector<T>::pop_back() {
|
||||
ASSERT_HOST(size_used_ > 0);
|
||||
assert(size_used_ > 0);
|
||||
return data_[--size_used_];
|
||||
}
|
||||
|
||||
// Return the object from an index.
|
||||
template <typename T>
|
||||
void GenericVector<T>::set(T t, int index) {
|
||||
ASSERT_HOST(index >= 0 && index < size_used_);
|
||||
assert(index >= 0 && index < size_used_);
|
||||
data_[index] = t;
|
||||
}
|
||||
|
||||
@ -742,7 +741,7 @@ void GenericVector<T>::set(T t, int index) {
|
||||
// at the specified index.
|
||||
template <typename T>
|
||||
void GenericVector<T>::insert(T t, int index) {
|
||||
ASSERT_HOST(index >= 0 && index <= size_used_);
|
||||
assert(index >= 0 && index <= size_used_);
|
||||
if (size_reserved_ == size_used_)
|
||||
double_the_size();
|
||||
for (int i = size_used_; i > index; --i) {
|
||||
@ -756,7 +755,7 @@ void GenericVector<T>::insert(T t, int index) {
|
||||
// shifts the remaining elements to the left.
|
||||
template <typename T>
|
||||
void GenericVector<T>::remove(int index) {
|
||||
ASSERT_HOST(index >= 0 && index < size_used_);
|
||||
assert(index >= 0 && index < size_used_);
|
||||
for (int i = index; i < size_used_ - 1; ++i) {
|
||||
data_[i] = data_[i+1];
|
||||
}
|
||||
@ -773,7 +772,7 @@ T GenericVector<T>::contains_index(int index) const {
|
||||
template <typename T>
|
||||
int GenericVector<T>::get_index(T object) const {
|
||||
for (int i = 0; i < size_used_; ++i) {
|
||||
ASSERT_HOST(compare_cb_ != nullptr);
|
||||
assert(compare_cb_ != nullptr);
|
||||
if (compare_cb_->Run(object, data_[i]))
|
||||
return i;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "serialis.h"
|
||||
#include <cstdio>
|
||||
#include "errcode.h"
|
||||
#include "genericvector.h"
|
||||
|
||||
namespace tesseract {
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "errcode.h"
|
||||
#include "genericvector.h"
|
||||
#include "helpers.h"
|
||||
#include "serialis.h"
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "errcode.h"
|
||||
#include "helpers.h"
|
||||
#include "serialis.h"
|
||||
#include "strngs.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "baseapi.h" // TessBaseAPI::Version
|
||||
#include "commandlineflags.h"
|
||||
#include "errcode.h"
|
||||
|
||||
#ifndef GOOGLE_TESSERACT
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#include "errcode.h"
|
||||
#include "fileio.h"
|
||||
#include "tprintf.h"
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "errcode.h"
|
||||
#include "icuerrorcode.h"
|
||||
#include "unichar.h"
|
||||
#include "unicode/normalizer2.h" // From libicu
|
||||
|
Loading…
Reference in New Issue
Block a user