File: fix-incompat-pointer-types.patch

package info (click to toggle)
mlterm 3.9.3-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 28,548 kB
  • sloc: ansic: 143,284; sh: 4,796; cpp: 2,953; objc: 2,713; java: 2,463; makefile: 2,430; perl: 1,269; xml: 45
file content (1893 lines) | stat: -rw-r--r-- 70,404 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
Description: Fix errors in -Werror=incompatible-pointer-types
Origin: upstream, commit: f971955,23d384b..08ba985
Bug: https://github.com/arakiken/mlterm/issues/92
Bug-Debian: https://bugs.debian.org/1075281
Index: mlterm/android/jni/ui_display.c
===================================================================
--- mlterm.orig/android/jni/ui_display.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/android/jni/ui_display.c	2024-12-11 12:27:46.101053222 +0100
@@ -222,7 +222,7 @@
       xev.keycode = code;
       xev.state = _display.button_state | _display.key_state;
 
-      ui_window_receive_event(_disp.roots[0], &xev);
+      ui_window_receive_event(_disp.roots[0], (XEvent*)&xev);
     }
   } else if (action == AKEY_EVENT_ACTION_MULTIPLE) {
     XKeyEvent xev;
@@ -232,7 +232,7 @@
     xev.keycode = 0;
     xev.state = 0;
 
-    ui_window_receive_event(_disp.roots[0], &xev);
+    ui_window_receive_event(_disp.roots[0], (XEvent*)&xev);
   } else /* if( action == AKEY_EVENT_ACTION_UP) */
   {
     if (code == AKEYCODE_SHIFT_RIGHT || code == AKEYCODE_SHIFT_LEFT) {
@@ -439,7 +439,7 @@
     xev.x -= win->x;
     xev.y -= win->y;
 
-    ui_window_receive_event(win, &xev);
+    ui_window_receive_event(win, (XEvent*)&xev);
   }
 
   return 1;
Index: mlterm/baselib/src/bl_utmp_sysv.c
===================================================================
--- mlterm.orig/baselib/src/bl_utmp_sysv.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/baselib/src/bl_utmp_sysv.c	2024-12-11 12:27:46.101053222 +0100
@@ -62,7 +62,7 @@
 #endif
   bl_utmp_t utmp;
   const char *pw_name;
-  char *tty_num;
+  const char *tty_num;
   struct timeval timenow;
 
   gettimeofday(&timenow, NULL);
Index: mlterm/gtk/vte.c
===================================================================
--- mlterm.orig/gtk/vte.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/gtk/vte.c	2024-12-11 12:27:46.101053222 +0100
@@ -138,7 +138,7 @@
   ui_system_event_listener_t system_listener;
 
   void (*line_scrolled_out)(void *);
-  void (*xterm_resize)(void *, u_int, u_int, int);
+  void (*xterm_resize)(void *, u_int, u_int, int, int);
   ui_screen_scroll_event_listener_t screen_scroll_listener;
   int8_t adj_value_changed_by_myself;
 
@@ -298,7 +298,7 @@
 static guint signals[LAST_SIGNAL];
 #endif
 
-static int (*orig_select_in_window)(void *, vt_char_t **, u_int *, int, int, int, int, int);
+static int (*orig_select_in_window)(void *);
 
 #if defined(USE_XLIB)
 #include "vte_xlib.c"
@@ -324,10 +324,8 @@
 }
 #endif
 
-static int select_in_window(void *p, vt_char_t **chars, u_int *len, int beg_char_index, int beg_row,
-                            int end_char_index, int end_row, int is_rect) {
-  int ret = (*orig_select_in_window)(p, chars, len, beg_char_index, beg_row,
-                                     end_char_index, end_row, is_rect);
+static int select_in_window(void *p) {
+  int ret = (*orig_select_in_window)(p);
 #if VTE_CHECK_VERSION(0, 19, 0)
   g_signal_emit(VTE_WIDGET((ui_screen_t*)p), signals[SIGNAL_SELECTION_CHANGED], 0);
 #endif
@@ -719,19 +717,19 @@
  * vt_xterm_event_listener_t (overriding) handlers
  */
 
-static void xterm_resize(void *p, u_int width, u_int height, int flag) {
+static void xterm_resize(void *p, u_int width, u_int height, int mx_flag, int sb_flag) {
   ui_screen_t *screen = p;
   VteTerminal *terminal = VTE_WIDGET(screen);
 
-  if (flag) {
-    flag --; /* converting to ui_maximize_flag_t */
-    if (flag == MAXIMIZE_FULL) {
-      gtk_window_maximize(gtk_widget_get_toplevel(GTK_WIDGET(terminal)));
-    } else if (flag == MAXIMIZE_RESTORE) {
-      gtk_window_unmaximize(gtk_widget_get_toplevel(GTK_WIDGET(terminal)));
+  if (mx_flag) {
+    mx_flag --; /* converting to ui_maximize_flag_t */
+    if (mx_flag == MAXIMIZE_FULL) {
+      gtk_window_maximize(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(terminal))));
+    } else if (mx_flag == MAXIMIZE_RESTORE) {
+      gtk_window_unmaximize(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(terminal))));
     }
   } else {
-    (*PVT(terminal)->xterm_resize)(p, width, height, 0);
+    (*PVT(terminal)->xterm_resize)(p, width, height, 0, 0);
   }
 }
 
@@ -1631,7 +1629,7 @@
          * "exo-open --launch TerminalEmulator" (which calls
          * "x-terminal-emulator" internally)
          */
-        g_object_get_data(gtk_widget_get_parent(widget), "roxterm_tab")) {
+        g_object_get_data(G_OBJECT(gtk_widget_get_parent(widget)), "roxterm_tab")) {
       /*
        * XXX
        * I don't know why, but the size of roxterm 2.6.5 (GTK+3) is
@@ -2380,7 +2378,7 @@
 #endif
 
 #if VTE_CHECK_VERSION(0, 40, 0)
-  terminal->_unused_padding[0] = G_TYPE_INSTANCE_GET_PRIVATE(terminal, VTE_TYPE_TERMINAL, VteTerminalPrivate);
+  terminal->_unused_padding[0] = (void**)G_TYPE_INSTANCE_GET_PRIVATE(terminal, VTE_TYPE_TERMINAL, VteTerminalPrivate);
 #else
   terminal->pvt = G_TYPE_INSTANCE_GET_PRIVATE(terminal, VTE_TYPE_TERMINAL, VteTerminalPrivate);
 #endif
@@ -2756,8 +2754,8 @@
   g_free(str);
 }
 
-static int set_colors(VteTerminal *terminal, const char *palette, glong palette_size,
-                      size_t color_size, gchar *(*to_string)(const char *)) {
+static int set_colors(VteTerminal *terminal, const void *palette, glong palette_size,
+                      size_t color_size, gchar *(*to_string)(const void *)) {
   int need_redraw = 0;
   vt_color_t color;
 
@@ -2932,8 +2930,9 @@
   GPid child_pid;
   GError *error;
 
-  vte_terminal_spawn_sync(terminal, pty_flags, working_directory, argv, envv, spawn_flags,
-                          child_setup, child_setup_data, &child_pid, cancellable, &error);
+  vte_terminal_spawn_sync(terminal, pty_flags, working_directory, (char**)argv, (char**)envv,
+                          spawn_flags, child_setup, child_setup_data, &child_pid, cancellable,
+                          &error);
   if (callback) {
     (*callback)(terminal, child_pid, NULL, user_data);
   }
@@ -2960,8 +2959,9 @@
     bl_msg_printf("vte_terminal_spawn_with_fds_async() ignores fds and fd_map_to.\n");
   }
 
-  vte_terminal_spawn_sync(terminal, pty_flags, working_directory, argv, envv, spawn_flags,
-                          child_setup, child_setup_data, &child_pid, cancellable, &error);
+  vte_terminal_spawn_sync(terminal, pty_flags, working_directory, (char**)argv, (char**)envv,
+                          spawn_flags, child_setup, child_setup_data, &child_pid, cancellable,
+                          &error);
   if (callback) {
     (*callback)(terminal, child_pid, NULL, user_data);
   }
@@ -3369,19 +3369,19 @@
 
 #if GTK_CHECK_VERSION(2, 99, 0)
 void vte_terminal_set_color_bold_rgba(VteTerminal *terminal, const GdkRGBA *bold) {
-  set_color_bold(terminal, bold, gdk_rgba_to_string2);
+  set_color_bold(terminal, bold, (gchar*(*)(const void*))gdk_rgba_to_string2);
 }
 
 void vte_terminal_set_color_foreground_rgba(VteTerminal *terminal, const GdkRGBA *foreground) {
-  set_color_foreground(terminal, foreground, gdk_rgba_to_string2);
+  set_color_foreground(terminal, foreground, (gchar*(*)(const void*))gdk_rgba_to_string2);
 }
 
 void vte_terminal_set_color_background_rgba(VteTerminal *terminal, const GdkRGBA *background) {
-  set_color_background(terminal, background, gdk_rgba_to_string2);
+  set_color_background(terminal, background, (gchar*(*)(const void*))gdk_rgba_to_string2);
 }
 
 void vte_terminal_set_color_cursor_rgba(VteTerminal *terminal, const GdkRGBA *cursor_background) {
-  set_color_cursor(terminal, cursor_background, gdk_rgba_to_string2);
+  set_color_cursor(terminal, cursor_background, (gchar*(*)(const void*))gdk_rgba_to_string2);
 }
 
 #if VTE_CHECK_VERSION(0, 44, 0)
@@ -3418,7 +3418,8 @@
 void vte_terminal_set_colors_rgba(VteTerminal *terminal, const GdkRGBA *foreground,
                                   const GdkRGBA *background, const GdkRGBA *palette,
                                   gsize palette_size) {
-  if (set_colors(terminal, palette, palette_size, sizeof(GdkRGBA), gdk_rgba_to_string2) &&
+  if (set_colors(terminal, (const void*)palette, palette_size, sizeof(GdkRGBA),
+                 (gchar*(*)(const void*))gdk_rgba_to_string2) &&
       palette_size > 0) {
     if (foreground == NULL) {
       foreground = &palette[7];
Index: mlterm/inputmethod/canna/im_canna.c
===================================================================
--- mlterm.orig/inputmethod/canna/im_canna.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/inputmethod/canna/im_canna.c	2024-12-11 12:27:46.101053222 +0100
@@ -54,7 +54,7 @@
   ksv.bytes_buffer = sizeof(canna->buf);
   ksv.val = mode;
 
-  jrKanjiControl(0, KC_CHANGEMODE, &ksv);
+  jrKanjiControl(0, KC_CHANGEMODE, (char*)&ksv);
 }
 
 static void preedit(im_canna_t *canna, char *preedit,             /* eucjp(null terminated) */
Index: mlterm/inputmethod/fcitx/im_fcitx.c
===================================================================
--- mlterm.orig/inputmethod/fcitx/im_fcitx.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/inputmethod/fcitx/im_fcitx.c	2024-12-11 12:27:46.101053222 +0100
@@ -448,7 +448,7 @@
   if ((len = strlen(str)) == 0) {
     /* do nothing */
   } else {
-    (*fcitx->im.listener->write_to_term)(fcitx->im.listener->self, str, len,
+    (*fcitx->im.listener->write_to_term)(fcitx->im.listener->self, (u_char*)str, len,
                                          fcitx->term_encoding == VT_UTF8 ? NULL : parser_utf8);
   }
 
@@ -481,7 +481,7 @@
       ) {
     fcitx->prev_key.state |= FcitxKeyState_IgnoredMask;
 #ifdef USE_XLIB
-    XPutBackEvent(fcitx->prev_key.display, &fcitx->prev_key);
+    XPutBackEvent(fcitx->prev_key.display, (XEvent*)&fcitx->prev_key);
 #endif
     memset(&fcitx->prev_key, 0, sizeof(XKeyEvent));
   }
@@ -529,7 +529,7 @@
       }
 
       (*parser_utf8->init)(parser_utf8);
