Skip to content

Commit

Permalink
Remove unneeded const qualifiers
Browse files Browse the repository at this point in the history
This fixes compiler warnings like this one:

api/baseapi.h:739:32: warning:
 type qualifiers ignored on function return type [-Wignored-qualifiers]

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Nov 5, 2015
1 parent eb34cb1 commit edf765b
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions api/baseapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,11 +736,11 @@ class TESS_API TessBaseAPI {
*/
static void NormalizeTBLOB(TBLOB *tblob, ROW *row, bool numeric_mode);

Tesseract* const tesseract() const {
Tesseract* tesseract() const {
return tesseract_;
}

OcrEngineMode const oem() const {
OcrEngineMode oem() const {
return last_oem_requested_;
}

Expand Down
2 changes: 1 addition & 1 deletion ccmain/osdetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ bool ScriptDetector::must_stop(int orientation) {
// Helper method to convert an orientation index to its value in degrees.
// The value represents the amount of clockwise rotation in degrees that must be
// applied for the text to be upright (readable).
const int OrientationIdToValue(const int& id) {
int OrientationIdToValue(const int& id) {
switch (id) {
case 0:
return 0;
Expand Down
2 changes: 1 addition & 1 deletion ccmain/osdetect.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ bool os_detect_blob(BLOBNBOX* bbox, OrientationDetector* o,
// Helper method to convert an orientation index to its value in degrees.
// The value represents the amount of clockwise rotation in degrees that must be
// applied for the text to be upright (readable).
TESS_API const int OrientationIdToValue(const int& id);
TESS_API int OrientationIdToValue(const int& id);

#endif // TESSERACT_CCMAIN_OSDETECT_H__
2 changes: 1 addition & 1 deletion ccstruct/boxword.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class BoxWord {
const TBOX& bounding_box() const {
return bbox_;
}
const int length() const {
int length() const {
return length_;
}
const TBOX& BlobBox(int index) const {
Expand Down
4 changes: 2 additions & 2 deletions ccstruct/pageres.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class WERD_RES : public ELIST_LINK {
// This matters for mirrorable characters such as parentheses. We recognize
// characters purely based on their shape on the page, and by default produce
// the corresponding unicode for a left-to-right context.
const char* const BestUTF8(int blob_index, bool in_rtl_context) const {
const char* BestUTF8(int blob_index, bool in_rtl_context) const {
if (blob_index < 0 || best_choice == NULL ||
blob_index >= best_choice->length())
return NULL;
Expand All @@ -352,7 +352,7 @@ class WERD_RES : public ELIST_LINK {
return uch_set->id_to_unichar_ext(id);
}
// Returns the UTF-8 string for the given blob index in the raw_choice word.
const char* const RawUTF8(int blob_index) const {
const char* RawUTF8(int blob_index) const {
if (blob_index < 0 || blob_index >= raw_choice->length())
return NULL;
UNICHAR_ID id = raw_choice->unichar_id(blob_index);
Expand Down
2 changes: 1 addition & 1 deletion ccstruct/ratngs.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class WERD_CHOICE : public ELIST_LINK {
inline const UNICHAR_ID *unichar_ids() const {
return unichar_ids_;
}
inline const UNICHAR_ID unichar_id(int index) const {
inline UNICHAR_ID unichar_id(int index) const {
assert(index < length_);
return unichar_ids_[index];
}
Expand Down
10 changes: 5 additions & 5 deletions ccutil/unicharset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ void UNICHARSET::reserve(int unichars_number) {
}
}

const UNICHAR_ID
UNICHAR_ID
UNICHARSET::unichar_to_id(const char* const unichar_repr) const {
return ids.contains(unichar_repr) ?
ids.unichar_to_id(unichar_repr) : INVALID_UNICHAR_ID;
}

const UNICHAR_ID UNICHARSET::unichar_to_id(const char* const unichar_repr,
int length) const {
UNICHAR_ID UNICHARSET::unichar_to_id(const char* const unichar_repr,
int length) const {
assert(length > 0 && length <= UNICHAR_LEN);
return ids.contains(unichar_repr, length) ?
ids.unichar_to_id(unichar_repr, length) : INVALID_UNICHAR_ID;
Expand Down Expand Up @@ -263,15 +263,15 @@ bool UNICHARSET::encode_string(const char* str, bool give_up_on_failure,
return perfect;
}

const char* const UNICHARSET::id_to_unichar(UNICHAR_ID id) const {
const char* UNICHARSET::id_to_unichar(UNICHAR_ID id) const {
if (id == INVALID_UNICHAR_ID) {
return INVALID_UNICHAR;
}
ASSERT_HOST(id < this->size());
return unichars[id].representation;
}

const char* const UNICHARSET::id_to_unichar_ext(UNICHAR_ID id) const {
const char* UNICHARSET::id_to_unichar_ext(UNICHAR_ID id) const {
if (id == INVALID_UNICHAR_ID) {
return INVALID_UNICHAR;
}
Expand Down
8 changes: 4 additions & 4 deletions ccutil/unicharset.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ class UNICHARSET {

// Return the UNICHAR_ID of a given unichar representation within the
// UNICHARSET.
const UNICHAR_ID unichar_to_id(const char* const unichar_repr) const;
UNICHAR_ID unichar_to_id(const char* const unichar_repr) const;

// Return the UNICHAR_ID of a given unichar representation within the
// UNICHARSET. Only the first length characters from unichar_repr are used.
const UNICHAR_ID unichar_to_id(const char* const unichar_repr,
UNICHAR_ID unichar_to_id(const char* const unichar_repr,
int length) const;

// Return the minimum number of bytes that matches a legal UNICHAR_ID,
Expand Down Expand Up @@ -215,13 +215,13 @@ class UNICHARSET {

// Return the unichar representation corresponding to the given UNICHAR_ID
// within the UNICHARSET.
const char* const id_to_unichar(UNICHAR_ID id) const;
const char* id_to_unichar(UNICHAR_ID id) const;

// Return the UTF8 representation corresponding to the given UNICHAR_ID after
// resolving any private encodings internal to Tesseract. This method is
// preferable to id_to_unichar for outputting text that will be visible to
// external applications.
const char* const id_to_unichar_ext(UNICHAR_ID id) const;
const char* id_to_unichar_ext(UNICHAR_ID id) const;

// Return a STRING that reformats the utf8 str into the str followed
// by its hex unicodes.
Expand Down
4 changes: 2 additions & 2 deletions dict/dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,11 @@ class Dict {
}

inline void SetWildcardID(UNICHAR_ID id) { wildcard_unichar_id_ = id; }
inline const UNICHAR_ID WildcardID() const {
inline UNICHAR_ID WildcardID() const {
return wildcard_unichar_id_;
}
/// Return the number of dawgs in the dawgs_ vector.
inline const int NumDawgs() const { return dawgs_.size(); }
inline int NumDawgs() const { return dawgs_.size(); }
/// Return i-th dawg pointer recorded in the dawgs_ vector.
inline const Dawg *GetDawg(int index) const { return dawgs_[index]; }
/// Return the points to the punctuation dawg.
Expand Down
2 changes: 1 addition & 1 deletion textord/devanagari_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PixelHistogram {
length_ = 0;
}

int* const hist() const {
int* hist() const {
return hist_;
}

Expand Down

0 comments on commit edf765b

Please sign in to comment.