Ticket #3547: mc-3547-cleanup-conversion-warning-keybind_t.patch
File mc-3547-cleanup-conversion-warning-keybind_t.patch, 18.8 KB (added by and, 8 years ago) |
---|
-
lib/keybind.c
fix -Wconversion warning at *_keymap_t and follow ups CK_InsertChar defined as a negative number so use int and not unsigned long command and action field convert to int also as follow up patch will resolve following warnings: buttonbar.c:153:68: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] dialog.c:351:44: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] input.c:1093:39: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] listbox.c:444:40: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] menu.c:341:55: warning: implicit conversion loses integer precision: 'const unsigned long' to 'int' [-Wshorten-64-to-32] keybind.c:49:20: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] lock.c:184:11: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32] midnight.c:1322:70: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] midnight.c:1570:48: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] midnight.c:1573:50: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] midnight.c:1579:50: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] panel.c:3674:42: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] tree.c:1241:40: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] actions_cmd.c:681:39: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] actions_cmd.c:729:46: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] actions_cmd.c:737:46: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] edit.c:1673:30: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] edit.c:3912:47: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] editcmd.c:1870:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] editcmd.c:2032:57: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] editcmd.c:3404:37: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] editwidget.c:926:19: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] editwidget.c:1025:52: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] editwidget.c:1030:49: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] editwidget.c:1041:52: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] editwidget.c:1136:46: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] editwidget.c:1146:38: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] ydiff.c:3359:39: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] ydiff.c:3410:45: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] ydiff.c:3418:46: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] help.c:971:38: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] help.c:977:38: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] setup.c:701:61: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] setup.c:695:22: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] patch against a5cd0093c5330ae6118cbf2830cf288dd4a68ed0 compile test with gcc 4.6/4.9/5.2 and clang 3.7 Signed-off-by: Andreas Mohr <and@gmx.li>
a b 395 395 /* --------------------------------------------------------------------------------------------- */ 396 396 397 397 static void 398 keymap_add (GArray * keymap, long key, unsigned longcmd, const char *caption)398 keymap_add (GArray * keymap, long key, int cmd, const char *caption) 399 399 { 400 400 if (key != 0 && cmd != CK_IgnoreKey) 401 401 { … … 413 413 /* --------------------------------------------------------------------------------------------- */ 414 414 415 415 void 416 keybind_cmd_bind (GArray * keymap, const char *keybind, unsigned longaction)416 keybind_cmd_bind (GArray * keymap, const char *keybind, int action) 417 417 { 418 418 char *caption = NULL; 419 419 long key; … … 425 425 426 426 /* --------------------------------------------------------------------------------------------- */ 427 427 428 unsigned long 428 int 429 429 keybind_lookup_action (const char *name) 430 430 { 431 431 const name_keymap_t key = { name, 0 }; … … 442 442 /* --------------------------------------------------------------------------------------------- */ 443 443 444 444 const char * 445 keybind_lookup_actionname ( unsigned longaction)445 keybind_lookup_actionname (int action) 446 446 { 447 447 size_t i; 448 448 … … 456 456 /* --------------------------------------------------------------------------------------------- */ 457 457 458 458 const char * 459 keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned longaction)459 keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, int action) 460 460 { 461 461 if (keymap != NULL) 462 462 { … … 471 471 472 472 /* --------------------------------------------------------------------------------------------- */ 473 473 474 unsigned long 474 int 475 475 keybind_lookup_keymap_command (const global_keymap_t * keymap, long key) 476 476 { 477 477 if (keymap != NULL) -
lib/keybind.h
a b 339 339 typedef struct name_keymap_t 340 340 { 341 341 const char *name; 342 unsigned longval;342 int val; 343 343 } name_keymap_t; 344 344 345 345 typedef struct key_config_t … … 354 354 typedef struct global_keymap_t 355 355 { 356 356 long key; 357 unsigned longcommand;357 int command; 358 358 char caption[KEYMAP_SHORTCUT_LENGTH]; 359 359 } global_keymap_t; 360 360 … … 362 362 363 363 /*** declarations of public functions ************************************************************/ 364 364 365 void keybind_cmd_bind (GArray * keymap, const char *keybind, unsigned longaction);366 unsigned longkeybind_lookup_action (const char *name);367 const char *keybind_lookup_actionname ( unsigned longaction);368 const char *keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned longaction);369 unsigned longkeybind_lookup_keymap_command (const global_keymap_t * keymap, long key);365 void keybind_cmd_bind (GArray * keymap, const char *keybind, int action); 366 int keybind_lookup_action (const char *name); 367 const char *keybind_lookup_actionname (int action); 368 const char *keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, int action); 369 int keybind_lookup_keymap_command (const global_keymap_t * keymap, long key); 370 370 371 371 /*** inline functions ****************************************************************************/ 372 372 -
lib/widget/buttonbar.c
a b 266 266 { 267 267 if ((bb != NULL) && (idx >= 1) && (idx <= BUTTONBAR_LABELS_NUM)) 268 268 { 269 unsigned longcommand = CK_IgnoreKey;269 int command = CK_IgnoreKey; 270 270 271 271 if (keymap != NULL) 272 272 command = keybind_lookup_keymap_command (keymap, KEY_F (idx)); -
lib/widget/buttonbar.h
a b 28 28 struct 29 29 { 30 30 char *text; 31 unsigned longcommand;31 int command; 32 32 Widget *receiver; 33 33 int end_coord; /* cumulative width of buttons so far */ 34 34 } labels[BUTTONBAR_LABELS_NUM]; -
lib/widget/dialog.c
a b 272 272 /* --------------------------------------------------------------------------------------------- */ 273 273 274 274 static cb_ret_t 275 dlg_execute_cmd (WDialog * h, unsigned longcommand)275 dlg_execute_cmd (WDialog * h, int command) 276 276 { 277 277 cb_ret_t ret = MSG_HANDLED; 278 278 switch (command) … … 341 341 static cb_ret_t 342 342 dlg_handle_key (WDialog * h, int d_key) 343 343 { 344 unsigned longcommand;344 int command; 345 345 346 346 command = keybind_lookup_keymap_command (dialog_map, d_key); 347 347 -
lib/widget/dialog.h
a b 64 64 65 65 /* get string representation of shortcut assigned with command */ 66 66 /* as menu is a widget of dialog, ask dialog about shortcut string */ 67 typedef char *(*dlg_shortcut_str) ( unsigned longcommand);67 typedef char *(*dlg_shortcut_str) (int command); 68 68 69 69 /* get dialog name to show in dialog list */ 70 70 typedef char *(*dlg_title_str) (const WDialog * h, size_t len); -
lib/widget/input.c
a b 679 679 /* --------------------------------------------------------------------------------------------- */ 680 680 681 681 static cb_ret_t 682 input_execute_cmd (WInput * in, unsigned longcommand)682 input_execute_cmd (WInput * in, int command) 683 683 { 684 684 cb_ret_t res = MSG_HANDLED; 685 685 … … 1133 1133 input_handle_char (WInput * in, int key) 1134 1134 { 1135 1135 cb_ret_t v; 1136 unsigned longcommand;1136 int command; 1137 1137 1138 1138 if (quote != 0) 1139 1139 { … … 1177 1177 int 1178 1178 input_key_is_in_map (WInput * in, int key) 1179 1179 { 1180 unsigned longcommand;1180 int command; 1181 1181 1182 1182 (void) in; 1183 1183 -
lib/widget/listbox.c
a b 256 256 /* --------------------------------------------------------------------------------------------- */ 257 257 258 258 static cb_ret_t 259 listbox_execute_cmd (WListbox * l, unsigned longcommand)259 listbox_execute_cmd (WListbox * l, int command) 260 260 { 261 261 cb_ret_t ret = MSG_HANDLED; 262 262 int i; … … 325 325 static cb_ret_t 326 326 listbox_key (WListbox * l, int key) 327 327 { 328 unsigned longcommand;328 int command; 329 329 330 330 if (l->list == NULL) 331 331 return MSG_NOT_HANDLED; -
lib/widget/menu.c
a b 57 57 { 58 58 unsigned char first_letter; 59 59 hotkey_t text; 60 unsigned longcommand;60 int command; 61 61 char *shortcut; 62 62 }; 63 63 … … 774 774 /* --------------------------------------------------------------------------------------------- */ 775 775 776 776 menu_entry_t * 777 menu_entry_create (const char *name, unsigned longcommand)777 menu_entry_create (const char *name, int command) 778 778 { 779 779 menu_entry_t *entry; 780 780 -
lib/widget/menu.h
a b 42 42 43 43 /*** declarations of public functions ************************************************************/ 44 44 45 menu_entry_t *menu_entry_create (const char *name, unsigned longcommand);45 menu_entry_t *menu_entry_create (const char *name, int command); 46 46 void menu_entry_free (menu_entry_t * me); 47 47 48 48 menu_t *create_menu (const char *name, GList * entries, const char *help_node); -
src/diffviewer/ydiff.c
a b 3145 3145 /* --------------------------------------------------------------------------------------------- */ 3146 3146 3147 3147 static cb_ret_t 3148 dview_execute_cmd (WDiff * dview, unsigned longcommand)3148 dview_execute_cmd (WDiff * dview, int command) 3149 3149 { 3150 3150 cb_ret_t res = MSG_HANDLED; 3151 3151 … … 3311 3311 static cb_ret_t 3312 3312 dview_handle_key (WDiff * dview, int key) 3313 3313 { 3314 unsigned longcommand;3314 int command; 3315 3315 3316 3316 #ifdef HAVE_CHARSET 3317 3317 key = convert_from_input_c (key); -
src/editor/edit.c
a b 3185 3185 */ 3186 3186 3187 3187 void 3188 edit_execute_key_command (WEdit * edit, unsigned longcommand, int char_for_insertion)3188 edit_execute_key_command (WEdit * edit, int command, int char_for_insertion) 3189 3189 { 3190 3190 if (command == CK_MacroStartRecord || command == CK_RepeatStartRecord 3191 3191 || (macro_index < 0 … … 3234 3234 all of them. It also does not check for the Undo command. 3235 3235 */ 3236 3236 void 3237 edit_execute_cmd (WEdit * edit, unsigned longcommand, int char_for_insertion)3237 edit_execute_cmd (WEdit * edit, int command, int char_for_insertion) 3238 3238 { 3239 3239 Widget *w = WIDGET (edit); 3240 3240 -
src/editor/editcmd.c
a b 3412 3412 /* edit is a pointer to the widget */ 3413 3413 if (edit != NULL) 3414 3414 { 3415 unsigned longcommand = macro_index < 0 ? CK_MacroStartRecord : CK_MacroStopRecord;3415 int command = macro_index < 0 ? CK_MacroStartRecord : CK_MacroStopRecord; 3416 3416 edit_execute_key_command (edit, command, -1); 3417 3417 } 3418 3418 } … … 3425 3425 /* edit is a pointer to the widget */ 3426 3426 if (edit != NULL) 3427 3427 { 3428 unsigned longcommand = macro_index < 0 ? CK_RepeatStartRecord : CK_RepeatStopRecord;3428 int command = macro_index < 0 ? CK_RepeatStartRecord : CK_RepeatStopRecord; 3429 3429 edit_execute_key_command (edit, command, -1); 3430 3430 } 3431 3431 } -
src/editor/edit-impl.h
a b 234 234 void edit_goto_cmd (WEdit * edit); 235 235 gboolean eval_marks (WEdit * edit, off_t * start_mark, off_t * end_mark); 236 236 void edit_status (WEdit * edit, gboolean active); 237 void edit_execute_key_command (WEdit * edit, unsigned longcommand, int char_for_insertion);237 void edit_execute_key_command (WEdit * edit, int command, int char_for_insertion); 238 238 void edit_update_screen (WEdit * edit); 239 239 void edit_save_size (WEdit * edit); 240 gboolean edit_handle_move_resize (WEdit * edit, unsigned longcommand);240 gboolean edit_handle_move_resize (WEdit * edit, int command); 241 241 void edit_toggle_fullscreen (WEdit * edit); 242 242 void edit_move_to_line (WEdit * e, long line); 243 243 void edit_move_display (WEdit * e, long line); … … 286 286 void format_paragraph (WEdit * edit, gboolean force); 287 287 288 288 /* either command or char_for_insertion must be passed as -1 */ 289 void edit_execute_cmd (WEdit * edit, unsigned longcommand, int char_for_insertion);289 void edit_execute_cmd (WEdit * edit, int command, int char_for_insertion); 290 290 291 291 /*** inline functions ****************************************************************************/ 292 292 -
src/editor/editwidget.c
a b 225 225 */ 226 226 227 227 static void 228 edit_window_move (WEdit * edit, unsigned longcommand)228 edit_window_move (WEdit * edit, int command) 229 229 { 230 230 Widget *w = WIDGET (edit); 231 231 Widget *wh = WIDGET (w->owner); … … 265 265 */ 266 266 267 267 static void 268 edit_window_resize (WEdit * edit, unsigned longcommand)268 edit_window_resize (WEdit * edit, int command) 269 269 { 270 270 Widget *w = WIDGET (edit); 271 271 Widget *wh = WIDGET (w->owner); … … 359 359 /* --------------------------------------------------------------------------------------------- */ 360 360 361 361 static char * 362 edit_get_shortcut ( unsigned longcommand)362 edit_get_shortcut (int command) 363 363 { 364 364 const char *ext_map; 365 365 const char *shortcut = NULL; … … 708 708 /* --------------------------------------------------------------------------------------------- */ 709 709 710 710 static cb_ret_t 711 edit_dialog_command_execute (WDialog * h, unsigned longcommand)711 edit_dialog_command_execute (WDialog * h, int command) 712 712 { 713 713 Widget *wh = WIDGET (h); 714 714 gboolean ret = MSG_HANDLED; … … 817 817 static gboolean 818 818 edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch) 819 819 { 820 unsigned long command = (unsigned long)CK_InsertChar;820 int command = CK_InsertChar; 821 821 int char_for_insertion = -1; 822 822 823 823 /* an ordinary insertable character */ … … 929 929 *cmd = (int) command; /* FIXME */ 930 930 *ch = char_for_insertion; 931 931 932 return !(command == (unsigned long)CK_InsertChar && char_for_insertion == -1);932 return !(command == CK_InsertChar && char_for_insertion == -1); 933 933 } 934 934 935 935 … … 1050 1050 if (edit_widget_is_editor (we)) 1051 1051 { 1052 1052 WEdit *e = (WEdit *) we; 1053 unsigned longcommand;1053 int command; 1054 1054 1055 1055 if (!e->extmod) 1056 1056 command = keybind_lookup_keymap_command (editor_map, parm); … … 1379 1379 */ 1380 1380 1381 1381 gboolean 1382 edit_handle_move_resize (WEdit * edit, unsigned longcommand)1382 edit_handle_move_resize (WEdit * edit, int command) 1383 1383 { 1384 1384 gboolean ret = FALSE; 1385 1385 -
src/filemanager/midnight.c
a b 407 407 /* --------------------------------------------------------------------------------------------- */ 408 408 409 409 static char * 410 midnight_get_shortcut ( unsigned longcommand)410 midnight_get_shortcut (int command) 411 411 { 412 412 const char *ext_map; 413 413 const char *shortcut = NULL; … … 1095 1095 /* --------------------------------------------------------------------------------------------- */ 1096 1096 1097 1097 static cb_ret_t 1098 midnight_execute_cmd (Widget * sender, unsigned longcommand)1098 midnight_execute_cmd (Widget * sender, int command) 1099 1099 { 1100 1100 cb_ret_t res = MSG_HANDLED; 1101 1101 … … 1395 1395 static cb_ret_t 1396 1396 midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) 1397 1397 { 1398 unsigned longcommand;1398 int command; 1399 1399 1400 1400 switch (msg) 1401 1401 { -
src/filemanager/panel.c
a b 3384 3384 /* --------------------------------------------------------------------------------------------- */ 3385 3385 3386 3386 static cb_ret_t 3387 panel_execute_cmd (WPanel * panel, unsigned longcommand)3387 panel_execute_cmd (WPanel * panel, int command) 3388 3388 { 3389 3389 int res = MSG_HANDLED; 3390 3390 -
src/filemanager/tree.c
a b 1029 1029 /* --------------------------------------------------------------------------------------------- */ 1030 1030 1031 1031 static cb_ret_t 1032 tree_execute_cmd (WTree * tree, unsigned longcommand)1032 tree_execute_cmd (WTree * tree, int command) 1033 1033 { 1034 1034 cb_ret_t res = MSG_HANDLED; 1035 1035 -
src/help.c
diff -ruN a/src/help.c b/src/help.c
a b 858 858 /* --------------------------------------------------------------------------------------------- */ 859 859 860 860 static cb_ret_t 861 help_execute_cmd ( unsigned longcommand)861 help_execute_cmd (int command) 862 862 { 863 863 cb_ret_t ret = MSG_HANDLED; 864 864 … … 927 927 static cb_ret_t 928 928 help_handle_key (WDialog * h, int c) 929 929 { 930 unsigned longcommand;930 int command; 931 931 932 932 command = keybind_lookup_keymap_command (help_map, c); 933 933 if ((command == CK_IgnoreKey) || (help_execute_cmd (command) == MSG_NOT_HANDLED)) -
src/setup.h
a b 58 58 59 59 typedef struct macro_action_t 60 60 { 61 unsigned longaction;61 int action; 62 62 int ch; 63 63 } macro_action_t; 64 64 -
src/viewer/actions_cmd.c
a b 382 382 /* --------------------------------------------------------------------------------------------- */ 383 383 384 384 static cb_ret_t 385 mcview_execute_cmd (WView * view, unsigned longcommand)385 mcview_execute_cmd (WView * view, int command) 386 386 { 387 387 int res = MSG_HANDLED; 388 388 … … 546 546 static cb_ret_t 547 547 mcview_handle_key (WView * view, int key) 548 548 { 549 unsigned longcommand;549 int command; 550 550 551 551 #ifdef HAVE_CHARSET 552 552 key = convert_from_input_c (key);