From 7b70d051da10e6ea54cc118e8f7f254ddd07f6c1 Mon Sep 17 00:00:00 2001 From: dequis Date: Mon, 27 Aug 2018 00:14:01 -0300 Subject: [PATCH] wcwidth-wrapper: avoid cast with a tiny wrapper, julia_wcwidth() --- src/core/wcwidth-wrapper.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/wcwidth-wrapper.c b/src/core/wcwidth-wrapper.c index b670396d..8dd9dac7 100644 --- a/src/core/wcwidth-wrapper.c +++ b/src/core/wcwidth-wrapper.c @@ -71,6 +71,15 @@ static int system_wcwidth(unichar ucs) return retval; } +#ifdef HAVE_LIBUTF8PROC +/* wrapper because the function signatures are different + * (the parameter is unsigned for us, signed for them) */ +static int julia_wcwidth(unichar ucs) +{ + return utf8proc_charwidth(ucs); +} +#endif + static void read_settings(void) { static int choice = -1; @@ -95,7 +104,7 @@ static void read_settings(void) #ifdef HAVE_LIBUTF8PROC case WCWIDTH_IMPL_JULIA: - wcwidth_impl_func = (WCWIDTH_FUNC) &utf8proc_charwidth; + wcwidth_impl_func = &julia_wcwidth; break; #endif }