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 793cf64 commit 519d9e1
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions src/lib_ccx/ccx_encoders_spupng.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ 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 @@ -138,46 +139,43 @@ 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++)
void sanitize_and_write_comment(FILE *fpxml, char *input_file)
{
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);
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)
{
sanitize_and_write_comment(sp->fpxml, first_input_file);
}
fprintf(sp->fpxml, "<subpictures>\n<stream>\n");
if (multiple_files)
sanitize_and_write_comment(sp->fpxml, first_input_file);
}


void spupng_write_footer(struct spupng_t *sp)
{
fprintf(sp->fpxml, "</stream>\n</subpictures>\n");
Expand Down

0 comments on commit 519d9e1

Please sign in to comment.