-      (*parser_utf8->set_str)(parser_utf8, item->string, str_len);
+      (*parser_utf8->set_str)(parser_utf8, (u_char*)item->string, str_len);
 
       while ((*parser_utf8->next_char)(parser_utf8, &ch)) {
         num_chars++;
@@ -548,7 +548,7 @@
       item = g_ptr_array_index(list, count);
 
       (*parser_utf8->init)(parser_utf8);
-      (*parser_utf8->set_str)(parser_utf8, item->string, strlen(item->string));
+      (*parser_utf8->set_str)(parser_utf8, (u_char*)item->string, strlen(item->string));
 
       while ((*parser_utf8->next_char)(parser_utf8, &ch)) {
         int is_fullwidth = 0;
Index: mlterm/inputmethod/ibus/im_ibus.c
===================================================================
--- mlterm.orig/inputmethod/ibus/im_ibus.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/inputmethod/ibus/im_ibus.c	2024-12-11 12:27:46.101053222 +0100
@@ -151,7 +151,7 @@
     ibus->im.preedit.filled_len = 0;
 
     (*parser_utf8->init)(parser_utf8);
-    (*parser_utf8->set_str)(parser_utf8, text->text, strlen(text->text));
+    (*parser_utf8->set_str)(parser_utf8, (u_char*)text->text, strlen(text->text));
 
     index = 0;
     while ((*parser_utf8->next_char)(parser_utf8, &ch)) {
@@ -159,23 +159,28 @@
       IBusAttribute *attr;
       int is_fullwidth = 0;
       int is_comb = 0;
+      /* LS_UNDERLINE_SINGLE is always used. */
+#if 0
       int is_underlined = 0;
+#endif
       vt_color_t fg_color = VT_FG_COLOR;
       vt_color_t bg_color = VT_BG_COLOR;
 
       for (count = 0; (attr = ibus_attr_list_get(text->attrs, count)); count++) {
         if (attr->start_index <= index && index < attr->end_index) {
+#if 0
           if (attr->type == IBUS_ATTR_TYPE_UNDERLINE) {
             is_underlined = (attr->value != IBUS_ATTR_UNDERLINE_NONE);
-          }
+          } else
+#endif
 #if 0
-          else if (attr->type == IBUS_ATTR_TYPE_FOREGROUND) {
+          if (attr->type == IBUS_ATTR_TYPE_FOREGROUND) {
             fg_color = get_near_color(attr->value);
           } else if (attr->type == IBUS_ATTR_TYPE_BACKGROUND) {
             bg_color = get_near_color(attr->value);
           }
 #else
-          else if (attr->type == IBUS_ATTR_TYPE_BACKGROUND) {
+          if (attr->type == IBUS_ATTR_TYPE_BACKGROUND) {
             fg_color = VT_BG_COLOR;
             bg_color = VT_FG_COLOR;
           }
@@ -281,7 +286,8 @@
   if (ibus_text_get_length(text) == 0) {
     /* do nothing */
   } else {
-    (*ibus->im.listener->write_to_term)(ibus->im.listener->self, text->text, strlen(text->text),
+    (*ibus->im.listener->write_to_term)(ibus->im.listener->self, (u_char*)text->text,
+                                        strlen(text->text),
                                         ibus->term_encoding == VT_UTF8 ? NULL : parser_utf8);
   }
 
@@ -308,7 +314,7 @@
       ) {
     ibus->prev_key.state |= IBUS_IGNORED_MASK;
 #ifdef USE_XLIB
-    XPutBackEvent(ibus->prev_key.display, &ibus->prev_key);
+    XPutBackEvent(ibus->prev_key.display, (XEvent*)&ibus->prev_key);
 #endif
     memset(&ibus->prev_key, 0, sizeof(XKeyEvent));
   }
@@ -438,8 +444,9 @@
    * GIOStream returned by g_dbus_connection_get_stream() is forcibly
    * regarded as GSocketConnection.
    */
+  GIOStream *stream = g_dbus_connection_get_stream(ibus_bus_get_connection(ibus_bus));
   if ((ibus_bus_fd = g_socket_get_fd(g_socket_connection_get_socket(
-           g_dbus_connection_get_stream(ibus_bus_get_connection(ibus_bus))))) == -1) {
+                                       G_SOCKET_CONNECTION(stream)))) == -1) {
     return 0;
   }
 #endif
Index: mlterm/inputmethod/skk/dict.c
===================================================================
--- mlterm.orig/inputmethod/skk/dict.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/inputmethod/skk/dict.c	2024-12-11 12:27:46.101053222 +0100
@@ -569,7 +569,7 @@
 
   memcpy(&sa.sin_addr, host->h_addr_list[0], sizeof(sa.sin_addr));
 
-  if (connect(sock, &sa, sizeof(struct sockaddr_in)) == -1) {
+  if (connect(sock, (struct sockaddr*)&sa, sizeof(struct sockaddr_in)) == -1) {
     goto error;
   }
 
@@ -632,7 +632,7 @@
   }
 }
 
-static int candidate_exists(const char **cands, u_int num_cands, const char *cand) {
+static int candidate_exists(char **cands, u_int num_cands, const char *cand) {
   u_int count;
 
   for (count = 0; count < num_cands; count++) {
@@ -927,7 +927,7 @@
       return caption_len;
     }
 
-    compl->caption_orig = (char *)(compl + 1);
+    compl->caption_orig = (ef_char_t*)(compl + 1);
     memcpy(compl->caption_orig, caption, sizeof(*caption) * caption_len);
     compl->caption_orig_len = caption_len;
 
@@ -1072,7 +1072,7 @@
       return caption_len;
     }
 
-    cand->caption_orig = (char *)(cand + 1);
+    cand->caption_orig = (ef_char_t*)(cand + 1);
     memcpy(cand->caption_orig, caption, sizeof(*caption) * caption_len);
     cand->caption_orig_len = caption_len;
 
Index: mlterm/inputmethod/skk/im_skk.c
===================================================================
--- mlterm.orig/inputmethod/skk/im_skk.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/inputmethod/skk/im_skk.c	2024-12-11 12:27:46.101053222 +0100
@@ -154,6 +154,7 @@
   }
 }
 
+/* preedit != NULL and preedit_len == 0 -> stop preediting */
 static void preedit(im_skk_t *skk, ef_char_t *preedit, u_int preedit_len, int rev_len,
                     char *candidateword /* already converted to term encoding */,
                     /* 0 means the length of candidateword is 0 or necessity of strlen() */
@@ -601,10 +602,10 @@
 
   if ((skk->is_enabled = (!skk->is_enabled))) {
     skk->mode = HIRAGANA;
-    preedit(skk, "", 0, 0, skk->status[skk->mode], 0, "");
+    preedit(skk, (ef_char_t*)"", 0, 0, skk->status[skk->mode], 0, "");
   } else {
     preedit_clear(skk);
-    preedit(skk, "", 0, 0, "", 0, "");
+    preedit(skk, (ef_char_t*)"", 0, 0, "", 0, "");
   }
 
   return 1;
@@ -733,9 +734,9 @@
       memcpy(skk->new_word + skk->new_word_len, skk->preedit,
              skk->preedit_len * sizeof(skk->preedit[0]));
       skk->new_word_len += skk->preedit_len;
-      preedit(skk, "", 0, 0, skk->status[skk->mode], 0, "");
+      preedit(skk, (ef_char_t*)"", 0, 0, skk->status[skk->mode], 0, "");
     } else {
-      preedit(skk, "", 0, 0, skk->status[skk->mode], 0, "");
+      preedit(skk, (ef_char_t*)"", 0, 0, skk->status[skk->mode], 0, "");
       commit(skk);
     }
     preedit_clear(skk);
Index: mlterm/inputmethod/wnn/im_wnn.c
===================================================================
--- mlterm.orig/inputmethod/wnn/im_wnn.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/inputmethod/wnn/im_wnn.c	2024-12-11 12:27:46.101053222 +0100
@@ -538,7 +538,7 @@
     wnn->dan = 0;
     wnn->is_cand = 0;
     preedit(wnn, "", 0, 0, 0, "", 0, "");
-    commit(wnn, wnn->convbuf->displayBuf,
+    commit(wnn, (char*)wnn->convbuf->displayBuf,
            (wnn->convbuf->displayEnd - wnn->convbuf->displayBuf) * 2);
     jcFix(wnn->convbuf);
     jcClear(wnn->convbuf);
@@ -764,14 +764,14 @@
   }
 
   if (jcIsConverted(wnn->convbuf, 0)) {
-    preedit(wnn, wnn->convbuf->displayBuf,
+    preedit(wnn, (char*)wnn->convbuf->displayBuf,
             (wnn->convbuf->displayEnd - wnn->convbuf->displayBuf) * 2,
             wnn->convbuf->clauseInfo[wnn->convbuf->curLCStart].dispp - wnn->convbuf->displayBuf,
             wnn->convbuf->clauseInfo[wnn->convbuf->curLCEnd].dispp -
                 wnn->convbuf->clauseInfo[wnn->convbuf->curLCStart].dispp,
-            cand, cand_len * sizeof(wchar), pos);
+            (char*)cand, cand_len * sizeof(wchar), pos);
   } else {
-    preedit(wnn, wnn->convbuf->displayBuf,
+    preedit(wnn, (char*)wnn->convbuf->displayBuf,
             (wnn->convbuf->displayEnd - wnn->convbuf->displayBuf) * 2, jcDotOffset(wnn->convbuf), 0,
             (char*)kana, sizeof(kana), pos);
   }
@@ -838,7 +838,7 @@
     goto error;
   }
 
-  if (!(buf = jcOpen(server, "", 0, "", bl_msg_printf, bl_msg_printf, 0))) {
+  if (!(buf = jcOpen(server, "", 0, "", (void (*)())bl_msg_printf, (int (*)())bl_msg_printf, 0))) {
 #ifdef DEBUG
     bl_debug_printf(BL_DEBUG_TAG " jcOpen failed.\n");
 #endif
Index: mlterm/inputmethod/wnn/wnnlib.c
===================================================================
--- mlterm.orig/inputmethod/wnn/wnnlib.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/inputmethod/wnn/wnnlib.c	2024-12-11 12:27:46.101053222 +0100
@@ -3443,7 +3443,7 @@
      */
 #if JSERVER_VERSION > 0x4030
     wnnbuf = jl_open_lang(envname, server, "ja_JP",
-    				NULL, confirm, errmsg, timeout);
+                          NULL, confirm, (int (*)(const char*))errmsg, timeout);
 #else
     wnnbuf = jl_open(envname, server, NULL, confirm, errmsg, timeout);
 #endif
@@ -3533,7 +3533,7 @@
     }
 
     /* $B4D6-@_Dj$9$k(B */
-    (void)jl_set_env_wnnrc(wnnenv, rcfile, confirm, errmsg);
+    (void)jl_set_env_wnnrc(wnnenv, rcfile, confirm, (int (*)(const char*))errmsg);
 
     return wnnbuf;
 }
