diff --git a/src/lib_ccx/ccx_encoders_spupng.c b/src/lib_ccx/ccx_encoders_spupng.c index b3ca5fa0b..3eb0e9b04 100644 --- a/src/lib_ccx/ccx_encoders_spupng.c +++ b/src/lib_ccx/ccx_encoders_spupng.c @@ -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; @@ -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, "\n", sanitized_file); +} void spupng_write_header(struct spupng_t *sp, int multiple_files, char *first_input_file) { fprintf(sp->fpxml, "\n\n"); if (multiple_files) - fprintf(sp->fpxml, "\n", first_input_file); + sanitize_and_write_comment(sp->fpxml, first_input_file); } void spupng_write_footer(struct spupng_t *sp)