Skip to content

Commit e80393b

Browse files
committed
Merge pull request #1389 from alalek:fix_msvs2017_warning
2 parents 98ded86 + 0de0ba7 commit e80393b

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

modules/datasets/samples/tr_icdar_benchmark.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ void er_draw(vector<Mat> &channels, vector<vector<ERStat> > &regions, vector<Vec
133133
}
134134
}
135135

136+
// std::toupper is int->int
137+
static char char_toupper(char ch)
138+
{
139+
return (char)std::toupper((int)ch);
140+
}
141+
136142
int main(int argc, char *argv[])
137143
{
138144
const char *keys =
@@ -200,7 +206,7 @@ int main(int argc, char *argv[])
200206
for (size_t w=0; w<example->words.size(); w++)
201207
{
202208
string w_upper = example->words[w].value;
203-
transform(w_upper.begin(), w_upper.end(), w_upper.begin(), ::toupper);
209+
transform(w_upper.begin(), w_upper.end(), w_upper.begin(), char_toupper);
204210
if ((find (lex->begin(), lex->end(), w_upper) == lex->end()) &&
205211
(is_word_spotting) && (selected_lex != 0))
206212
example->words[w].value = "###";
@@ -297,7 +303,7 @@ int main(int argc, char *argv[])
297303
continue;
298304
}
299305

300-
std::transform(words[j].begin(), words[j].end(), words[j].begin(), ::toupper);
306+
std::transform(words[j].begin(), words[j].end(), words[j].begin(), char_toupper);
301307

302308
/* Increase confidence of predicted words matching a word in the lexicon */
303309
if (lex->size() > 0)
@@ -413,7 +419,7 @@ int main(int argc, char *argv[])
413419
}
414420
}
415421

416-
std::transform(t.value.begin(), t.value.end(), t.value.begin(), ::toupper);
422+
std::transform(t.value.begin(), t.value.end(), t.value.begin(), char_toupper);
417423
if (((t.value==final_words[j]) || (alnum_value==final_words[j])) &&
418424
!(final_boxes[j].tl().x > t.x+t.width || final_boxes[j].br().x < t.x ||
419425
final_boxes[j].tl().y > t.y+t.height || final_boxes[j].br().y < t.y))
@@ -430,7 +436,7 @@ int main(int argc, char *argv[])
430436
for (vector<word>::iterator it=example->words.begin(); it!=example->words.end(); ++it)
431437
{
432438
word &t = (*it);
433-
std::transform(t.value.begin(), t.value.end(), t.value.begin(), ::toupper);
439+
std::transform(t.value.begin(), t.value.end(), t.value.begin(), char_toupper);
434440
if ((t.value == "###") &&
435441
!(final_boxes[j].tl().x > t.x+t.width || final_boxes[j].br().x < t.x ||
436442
final_boxes[j].tl().y > t.y+t.height || final_boxes[j].br().y < t.y))

modules/datasets/samples/tr_svt_benchmark.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ void er_draw(vector<Mat> &channels, vector<vector<ERStat> > &regions, vector<Vec
133133
}
134134
}
135135

136+
// std::toupper is int->int
137+
static char char_toupper(char ch)
138+
{
139+
return (char)std::toupper((int)ch);
140+
}
141+
136142
int main(int argc, char *argv[])
137143
{
138144
const char *keys =
@@ -244,7 +250,7 @@ int main(int argc, char *argv[])
244250
continue;
245251
}
246252

247-
std::transform(words[j].begin(), words[j].end(), words[j].begin(), ::toupper);
253+
std::transform(words[j].begin(), words[j].end(), words[j].begin(), char_toupper);
248254

249255
if (find(example->lex.begin(), example->lex.end(), words[j]) == example->lex.end())
250256
{

0 commit comments

Comments
 (0)