Skip to content

Commit

Permalink
Rename spell_correct to capitalization_list
Browse files Browse the repository at this point in the history
  • Loading branch information
NilsIrl committed Dec 28, 2019
1 parent b2d3a2f commit 5fcb31d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/lib_ccx/ccx_encoders_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct word_list {
size_t capacity;
};

struct word_list spell_correct = {
struct word_list capitalization_list = {
.words = NULL,
.len = 0,
.capacity = 0,
Expand Down Expand Up @@ -97,7 +97,7 @@ int string_cmp(const void *p1, const void *p2)

void capitalize_word(size_t index, char *word)
{
memcpy(word, spell_correct.words[index], strlen(spell_correct.words[index]));
memcpy(word, capitalization_list.words[index], strlen(capitalization_list.words[index]));
}

void censor_word(size_t index, char *word)
Expand Down Expand Up @@ -136,7 +136,7 @@ void call_function_if_match(int line_num, struct eia608_screen *data, struct wor

void correct_case_with_dictionary(int line_num, struct eia608_screen *data)
{
call_function_if_match(line_num, data, &spell_correct, capitalize_word);
call_function_if_match(line_num, data, &capitalization_list, capitalize_word);
}

void censor_word_with_dictionary(int line_num, struct eia608_screen *data)
Expand Down Expand Up @@ -165,11 +165,11 @@ void telx_correct_case(char *sub_line)
}
do
{
char **index = bsearch(&c, spell_correct.words, spell_correct.len, sizeof(*spell_correct.words), string_cmp);
char **index = bsearch(&c, capitalization_list.words, capitalization_list.len, sizeof(*capitalization_list.words), string_cmp);

if (index)
{
char *correct_c = spell_correct.words[index - spell_correct.words];
char *correct_c = capitalization_list.words[index - capitalization_list.words];
size_t len = strlen(correct_c);
memcpy(oline + (c - line), correct_c, len);
}
Expand Down Expand Up @@ -512,6 +512,6 @@ void shell_sort(void *base, int nb, size_t size, int(*compar)(const void*p1, con

void ccx_encoders_helpers_perform_shellsort_words(void)
{
shell_sort(spell_correct.words, spell_correct.len, sizeof(*spell_correct.words), string_cmp_function, NULL);
shell_sort(capitalization_list.words, capitalization_list.len, sizeof(*capitalization_list.words), string_cmp_function, NULL);
shell_sort(profane.words, profane.len, sizeof(*profane.words), string_cmp_function, NULL);
}
2 changes: 1 addition & 1 deletion src/lib_ccx/ccx_encoders_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "ccx_encoders_common.h"
#include "png.h"

extern struct word_list spell_correct;
extern struct word_list capitalization_list;
extern struct word_list profane;
extern const char *capitalized_builtin[];
extern const char *profane_builtin[];
Expand Down
4 changes: 2 additions & 2 deletions src/lib_ccx/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -2820,9 +2820,9 @@ int parse_parameters (struct ccx_s_options *opt, int argc, char *argv[])

if (opt->enc_cfg.sentence_cap)
{
if (add_builtin_words(capitalized_builtin, &spell_correct))
if (add_builtin_words(capitalized_builtin, &capitalization_list))
fatal(EXIT_NOT_ENOUGH_MEMORY, "Not enough memory for capitalized word list");
if (opt->sentence_cap_file && process_word_file(opt->sentence_cap_file, &spell_correct))
if (opt->sentence_cap_file && process_word_file(opt->sentence_cap_file, &capitalization_list))
fatal(EXIT_ERROR_IN_CAPITALIZATION_FILE, "There was an error processing the capitalization file.\n");
}

Expand Down

0 comments on commit 5fcb31d

Please sign in to comment.