From 0518043ccfb644bc56f48f52e82f2d81ce893c14 Mon Sep 17 00:00:00 2001 From: jozan Date: Tue, 10 Nov 2020 20:20:38 +0000 Subject: In progress FossilOrigin-Name: 2dc02e78538ff15abf2d4363152ab96b7222bdc88b00dc1a60c1cbb1f30cc8ae --- src/c_subst.c | 20 ++++++++++++++++---- src/c_subst.h | 4 ++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/c_subst.c b/src/c_subst.c index 406d0ae..b589552 100644 --- a/src/c_subst.c +++ b/src/c_subst.c @@ -200,12 +200,24 @@ c_specific_subst(char filename[]) static void c_unicode_subst(char filename[]) { - unsigned char *p; + char *p; - p = (unsigned char*)filename; + p = filename; while (*p != 0x00) { - if (u_ischarset(*p, "")) { - *p = 'c'; + if ( + u_ischarset(*p, C_CHARSET_A_MAJ) == TRUE || + u_ischarset(*p, C_CHARSET_A_MIN) == TRUE + ) { + *p = 'a'; + memmove(p + 1, p + 2, (strlen(p + 2) + 1) * sizeof(char)); + c_unicode_subst(filename); + } + if ( + u_ischarset(*p, C_CHARSET_O_MAJ) == TRUE || + u_ischarset(*p, C_CHARSET_O_MIN) == TRUE + ) { + *p = 'o'; + memmove(p + 1, p + 2, (strlen(p + 2) + 1) * sizeof(char)); c_unicode_subst(filename); } p++; diff --git a/src/c_subst.h b/src/c_subst.h index 11e50d6..e21f72c 100644 --- a/src/c_subst.h +++ b/src/c_subst.h @@ -51,6 +51,10 @@ #include "c_unixize.h" #define C_CHARSET_VALID "_-." +#define C_CHARSET_A_MAJ "\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5" +#define C_CHARSET_A_MIN "\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5" +#define C_CHARSET_O_MAJ "\u00d2\u00d3\u00d4\u00d5\u00d6\u00d8" +#define C_CHARSET_O_MIN "\u00f2\u00f3\u00f4\u00f5\u00f6\u00f8" struct lfiles_s* c_subst_filenames(struct lfiles_s*, const bool_t, const unsigned char); -- cgit v1.2.3