From edf765b9523d1a2d00d66e417c16f74fa78bf69c Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 4 Nov 2015 22:34:22 +0100 Subject: [PATCH] Remove unneeded const qualifiers 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 --- api/baseapi.h | 4 ++-- ccmain/osdetect.cpp | 2 +- ccmain/osdetect.h | 2 +- ccstruct/boxword.h | 2 +- ccstruct/pageres.h | 4 ++-- ccstruct/ratngs.h | 2 +- ccutil/unicharset.cpp | 10 +++++----- ccutil/unicharset.h | 8 ++++---- dict/dict.h | 4 ++-- textord/devanagari_processing.h | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/api/baseapi.h b/api/baseapi.h index 48cd7472f3..a3a5c6cb70 100644 --- a/api/baseapi.h +++ b/api/baseapi.h @@ -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_; } diff --git a/ccmain/osdetect.cpp b/ccmain/osdetect.cpp index 7aba392ce1..90432838f1 100644 --- a/ccmain/osdetect.cpp +++ b/ccmain/osdetect.cpp @@ -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; diff --git a/ccmain/osdetect.h b/ccmain/osdetect.h index dec07d584e..f092e36e56 100644 --- a/ccmain/osdetect.h +++ b/ccmain/osdetect.h @@ -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__ diff --git a/ccstruct/boxword.h b/ccstruct/boxword.h index 2ab18c8ae3..742bbb8e4d 100644 --- a/ccstruct/boxword.h +++ b/ccstruct/boxword.h @@ -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 { diff --git a/ccstruct/pageres.h b/ccstruct/pageres.h index b8cd4dc31a..b4061a9ee7 100644 --- a/ccstruct/pageres.h +++ b/ccstruct/pageres.h @@ -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; @@ -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); diff --git a/ccstruct/ratngs.h b/ccstruct/ratngs.h index 54e625a56c..3b320ee147 100644 --- a/ccstruct/ratngs.h +++ b/ccstruct/ratngs.h @@ -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]; } diff --git a/ccutil/unicharset.cpp b/ccutil/unicharset.cpp index b2b1fae98c..f7e4842162 100644 --- a/ccutil/unicharset.cpp +++ b/ccutil/unicharset.cpp @@ -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; @@ -263,7 +263,7 @@ 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; } @@ -271,7 +271,7 @@ const char* const UNICHARSET::id_to_unichar(UNICHAR_ID id) const { 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; } diff --git a/ccutil/unicharset.h b/ccutil/unicharset.h index b74afd2445..684655affb 100644 --- a/ccutil/unicharset.h +++ b/ccutil/unicharset.h @@ -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, @@ -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. diff --git a/dict/dict.h b/dict/dict.h index 938ca3a332..326f1235d5 100644 --- a/dict/dict.h +++ b/dict/dict.h @@ -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. diff --git a/textord/devanagari_processing.h b/textord/devanagari_processing.h index a512460d1f..990a5dfe39 100644 --- a/textord/devanagari_processing.h +++ b/textord/devanagari_processing.h @@ -41,7 +41,7 @@ class PixelHistogram { length_ = 0; } - int* const hist() const { + int* hist() const { return hist_; }