From dbf581cccc8ca59d92c8f84b563d5d2376c11208 Mon Sep 17 00:00:00 2001 From: arakiken Date: Sun, 20 Nov 2022 14:37:25 +0900 Subject: [PATCH] * bl_map.h, pixmap_engine.c, */ui.h, ui_im.[ch], ui_sb_view.h, ui_screen.c: Fix incompatible function pointer types which becomes fatal with clang 16. --- ChangeLog | 6 ++++ baselib/src/bl_map.h | 28 +++++++++++-------- .../scrollbar/pixmap_engine/pixmap_engine.c | 2 +- doc/en/ReleaseNote | 2 ++ uitoolkit/beos/ui.h | 2 +- uitoolkit/console/ui.h | 2 +- uitoolkit/fb/ui.h | 2 +- uitoolkit/quartz/ui.h | 2 +- uitoolkit/sdl2/ui.h | 2 +- uitoolkit/ui_im.c | 9 +++--- uitoolkit/ui_im.h | 2 +- uitoolkit/ui_sb_view.h | 4 +-- uitoolkit/ui_screen.c | 13 +++++---- uitoolkit/wayland/ui.h | 2 +- uitoolkit/win32/ui.c | 2 +- uitoolkit/win32/ui.h | 2 +- 16 files changed, 49 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0bf54f1f..b2aa3bcd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2022-11-19 Araki Ken + + * bl_map.h, pixmap_engine.c, */ui.h, ui_im.[ch], ui_sb_view.h, + ui_screen.c: Fix incompatible function pointer types which + becomes fatal with clang 16. + 2022-11-09 Araki Ken * cocoa/install.sh, cocoa/install-sdl2.sh: diff --git a/baselib/src/bl_map.h b/baselib/src/bl_map.h index c2cdcf643..afae5e853 100644 --- a/baselib/src/bl_map.h +++ b/baselib/src/bl_map.h @@ -47,17 +47,17 @@ (map)->pairs_array = NULL; \ (map)->map_size = size; \ (map)->filled_size = 0; \ - if (__hash_func == bl_map_hash_int) { \ + if ((int (*)(int, u_int))__hash_func == bl_map_hash_int) { \ if (size & (size - 1)) { \ - (map)->hash_func = bl_map_hash_int; \ + (map)->hash_func = (int (*)(key_type, u_int))bl_map_hash_int; \ } else { \ /* new_size == 2^n */ \ - (map)->hash_func = bl_map_hash_int_fast; \ + (map)->hash_func = (int (*)(key_type, u_int))bl_map_hash_int_fast; \ } \ } else { \ - (map)->hash_func = __hash_func; \ + (map)->hash_func = (int (*)(key_type, u_int))__hash_func; \ } \ - (map)->compare_func = __compare_func; \ + (map)->compare_func = (int (*)(key_type, key_type))__compare_func; \ } #define bl_map_new(key_type, val_type, map, __hash_func, __compare_func) \ @@ -138,12 +138,15 @@ \ __old = (map)->pairs; \ \ - if ((map)->hash_func == bl_map_hash_int || (map)->hash_func == bl_map_hash_int_fast) { \ + if ((int (*)(int, u_int))(map)->hash_func == bl_map_hash_int || \ + (int (*)(int, u_int))(map)->hash_func == bl_map_hash_int_fast) { \ if (__new_size & (__new_size - 1)) { \ - (map)->hash_func = bl_map_hash_int; \ + /* XXX int (*)() should be int (*)(key_type, u_int) */ \ + (map)->hash_func = (int (*)())bl_map_hash_int; \ } else { \ /* __new_size == 2^n */ \ - (map)->hash_func = bl_map_hash_int_fast; \ + /* XXX int (*)() should be int (*)(key_type, u_int) */ \ + (map)->hash_func = (int (*)())bl_map_hash_int_fast; \ } \ } \ \ @@ -256,12 +259,15 @@ if ((__new = calloc(__new_size, sizeof(*(map)->pairs)))) { \ __old = (map)->pairs; \ \ - if ((map)->hash_func == bl_map_hash_int || (map)->hash_func == bl_map_hash_int_fast) { \ + if ((int (*)(int, u_int))(map)->hash_func == bl_map_hash_int || \ + (int (*)(int, u_int))(map)->hash_func == bl_map_hash_int_fast) { \ if (__new_size & (__new_size - 1)) { \ - (map)->hash_func = bl_map_hash_int; \ + /* XXX int (*)() should be int (*)(key_type, u_int) */ \ + (map)->hash_func = (int (*)())bl_map_hash_int; \ } else { \ /* __new_size == 2^n */ \ - (map)->hash_func = bl_map_hash_int_fast; \ + /* XXX int (*)() should be int (*)(key_type, u_int) */ \ + (map)->hash_func = (int (*)())bl_map_hash_int_fast; \ } \ } \ \ diff --git a/contrib/scrollbar/pixmap_engine/pixmap_engine.c b/contrib/scrollbar/pixmap_engine/pixmap_engine.c index 5f39a89f8..6d6b93388 100644 --- a/contrib/scrollbar/pixmap_engine/pixmap_engine.c +++ b/contrib/scrollbar/pixmap_engine/pixmap_engine.c @@ -143,7 +143,7 @@ static void load_image(ui_display_t *disp, ui_sb_view_conf_t *conf, const char * path = malloc(sizeof(char) * (len + 1)); sprintf(path, "%s/%s.png", conf->dir, file); - if (!(*conf->load_image)(disp, path, NULL, pixmap, mask, width, height)) { + if (!(*conf->load_image)(disp, path, NULL, pixmap, mask, width, height, 0)) { #ifdef __DEBUG printf("ui_imagelib_load_file() failed\n"); ; diff --git a/doc/en/ReleaseNote b/doc/en/ReleaseNote index 4224a724a..72f174b42 100644 --- a/doc/en/ReleaseNote +++ b/doc/en/ReleaseNote @@ -13,6 +13,8 @@ Fix https://github.com/arakiken/mlterm/issues/35. Fix https://github.com/arakiken/mlterm/issues/39. Fix https://github.com/arakiken/mlterm/issues/44. + Fix https://github.com/arakiken/mlterm/issues/50. + Fix https://github.com/arakiken/mlterm/issues/51. Fix https://twitter.com/isaki68k/status/1555895011991883783. ver 3.9.2 diff --git a/uitoolkit/beos/ui.h b/uitoolkit/beos/ui.h index 798bd2df9..6af09b4d6 100644 --- a/uitoolkit/beos/ui.h +++ b/uitoolkit/beos/ui.h @@ -371,7 +371,7 @@ typedef struct { int XParseGeometry(char *str, int *x, int *y, unsigned int *width, unsigned int *height); -KeySym XStringToKeysym(char *str); +KeySym XStringToKeysym(const char *str); /* === Platform dependent options === */ diff --git a/uitoolkit/console/ui.h b/uitoolkit/console/ui.h index d16e1ee68..37e8a2292 100644 --- a/uitoolkit/console/ui.h +++ b/uitoolkit/console/ui.h @@ -510,7 +510,7 @@ typedef struct { int XParseGeometry(char *str, int *x, int *y, unsigned int *width, unsigned int *height); -KeySym XStringToKeysym(char *str); +KeySym XStringToKeysym(const char *str); /* === Platform dependent options === */ diff --git a/uitoolkit/fb/ui.h b/uitoolkit/fb/ui.h index e5e1746c2..ebc4f1a42 100644 --- a/uitoolkit/fb/ui.h +++ b/uitoolkit/fb/ui.h @@ -633,7 +633,7 @@ typedef struct { int XParseGeometry(char *str, int *x, int *y, unsigned int *width, unsigned int *height); -KeySym XStringToKeysym(char *str); +KeySym XStringToKeysym(const char *str); /* === Platform dependent options === */ diff --git a/uitoolkit/quartz/ui.h b/uitoolkit/quartz/ui.h index 188953324..c1f3952b9 100644 --- a/uitoolkit/quartz/ui.h +++ b/uitoolkit/quartz/ui.h @@ -494,7 +494,7 @@ typedef int XFontSet; /* dummy */ int XParseGeometry(char *str, int *x, int *y, unsigned int *width, unsigned int *height); -KeySym XStringToKeysym(char *str); +KeySym XStringToKeysym(const char *str); /* === Platform dependent options === */ diff --git a/uitoolkit/sdl2/ui.h b/uitoolkit/sdl2/ui.h index 880fe88bd..7c84f621f 100644 --- a/uitoolkit/sdl2/ui.h +++ b/uitoolkit/sdl2/ui.h @@ -373,7 +373,7 @@ typedef struct { int XParseGeometry(char *str, int *x, int *y, unsigned int *width, unsigned int *height); -KeySym XStringToKeysym(char *str); +KeySym XStringToKeysym(const char *str); /* === Platform dependent options === */ diff --git a/uitoolkit/ui_im.c b/uitoolkit/ui_im.c index 90b41f8a3..186072913 100644 --- a/uitoolkit/ui_im.c +++ b/uitoolkit/ui_im.c @@ -26,11 +26,10 @@ typedef ui_im_t *(*ui_im_new_func_t)(u_int64_t magic, vt_char_encoding_t term_en static ui_im_export_syms_t im_export_syms = { vt_str_init, vt_str_destroy, vt_char_combine, vt_char_set, vt_get_char_encoding_name, - vt_get_char_encoding, vt_convert_to_internal_ch, vt_isciikey_state_new, - vt_isciikey_state_destroy, vt_convert_ascii_to_iscii, vt_char_encoding_parser_new, - vt_char_encoding_conv_new, ui_im_candidate_screen_new, ui_im_status_screen_new, - ui_event_source_add_fd, ui_event_source_remove_fd, XStringToKeysym - + vt_get_char_encoding, (int (*)(void*, ef_char_t*))vt_convert_to_internal_ch, + vt_isciikey_state_new, vt_isciikey_state_destroy, vt_convert_ascii_to_iscii, + vt_char_encoding_parser_new, vt_char_encoding_conv_new, ui_im_candidate_screen_new, + ui_im_status_screen_new, ui_event_source_add_fd, ui_event_source_remove_fd, XStringToKeysym }; #if 1 diff --git a/uitoolkit/ui_im.h b/uitoolkit/ui_im.h index 0ce36c277..3588307d4 100644 --- a/uitoolkit/ui_im.h +++ b/uitoolkit/ui_im.h @@ -70,7 +70,7 @@ typedef struct ui_im_export_syms { u_int, int, int); int (*ui_event_source_add_fd)(int, void (*handler)(void)); void (*ui_event_source_remove_fd)(int); - KeySym (*XStringToKeysym)(char *); + KeySym (*XStringToKeysym)(const char *); } ui_im_export_syms_t; diff --git a/uitoolkit/ui_sb_view.h b/uitoolkit/ui_sb_view.h index 92c7c09b1..9856e247c 100644 --- a/uitoolkit/ui_sb_view.h +++ b/uitoolkit/ui_sb_view.h @@ -75,8 +75,8 @@ typedef struct ui_sb_view_conf { unsigned int use_count; int (*load_image)(__ui_display_ptr_t disp, char *path, - /* u_int32_t */ unsigned int **cardinal, Pixmap *pixmap, Pixmap *mask, - unsigned int *width, unsigned int *height); + /* u_int32_t */ unsigned int **cardinal, Pixmap *pixmap, PixmapMask *mask, + unsigned int *width, unsigned int *height, int); } ui_sb_view_conf_t; diff --git a/uitoolkit/ui_screen.c b/uitoolkit/ui_screen.c index c6d297838..1240e9394 100644 --- a/uitoolkit/ui_screen.c +++ b/uitoolkit/ui_screen.c @@ -6548,7 +6548,10 @@ ui_screen_t *ui_screen_new(vt_term_t *term, /* can be NULL */ u_int line_height; #ifdef USE_OT_LAYOUT - vt_ot_layout_set_shape_func(ui_convert_text_to_glyphs, ot_layout_get_ot_layout_font); + vt_ot_layout_set_shape_func((u_int (*)(void*, u_int32_t*, u_int, int8_t*, int8_t*, + u_int8_t*, u_int32_t*, u_int32_t*, u_int, + const char*, const char*))ui_convert_text_to_glyphs, + (void* (*)(void*, vt_font_t))ot_layout_get_ot_layout_font); #endif if ((screen = calloc(1, sizeof(ui_screen_t))) == NULL) { @@ -6639,8 +6642,8 @@ ui_screen_t *ui_screen_new(vt_term_t *term, /* can be NULL */ screen->xterm_listener.reverse_video = xterm_reverse_video; screen->xterm_listener.set_mouse_report = xterm_set_mouse_report; screen->xterm_listener.request_locator = xterm_request_locator; - screen->xterm_listener.set_window_name = ui_set_window_name; - screen->xterm_listener.set_icon_name = ui_set_icon_name; + screen->xterm_listener.set_window_name = (void (*)(void*, u_char*))ui_set_window_name; + screen->xterm_listener.set_icon_name = (void (*)(void*, u_char*))ui_set_icon_name; screen->xterm_listener.bel = xterm_bel; screen->xterm_listener.im_is_active = xterm_im_is_active; screen->xterm_listener.switch_im_mode = xterm_switch_im_mode; @@ -6658,8 +6661,8 @@ ui_screen_t *ui_screen_new(vt_term_t *term, /* can be NULL */ screen->xterm_listener.lock_keyboard = xterm_lock_keyboard; screen->config_listener.self = screen; - screen->config_listener.exec = ui_screen_exec_cmd; - screen->config_listener.set = ui_screen_set_config; + screen->config_listener.exec = (int (*)(void*, char*))ui_screen_exec_cmd; + screen->config_listener.set = (int (*)(void*, char*, char*, char*))ui_screen_set_config; screen->config_listener.get = get_config; screen->config_listener.saved = NULL; screen->config_listener.set_font = set_font_config; diff --git a/uitoolkit/wayland/ui.h b/uitoolkit/wayland/ui.h index 11ad63d68..15d39d4bd 100644 --- a/uitoolkit/wayland/ui.h +++ b/uitoolkit/wayland/ui.h @@ -493,7 +493,7 @@ typedef struct { int XParseGeometry(char *str, int *x, int *y, unsigned int *width, unsigned int *height); -KeySym XStringToKeysym(char *str); +KeySym XStringToKeysym(const char *str); /* === Platform dependent options === */ diff --git a/uitoolkit/win32/ui.c b/uitoolkit/win32/ui.c index f5dd00e85..7535e89ee 100644 --- a/uitoolkit/win32/ui.c +++ b/uitoolkit/win32/ui.c @@ -89,7 +89,7 @@ int XParseGeometry(char *str, int *xpos, int *ypos, unsigned int *width, unsigne } } -KeySym XStringToKeysym(char *str) { +KeySym XStringToKeysym(const char *str) { #ifdef SELF_TEST int debug_count = 0; #endif diff --git a/uitoolkit/win32/ui.h b/uitoolkit/win32/ui.h index 06a42bf06..2ea5f6cfe 100644 --- a/uitoolkit/win32/ui.h +++ b/uitoolkit/win32/ui.h @@ -373,7 +373,7 @@ typedef LPLOGFONT XFontSet; int XParseGeometry(char *str, int *x, int *y, unsigned int *width, unsigned int *height); -KeySym XStringToKeysym(char *str); +KeySym XStringToKeysym(const char *str); /* === Platform dependent options === */