Skip to content

Commit

Permalink
Fix compiler warnings [-Wconditional-uninitialized]
Browse files Browse the repository at this point in the history
clang warnings:

src/ccstruct/coutln.cpp:231:15: warning:
 variable 'destindex' may be uninitialized when used here [-Wconditional-uninitialized]
src/wordrec/language_model.cpp:1170:27: warning:
 variable 'expected_gap' may be uninitialized when used here [-Wconditional-uninitialized]

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Jul 5, 2018
1 parent a74d467 commit f107f11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/ccstruct/coutln.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ int16_t length //length of loop
*/

C_OUTLINE::C_OUTLINE(C_OUTLINE* srcline, FCOORD rotation) : offsets(nullptr) {
TBOX new_box; //easy bounding
int16_t stepindex; //index to step
int16_t dirdiff; //direction change
TBOX new_box; //easy bounding
int16_t stepindex; //index to step
int16_t dirdiff; //direction change
ICOORD pos; //current position
ICOORD prevpos; //previous dest point

ICOORD destpos; //destination point
int16_t destindex; //index to step
int16_t destindex = INT16_MAX; //index to step
DIR128 dir; //coded direction
uint8_t new_step;

Expand Down
5 changes: 2 additions & 3 deletions src/wordrec/language_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ void LanguageModel::FillConsistencyInfo(
}
if (!word_res->blob_widths.empty()) { // if we have widths/gaps info
bool expected_gap_found = false;
float expected_gap;
float expected_gap = 0.0f;
int temp_gap;
if (fontinfo_id >= 0) { // found a common font
ASSERT_HOST(fontinfo_id < fontinfo_table_->size());
Expand All @@ -1140,7 +1140,6 @@ void LanguageModel::FillConsistencyInfo(
consistency_info->inconsistent_font = true;
// Get an average of the expected gaps in each font
int num_addends = 0;
expected_gap = 0;
int temp_fid;
for (int i = 0; i < 4; ++i) {
if (i == 0) {
Expand All @@ -1159,9 +1158,9 @@ void LanguageModel::FillConsistencyInfo(
num_addends++;
}
}
expected_gap_found = (num_addends > 0);
if (num_addends > 0) {
expected_gap /= static_cast<float>(num_addends);
expected_gap_found = true;
}
}
if (expected_gap_found) {
Expand Down

0 comments on commit f107f11

Please sign in to comment.