mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-01 07:59:05 +08:00
Merge pull request #2000 from stweil/lgtm
Fix some issues reported by LGTM
This commit is contained in:
commit
ac2fc208bd
@ -79,6 +79,13 @@ struct LineHypothesis {
|
|||||||
LineHypothesis(const LineHypothesis &other)
|
LineHypothesis(const LineHypothesis &other)
|
||||||
: ty(other.ty), model(other.model) {}
|
: ty(other.ty), model(other.model) {}
|
||||||
|
|
||||||
|
// Copy assignment operator.
|
||||||
|
LineHypothesis& operator=(const LineHypothesis& other) {
|
||||||
|
ty = other.ty;
|
||||||
|
model = other.model;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const LineHypothesis &other) const {
|
bool operator==(const LineHypothesis &other) const {
|
||||||
return ty == other.ty && model == other.model;
|
return ty == other.ty && model == other.model;
|
||||||
}
|
}
|
||||||
|
@ -289,6 +289,8 @@ struct BlamerBundle {
|
|||||||
void SetMisAdaptionDebug(const WERD_CHOICE *best_choice, bool debug);
|
void SetMisAdaptionDebug(const WERD_CHOICE *best_choice, bool debug);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Copy assignment operator (currently unused, therefore private).
|
||||||
|
BlamerBundle& operator=(const BlamerBundle& other);
|
||||||
void SetBlame(IncorrectResultReason irr, const STRING &msg,
|
void SetBlame(IncorrectResultReason irr, const STRING &msg,
|
||||||
const WERD_CHOICE *choice, bool debug) {
|
const WERD_CHOICE *choice, bool debug) {
|
||||||
incorrect_result_reason_ = irr;
|
incorrect_result_reason_ = irr;
|
||||||
|
@ -144,6 +144,9 @@ class ROW:public ELIST_LINK
|
|||||||
ROW& operator= (const ROW & source);
|
ROW& operator= (const ROW & source);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Copy constructor (currently unused, therefore private).
|
||||||
|
ROW(const ROW& source);
|
||||||
|
|
||||||
int32_t kerning; //inter char gap
|
int32_t kerning; //inter char gap
|
||||||
int32_t spacing; //inter word gap
|
int32_t spacing; //inter word gap
|
||||||
TBOX bound_box; //bounding box
|
TBOX bound_box; //bounding box
|
||||||
|
@ -105,14 +105,19 @@ int ParamsTrainingFeatureByName(const char *name);
|
|||||||
// Entry with features extracted from a single OCR hypothesis for a word.
|
// Entry with features extracted from a single OCR hypothesis for a word.
|
||||||
struct ParamsTrainingHypothesis {
|
struct ParamsTrainingHypothesis {
|
||||||
ParamsTrainingHypothesis() : cost(0.0) {
|
ParamsTrainingHypothesis() : cost(0.0) {
|
||||||
memset(features, 0, sizeof(float) * PTRAIN_NUM_FEATURE_TYPES);
|
memset(features, 0, sizeof(features));
|
||||||
}
|
}
|
||||||
ParamsTrainingHypothesis(const ParamsTrainingHypothesis &other) {
|
ParamsTrainingHypothesis(const ParamsTrainingHypothesis &other) {
|
||||||
memcpy(features, other.features,
|
memcpy(features, other.features, sizeof(features));
|
||||||
sizeof(float) * PTRAIN_NUM_FEATURE_TYPES);
|
|
||||||
str = other.str;
|
str = other.str;
|
||||||
cost = other.cost;
|
cost = other.cost;
|
||||||
}
|
}
|
||||||
|
ParamsTrainingHypothesis& operator=(const ParamsTrainingHypothesis& other) {
|
||||||
|
memcpy(features, other.features, sizeof(features));
|
||||||
|
str = other.str;
|
||||||
|
cost = other.cost;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
float features[PTRAIN_NUM_FEATURE_TYPES];
|
float features[PTRAIN_NUM_FEATURE_TYPES];
|
||||||
STRING str; // string corresponding to word hypothesis (for debugging)
|
STRING str; // string corresponding to word hypothesis (for debugging)
|
||||||
float cost; // path cost computed by segsearch
|
float cost; // path cost computed by segsearch
|
||||||
|
@ -129,6 +129,24 @@ BLOB_CHOICE::BLOB_CHOICE(const BLOB_CHOICE &other) : ELIST_LINK(other) {
|
|||||||
fonts_ = other.fonts_;
|
fonts_ = other.fonts_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy assignment operator.
|
||||||
|
BLOB_CHOICE& BLOB_CHOICE::operator=(const BLOB_CHOICE& other) {
|
||||||
|
ELIST_LINK::operator=(other);
|
||||||
|
unichar_id_ = other.unichar_id();
|
||||||
|
rating_ = other.rating();
|
||||||
|
certainty_ = other.certainty();
|
||||||
|
fontinfo_id_ = other.fontinfo_id();
|
||||||
|
fontinfo_id2_ = other.fontinfo_id2();
|
||||||
|
script_id_ = other.script_id();
|
||||||
|
matrix_cell_ = other.matrix_cell_;
|
||||||
|
min_xheight_ = other.min_xheight_;
|
||||||
|
max_xheight_ = other.max_xheight_;
|
||||||
|
yshift_ = other.yshift();
|
||||||
|
classifier_ = other.classifier_;
|
||||||
|
fonts_ = other.fonts_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns true if *this and other agree on the baseline and x-height
|
// Returns true if *this and other agree on the baseline and x-height
|
||||||
// to within some tolerance based on a given estimate of the x-height.
|
// to within some tolerance based on a given estimate of the x-height.
|
||||||
bool BLOB_CHOICE::PosAndSizeAgree(const BLOB_CHOICE& other, float x_height,
|
bool BLOB_CHOICE::PosAndSizeAgree(const BLOB_CHOICE& other, float x_height,
|
||||||
|
@ -197,6 +197,9 @@ class BLOB_CHOICE: public ELIST_LINK
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Copy assignment operator.
|
||||||
|
BLOB_CHOICE& operator=(const BLOB_CHOICE& other);
|
||||||
|
|
||||||
UNICHAR_ID unichar_id_; // unichar id
|
UNICHAR_ID unichar_id_; // unichar id
|
||||||
// Fonts and scores. Allowed to be empty.
|
// Fonts and scores. Allowed to be empty.
|
||||||
GenericVector<tesseract::ScoredFont> fonts_;
|
GenericVector<tesseract::ScoredFont> fonts_;
|
||||||
|
@ -52,6 +52,8 @@ class C_OUTLINE_FRAG:public ELIST_LINK
|
|||||||
int16_t ycoord; //coord of cut pt
|
int16_t ycoord; //coord of cut pt
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Copy constructor (currently unused, therefore private).
|
||||||
|
C_OUTLINE_FRAG(const C_OUTLINE_FRAG& other);
|
||||||
};
|
};
|
||||||
|
|
||||||
ELISTIZEH(C_OUTLINE_FRAG)
|
ELISTIZEH(C_OUTLINE_FRAG)
|
||||||
|
Loading…
Reference in New Issue
Block a user