Skip to content

Commit

Permalink
training: Don't hide global variables
Browse files Browse the repository at this point in the history
This fixes two warnings from LGTM:

    Parameter feature_defs hides a global variable with the same name.
    Parameter Config hides a global variable with the same name.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Oct 19, 2018
1 parent bafe8f6 commit b40151c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/training/commontraining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,15 @@ LABELEDLIST NewLabeledList(const char* Label) {
* samples by FontName and CharName. It then returns this
* data structure.
* @param file open text file to read samples from
* @param feature_defs
* @param feature_definitions
* @param feature_name
* @param max_samples
* @param unicharset
* @param training_samples
* @return none
* @note Globals: none
*/
void ReadTrainingSamples(const FEATURE_DEFS_STRUCT& feature_defs,
void ReadTrainingSamples(const FEATURE_DEFS_STRUCT& feature_definitions,
const char *feature_name, int max_samples,
UNICHARSET* unicharset,
FILE* file, LIST* training_samples) {
Expand All @@ -405,7 +405,8 @@ void ReadTrainingSamples(const FEATURE_DEFS_STRUCT& feature_defs,
LABELEDLIST char_sample;
FEATURE_SET feature_samples;
CHAR_DESC char_desc;
uint32_t feature_type = ShortNameToFeatureType(feature_defs, feature_name);
uint32_t feature_type =
ShortNameToFeatureType(feature_definitions, feature_name);

// Zero out the font_sample_count for all the classes.
LIST it = *training_samples;
Expand All @@ -432,7 +433,7 @@ void ReadTrainingSamples(const FEATURE_DEFS_STRUCT& feature_defs,
char_sample = NewLabeledList(unichar);
*training_samples = push(*training_samples, char_sample);
}
char_desc = ReadCharDescription(feature_defs, file);
char_desc = ReadCharDescription(feature_definitions, file);
feature_samples = char_desc->FeatureSets[feature_type];
if (char_sample->font_sample_count < max_samples || max_samples <= 0) {
char_sample->List = push(char_sample->List, feature_samples);
Expand Down Expand Up @@ -538,7 +539,8 @@ CLUSTERER *SetUpForClustering(const FEATURE_DEFS_STRUCT &FeatureDefs,

/*------------------------------------------------------------------------*/
void MergeInsignificantProtos(LIST ProtoList, const char* label,
CLUSTERER* Clusterer, CLUSTERCONFIG* Config) {
CLUSTERER* Clusterer,
CLUSTERCONFIG* clusterconfig) {
PROTOTYPE* Prototype;
bool debug = strcmp(FLAGS_test_ch.c_str(), label) == 0;

Expand Down Expand Up @@ -586,7 +588,8 @@ void MergeInsignificantProtos(LIST ProtoList, const char* label,
}
}
// Mark significant those that now have enough samples.
int min_samples = (int32_t) (Config->MinSamples * Clusterer->NumChar);
int min_samples =
static_cast<int32_t>(clusterconfig->MinSamples * Clusterer->NumChar);
pProtoList = ProtoList;
iterate(pProtoList) {
Prototype = (PROTOTYPE *) first_node (pProtoList);
Expand Down

0 comments on commit b40151c

Please sign in to comment.