Index: mlterm/libvterm/vterm.c
===================================================================
--- mlterm.orig/libvterm/vterm.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/libvterm/vterm.c	2024-12-11 12:27:46.101053222 +0100
@@ -67,7 +67,7 @@
 
 static int final(vt_pty_ptr_t pty) { return 1; }
 
-static ssize_t pty_write(vt_pty_ptr_t pty, u_char* buf, size_t len) {
+static ssize_t pty_write(vt_pty_ptr_t pty, const u_char* buf, size_t len) {
   VTerm *vterm = pty->pty_listener->self;
 
 #if VTERM_CHECK_VERSION2(0, 1)
@@ -109,20 +109,24 @@
   ((VTerm*)p)->term = NULL;
 }
 
-static void set_config(void *p, char *dev, char *key, char *value) {
+static int set_config(void *p, char *dev, char *key, char *value) {
   VTerm *vterm;
 
   vterm = p;
 
   if (vt_term_set_config(vterm->term, key, value)) {
-    /* do nothing */
+    return 1;
   } else if (strcmp(key, "encoding") == 0) {
     vt_char_encoding_t encoding;
 
     if ((encoding = vt_get_char_encoding(value)) != VT_UNKNOWN_ENCODING) {
       vt_term_change_encoding(vterm->term, encoding);
     }
+
+    return 1;
   }
+
+  return 0;
 }
 
 static void get_config(void *p, char *dev, char *key, int to_menu) {
@@ -466,7 +470,7 @@
      */
     pos.row = 0;
     for (pos.col = 0; pos.col < cols; pos.col++) {
-      vterm_screen_get_cell(vterm, pos, cells + pos.col);
+      vterm_screen_get_cell((VTermScreen*)vterm, pos, cells + pos.col);
     }
 
     (*vterm->vterm_screen_cb->sb_pushline)(cols, cells, vterm->vterm_screen_cbdata);
@@ -650,7 +654,7 @@
   }
 
   (*utf32_parser->init)(utf32_parser);
-  (*utf32_parser->set_str)(utf32_parser, &c, 4);
+  (*utf32_parser->set_str)(utf32_parser, (u_char*)&c, 4);
   (*utf8_conv->init)(utf8_conv);
   len = (*utf8_conv->convert)(utf8_conv, buf, sizeof(buf), utf32_parser);
 
@@ -754,7 +758,7 @@
 
 void *vterm_parser_get_cbdata(VTerm *vterm) { return NULL; }
 
-VTermState *vterm_obtain_state(VTerm *vterm) { return vterm; }
+VTermState *vterm_obtain_state(VTerm *vterm) { return (VTermState*)vterm; }
 
 void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks,
                                 void *user) {
@@ -770,16 +774,16 @@
  * https://bazaar.launchpad.net/~libvterm/libvterm/trunk/revision/759
  */
 void vterm_state_set_unrecognised_fallbacks(VTermState *state,
-                                             const VTermStateFallbacks *fallbacks, void *user) {}
+                                            const VTermStateFallbacks *fallbacks, void *user) {}
 #else
 void vterm_state_set_unrecognised_fallbacks(VTermState *state,
-                                             const VTermParserCallbacks *fallbacks, void *user) {}
+                                            const VTermParserCallbacks *fallbacks, void *user) {}
 #endif
 
 void *vterm_state_get_unrecognised_fbdata(VTermState *state) { return NULL; }
 
 void vterm_state_reset(VTermState *state, int hard) {
-  VTerm *vterm = state;
+  VTerm *vterm = (VTerm*)state;
 
   if (hard) {
     vt_term_write_loopback(vterm->term, "\x1bc", 2); /* RIS */
@@ -789,12 +793,12 @@
 }
 
 void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos) {
-  *cursorpos = get_cursor_pos((VTerm*)state);
+  *cursorpos = get_cursor_pos((vt_term_t*)state);
 }
 
 void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg,
                                     VTermColor *default_bg) {
-  VTerm *vterm = state;
+  VTerm *vterm = (VTerm*)state;
 
   *default_fg = vterm->default_fg;
   *default_bg = vterm->default_bg;
@@ -818,7 +822,7 @@
 
 void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg,
                                     const VTermColor *default_bg) {
-  VTerm *vterm = state;
+  VTerm *vterm = (VTerm*)state;
 
   vterm->default_fg = *default_fg;
   vterm->default_bg = *default_bg;
@@ -864,11 +868,11 @@
 }
 #endif
 
-VTermScreen *vterm_obtain_screen(VTerm *vterm) { return vterm; }
+VTermScreen *vterm_obtain_screen(VTerm *vterm) { return (VTermScreen*)vterm; }
 
 void  vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks,
                                  void *user) {
-  VTerm *vterm = screen;
+  VTerm *vterm = (VTerm*)screen;
 
   vterm->vterm_screen_cbdata = user;
   vterm->vterm_screen_cb = callbacks;
@@ -894,13 +898,13 @@
 void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen) {}
 
 void vterm_screen_flush_damage(VTermScreen *screen) {
-  update_screen(screen);
+  update_screen((VTerm*)screen);
 }
 
 void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size) {}
 
 void vterm_screen_reset(VTermScreen *screen, int hard) {
-  vterm_state_reset(screen, hard);
+  vterm_state_reset((VTermState*)screen, hard);
   vterm_screen_flush_damage(screen);
 }
 
@@ -923,7 +927,7 @@
 }
 
 int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell) {
-  VTerm *vterm = screen;
+  VTerm *vterm = (VTerm*)screen;
   vt_line_t *line;
   vt_color_t fg = VT_FG_COLOR;
   vt_color_t bg = VT_BG_COLOR;
@@ -1042,7 +1046,7 @@
 
 #ifdef VTERM_EXPOSE_COLOR_INDEX
 void vterm_screen_convert_color_to_rgb(const VTermScreen *screen, VTermColor *color) {
-  vterm_state_convert_color_to_rgb(screen, color);
+  vterm_state_convert_color_to_rgb((const VTermState*)screen, color);
 }
 #endif
 
Index: mlterm/main/main_loop.c
===================================================================
--- mlterm.orig/main/main_loop.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/main/main_loop.c	2024-12-11 12:27:46.101053222 +0100
@@ -111,7 +111,7 @@
   u_int num_startup_screens;
   u_int depth;
   char *invalid_msg = "%s %s is not valid.\n";
-  char *orig_argv;
+  char **orig_argv;
 #if defined(USE_FRAMEBUFFER) || defined(USE_WAYLAND) || defined(USE_SDL2)
   int use_aafont = 0;
 #endif
Index: mlterm/tool/mlconfig/main.c
===================================================================
--- mlterm.orig/tool/mlconfig/main.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/tool/mlconfig/main.c	2024-12-11 12:27:46.101053222 +0100
@@ -339,7 +339,7 @@
 #if GTK_CHECK_VERSION(4, 0, 0)
   vbox = gtk_vbox_new(FALSE, 0);
   gtk_widget_show(vbox);
-  gtk_box_append(gtk_dialog_get_content_area(GTK_DIALOG(dialog)), vbox);
+  gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), vbox);
 #elif GTK_CHECK_VERSION(2, 14, 0)
   content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
 #else
Index: mlterm/tool/mlconfig/mc_combo.c
===================================================================
--- mlterm.orig/tool/mlconfig/mc_combo.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/tool/mlconfig/mc_combo.c	2024-12-11 12:27:46.101053222 +0100
@@ -93,9 +93,10 @@
     }
 
 #if GTK_CHECK_VERSION(4, 0, 0)
-    gtk_entry_set_width_chars(gtk_combo_box_get_child(GTK_COMBO_BOX(combo)), width_chars);
+    gtk_entry_set_width_chars(GTK_ENTRY(gtk_combo_box_get_child(GTK_COMBO_BOX(combo))),
+                              width_chars);
 #else
-    gtk_entry_set_width_chars(gtk_bin_get_child(GTK_BIN(combo)), width_chars);
+    gtk_entry_set_width_chars(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo))), width_chars);
 #endif
 #else
     gtk_widget_set_size_request(gtk_bin_get_child(GTK_BIN(combo)), entry_width, -1);
