Skip to content

Commit

Permalink
Remove unused variable assignments
Browse files Browse the repository at this point in the history
This fixes some issues which were reported by Codacy.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jun 11, 2024
1 parent 08e9ba8 commit 130b8a1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/arch/intsimdmatrixavx2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/ccmain/fixspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 =
Expand Down
12 changes: 4 additions & 8 deletions src/classify/intmatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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++) {
Expand All @@ -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++) {
Expand Down Expand Up @@ -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;

Expand All @@ -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++) {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/dict/dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
6 changes: 2 additions & 4 deletions src/textord/tablefind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 130b8a1

Please sign in to comment.