Skip to content

Commit

Permalink
Valid xml tokens
Browse files Browse the repository at this point in the history
Signed-off-by: peach280 <[email protected]>
  • Loading branch information
peach280 committed Jan 10, 2025
1 parent b08c5fa commit 47d4727
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions src/lib_ccx/ccx_encoders_spupng.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ struct spupng_t
#define CCPL (ccfont2_width / CCW * ccfont2_height / CCH)

static int initialized = 0;

void spupng_init_font()
{
uint8_t *t, *p;
Expand Down Expand Up @@ -139,12 +138,38 @@ void spunpg_free(struct spupng_t *sp)
free(sp->relative_path_png);
free(sp);
}
void sanitize_and_write_comment(FILE *fpxml, const char *input_file)
{
char sanitized_file[300];
int j = 0;

for (int i = 0; input_file[i] != '\0' && j < sizeof(sanitized_file) - 1; i++) {
if (input_file[i] == '-') {

if (input_file[i + 1] == '-')
{
sanitized_file[j++] = ' ';
i++;
}
else
{
sanitized_file[j++] = input_file[i];
}
}
else
{
sanitized_file[j++] = input_file[i];
}
}
sanitized_file[j] = '\0';

fprintf(fpxml, "<!-- %s -->\n", sanitized_file);
}
void spupng_write_header(struct spupng_t *sp, int multiple_files, char *first_input_file)
{
fprintf(sp->fpxml, "<subpictures>\n<stream>\n");
if (multiple_files)
fprintf(sp->fpxml, "<!-- %s -->\n", first_input_file);
sanitize_and_write_comment(sp->fpxml, first_input_file);
}

void spupng_write_footer(struct spupng_t *sp)
Expand Down

0 comments on commit 47d4727

Please sign in to comment.