Index: mlterm/tool/mlconfig/mc_font.c
===================================================================
--- mlterm.orig/tool/mlconfig/mc_font.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/tool/mlconfig/mc_font.c	2024-12-11 12:27:46.101053222 +0100
@@ -327,7 +327,7 @@
 }
 
 static void specify_width(GtkWidget *widget, int flag) {
-  gchar *fontname;
+  const gchar *fontname; /* gtk_entry_get_text() returns const gchar* */
 
   if (((fontname = new_fontname_list[selected_cs]) ||
        (fontname = gtk_entry_get_text(GTK_ENTRY(fontname_entry)))) &&
Index: mlterm/tool/mlconfig/mc_opentype.c
===================================================================
--- mlterm.orig/tool/mlconfig/mc_opentype.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/tool/mlconfig/mc_opentype.c	2024-12-11 12:27:46.101053222 +0100
@@ -199,7 +199,8 @@
 
   vbox = gtk_vbox_new(FALSE, 0);
   gtk_widget_show(vbox);
-  gtk_box_pack_start(gtk_dialog_get_content_area(GTK_DIALOG(dialog)), vbox, FALSE, FALSE, 0);
+  gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
+                     vbox, FALSE, FALSE, 0);
 
   for (count = 0; count < BL_ARRAY_SIZE(features_tbl); count++) {
     if (count % 8 == 0) {
@@ -259,7 +260,8 @@
 
   vbox = gtk_vbox_new(FALSE, 0);
   gtk_widget_show(vbox);
-  gtk_box_pack_start(gtk_dialog_get_content_area(GTK_DIALOG(dialog)), vbox, FALSE, FALSE, 0);
+  gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
+                     vbox, FALSE, FALSE, 0);
 
   for (count = 0; count < BL_ARRAY_SIZE(scripts_tbl); count++) {
     if (count % 8 == 0) {
Index: mlterm/tool/mlconfig/mc_unicode_areas.c
===================================================================
--- mlterm.orig/tool/mlconfig/mc_unicode_areas.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/tool/mlconfig/mc_unicode_areas.c	2024-12-11 12:27:46.101053222 +0100
@@ -190,7 +190,7 @@
 #if GTK_CHECK_VERSION(4, 0, 0)
   vbox = gtk_vbox_new(FALSE, 0);
   gtk_widget_show(vbox);
-  gtk_box_append(gtk_dialog_get_content_area(GTK_DIALOG(dialog)), vbox);
+  gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), vbox);
 #else
   vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
 #endif
Index: mlterm/uitoolkit/beos/ui_window.c
===================================================================
--- mlterm.orig/uitoolkit/beos/ui_window.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/beos/ui_window.c	2024-12-11 12:27:46.101053222 +0100
@@ -23,7 +23,7 @@
 #define BOTTOM_MARGIN(win) \
   ((win)->height_inc ? ((win)->height - (win)->min_height) % (win)->height_inc : 0)
 
-#define ParentRelative (1L)
+#define ParentRelative ((void*)1L)
 
 #define IS_UILAYOUT(win) ((win)->child_window_resized)
 #define IS_IM_WINDOW(win) ((win)->window_resized == NULL)
Index: mlterm/uitoolkit/console/ui_display.c
===================================================================
--- mlterm.orig/uitoolkit/console/ui_display.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/console/ui_display.c	2024-12-11 12:27:46.105053169 +0100
@@ -693,7 +693,7 @@
 #endif
 
           set_blocking(fileno(disp->display->fp), 1);
-          ui_window_receive_event(win, &bev);
+          ui_window_receive_event(win, (XEvent*)&bev);
           set_blocking(fileno(disp->display->fp), 0);
 
           continue;
@@ -868,7 +868,7 @@
     }
 
     set_blocking(fileno(disp->display->fp), 1);
-    receive_event_for_multi_roots(disp, &kev);
+    receive_event_for_multi_roots(disp, (XEvent*)&kev);
     set_blocking(fileno(disp->display->fp), 0);
   }
 
Index: mlterm/uitoolkit/console/ui_imagelib.c
===================================================================
--- mlterm.orig/uitoolkit/console/ui_imagelib.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/console/ui_imagelib.c	2024-12-11 12:27:46.105053169 +0100
@@ -102,7 +102,8 @@
     value_table = NULL;
   }
 
-  src = dst = pixmap->image;
+  dst = pixmap->image;
+  src = (u_int32_t*)dst;
   num_pixels = pixmap->width * pixmap->height;
 
   for (count = 0; count < num_pixels; count++) {
Index: mlterm/uitoolkit/console/ui_window.c
===================================================================
--- mlterm.orig/uitoolkit/console/ui_window.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/console/ui_window.c	2024-12-11 12:27:46.105053169 +0100
@@ -29,8 +29,8 @@
 static ui_color_t black = {TP_COLOR, 0, 0, 0, 0};
 #endif
 
-#define ParentRelative (1L)
-#define DummyPixmap (2L)
+#define ParentRelative ((void*)1L)
+#define DummyPixmap ((void*)2L)
 
 #define COL_WIDTH (win->disp->display->col_width)
 #define LINE_HEIGHT (win->disp->display->line_height)
@@ -1309,7 +1309,7 @@
 void ui_window_console_draw_string16(ui_window_t *win, ui_font_t *font, ui_color_t *fg_color,
                                      ui_color_t *bg_color, int x, int y, XChar2b *str, u_int len,
                                      int line_style) {
-  draw_string(win, font, fg_color, bg_color, x, y, str, len, 2, line_style);
+  draw_string(win, font, fg_color, bg_color, x, y, (u_char*)str, len, 2, line_style);
 }
 
 void ui_window_draw_rect_frame(ui_window_t *win, int x1, int y1, int x2, int y2) {
Index: mlterm/uitoolkit/fb/ui_display.c
===================================================================
--- mlterm.orig/uitoolkit/fb/ui_display.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/fb/ui_display.c	2024-12-11 12:27:46.105053169 +0100
@@ -652,7 +652,7 @@
 static void draw_mouse_cursor_line(int y) {
   u_char *fb;
   ui_window_t *win;
-  char *shape;
+  const char *shape;
   u_char image[MAX_CURSOR_SHAPE_WIDTH * sizeof(u_int32_t)];
   int x;
 
@@ -898,7 +898,7 @@
     draw_mouse_cursor();
 
     if (ret == 1) {
-      receive_event_for_multi_roots(&kev);
+      receive_event_for_multi_roots((XEvent*)&kev);
     }
   }
 
@@ -1061,7 +1061,7 @@
     }
 
     if (xev.ksym) {
-      receive_event_for_multi_roots(&xev);
+      receive_event_for_multi_roots((XEvent*)&xev);
     } else {
       for (count = 0; count < len; count++) {
         xev.ksym = buf[count];
@@ -1083,7 +1083,7 @@
           xev.state = ControlMask;
         }
 
-        receive_event_for_multi_roots(&xev);
+        receive_event_for_multi_roots((XEvent*)&xev);
       }
     }
   }
@@ -1110,7 +1110,7 @@
   cmap->transp = NULL;
 #endif
   CMAP_SIZE(cmap) = num_colors;
-  cmap->red = cmap + 1;
+  cmap->red = (void*)(cmap + 1);
   cmap->green = cmap->red + num_colors;
   cmap->blue = cmap->green + num_colors;
 
Index: mlterm/uitoolkit/fb/ui_display_freebsd.c
===================================================================
--- mlterm.orig/uitoolkit/fb/ui_display_freebsd.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/fb/ui_display_freebsd.c	2024-12-11 12:27:46.105053169 +0100
@@ -430,7 +430,7 @@
         xev.x -= win->x;
         xev.y -= win->y;
 
-        ui_window_receive_event(win, &xev);
+        ui_window_receive_event(win, (XEvent*)&xev);
       }
 
       if (move) {
@@ -625,7 +625,7 @@
                     xev.state);
 #endif
 
-    receive_event_for_multi_roots(&xev);
+    receive_event_for_multi_roots((XEvent*)&xev);
   }
 
   return 1;
Index: mlterm/uitoolkit/fb/ui_display_linux.c
===================================================================
--- mlterm.orig/uitoolkit/fb/ui_display_linux.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/fb/ui_display_linux.c	2024-12-11 12:27:46.105053169 +0100
@@ -526,7 +526,7 @@
 #ifdef DEBUG
       bl_debug_printf("MOUSE2: /dev/input/event%d\n", mouse_num[1]);
 #endif
-      _disp_mouse2.display = &_mouse2;
+      _disp_mouse2.display = (Display*)&_mouse2;
       opened_disps[num_opened_displays++] = &_disp_mouse2;
     }
   }
@@ -540,7 +540,7 @@
       bl_debug_printf("KBD2: /dev/input/event%d\n", kbd_num[1]);
 #endif
       _kbd2.is_kbd = 1;
-      _disp_kbd2.display = &_kbd2;
+      _disp_kbd2.display = (Display*)&_kbd2;
       opened_disps[num_opened_displays++] = &_disp_kbd2;
     }
   }
@@ -680,7 +680,7 @@
         xev.x -= win->x;
         xev.y -= win->y;
 
-        ui_window_receive_event(win, &xev);
+        ui_window_receive_event(win, (XEvent*)&xev);
       }
     } else if (ev.type == EV_REL) {
       XMotionEvent xev;
@@ -753,7 +753,7 @@
       xev.x -= win->x;
       xev.y -= win->y;
 
-      ui_window_receive_event(win, &xev);
+      ui_window_receive_event(win, (XEvent*)&xev);
 
       save_hidden_region();
       draw_mouse_cursor();
@@ -827,7 +827,7 @@
             xev.keycode = ev.code;
 
             if ((xev.ksym = kcode_to_ksym(ev.code, ent.kb_value, &xev.state)) > 0) {
-              receive_event_for_multi_roots(&xev);
+              receive_event_for_multi_roots((XEvent*)&xev);
             }
           }
         } else if (ev.value == 0 /* Released */) {
Index: mlterm/uitoolkit/fb/ui_display_wscons.c
===================================================================
--- mlterm.orig/uitoolkit/fb/ui_display_wscons.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/fb/ui_display_wscons.c	2024-12-11 12:27:46.105053169 +0100
@@ -244,7 +244,7 @@
         xev.state = _mouse.button_state | _display.key_state;
         xev.type = KeyPress;
 
-        receive_event_for_multi_roots(&xev);
+        receive_event_for_multi_roots((XEvent*)&xev);
 
         prev_key_event = *ev;
       }
