Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues reported by LGTM #2000

Merged
merged 6 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
BLOB_CHOICE: Add copy assignment operator
This fixes a warning from LGTM:

    No matching copy assignment operator in class BLOB_CHOICE.
    It is good practice to match a copy constructor
    with a copy assignment operator.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Oct 18, 2018
commit a1f0c66be111448a818b156b92b18a5db284bcfc
18 changes: 18 additions & 0 deletions src/ccstruct/ratngs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,24 @@ BLOB_CHOICE::BLOB_CHOICE(const BLOB_CHOICE &other) : ELIST_LINK(other) {
fonts_ = other.fonts_;
}

// Copy assignment operator.
BLOB_CHOICE& BLOB_CHOICE::operator=(const BLOB_CHOICE& other) {
ELIST_LINK::operator=(other);
unichar_id_ = other.unichar_id();
rating_ = other.rating();
certainty_ = other.certainty();
fontinfo_id_ = other.fontinfo_id();
fontinfo_id2_ = other.fontinfo_id2();
script_id_ = other.script_id();
matrix_cell_ = other.matrix_cell_;
min_xheight_ = other.min_xheight_;
max_xheight_ = other.max_xheight_;
yshift_ = other.yshift();
classifier_ = other.classifier_;
fonts_ = other.fonts_;
return *this;
}

// Returns true if *this and other agree on the baseline and x-height
// to within some tolerance based on a given estimate of the x-height.
bool BLOB_CHOICE::PosAndSizeAgree(const BLOB_CHOICE& other, float x_height,
Expand Down
3 changes: 3 additions & 0 deletions src/ccstruct/ratngs.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ class BLOB_CHOICE: public ELIST_LINK
}

private:
// Copy assignment operator.
BLOB_CHOICE& operator=(const BLOB_CHOICE& other);

UNICHAR_ID unichar_id_; // unichar id
// Fonts and scores. Allowed to be empty.
GenericVector<tesseract::ScoredFont> fonts_;
Expand Down