Skip to content

Commit b40151c

Browse files
committed
training: Don't hide global variables
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>
1 parent bafe8f6 commit b40151c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/training/commontraining.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,15 @@ LABELEDLIST NewLabeledList(const char* Label) {
388388
* samples by FontName and CharName. It then returns this
389389
* data structure.
390390
* @param file open text file to read samples from
391-
* @param feature_defs
391+
* @param feature_definitions
392392
* @param feature_name
393393
* @param max_samples
394394
* @param unicharset
395395
* @param training_samples
396396
* @return none
397397
* @note Globals: none
398398
*/
399-
void ReadTrainingSamples(const FEATURE_DEFS_STRUCT& feature_defs,
399+
void ReadTrainingSamples(const FEATURE_DEFS_STRUCT& feature_definitions,
400400
const char *feature_name, int max_samples,
401401
UNICHARSET* unicharset,
402402
FILE* file, LIST* training_samples) {
@@ -405,7 +405,8 @@ void ReadTrainingSamples(const FEATURE_DEFS_STRUCT& feature_defs,
405405
LABELEDLIST char_sample;
406406
FEATURE_SET feature_samples;
407407
CHAR_DESC char_desc;
408-
uint32_t feature_type = ShortNameToFeatureType(feature_defs, feature_name);
408+
uint32_t feature_type =
409+
ShortNameToFeatureType(feature_definitions, feature_name);
409410

410411
// Zero out the font_sample_count for all the classes.
411412
LIST it = *training_samples;
@@ -432,7 +433,7 @@ void ReadTrainingSamples(const FEATURE_DEFS_STRUCT& feature_defs,
432433
char_sample = NewLabeledList(unichar);
433434
*training_samples = push(*training_samples, char_sample);
434435
}
435-
char_desc = ReadCharDescription(feature_defs, file);
436+
char_desc = ReadCharDescription(feature_definitions, file);
436437
feature_samples = char_desc->FeatureSets[feature_type];
437438
if (char_sample->font_sample_count < max_samples || max_samples <= 0) {
438439
char_sample->List = push(char_sample->List, feature_samples);
@@ -538,7 +539,8 @@ CLUSTERER *SetUpForClustering(const FEATURE_DEFS_STRUCT &FeatureDefs,
538539

539540
/*------------------------------------------------------------------------*/
540541
void MergeInsignificantProtos(LIST ProtoList, const char* label,
541-
CLUSTERER* Clusterer, CLUSTERCONFIG* Config) {
542+
CLUSTERER* Clusterer,
543+
CLUSTERCONFIG* clusterconfig) {
542544
PROTOTYPE* Prototype;
543545
bool debug = strcmp(FLAGS_test_ch.c_str(), label) == 0;
544546

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

0 commit comments

Comments
 (0)