@@ -834,7 +834,7 @@
         xev.x -= win->x;
         xev.y -= win->y;
 
-        ui_window_receive_event(win, &xev);
+        ui_window_receive_event(win, (XEvent*)&xev);
       }
     } else if (ev.type == WSCONS_EVENT_MOUSE_DELTA_X || ev.type == WSCONS_EVENT_MOUSE_DELTA_Y ||
                ev.type == WSCONS_EVENT_MOUSE_DELTA_Z || ev.type == WSCONS_EVENT_MOUSE_DELTA_W) {
@@ -907,7 +907,7 @@
       xev.x -= win->x;
       xev.y -= win->y;
 
-      ui_window_receive_event(win, &xev);
+      ui_window_receive_event(win, (XEvent*)&xev);
 
       save_hidden_region();
       draw_mouse_cursor();
Index: mlterm/uitoolkit/fb/ui_font.c
===================================================================
--- mlterm.orig/uitoolkit/fb/ui_font.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/fb/ui_font.c	2024-12-11 12:27:46.105053169 +0100
@@ -780,7 +780,7 @@
     goto error;
   }
 
-  face->generic.data = ((int)face->generic.data) + 1; /* ref_count */
+  face->generic.data = (void*)(((int)face->generic.data) + 1); /* ref_count */
 
   if (force_height) {
     xfont->height = force_height;
@@ -969,7 +969,7 @@
   free(xfont->file);
 
   face = xfont->face;
-  face->generic.data = ((int)face->generic.data) - 1;
+  face->generic.data = (void*)(((int)face->generic.data) - 1);
   if (!face->generic.data) {
     FT_Done_Face(xfont->face);
   }
@@ -1726,7 +1726,7 @@
       return NULL;
     }
 
-    fc_charsets = fc_files + num_fc_files;
+    fc_charsets = (FcCharSet**)(fc_files + num_fc_files);
   }
 
   if (!xfont->compl_xfonts &&
Index: mlterm/uitoolkit/fb/ui_imagelib.c
===================================================================
--- mlterm.orig/uitoolkit/fb/ui_imagelib.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/fb/ui_imagelib.c	2024-12-11 12:27:46.105053169 +0100
@@ -116,7 +116,8 @@
     value_table = NULL;
   }
 
