Skip to content

Commit a50b966

Browse files
committed
Added more const and one small fix.
1 parent 0697235 commit a50b966

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/classify/cutoffs.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ void Classify::ReadNewCutoffs(TFile* fp, CLASS_CUTOFF_ARRAY Cutoffs) {
5151
char Class[UNICHAR_LEN + 1];
5252
CLASS_ID ClassId;
5353
int Cutoff;
54-
int i;
5554

5655
if (shape_table_ != nullptr) {
5756
if (!shapetable_cutoffs_.DeSerialize(fp)) {
5857
tprintf("Error during read of shapetable pffmtable!\n");
5958
}
6059
}
61-
for (i = 0; i < MAX_NUM_CLASSES; i++)
60+
for (int i = 0; i < MAX_NUM_CLASSES; i++)
6261
Cutoffs[i] = MAX_CUTOFF;
6362

6463
const int kMaxLineSize = 100;

src/classify/mastertrainer.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ void MasterTrainer::ReadTrainingSamples(const char* page_name,
115115
const FEATURE_DEFS_STRUCT& feature_defs,
116116
bool verification) {
117117
char buffer[2048];
118-
int int_feature_type = ShortNameToFeatureType(feature_defs, kIntFeatureType);
119-
int micro_feature_type = ShortNameToFeatureType(feature_defs,
118+
const int int_feature_type = ShortNameToFeatureType(feature_defs, kIntFeatureType);
119+
const int micro_feature_type = ShortNameToFeatureType(feature_defs,
120120
kMicroFeatureType);
121-
int cn_feature_type = ShortNameToFeatureType(feature_defs, kCNFeatureType);
122-
int geo_feature_type = ShortNameToFeatureType(feature_defs, kGeoFeatureType);
121+
const int cn_feature_type = ShortNameToFeatureType(feature_defs, kCNFeatureType);
122+
const int geo_feature_type = ShortNameToFeatureType(feature_defs, kGeoFeatureType);
123123

124124
FILE* fp = Efopen(page_name, "rb");
125125
if (fp == nullptr) {
@@ -174,7 +174,7 @@ void MasterTrainer::AddSample(bool verification, const char* unichar,
174174
if (flat_shapes_.FindShape(prev_unichar_id_, sample->font_id()) < 0)
175175
flat_shapes_.AddShape(prev_unichar_id_, sample->font_id());
176176
} else {
177-
int junk_id = junk_samples_.AddSample(unichar, sample);
177+
const int junk_id = junk_samples_.AddSample(unichar, sample);
178178
if (prev_unichar_id_ >= 0) {
179179
CHAR_FRAGMENT* frag = CHAR_FRAGMENT::parse_from_string(unichar);
180180
if (frag != nullptr && frag->is_natural()) {
@@ -247,7 +247,7 @@ void MasterTrainer::PreTrainingSetup() {
247247
// together until they get to a leaf node classifier.
248248
void MasterTrainer::SetupMasterShapes() {
249249
tprintf("Building master shape table\n");
250-
int num_fonts = samples_.NumFonts();
250+
const int num_fonts = samples_.NumFonts();
251251

252252
ShapeTable char_shapes_begin_fragment(samples_.unicharset());
253253
ShapeTable char_shapes_end_fragment(samples_.unicharset());

0 commit comments

Comments
 (0)