Fix CID 1164623 (Uninitialized scalar field)

Fix it by combining constructor and Init method.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-07-06 17:34:46 +02:00
parent 66b71e6b58
commit 18edac4086
4 changed files with 6 additions and 9 deletions

View File

@ -555,7 +555,6 @@ void Classify::InitAdaptiveClassifier(TessdataManager* mgr) {
static_classifier_ = new TessClassifier(false, this);
}
im_.Init(&classify_debug_level);
InitIntegerFX();
AllProtosOn = NewBitVector(MAX_NUM_PROTOS);

View File

@ -184,6 +184,7 @@ Classify::Classify()
this->params()),
double_MEMBER(speckle_rating_penalty, 10.0,
"Penalty to add to worst rating for noise", this->params()),
im_(&classify_debug_level),
shape_table_(nullptr),
dict_(this),
static_classifier_(nullptr) {

View File

@ -667,9 +667,9 @@ int IntegerMatcher::FindBadFeatures(
}
void IntegerMatcher::Init(tesseract::IntParam *classify_debug_level) {
classify_debug_level_ = classify_debug_level;
IntegerMatcher::IntegerMatcher(tesseract::IntParam *classify_debug_level)
: classify_debug_level_(classify_debug_level)
{
/* Initialize table for evidence to similarity lookup */
for (int i = 0; i < SE_TABLE_SIZE; i++) {
uint32_t IntSimilarity = i << (27 - SE_TABLE_BITS);

View File

@ -93,9 +93,7 @@ class IntegerMatcher {
// Center of Similarity Curve.
static const float kSimilarityCenter;
IntegerMatcher() : classify_debug_level_(nullptr) {}
void Init(tesseract::IntParam *classify_debug_level);
IntegerMatcher(tesseract::IntParam *classify_debug_level);
void Match(INT_CLASS ClassTemplate,
BIT_VECTOR ProtoMask,
@ -173,13 +171,12 @@ class IntegerMatcher {
bool SeparateDebugWindows);
#endif
private:
tesseract::IntParam *classify_debug_level_;
uint8_t similarity_evidence_table_[SE_TABLE_SIZE];
uint32_t evidence_table_mask_;
uint32_t mult_trunc_shift_bits_;
uint32_t table_trunc_shift_bits_;
tesseract::IntParam *classify_debug_level_;
uint32_t evidence_mult_mask_;
};