mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-03 00:49:01 +08:00
Don't use local CP_RESULT_STRUCT variable to initialize elements of std::vector
std::vector passes that local variable by reference, so no individual instances are used for the new vector elements. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
b0e46085f4
commit
5e661b9339
@ -393,8 +393,7 @@ class ClassPruner {
|
||||
/// Copies the pruned, sorted classes into the output results and returns
|
||||
/// the number of classes.
|
||||
int SetupResults(std::vector<CP_RESULT_STRUCT>* results) const {
|
||||
CP_RESULT_STRUCT empty;
|
||||
results->resize(num_classes_, empty);
|
||||
results->resize(num_classes_);
|
||||
for (int c = 0; c < num_classes_; ++c) {
|
||||
(*results)[c].Class = sort_index_[num_classes_ - c];
|
||||
(*results)[c].Rating = 1.0f - sort_key_[num_classes_ - c] /
|
||||
|
Loading…
Reference in New Issue
Block a user