Remove unused variable assignments

This fixes some issues which were reported by Codacy.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2024-06-11 19:00:17 +02:00
parent 08e9ba8b2e
commit 130b8a1c1e
5 changed files with 8 additions and 16 deletions

View File

@ -568,7 +568,6 @@ static void matrixDotVector(int dim1, int dim2, const int8_t *wi, const double *
output += group_size;
}
group_size /= 2;
w_step /= 2;
if (output + group_size <= rounded_num_out) {
PartialMatrixDotVector8(wi, scales, u, rounded_num_in, v);

View File

@ -267,8 +267,6 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
bool prev_char_1 = false; // prev ch a "1/I/l"?
bool prev_char_digit = false; // prev ch 2..9 or 0
const char *punct_chars = "!\"`',.:;";
bool prev_char_punct = false;
do {
// current word
WERD_RES *word = word_res_it.data();
@ -325,6 +323,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
/* Add 1 to total score for every joined punctuation regardless of context
and rejtn */
if (tessedit_prefer_joined_punct) {
bool prev_char_punct;
for (i = 0, offset = 0, prev_char_punct = false; i < word_len;
offset += word->best_choice->unichar_lengths()[i++]) {
bool current_char_punct =

View File

@ -892,7 +892,6 @@ void IntegerMatcher::DebugFeatureProtoError(INT_CLASS_STRUCT *ClassTemplate, BIT
uint16_t ProtoNum;
uint8_t ProtoWordNum;
PROTO_SET_STRUCT *ProtoSet;
uint16_t ActualProtoNum;
if (PrintMatchSummaryOn(Debug)) {
tprintf("Configuration Mask:\n");
@ -912,9 +911,8 @@ void IntegerMatcher::DebugFeatureProtoError(INT_CLASS_STRUCT *ClassTemplate, BIT
if (PrintMatchSummaryOn(Debug)) {
tprintf("Proto Mask:\n");
for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->NumProtoSets; ProtoSetIndex++) {
ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
for (ProtoWordNum = 0; ProtoWordNum < 2; ProtoWordNum++, ProtoMask++) {
ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
uint16_t ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
for (ProtoNum = 0; ((ProtoNum < (PROTOS_PER_PROTO_SET >> 1)) &&
(ActualProtoNum < ClassTemplate->NumProtos));
ProtoNum++, ActualProtoNum++) {
@ -934,7 +932,7 @@ void IntegerMatcher::DebugFeatureProtoError(INT_CLASS_STRUCT *ClassTemplate, BIT
tprintf("Proto Evidence:\n");
for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->NumProtoSets; ProtoSetIndex++) {
ProtoSet = ClassTemplate->ProtoSets[ProtoSetIndex];
ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
uint16_t ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
for (ProtoNum = 0;
((ProtoNum < PROTOS_PER_PROTO_SET) && (ActualProtoNum < ClassTemplate->NumProtos));
ProtoNum++, ActualProtoNum++) {
@ -991,7 +989,6 @@ void IntegerMatcher::DisplayProtoDebugInfo(INT_CLASS_STRUCT *ClassTemplate, BIT_
const ScratchEvidence &tables,
bool SeparateDebugWindows) {
uint16_t ProtoNum;
uint16_t ActualProtoNum;
PROTO_SET_STRUCT *ProtoSet;
int ProtoSetIndex;
@ -1003,7 +1000,7 @@ void IntegerMatcher::DisplayProtoDebugInfo(INT_CLASS_STRUCT *ClassTemplate, BIT_
for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->NumProtoSets; ProtoSetIndex++) {
ProtoSet = ClassTemplate->ProtoSets[ProtoSetIndex];
ActualProtoNum = ProtoSetIndex * PROTOS_PER_PROTO_SET;
uint16_t ActualProtoNum = ProtoSetIndex * PROTOS_PER_PROTO_SET;
for (ProtoNum = 0;
((ProtoNum < PROTOS_PER_PROTO_SET) && (ActualProtoNum < ClassTemplate->NumProtos));
ProtoNum++, ActualProtoNum++) {
@ -1076,13 +1073,12 @@ void ScratchEvidence::UpdateSumOfProtoEvidences(INT_CLASS_STRUCT *ClassTemplate,
uint16_t ProtoNum;
PROTO_SET_STRUCT *ProtoSet;
int NumProtos;
uint16_t ActualProtoNum;
NumProtos = ClassTemplate->NumProtos;
for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->NumProtoSets; ProtoSetIndex++) {
ProtoSet = ClassTemplate->ProtoSets[ProtoSetIndex];
ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
uint16_t ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
for (ProtoNum = 0; ((ProtoNum < PROTOS_PER_PROTO_SET) && (ActualProtoNum < NumProtos));
ProtoNum++, ActualProtoNum++) {
int temp = 0;

View File

@ -886,7 +886,7 @@ bool Dict::valid_punctuation(const WERD_CHOICE &word) {
}
WERD_CHOICE new_word(word.unicharset());
auto last_index = word.length() - 1;
int new_len = 0;
int new_len;
for (unsigned i = 0; i <= last_index; ++i) {
UNICHAR_ID unichar_id = (word.unichar_id(i));
if (getUnicharset().get_ispunctuation(unichar_id)) {

View File

@ -884,8 +884,6 @@ bool TableFinder::HasWideOrNoInterWordGap(ColPartition *part) const {
}
// Variables used to compute inter-blob spacing.
int current_x0 = -1;
int current_x1 = -1;
int previous_x1 = -1;
// Stores the maximum gap detected.
int largest_partition_gap_found = -1;
@ -897,8 +895,8 @@ bool TableFinder::HasWideOrNoInterWordGap(ColPartition *part) const {
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
BLOBNBOX *blob = it.data();
current_x0 = blob->bounding_box().left();
current_x1 = blob->bounding_box().right();
int current_x0 = blob->bounding_box().left();
int current_x1 = blob->bounding_box().right();
if (previous_x1 != -1) {
int gap = current_x0 - previous_x1;