Skip to content

Commit

Permalink
* bl_map.h, pixmap_engine.c, */ui.h, ui_im.[ch], ui_sb_view.h,
Browse files Browse the repository at this point in the history
  ui_screen.c: Fix incompatible function pointer types which
  becomes fatal with clang 16.
  • Loading branch information
arakiken committed Nov 20, 2022
1 parent a70118e commit dbf581c
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 33 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2022-11-19 Araki Ken <arakiken@users.sf.net>

* 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 <arakiken@users.sf.net>

* cocoa/install.sh, cocoa/install-sdl2.sh:
Expand Down
28 changes: 17 additions & 11 deletions baselib/src/bl_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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; \
} \
} \
\
Expand Down Expand Up @@ -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; \
} \
} \
\
Expand Down
2 changes: 1 addition & 1 deletion contrib/scrollbar/pixmap_engine/pixmap_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
;
Expand Down
2 changes: 2 additions & 0 deletions doc/en/ReleaseNote
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/beos/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 === */

Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/console/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 === */

Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/fb/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 === */

Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/quartz/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 === */

Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/sdl2/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 === */

Expand Down
9 changes: 4 additions & 5 deletions uitoolkit/ui_im.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/ui_im.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions uitoolkit/ui_sb_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 8 additions & 5 deletions uitoolkit/ui_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/wayland/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 === */

Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/win32/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion uitoolkit/win32/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 === */

Expand Down

0 comments on commit dbf581c

Please sign in to comment.