diff --git a/src/xutf8/fl_wcwidth.c b/src/xutf8/fl_wcwidth.c index 005ade0032216beab63885e45813531092a797c1..6adeb924e13066ff4bc4ce8b88432fad93cb3bf7 100644 --- a/src/xutf8/fl_wcwidth.c +++ b/src/xutf8/fl_wcwidth.c @@ -30,13 +30,16 @@ * forward declare the routines as static to avoid name leakage. */ +#if 0 #include <stdio.h> /* for size_t only */ -typedef unsigned int wchar_t; /* supercede system wchar_t */ +#endif -static int mk_wcwidth(wchar_t ucs); -static int mk_wcswidth(const wchar_t *pwcs, size_t n); -static int mk_wcwidth_cjk(wchar_t ucs); -static int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n); +static int mk_wcwidth(unsigned int ucs); +#if 0 +static int mk_wcswidth(const unsigned int *pwcs, size_t n); +static int mk_wcwidth_cjk(unsigned int ucs); +static int mk_wcswidth_cjk(const unsigned int *pwcs, size_t n); +#endif #include "mk_wcwidth.c" diff --git a/src/xutf8/mk_wcwidth.c b/src/xutf8/mk_wcwidth.c index c0bebaecc32eb3c0d97410d0330494b5cdf0d400..0c4eb2cc9adc64d73a3737eddf31f38c6857611a 100644 --- a/src/xutf8/mk_wcwidth.c +++ b/src/xutf8/mk_wcwidth.c @@ -1,9 +1,10 @@ /* - * Important! + * FLTK: Important! * This file should remain as close to Markus Kuhn's original source * as possible for easy checking for changes later, however unlikely. * All customisations to work with FLTK shall be annotated! */ + /* * This is an implementation of wcwidth() and wcswidth() (defined in * IEEE Std 1002.1-2001) for Unicode. @@ -67,8 +68,8 @@ /* * FLTK - avoid possible problems on systems with 32-bit wchar_t. - * In the first instance, wchar_t is superceded in calling file - * to avoid any unnecessary changes in this one. + * Don't include wchar.h, and change wchar_t to unsigned int. + * Can we guarantee sizeof(unsigned int) >= 4 ? */ #if 0 #include <wchar.h> @@ -80,7 +81,11 @@ struct interval { }; /* auxiliary function for binary search in interval table */ +/* + * FLTK: was static int bisearch(wchar_t ucs, const struct interval *table, int max) { + */ +static int bisearch(unsigned int ucs, const struct interval *table, int max) { int min = 0; int mid; @@ -132,7 +137,11 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) { * in ISO 10646. */ +/* + * FLTK: was int mk_wcwidth(wchar_t ucs) + */ +int mk_wcwidth(unsigned int ucs) { /* sorted list of non-overlapping intervals of non-spacing characters */ /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ @@ -217,7 +226,16 @@ int mk_wcwidth(wchar_t ucs) } +/* + * FLTK: comment out the remaining functions, as we don't need themm. + */ +#if 0 + +/* + * FLTK: was int mk_wcswidth(const wchar_t *pwcs, size_t n) + */ +int mk_wcswidth(const unsigned int *pwcs, size_t n) { int w, width = 0; @@ -240,7 +258,11 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n) * the traditional terminal character-width behaviour. It is not * otherwise recommended for general use. */ +/* + * FLTK: was int mk_wcwidth_cjk(wchar_t ucs) + */ +int mk_wcwidth_cjk(unsigned int ucs) { /* sorted list of non-overlapping intervals of East Asian Ambiguous * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ @@ -308,7 +330,11 @@ int mk_wcwidth_cjk(wchar_t ucs) } +/* + * FLTK: was int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) + */ +int mk_wcswidth_cjk(const unsigned int *pwcs, size_t n) { int w, width = 0; @@ -320,3 +346,8 @@ int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) return width; } + +/* + * FLTK: end of commented out functions + */ +#endif