mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-07-08 18:06:30 +00:00
Feedback
This commit is contained in:
committed by
Nils André-Chang
parent
84cff4d6d8
commit
b0e5eb03e1
@@ -61,9 +61,11 @@ void millis_to_time(LLONG milli, unsigned *hours, unsigned *minutes,
|
||||
/* Frees the given pointer */
|
||||
void freep(void **arg)
|
||||
{
|
||||
if (*arg)
|
||||
if (arg)
|
||||
{
|
||||
free(*arg);
|
||||
*arg = NULL;
|
||||
*arg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int add_cc_sub_text(struct cc_subtitle *sub, char *str, LLONG start_time,
|
||||
|
||||
@@ -62,7 +62,7 @@ typedef struct eia608_screen // A CC buffer
|
||||
{
|
||||
/** format of data inside this structure */
|
||||
enum ccx_eia608_format format;
|
||||
char characters[15][33];
|
||||
unsigned char characters[15][33];
|
||||
unsigned char colors[15][33];
|
||||
unsigned char fonts[15][33]; // Extra char at the end for a 0
|
||||
int row_used[15]; // Any data in row?
|
||||
|
||||
@@ -454,7 +454,7 @@ int add_word(struct word_list *list, const char *word)
|
||||
return word_len;
|
||||
}
|
||||
|
||||
int add_builtin_capitalized_words()
|
||||
int add_builtin_capitalized_words(void)
|
||||
{
|
||||
static int function_already_ran = 0; // so we don't do it twice
|
||||
if (!function_already_ran)
|
||||
@@ -470,7 +470,7 @@ int add_builtin_capitalized_words()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int add_builtin_profane_words()
|
||||
int add_builtin_profane_words(void)
|
||||
{
|
||||
static int function_already_ran = 0; // so we don't do it twice
|
||||
if (!function_already_ran)
|
||||
|
||||
@@ -32,8 +32,8 @@ void get_sentence_borders(int *first, int *last, int line_num, struct eia608_scr
|
||||
int string_cmp(const void *p1, const void *p2);
|
||||
int string_cmp_function(const void *p1, const void *p2, void *arg);
|
||||
|
||||
int add_builtin_profane_words();
|
||||
int add_builtin_capitalized_words();
|
||||
int add_builtin_profane_words(void);
|
||||
int add_builtin_capitalized_words(void);
|
||||
void fix_subtitles(struct encoder_ctx *context, int line_number, struct eia608_screen *data);
|
||||
|
||||
unsigned encode_line (struct encoder_ctx *ctx, unsigned char *buffer, unsigned char *text);
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
|
||||
static int inputfile_capacity = 0;
|
||||
|
||||
#define MAX_WORD_LENGTH 50
|
||||
|
||||
size_t remove_trailing_whitespace(char *line)
|
||||
{
|
||||
char *c = line + strlen(line) - 1;
|
||||
@@ -58,18 +56,19 @@ int process_word_file(const char *filename, struct word_list *list)
|
||||
return -1;
|
||||
}
|
||||
|
||||
char line[MAX_WORD_LENGTH]; // For screen width (32)+CRLF+0
|
||||
char line[CCX_DECODER_608_SCREEN_WIDTH + 3]; // For screen width (CR)LF + '\0' == 3
|
||||
int num = 0;
|
||||
while (fgets(line, MAX_WORD_LENGTH, fi))
|
||||
while (fgets(line, CCX_DECODER_608_SCREEN_WIDTH + 3, fi))
|
||||
{
|
||||
num++;
|
||||
if (line[0] == '#') // Treat lines starting with '#' as comments
|
||||
continue;
|
||||
|
||||
size_t new_len = remove_trailing_whitespace(line);
|
||||
if (new_len > MAX_WORD_LENGTH - 3)
|
||||
|
||||
if (new_len > CCX_DECODER_608_SCREEN_WIDTH)
|
||||
{
|
||||
mprint("Word in line %d too long, max = %d characters.\n", num, MAX_WORD_LENGTH);
|
||||
mprint("Word in line %d too long, max = %d characters.\n", num, CCX_DECODER_608_SCREEN_WIDTH);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user