From c0dec468c918e5ee2ca681b056fd25ab3fec3525 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 4 Nov 2015 09:38:39 +0100 Subject: [PATCH 1/3] ccmain: Remove unused local variables Signed-off-by: Stefan Weil --- ccmain/control.cpp | 1 - ccmain/fixspace.cpp | 2 -- 2 files changed, 3 deletions(-) diff --git a/ccmain/control.cpp b/ccmain/control.cpp index 66a2a8bb3e..2e17727730 100644 --- a/ccmain/control.cpp +++ b/ccmain/control.cpp @@ -1400,7 +1400,6 @@ void Tesseract::ReportXhtFixResult(bool accept_new_word, float new_x_ht, // Returns true if the word was changed. // See the comment in fixxht.cpp for a description of the overall process. bool Tesseract::TrainedXheightFix(WERD_RES *word, BLOCK* block, ROW *row) { - bool accept_new_x_ht = false; int original_misfits = CountMisfitTops(word); if (original_misfits == 0) return false; diff --git a/ccmain/fixspace.cpp b/ccmain/fixspace.cpp index e42617c053..f58c9610fa 100644 --- a/ccmain/fixspace.cpp +++ b/ccmain/fixspace.cpp @@ -831,7 +831,6 @@ namespace tesseract { inT16 Tesseract::fp_eval_word_spacing(WERD_RES_LIST &word_res_list) { WERD_RES_IT word_it(&word_res_list); WERD_RES *word; - inT16 word_length; inT16 score = 0; inT16 i; float small_limit = kBlnXHeight * fixsp_small_outlines_size; @@ -840,7 +839,6 @@ inT16 Tesseract::fp_eval_word_spacing(WERD_RES_LIST &word_res_list) { word = word_it.data(); if (word->rebuild_word == NULL) continue; // Can't handle cube words. - word_length = word->reject_map.length(); if (word->done || word->tess_accepted || word->best_choice->permuter() == SYSTEM_DAWG_PERM || From 8d95501f8c196e0b56788865f29879f87e59f9dd Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 4 Nov 2015 09:40:26 +0100 Subject: [PATCH 2/3] cube: Use local variable which was reported as unused The local variable first_lower was assigned a value which was not used. Signed-off-by: Stefan Weil --- cube/cube_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cube/cube_utils.cpp b/cube/cube_utils.cpp index c9c7d86f09..13c9c236da 100644 --- a/cube/cube_utils.cpp +++ b/cube/cube_utils.cpp @@ -310,7 +310,7 @@ bool CubeUtils::IsCaseInvariant(const char_32 *str32, CharSet *char_set) { if (first_upper) capitalized = true; prev_upper = first_upper; - prev_lower = islower(str32[0]); + prev_lower = first_lower; for (int c = 1; str32[c] != 0; ++c) { cur_upper = isupper(str32[c]); cur_lower = islower(str32[c]); @@ -329,7 +329,7 @@ bool CubeUtils::IsCaseInvariant(const char_32 *str32, CharSet *char_set) { if (first_upper) capitalized = true; prev_upper = first_upper; - prev_lower = unicharset->get_islower(char_set->ClassID(str32[0])); + prev_lower = first_lower; for (int c = 1; c < StrLen(str32); ++c) { cur_upper = unicharset->get_isupper(char_set->ClassID(str32[c])); From 99a5717df595a50c81d9838f768a3d981a511d97 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 4 Nov 2015 09:41:22 +0100 Subject: [PATCH 3/3] viewer: Fix format string Variable port is an int, so "%d" is needed. Signed-off-by: Stefan Weil --- viewer/svutil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viewer/svutil.cpp b/viewer/svutil.cpp index 62677f2a14..2ac94ee80f 100644 --- a/viewer/svutil.cpp +++ b/viewer/svutil.cpp @@ -372,7 +372,7 @@ static int GetAddrInfo(const char* hostname, int port, struct addrinfo** address) { #if defined(__linux__) char port_str[40]; - snprintf(port_str, 40, "%ld", port); + snprintf(port_str, 40, "%d", port); return getaddrinfo(hostname, port_str, NULL, address); #else return GetAddrInfoNonLinux(hostname, port, address);