Commit graph

244 commits

Author SHA1 Message Date
Kp ec1cf005b6 Enable -Wformat-truncation
Add macro cf_assert ("control flow" assert) to hint to gcc that certain
conditions are impossible.  Use it to avoid generating range checks for
situations that never happen.  If the event did happen, the only
consequence would be truncated UI text, rather than a correctness
problem.
2018-08-26 18:10:36 +00:00
Kp 08446f0ab6 Pass font to gr_string,gr_printf 2018-05-19 23:21:42 +00:00
Kp e63bbe8c52 Set d_event type at construction 2018-05-12 18:24:19 +00:00
Kp d049f738c8 Convert various gr_set_current_canvas calls to reference form 2017-11-05 20:49:08 +00:00
Kp 49c0cdae2e Simplify calls to gr_set_default_canvas
Rather than use an inline wrapper and rely on the compiler optimizer to
redirect gr_set_current_canvas(nullptr) to gr_set_default_canvas,
rewrite all relevant calls directly in the source.

git grep -l 'gr_set_current_canvas' | xargs sed -i -e 's:gr_set_current_canvas(\s*NULL\|nullptr\s*);:gr_set_default_canvas();:'
2017-11-05 20:49:08 +00:00
Kp 4cfd5f3324 Pass canvas to menubar_init 2017-09-26 04:15:50 +00:00
Kp adcf02e454 Expand tt:: indirection to std::
All supported compilers have an acceptable <type_traits>.  Commit
4cb3d46148 ("Move <type_traits> test to Cxx11RequiredFeature") made
<type_traits> support mandatory in August and no one has objected.
Remove the indirection and use namespace std directly for type_traits
members.
2017-06-25 20:46:03 +00:00
Kp b0cb681ae7 Add gcc-7 /*-fallthrough*/ comments for obvious cases
For switch cases where existing comments or code flow logic obviously
intended to fall through, add a gcc-7 /*-fallthrough*/ comment to
silence warnings about this.  Some cases which are less obvious are not
converted, so the code does not yet compile clean with
-Wimplicit-fallthrough.

Reported-by: parkerlreed <https://github.com/dxx-rebirth/dxx-rebirth/issues/338>
2017-06-07 02:44:54 +00:00
Kp c725a6cb88 Pass canvas to gr_init_font 2017-03-11 19:56:22 +00:00
Kp c50756c958 Cache canvas in radio.cpp 2017-03-10 01:22:25 +00:00
Kp 5be6b53d16 Fold calls in ui_draw_radio 2017-03-10 01:22:25 +00:00
Kp 0f93dc6e34 Cache canvas in message.cpp 2017-03-10 01:22:25 +00:00
Kp 4d9541d776 Cache canvas in menubar.cpp 2017-03-10 01:22:25 +00:00
Kp a730f68e0b Cache canvas in listbox.cpp 2017-03-10 01:22:25 +00:00
Kp 6ff14b7688 Cache canvas in keypad.cpp 2017-03-10 01:22:25 +00:00
Kp dff67dad1b Cache canvas in inputbox.cpp 2017-03-10 01:22:24 +00:00
Kp 8d5ca033e1 Cache canvas in icon.cpp 2017-03-10 01:22:24 +00:00
Kp 9d4e1e307c Shorten ui_dialog_do_gadgets 2017-03-10 01:22:24 +00:00
Kp 0dc59ab3f2 Simplify ui_dialog_handler switch 2017-03-10 01:22:24 +00:00
Kp 97cf921b72 Cache canvas in ui_draw_checkbox 2017-02-11 21:42:46 +00:00
Kp 2725ea02c2 Cache canvas in ui_draw_button 2017-02-11 21:42:46 +00:00
Kp 69a4857ba5 Pass canvas to ui_draw_box_in1 2017-02-11 21:42:44 +00:00
Kp d4aa43c17e Cache canvas in ui_draw_scrollbar 2017-02-11 21:42:37 +00:00
Kp 7a6818eb01 Fold ui_draw_checkbox calls 2017-02-11 21:42:36 +00:00
Kp 842bd7a649 Pass canvas to ui_string_centered 2017-02-11 21:42:36 +00:00
Kp aa9b9a8346 Pass canvas to ui_draw_box_in 2017-02-11 21:42:36 +00:00
Kp 04c7f7c790 Pass canvas to ui_draw_box_out 2017-02-11 21:42:35 +00:00
Kp a51b071053 Pass canvas to ui_draw_frame 2017-02-11 21:42:35 +00:00
Kp 5636a85f3c Pass canvas to ui_draw_shad 2017-02-11 21:42:35 +00:00
Kp cf1f5df3cc Pass canvas to Vline 2017-02-11 21:42:35 +00:00
Kp f9cb598b0f Pass canvas to Hline 2017-02-11 21:42:35 +00:00
Kp 13320c8011 Fold ui_draw_button calls to gr_rect 2017-02-11 21:42:34 +00:00
Kp e765f8b744 Reorder ui_draw_button to support folding 2017-02-11 21:42:34 +00:00
Kp f28a5e77f1 Fold ui_draw_button calls to gr_set_fontcolor 2017-02-11 21:42:34 +00:00
Kp 554daa61cc Pass font to ui_get_button_size 2017-02-11 21:42:34 +00:00
Kp ae33aaafc1 Pass canvas to gr_set_fontcolor 2017-02-11 21:42:32 +00:00
Kp c16b7763e9 Remove unused ui_draw_line_in 2017-02-08 23:34:41 +00:00
Kp 5da784dbed Pass canvas to gr_{,u}string 2017-01-08 22:32:00 +00:00
Kp 1ef6b9d5bc Pass font to gr_get_string_size 2017-01-08 22:31:59 +00:00
Kp 0480ba8030 Pass canvas to gr_string(int,int,const char*,int,int) 2017-01-08 22:31:59 +00:00
Kp 0905aefa0a Pass canvas to gr_rect 2017-01-01 00:45:45 +00:00
Kp 794dcce327 Pass canvas to gr_urect 2017-01-01 00:45:44 +00:00
Kp dac1a69f7c Pass canvas to gr_ubox 2017-01-01 00:45:44 +00:00
Kp 7439949595 Pass canvas to gr_uline 2016-12-29 03:27:10 +00:00
Kp dc881ec12d Merge pull #266 into master 2016-11-19 18:09:26 +00:00
Kp 6db96d1a6d Fix file.cpp -Wunused-but-set-variable
Commit 1c8ad24 removed all reads of `wind`, but did not remove its
assignment or declaration.  This breaks the build with gcc due to
-Wunused-but-set-variable.

Fixes: 1c8ad24da3 ("Check for window_event_result::deleted for ui_get_filename polling loop")
2016-11-19 17:24:51 +00:00
Kp 98afafb80f Fix gadget.cpp -Wunused-but-set-variable
Commit 917f079 removed all reads of `wind`, but did not remove its
assignment or declaration.  This breaks the build with gcc due to
-Wunused-but-set-variable.

Fixes: 917f079f02 ("Check for window_event_result::deleted in ui_dialog_do_gadgets")
2016-11-19 17:24:51 +00:00
Chris Taylor cc3f35649f Change all occurrences of "Couldn't" to "Could not" for consistency ("Could not" is more common and wins).
Not touching TXT_COULDNT because it's stored separately in hog file.
2016-11-13 13:27:18 +08:00
Chris Taylor 1761d696fe Check if dir is empty string the more efficient way in file_getdirlist 2016-11-13 12:49:08 +08:00
Chris Taylor 5f19a3cba9 Remove redundant checks and initialisations recently added for editor 2016-11-13 12:44:53 +08:00