-  src = dst = pixmap->image;
+  dst = pixmap->image;
+  src = (u_int32_t*)dst;
   num_pixels = pixmap->width * pixmap->height;
 
   for (count = 0; count < num_pixels; count++) {
Index: mlterm/uitoolkit/fb/ui_window.c
===================================================================
--- mlterm.orig/uitoolkit/fb/ui_window.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/fb/ui_window.c	2024-12-11 12:27:46.105053169 +0100
@@ -27,8 +27,8 @@
 static ui_color_t black = {TP_COLOR, 0, 0, 0, 0};
 #endif
 
-#define ParentRelative (1L)
-#define DummyPixmap (2L)
+#define ParentRelative ((void*)1L)
+#define DummyPixmap ((void*)2L)
 
 /* XXX Check if win is input method window or not. */
 #define IS_IM_WINDOW(win) ((win)->disp->num_roots >= 2 && (win) == (win)->disp->roots[1])
@@ -313,7 +313,7 @@
       case 2:
         for (; y_off < font_height; y_off++, y_off_bytes += xfont->glyph_width_bytes) {
           p = (picture ? memcpy(src, (picture += picture_line_len), size)
-                       : memset16(src, bg_pixel, size / 2));
+                       : memset16((u_int16_t*)src, bg_pixel, size / 2));
 
           for (count = 0; count < len; count++) {
             if (!ui_get_bitmap_line(xfont, bitmaps[count], y_off_bytes, bitmap_line)) {
@@ -340,7 +340,7 @@
       default:
         for (; y_off < font_height; y_off++, y_off_bytes += xfont->glyph_width_bytes) {
           p = (picture ? memcpy(src, (picture += picture_line_len), size)
-                       : memset32(src, bg_pixel, size / 4));
+                       : memset32((u_int32_t*)src, bg_pixel, size / 4));
 
           for (count = 0; count < len; count++) {
             if (!ui_get_bitmap_line(xfont, bitmaps[count], y_off_bytes, bitmap_line)) {
@@ -379,12 +379,12 @@
             break;
 
           case 2:
-            memset16(src, bg_pixel, size / 2);
+            memset16((u_int16_t*)src, bg_pixel, size / 2);
             break;
 
           /* case  4: */
           default:
-            memset32(src, bg_pixel, size / 4);
+            memset32((u_int32_t*)src, bg_pixel, size / 4);
             break;
           }
         }
@@ -455,12 +455,12 @@
             break;
 
           case 2:
-            memset16(src, bg_pixel, size / 2);
+            memset16((u_int16_t*)src, bg_pixel, size / 2);
             break;
 
           /* case  4: */
           default:
-            memset32(src, bg_pixel, size / 4);
+            memset32((u_int32_t*)src, bg_pixel, size / 4);
             break;
           }
         }
@@ -2338,7 +2338,7 @@
 
 void ui_window_draw_string16(ui_window_t *win, ui_font_t *font, ui_color_t *fg_color, int x, int y,
                              XChar2b *str, u_int len) {
-  draw_string(win, font, fg_color, NULL, x, y, str, len, 2, 0);
+  draw_string(win, font, fg_color, NULL, x, y, (u_char*)str, len, 2, 0);
 }
 
 void ui_window_draw_image_string(ui_window_t *win, ui_font_t *font, ui_color_t *fg_color,
@@ -2362,7 +2362,7 @@
   }
 #endif
 
-  draw_string(win, font, fg_color, bg_color, x, y, str, len, 2, bg_color == NULL);
+  draw_string(win, font, fg_color, bg_color, x, y, (u_char*)str, len, 2, bg_color == NULL);
 }
 
 void ui_window_draw_rect_frame(ui_window_t *win, int x1, int y1, int x2, int y2) {
Index: mlterm/uitoolkit/libtype/ui_window_cairo.c
===================================================================
--- mlterm.orig/uitoolkit/libtype/ui_window_cairo.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/libtype/ui_window_cairo.c	2024-12-11 12:32:33.413265058 +0100
@@ -54,7 +54,7 @@
 
 static void flush_glyphs(cairo_t *cr) {
   if (num_glyph_buf > 0) {
-    u_long pixel = cairo_get_user_data(cr, (cairo_user_data_key_t*)2);
+    u_long pixel = (u_long)cairo_get_user_data(cr, (cairo_user_data_key_t*)2);
 
     cairo_set_scaled_font(cr, cairo_get_user_data(cr, (cairo_user_data_key_t*)1));
     cairo_set_source_rgba(cr,
@@ -328,7 +328,7 @@
 
 #ifdef USE_OT_LAYOUT
   if (font->use_ot_layout /* && font->ot_font */) {
-    buf = str;
+    buf = (u_char*)str;
   } else
 #endif
   {
Index: mlterm/uitoolkit/quartz/cocoa.m
===================================================================
--- mlterm.orig/uitoolkit/quartz/cocoa.m	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/quartz/cocoa.m	2024-12-11 12:27:46.105053169 +0100
@@ -1548,7 +1548,7 @@
   NSString *ns_font_family =
       [NSString stringWithCString:font_family encoding:NSUTF8StringEncoding];
 
-  return CGFontCreateWithFontName(ns_font_family);
+  return CGFontCreateWithFontName((CFStringRef)ns_font_family);
 }
 
 #ifdef USE_OT_LAYOUT
@@ -1576,7 +1576,7 @@
 u_int cocoa_font_get_advance(CGFontRef cg_font, u_int fontsize, int size_attr,
                              unichar *utf16, u_int len, CGGlyph glyph) {
   if (utf16) {
-    CGFontGetGlyphsForUnichars(cg_font, &utf16, &glyph, 1);
+    CGFontGetGlyphsForUnichars(cg_font, utf16, &glyph, 1);
   }
 
   int advance;
Index: mlterm/uitoolkit/quartz/cocoatouch.m
===================================================================
--- mlterm.orig/uitoolkit/quartz/cocoatouch.m	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/quartz/cocoatouch.m	2024-12-11 12:27:46.105053169 +0100
@@ -1540,7 +1540,7 @@
   NSString *ns_font_family =
       [NSString stringWithCString:font_family encoding:NSUTF8StringEncoding];
 
-  return CGFontCreateWithFontName(ns_font_family);
+  return CGFontCreateWithFontName((CFStringRef)ns_font_family);
 }
 
 #ifdef USE_OT_LAYOUT
@@ -1572,7 +1572,7 @@
 u_int cocoa_font_get_advance(CGFontRef cg_font, u_int fontsize, int size_attr,
                              unichar *utf16, u_int len, CGGlyph glyph) {
   if (utf16) {
-    CGFontGetGlyphsForUnichars(cg_font, &utf16, &glyph, 1);
+    CGFontGetGlyphsForUnichars(cg_font, utf16, &glyph, 1);
   }
 
   int advance;
Index: mlterm/uitoolkit/quartz/ui_font.c
===================================================================
--- mlterm.orig/uitoolkit/quartz/ui_font.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/quartz/ui_font.c	2024-12-11 12:27:46.105053169 +0100
@@ -191,7 +191,7 @@
     return NULL;
   }
 
-  font->xfont = font + 1;
+  font->xfont = (XFontStruct*)(font + 1);
 
   font->display = display;
   font->id = id;
@@ -446,7 +446,7 @@
       u_int16_t utf16[2];
       u_int len;
 
-      if ((len = ui_convert_ucs4_to_utf16(utf16, ch) / 2) > 0) {
+      if ((len = ui_convert_ucs4_to_utf16((u_char*)utf16, ch) / 2) > 0) {
         return cocoa_font_get_advance(font->xfont->cg_font, font->xfont->size,
                                       font->size_attr, utf16, len, 0);
       } else {
Index: mlterm/uitoolkit/quartz/ui_im_status_screen-cocoa.m
===================================================================
--- mlterm.orig/uitoolkit/quartz/ui_im_status_screen-cocoa.m	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/quartz/ui_im_status_screen-cocoa.m	2024-12-11 12:27:46.105053169 +0100
@@ -17,30 +17,24 @@
  * methods of ui_im_status_screen_t
  */
 
-static int destroy(ui_im_status_screen_t* stat_screen) {
+static void destroy(ui_im_status_screen_t* stat_screen) {
   NSWindow* window = stat_screen->window.my_window;
 
   [window release];
 
   free(stat_screen);
-
-  return 1;
 }
 
-static int show(ui_im_status_screen_t* stat_screen) {
+static void show(ui_im_status_screen_t* stat_screen) {
   NSWindow* window = stat_screen->window.my_window;
 
   [window orderFront:window];
-
-  return 1;
 }
 
-static int hide(ui_im_status_screen_t* stat_screen) {
+static void hide(ui_im_status_screen_t* stat_screen) {
   NSWindow* window = stat_screen->window.my_window;
 
   [window orderOut:window];
-
-  return 1;
 }
 
 static int set_spot(ui_im_status_screen_t* stat_screen, int x, int y) {
Index: mlterm/uitoolkit/quartz/ui_imagelib.c
===================================================================
--- mlterm.orig/uitoolkit/quartz/ui_imagelib.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/quartz/ui_imagelib.c	2024-12-11 12:27:46.105053169 +0100
@@ -206,7 +206,7 @@
 
   if (info == kCGImageAlphaPremultipliedLast || info == kCGImageAlphaPremultipliedFirst ||
       info == kCGImageAlphaLast || info == kCGImageAlphaFirst) {
-    *mask = 1L; /* dummy */
+    *mask = (PixmapMask)1L; /* dummy */
   }
 
   return 1;
Index: mlterm/uitoolkit/quartz/ui_window.c
===================================================================
--- mlterm.orig/uitoolkit/quartz/ui_window.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/quartz/ui_window.c	2024-12-11 12:27:46.105053169 +0100
@@ -23,7 +23,7 @@
 #define BOTTOM_MARGIN(win) \
   ((win)->height_inc ? ((win)->height - (win)->min_height) % (win)->height_inc : 0)
 
-#define ParentRelative (1L)
+#define ParentRelative ((void*)1L)
 
 #define IS_UISCREEN(win) ((win)->selection_cleared)
 #define IS_UILAYOUT(win) ((win)->child_window_resized)
Index: mlterm/uitoolkit/sdl2/ui_display.c
===================================================================
--- mlterm.orig/uitoolkit/sdl2/ui_display.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/sdl2/ui_display.c	2024-12-11 12:27:46.105053169 +0100
@@ -437,7 +437,7 @@
   SDL_SetTextureBlendMode(display->texture, SDL_BLENDMODE_BLEND);
 #endif
 
-  SDL_LockTexture(display->texture, NULL, &display->fb,
+  SDL_LockTexture(display->texture, NULL, (void**)&display->fb,
                   &display->line_length);
 
   return 1;
@@ -560,7 +560,7 @@
       msec[3] = SDL_GetTicks();
 #endif
 
-      SDL_LockTexture(display->texture, NULL, &display->fb, &display->line_length);
+      SDL_LockTexture(display->texture, NULL, (void**)&display->fb, &display->line_length);
 
 #ifdef MEASURE_TIME
       msec[4] = SDL_GetTicks();
@@ -591,7 +591,7 @@
   xev->x -= win->x;
   xev->y -= win->y;
 
-  ui_window_receive_event(win, xev);
+  ui_window_receive_event(win, (XEvent*)xev);
 }
 
 static u_int get_mod_state(SDL_Keymod mod) {
@@ -804,7 +804,7 @@
     xev.xmotion.x = ev.motion.x;
     xev.xmotion.y = ev.motion.y;
 
-    receive_mouse_event(disp, &xev.xmotion);
+    receive_mouse_event(disp, (XButtonEvent*)&xev.xmotion);
 
 #if 0 /* defined(__HAIKU__) */
     /* If mouse cursor moves, garbage is left on HaikuOS, so damaged = 1 to redraw screen. */
@@ -903,7 +903,7 @@
     return NULL;
   }
 
-  disp->display = disp + 1;
+  disp->display = (Display*)(disp + 1);
 
   if ((p = realloc(displays, sizeof(ui_display_t*) * (num_displays + 1))) == NULL) {
     free(disp);
Index: mlterm/uitoolkit/ui_brltty.c
===================================================================
--- mlterm.orig/uitoolkit/ui_brltty.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/ui_brltty.c	2024-12-11 12:27:46.105053169 +0100
@@ -62,7 +62,7 @@
 
     if ((len = (*wconv->convert)(wconv, buf, display_cols * sizeof(wchar_t), parser)) > 0) {
       memset(buf + len, 0, 4);
-      brlapi_writeWText(cursor, buf);
+      brlapi_writeWText(cursor, (wchar_t*)buf);
     }
   }
 }
Index: mlterm/uitoolkit/ui_draw_str.c
===================================================================
--- mlterm.orig/uitoolkit/ui_draw_str.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/ui_draw_str.c	2024-12-11 12:27:46.105053169 +0100
@@ -557,13 +557,14 @@
 
   line_style = vt_char_line_style(&chars[count]);
 
-  if (!(str8 = str32 = pic_glyphs = drcs_glyphs =
-            alloca(BL_MAX(sizeof(*str8),
-                          BL_MAX(sizeof(*str32),
-                                 BL_MAX(sizeof(*pic_glyphs), sizeof(*drcs_glyphs)))) *
-                   num_chars))) {
+  if (!(str8 = alloca(BL_MAX(sizeof(*str8),
+                             BL_MAX(sizeof(*str32),
+                                    BL_MAX(sizeof(*pic_glyphs), sizeof(*drcs_glyphs)))) *
+                      num_chars))) {
     return 0;
   }
+  str32 = pic_glyphs = (u_int32_t*)str8;
+  drcs_glyphs = (char**)str8;
 
   str_len = 0;
 
@@ -818,7 +819,7 @@
         u_int len;
 
         if (IS_ISO10646_UCS4(ch_cs)) {
-          if ((len = ui_convert_ucs4_to_utf16(xch, ch_code) / 2) == 0) {
+          if ((len = ui_convert_ucs4_to_utf16((u_char*)xch, ch_code) / 2) == 0) {
             continue;
           }
         } else {
@@ -923,13 +924,15 @@
   bg_color = vt_char_bg_color(&chars[count]);
   line_style = vt_char_line_style(&chars[count]);
 
-  if (!(str2b = str = pic_glyphs = drcs_glyphs =
-            /* '* 2' is for UTF16 surrogate pair. */
-        alloca(BL_MAX(sizeof(*str2b) * 2,
-                      BL_MAX(sizeof(*str), BL_MAX(sizeof(*pic_glyphs), sizeof(*drcs_glyphs)))) *
-               num_chars))) {
+  if (!(str = alloca(BL_MAX(sizeof(*str2b) * 2, /* '* 2' is for UTF16 surrogate pair. */
+                            BL_MAX(sizeof(*str),
+                                   BL_MAX(sizeof(*pic_glyphs), sizeof(*drcs_glyphs)))) *
+                     num_chars))) {
     return 0;
   }
+  str2b = (XChar2b*)str;
+  pic_glyphs = (u_int32_t*)str;
+  drcs_glyphs = (char**)str;
 
   str_len = 0;
 
@@ -949,7 +952,7 @@
     } else {
       /* UCS4 */
 
-      str_len += (ui_convert_ucs4_to_utf16(str2b + str_len, ch_code) / 2);
+      str_len += (ui_convert_ucs4_to_utf16((u_char*)(str2b + str_len), ch_code) / 2);
     }
 
     /*
@@ -1058,7 +1061,7 @@
             str_len++;
           } else {
             /* UCS4 */
-            str_len += (ui_convert_ucs4_to_utf16(str2b + str_len, comb_code) / 2);
+            str_len += (ui_convert_ucs4_to_utf16((u_char*)(str2b + str_len), comb_code) / 2);
           }
         }
 
Index: mlterm/uitoolkit/ui_main_config.c
===================================================================
--- mlterm.orig/uitoolkit/ui_main_config.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/ui_main_config.c	2024-12-11 12:27:46.105053169 +0100
@@ -1471,7 +1471,7 @@
       argc = bl_count_char_in_str(value, ' ') + 1;
 
       if ((main_config->cmd_argv = malloc(sizeof(char *) * (argc + 1) + strlen(value) + 1))) {
-        value = strcpy(main_config->cmd_argv + argc + 1, value);
+        value = strcpy((char*)(main_config->cmd_argv + argc + 1), value);
         bl_arg_str_to_array(main_config->cmd_argv, &argc, value);
         main_config->cmd_path = main_config->cmd_argv[0];
       }
Index: mlterm/uitoolkit/ui_screen.c
===================================================================
--- mlterm.orig/uitoolkit/ui_screen.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/ui_screen.c	2024-12-11 12:27:46.105053169 +0100
@@ -1249,7 +1249,7 @@
   /* Don't set ui_screen_t::is_preediting = 0. */
 }
 
-static void preedit(ui_window_t *win, const char *preedit_text, const char *cur_preedit_text) {
+static void preedit(ui_window_t *win, char *preedit_text, const char *cur_preedit_text) {
   ef_parser_t *utf8_parser;
   vt_term_t *term = ((ui_screen_t *)win)->term;
 
Index: mlterm/uitoolkit/ui_screen_manager.c
===================================================================
--- mlterm.orig/uitoolkit/ui_screen_manager.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/ui_screen_manager.c	2024-12-11 12:27:46.105053169 +0100
@@ -637,7 +637,8 @@
     }
 
     if (!ui_display_show_root(disp, root, main_config.x, main_config.y, main_config.geom_hint,
-                              main_config.app_name, main_config.wm_role, main_config.parent_window)) {
+                              main_config.app_name, main_config.wm_role,
+                              (Window)main_config.parent_window)) {
 #ifdef DEBUG
       bl_warn_printf(BL_DEBUG_TAG " ui_display_show_root() failed.\n");
 #endif
Index: mlterm/uitoolkit/ui_window.h
===================================================================
--- mlterm.orig/uitoolkit/ui_window.h	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/ui_window.h	2024-12-11 12:27:46.105053169 +0100
@@ -220,7 +220,7 @@
   void (*set_xdnd_config)(struct ui_window *, char *, char *, char *);
   void (*idling)(struct ui_window *);
 #ifdef UIWINDOW_SUPPORTS_PREEDITING
-  void (*preedit)(struct ui_window *, const char *, const char *);
+  void (*preedit)(struct ui_window *, char *, const char *);
 #endif
 
 } ui_window_t;
Index: mlterm/uitoolkit/wayland/ui_display.c
===================================================================
--- mlterm.orig/uitoolkit/wayland/ui_display.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/wayland/ui_display.c	2024-12-11 12:27:46.105053169 +0100
@@ -418,7 +418,7 @@
 
     /* Key event for dead surface may be received. */
     if (disp && (win = search_focused_window(disp->roots[0]))) {
-      ui_window_receive_event(win, ev);
+      ui_window_receive_event(win, (XEvent*)ev);
     }
   }
 }
@@ -822,7 +822,7 @@
     bl_debug_printf("Motion event state %x x %d y %d in %p window.\n", ev.state, ev.x, ev.y, win);
 #endif
 
-    ui_window_receive_event(win, &ev);
+    ui_window_receive_event(win, (XEvent*)&ev);
   }
 }
 
@@ -928,7 +928,7 @@
 
     wlserv->serial = serial;
 
-    ui_window_receive_event(win, &ev);
+    ui_window_receive_event(win, (XEvent*)&ev);
 
 #ifdef COMPAT_LIBVTE
     if (ev.type == ButtonPress && disp->display->parent == NULL /* Not input method */) {
@@ -991,10 +991,10 @@
 #endif
 
     ev.type = ButtonPress;
-    ui_window_receive_event(win, &ev);
+    ui_window_receive_event(win, (XEvent*)&ev);
 
     ev.type = ButtonRelease;
-    ui_window_receive_event(win, &ev);
+    ui_window_receive_event(win, (XEvent*)&ev);
   }
 }
 
@@ -1997,7 +1997,7 @@
     return NULL;
   }
 
-  wlserv->xkb = wlserv + 1;
+  wlserv->xkb = (struct ui_xkb*)(wlserv + 1);
 
   if ((wlserv->display = wl_display_connect(name)) == NULL) {
     bl_error_printf("Couldn't open display %s.\n", name);
@@ -2525,7 +2525,7 @@
     return NULL;
   }
 
-  disp->display = disp + 1;
+  disp->display = (Display*)(disp + 1);
 
   if ((p = realloc(displays, sizeof(ui_display_t*) * (num_displays + 1))) == NULL) {
     free(disp);
Index: mlterm/uitoolkit/win32/ui_window.c
===================================================================
--- mlterm.orig/uitoolkit/win32/ui_window.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/win32/ui_window.c	2024-12-11 12:27:46.109053115 +0100
@@ -57,7 +57,7 @@
 #define BOTTOM_MARGIN(win) \
   ((win)->height_inc ? ((win)->height - (win)->min_height) % (win)->height_inc : 0)
 
-#define ParentRelative (1L)
+#define ParentRelative ((void*)1L)
 
 #if 0
 #define DEBUG_SCROLLABLE
Index: mlterm/uitoolkit/xlib/ui_font.c
===================================================================
--- mlterm.orig/uitoolkit/xlib/ui_font.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/xlib/ui_font.c	2024-12-11 12:27:46.109053115 +0100
@@ -197,7 +197,7 @@
   } else {
     XChar2b c[2];
 
-    width = XTextWidth16(xfont, c, ui_convert_ucs4_to_utf16(c, ch) / 2);
+    width = XTextWidth16(xfont, c, ui_convert_ucs4_to_utf16((u_char*)c, ch) / 2);
   }
 
   if (width < 0) {
Index: mlterm/uitoolkit/xlib/ui_imagelib.c
===================================================================
--- mlterm.orig/uitoolkit/xlib/ui_imagelib.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/xlib/ui_imagelib.c	2024-12-11 12:27:46.109053115 +0100
@@ -428,7 +428,7 @@
   GC mask_gc;
   int num_cells;
 
-  if (disp->depth < 8 || !(data = in = load_sixel_from_file(path, &w, &h))) {
+  if (disp->depth < 8 || !(data = in = (u_int32_t*)load_sixel_from_file(path, &w, &h))) {
     return 0;
   }
 
@@ -464,7 +464,7 @@
     }
 
     bytes_per_pixel = 1;
-    out8 = data;
+    out8 = (u_char*)data;
 
 #ifdef USE_FS
     if ((diff_cur = calloc(1, w * 3)) == NULL || (diff_next = calloc(1, w * 3)) == NULL) {
@@ -540,10 +540,10 @@
 
     if (disp->depth == 16) {
       bytes_per_pixel = 2;
-      out16 = data;
+      out16 = (u_int16_t*)data;
     } else /* if (disp->depth == 32 || disp->depth == 24) */ {
       bytes_per_pixel = 4;
-      out32 = data;
+      out32 = (u_int32_t*)data;
     }
 
     vinfo = ui_display_get_visual_info(disp);
@@ -577,7 +577,7 @@
     XFreeGC(disp->display, mask_gc);
   }
 
-  image = XCreateImage(disp->display, disp->visual, disp->depth, ZPixmap, 0, data, w, h,
+  image = XCreateImage(disp->display, disp->visual, disp->depth, ZPixmap, 0, (char*)data, w, h,
                        /* in case depth isn't multiple of 8 */
                        bytes_per_pixel * 8, w * bytes_per_pixel);
 #ifdef WORDS_BIGENDIAN
@@ -1406,7 +1406,7 @@
     cardinal[1] = height;
 
     size -= (sizeof(u_int32_t) * 2);
-    p = &cardinal[2];
+    p = (u_char*)(&cardinal[2]);
     while ((n_rd = read(read_fd, p, size)) > 0) {
       p += n_rd;
       size -= n_rd;
Index: mlterm/uitoolkit/xlib/ui_window.c
===================================================================
--- mlterm.orig/uitoolkit/xlib/ui_window.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/uitoolkit/xlib/ui_window.c	2024-12-11 12:27:46.109053115 +0100
@@ -3179,7 +3179,7 @@
   /* set extended window manager hint's icon */
   if (icon->cardinal && icon->cardinal[0] && icon->cardinal[1]) {
     int num;
-    u_long *data;
+    u_int32_t *data;
 
     /* width * height + 2 */
     num = icon->cardinal[0] * icon->cardinal[1] + 2;
@@ -3187,7 +3187,7 @@
     if (sizeof(u_long) != 4) {
       int count;
 
-      if (!(data = alloca(sizeof(u_long) * num))) {
+      if (!(data = alloca(sizeof(u_int32_t) * num))) {
         return;
       }
 
Index: mlterm/vtemu/libctl/vt_bidi.c
===================================================================
--- mlterm.orig/vtemu/libctl/vt_bidi.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/libctl/vt_bidi.c	2024-12-11 12:27:46.109053115 +0100
@@ -15,6 +15,19 @@
 #define DIR_LTR_MARK 0x200e
 #define DIR_RTL_MARK 0x200f
 
+/*
+ * FriBidiParType is introduced in
+ * https://github.com/fribidi/fribidi/commit/5a52ab708d73f6b8929856ddf7238ecdb04a36b0
+ */
+#if defined(FRIBIDI_MAJOR_VERSION) && defined(FRIBIDI_MINOR_VERSION)
+#if FRIBIDI_MAJOR_VERSION >= 1 || FRIBIDI_MINOR_VERSION >= 19
+#define FriBidiCharType FriBidiParType
+#define FRIBIDI_TYPE_LTR FRIBIDI_PAR_LTR
+#define FRIBIDI_TYPE_RTL FRIBIDI_PAR_RTL
+#define FRIBIDI_TYPE_ON FRIBIDI_PAR_ON
+#endif
+#endif
+
 /* --- global functions --- */
 
 vt_bidi_state_t vt_bidi_new(void) {
@@ -94,6 +107,10 @@
       type = FRIBIDI_TYPE_LTR;
     }
 
+    /*
+     * The type of the 3rd argument is changed from FriBidiCharType to FriBidiParType in
+     * https://github.com/fribidi/fribidi/commit/5a52ab708d73f6b8929856ddf7238ecdb04a36b0
+     */
     fribidi_log2vis(str + cur_pos, size - cur_pos, &type, NULL, order + cur_pos, NULL, NULL);
 
     if (*type_p == FRIBIDI_TYPE_ON) {
Index: mlterm/vtemu/libctl/vt_iscii.c
===================================================================
--- mlterm.orig/vtemu/libctl/vt_iscii.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/libctl/vt_iscii.c	2024-12-11 12:27:46.109053115 +0100
@@ -131,7 +131,7 @@
   return sym;
 }
 
-static struct tabl *get_iscii_table(int idx, size_t *size) {
+static struct tabl *get_iscii_table(int idx, u_int *size) {
   if (file_not_found_flags[idx]) {
     return NULL;
   }
@@ -145,7 +145,7 @@
   return (*get_iscii_tables[idx])(size);
 }
 
-static struct a2i_tabl *get_isciikey_table(int is_inscript, size_t *size) {
+static struct a2i_tabl *get_isciikey_table(int is_inscript, u_int *size) {
   if (is_inscript) {
     static int not_found;
 
@@ -183,7 +183,7 @@
 
 u_int vt_iscii_shape(ef_charset_t cs, u_char *dst, size_t dst_size, u_char *src) {
   struct tabl *table;
-  size_t size;
+  u_int size;
 
   if (!IS_ISCII(cs)) {
     return 0;
@@ -377,7 +377,7 @@
 size_t vt_convert_ascii_to_iscii(vt_isciikey_state_t state, u_char *iscii, size_t iscii_len,
                                  u_char *ascii, size_t ascii_len) {
   struct a2i_tabl *table;
-  size_t size;
+  u_int size;
   u_char *dup;
 
   /*
Index: mlterm/vtemu/libptymosh/vt_pty_mosh.cpp
===================================================================
--- mlterm.orig/vtemu/libptymosh/vt_pty_mosh.cpp	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/libptymosh/vt_pty_mosh.cpp	2024-12-11 12:27:46.109053115 +0100
@@ -256,7 +256,7 @@
   return read(pty->master, buf, len);
 }
 
-static ssize_t lo_write_to_pty(vt_pty_t *pty, u_char *buf, size_t len) {
+static ssize_t lo_write_to_pty(vt_pty_t *pty, const u_char *buf, size_t len) {
 #ifdef __CYGWIN__
   if (check_sig_child(pty->config_menu.pid)) {
     /*
@@ -636,17 +636,18 @@
   return 1;
 }
 
-static ssize_t write_to_pty(vt_pty_t *pty, u_char *buf, size_t len) {
+static ssize_t write_to_pty(vt_pty_t *pty, const u_char *buf, size_t len) {
   vt_pty_mosh_t *pty_mosh = (vt_pty_mosh_t*)pty;
 
   pthread_mutex_lock(&event_mutex);
 
 #ifdef MOSH_SIXEL
-  bool zmodem_cancel = (strcmp((char*)buf, "**\x18\x18\x18\x18\x18\x18\x18\x18"
-                                           "\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08") == 0);
+  bool zmodem_cancel = (strcmp((const char*)buf,
+                               "**\x18\x18\x18\x18\x18\x18\x18\x18"
+                               "\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08") == 0);
 
   if (pty_mosh->network->tcp_sock >= 0 &&
-      tcp_send(pty_mosh->network->tcp_sock, (char*)buf, len)) {
+      tcp_send(pty_mosh->network->tcp_sock, (const char*)buf, len)) {
     if (zmodem_cancel) {
       pass_seq_full_reset(&pty_mosh->network->ps);
 
Index: mlterm/vtemu/libptyssh/vt_pty_ssh.c
===================================================================
--- mlterm.orig/vtemu/libptyssh/vt_pty_ssh.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/libptyssh/vt_pty_ssh.c	2024-12-11 12:27:46.109053115 +0100
@@ -110,7 +110,7 @@
 
 /* --- static variables --- */
 
-static char *pass_response;
+static const char *pass_response;
 
 static ssh_session_t **sessions;
 static u_int num_sessions = 0;
@@ -858,7 +858,7 @@
   return 0;
 }
 
-static ssize_t write_to_pty(vt_pty_t *pty, u_char *buf, size_t len) {
+static ssize_t write_to_pty(vt_pty_t *pty, const u_char *buf, size_t len) {
   ssize_t ret;
 
   if (((vt_pty_ssh_t *)pty)->session->suspended) {
@@ -1032,7 +1032,7 @@
   return read(pty->master, buf, len);
 }
 
-static ssize_t lo_write_to_pty(vt_pty_t *pty, u_char *buf, size_t len) {
+static ssize_t lo_write_to_pty(vt_pty_t *pty, const u_char *buf, size_t len) {
 #ifdef __CYGWIN__
   if (check_sig_child(pty->config_menu.pid)) {
     /*
@@ -1881,9 +1881,9 @@
     char *str;
     char **dst;
 
-    session->stored->argv = session->stored + 1;
+    session->stored->argv = (char**)(session->stored + 1);
     session->stored->env = session->stored->argv + array_size[0];
-    str = session->stored->env + array_size[1];
+    str = (char*)(session->stored->env + array_size[1]);
     session->stored->pass = strcpy(str, pass);
     str += (strlen(pass) + 1);
     if (cmd_path) {
Index: mlterm/vtemu/vt_edit.c
===================================================================
--- mlterm.orig/vtemu/vt_edit.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/vt_edit.c	2024-12-11 12:27:46.109053115 +0100
@@ -1542,7 +1542,7 @@
               return NULL;
             }
 
-            dst = save->chars = save + 1;
+            dst = save->chars = (vt_char_t*)(save + 1);
             vt_str_init(dst, (vt_edit_get_cols(edit) + 1) * (end_row - row + 1));
             dst += count;
             save->beg_row = row;
Index: mlterm/vtemu/vt_parser.c
===================================================================
--- mlterm.orig/vtemu/vt_parser.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/vt_parser.c	2024-12-11 12:27:46.109053115 +0100
@@ -3079,7 +3079,7 @@
       }
     }
   } else {
-    while ((p = bl_str_sep(&pt, ";"))) {
+    while ((p = bl_str_sep((char**)&pt, ";"))) {
       if (is_spcolor) {
         if ('0' <= *p && *p <= '4') {
           config_protocol_set_simple(vt_parser, get_special_color_name(*p), "", 0);
@@ -5746,7 +5746,7 @@
         } else if (ps[0] == 10) {
           /* XXX full screen is not supported for now. */
         } else if (ps[0] == 7) {
-          const char cmd[] = "update_all";
+          char cmd[] = "update_all";
           config_protocol_set(vt_parser, cmd, 0);
         } else if (ps[0] == 11) {
           vt_write_to_pty(vt_parser->pty, "\x1b[1t", 4); /* XXX always non-iconified */
@@ -7277,7 +7277,7 @@
   return 1;
 }
 
-size_t vt_parser_write(vt_parser_t *vt_parser, u_char *buf, size_t len) {
+size_t vt_parser_write(vt_parser_t *vt_parser, const u_char *buf, size_t len) {
   if (vt_parser->is_transferring_data) {
     return 0;
   }
Index: mlterm/vtemu/vt_parser.h
===================================================================
--- mlterm.orig/vtemu/vt_parser.h	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/vt_parser.h	2024-12-11 12:27:46.109053115 +0100
@@ -380,7 +380,7 @@
 #define vt_parser_has_pending_sequence(vt_parser) \
   ((vt_parser)->r_buf.left > 0 || (vt_parser)->is_transferring_data)
 
-size_t vt_parser_write(vt_parser_t *vt_parser, u_char *buf, size_t len);
+size_t vt_parser_write(vt_parser_t *vt_parser, const u_char *buf, size_t len);
 
 int vt_parser_write_modified_key(vt_parser_t *vt_parser, int key, int ch, int modcode);
 
Index: mlterm/vtemu/vt_pty.c
===================================================================
--- mlterm.orig/vtemu/vt_pty.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/vt_pty.c	2024-12-11 12:27:46.109053115 +0100
@@ -125,9 +125,9 @@
 /*
  * Return size of lost bytes.
  */
-size_t vt_write_to_pty(vt_pty_t *pty, u_char *buf, size_t len /* if 0, flushing buffer. */
-                       ) {
-  u_char *w_buf;
+size_t vt_write_to_pty(vt_pty_t *pty, const u_char *buf,
+                       size_t len /* if 0, flushing buffer. */) {
+  const u_char *w_buf;
   size_t w_buf_size;
   ssize_t written_size;
   void *p;
@@ -173,15 +173,20 @@
     w_buf = pty->buf;
   } else if (/* pty->buf == NULL && */ pty->left == 0) {
     w_buf = buf;
-  } else if ((w_buf = alloca(w_buf_size))) {
-    memcpy(w_buf, pty->buf, pty->left);
-    memcpy(&w_buf[pty->left], buf, len);
   } else {
+    u_char *new_w_buf;
+
+    if ((new_w_buf = alloca(w_buf_size))) {
+      memcpy(new_w_buf, pty->buf, pty->left);
+      memcpy(&new_w_buf[pty->left], buf, len);
+      w_buf = new_w_buf;
+    } else {
 #ifdef DEBUG
-    bl_warn_printf(BL_DEBUG_TAG " alloca() failed. %d characters not written.\n", len);
+      bl_warn_printf(BL_DEBUG_TAG " alloca() failed. %d characters not written.\n", len);
 #endif
 
-    return len;
+      return len;
+    }
   }
 
 #ifdef __DEBUG
Index: mlterm/vtemu/vt_pty.h
===================================================================
--- mlterm.orig/vtemu/vt_pty.h	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/vt_pty.h	2024-12-11 12:27:46.109053115 +0100
@@ -61,7 +61,7 @@
 
   int (*final)(struct vt_pty *);
   int (*set_winsize)(struct vt_pty *, u_int, u_int, u_int, u_int);
-  ssize_t (*write)(struct vt_pty *, u_char*, size_t);
+  ssize_t (*write)(struct vt_pty *, const u_char*, size_t);
   ssize_t (*read)(struct vt_pty *, u_char*, size_t);
 
   vt_pty_event_listener_t *pty_listener;
@@ -71,7 +71,7 @@
   struct _stored {
     int master;
     int slave;
-    ssize_t (*write)(struct vt_pty *, u_char*, size_t);
+    ssize_t (*write)(struct vt_pty *, const u_char*, size_t);
     ssize_t (*read)(struct vt_pty *, u_char*, size_t);
 
     u_int ref_count;
@@ -98,7 +98,7 @@
 
 int vt_set_pty_winsize(vt_pty_t *pty, u_int cols, u_int rows, u_int width_pix, u_int height_pix);
 
-size_t vt_write_to_pty(vt_pty_t *pty, u_char *buf, size_t len);
+size_t vt_write_to_pty(vt_pty_t *pty, const u_char *buf, size_t len);
 
 size_t vt_read_pty(vt_pty_t *pty, u_char *buf, size_t left);
 
Index: mlterm/vtemu/vt_pty_unix.c
===================================================================
--- mlterm.orig/vtemu/vt_pty_unix.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/vt_pty_unix.c	2024-12-11 12:27:46.109053115 +0100
@@ -93,7 +93,7 @@
   return 1;
 }
 
-static ssize_t write_to_pty(vt_pty_t *pty, u_char *buf, size_t len) {
+static ssize_t write_to_pty(vt_pty_t *pty, const u_char *buf, size_t len) {
 #ifdef __APPLE__
   ssize_t ret;
 
Index: mlterm/vtemu/vt_term.c
===================================================================
--- mlterm.orig/vtemu/vt_term.c	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/vt_term.c	2024-12-11 12:27:46.109053115 +0100
@@ -562,7 +562,7 @@
   return vt_pty_get_mode(term->pty);
 }
 
-size_t vt_term_write(vt_term_t *term, u_char *buf, size_t len) {
+size_t vt_term_write(vt_term_t *term, const u_char *buf, size_t len) {
   if (term->pty == NULL) {
     return 0;
   }
Index: mlterm/vtemu/vt_term.h
===================================================================
--- mlterm.orig/vtemu/vt_term.h	2024-12-11 12:27:46.113053065 +0100
+++ mlterm/vtemu/vt_term.h	2024-12-11 12:27:46.109053115 +0100
@@ -146,7 +146,7 @@
 
 pid_t vt_term_get_pty_mode(vt_term_t *term);
 
-size_t vt_term_write(vt_term_t *term, u_char *buf, size_t len);
+size_t vt_term_write(vt_term_t *term, const u_char *buf, size_t len);
 
 #define vt_term_write_modified_key(term, key, ch, modcode)               \
   ((term)->pty ? vt_parser_write_modified_key((term)->parser, key, ch, modcode) : 0)