Fix CID 1164648 (Uninitialized scalar field)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-09-14 17:32:29 +02:00
parent 80f367c6f4
commit bd1083904d
2 changed files with 9 additions and 13 deletions

View File

@ -127,10 +127,7 @@ LanguageModel::LanguageModel(const UnicityTable<FontInfo> *fontinfo_table,
dict->getCCUtil()->params()), dict->getCCUtil()->params()),
dawg_args_(nullptr, new DawgPositionVector(), NO_PERM), dawg_args_(nullptr, new DawgPositionVector(), NO_PERM),
fontinfo_table_(fontinfo_table), fontinfo_table_(fontinfo_table),
dict_(dict), dict_(dict) {
fixed_pitch_(false),
max_char_wh_ratio_(0.0),
acceptable_choice_found_(false) {
ASSERT_HOST(dict_ != nullptr); ASSERT_HOST(dict_ != nullptr);
} }

View File

@ -4,7 +4,6 @@
// structure and statistics of the language to help segmentation // structure and statistics of the language to help segmentation
// search. // search.
// Author: Daria Antonova // Author: Daria Antonova
// Created: Mon Nov 11 11:26:43 PST 2009
// //
// (C) Copyright 2009, Google Inc. // (C) Copyright 2009, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
@ -372,26 +371,26 @@ class LanguageModel {
// avoid dynamic memory re-allocation (should be cleared before each use). // avoid dynamic memory re-allocation (should be cleared before each use).
DawgArgs dawg_args_; DawgArgs dawg_args_;
// Scaling for recovering blob outline length from rating and certainty. // Scaling for recovering blob outline length from rating and certainty.
float rating_cert_scale_; float rating_cert_scale_ = 0.0f;
// The following variables are set at construction time. // The following variables are set at construction time.
// Pointer to fontinfo table (not owned by LanguageModel). // Pointer to fontinfo table (not owned by LanguageModel).
const UnicityTable<FontInfo> *fontinfo_table_; const UnicityTable<FontInfo>* fontinfo_table_ = nullptr;
// Pointer to Dict class, that is used for querying the dictionaries // Pointer to Dict class, that is used for querying the dictionaries
// (the pointer is not owned by LanguageModel). // (the pointer is not owned by LanguageModel).
Dict *dict_; Dict* dict_ = nullptr;
// TODO(daria): the following variables should become LanguageModel params // TODO(daria): the following variables should become LanguageModel params
// when the old code in bestfirst.cpp and heuristic.cpp is deprecated. // when the old code in bestfirst.cpp and heuristic.cpp is deprecated.
// //
// Set to true if we are dealing with fixed pitch text // Set to true if we are dealing with fixed pitch text
// (set to assume_fixed_pitch_char_segment). // (set to assume_fixed_pitch_char_segment).
bool fixed_pitch_; bool fixed_pitch_ = false;
// Max char width-to-height ratio allowed // Max char width-to-height ratio allowed
// (set to segsearch_max_char_wh_ratio). // (set to segsearch_max_char_wh_ratio).
float max_char_wh_ratio_; float max_char_wh_ratio_ = 0.0f;
// The following variables are initialized with InitForWord(). // The following variables are initialized with InitForWord().
@ -399,7 +398,7 @@ class LanguageModel {
// (since this is only used by the character ngram model component, // (since this is only used by the character ngram model component,
// only the last language_model_ngram_order of the word are stored). // only the last language_model_ngram_order of the word are stored).
STRING prev_word_str_; STRING prev_word_str_;
int prev_word_unichar_step_len_; int prev_word_unichar_step_len_ = 0;
// Active dawg vector. // Active dawg vector.
DawgPositionVector very_beginning_active_dawgs_; // includes continuation DawgPositionVector very_beginning_active_dawgs_; // includes continuation
DawgPositionVector beginning_active_dawgs_; DawgPositionVector beginning_active_dawgs_;
@ -414,9 +413,9 @@ class LanguageModel {
// choices. This way the stopper will know that the best choice is not // choices. This way the stopper will know that the best choice is not
// ambiguous (i.e. there are best choices in the best choice list that have // ambiguous (i.e. there are best choices in the best choice list that have
// ratings close to the very best one) and will be less likely to mis-adapt. // ratings close to the very best one) and will be less likely to mis-adapt.
bool acceptable_choice_found_; bool acceptable_choice_found_ = false;
// Set to true if a choice representing correct segmentation was explored. // Set to true if a choice representing correct segmentation was explored.
bool correct_segmentation_explored_; bool correct_segmentation_explored_ = false;
// Params models containing weights for for computing ViterbiStateEntry costs. // Params models containing weights for for computing ViterbiStateEntry costs.
ParamsModel params_model_; ParamsModel params_model_;