Kp
65f68877aa
Rewrite simple integer casts from C style to static_cast<>
...
This pass only targets commonly used standard types.
s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\)\s*)\s*(/static_cast<\1>(/g
2016-06-16 03:56:44 +00:00
Kp
1b12a3f7ef
Add parentheses around target of more complicated casts
...
C casts do not require parentheses. C++ casts require grouping around
the target. Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of some C casts.
This pass attempts to process expressions that involve parenthesized or
bracketed subexpressions, but only if those subexpressions do not
themselves contain parenthesized or bracketed subexpressions.
(int) f(1); // changed
(int) f(g()); // not changed
perl -p -i -e 's/(\(\s*((?:un)?signed|int|char|short|long|float|double|s?size_t|(?:u?int[[:digit:]]+_t))\s*\**\s*\)\s*)([&+-]?)([[:alnum:]_.]+\s*->\s*)*([[:alnum:]_.]+)((?:\s*(?:\[[^][]*\])*|(?:\([^()]*\))*))(\s*([;+>*\/^%,|&<>])|$|(\s*-\s*[^>]))/\1\(\3\4\5\6\)\7/g'
2016-06-12 03:45:37 +00:00
Kp
bc30ccd216
Rewrite cast of (sbyte) to standard type int8_t
...
s/(sbyte)\s*\(\w\)/(int8_t) \1/g
2016-06-12 03:45:37 +00:00
Kp
1789643480
Remove UserError on unknown MED function
...
Jayman2000 reports that users who do not update their MED.MNU after
updating to 8b61b9f
("Remove unused symbols") receive an "editor crash"
on startup. This is not a crash, but instead is poor error handling in
menubar.cpp, which calls UserError instead of ignoring the offending
line. Calls to UserError are fatal, but do not crash the program.
Replace that call with a con_printf(CON_URGENT) and ignore the line.
Additionally, change the handling for excess menus and for excess menu
items to con_printf+ignore instead of UserError.
Reported-by: Jayman2000 <https://github.com/dxx-rebirth/dxx-rebirth/pull/190 >
Fixes: 8b61b9f0db
("Remove unused symbols")
2016-04-03 17:50:42 +00:00
Kp
27cef20eb3
Move namespace dsx handling to dsx-ns.h
2016-03-19 19:08:10 +00:00
Kp
08de1bbff0
Remove cv_color
...
It is only ever set to 0 or copied from other canvases. Set it to zero
everywhere.
2016-02-12 04:02:28 +00:00
Kp
f4e1ebb576
Remove unnecessary gr_setcolor calls
2016-02-12 04:02:28 +00:00
Kp
e09a590e6f
Pass color to Vline
2016-02-12 04:02:28 +00:00
Kp
76d0e01b6e
Pass color to Hline
2016-02-12 04:02:28 +00:00
Kp
de08a67321
Pass color to gr_ubox
2016-02-12 04:02:28 +00:00
Kp
23047b1165
Pass color to gr_rect
2016-02-12 04:02:28 +00:00
Kp
35a4736df0
Pass color to gr_urect
2016-02-12 04:02:28 +00:00
Kp
053901b62b
Pass color to gr_uline
2016-02-12 04:02:28 +00:00
Kp
b57f08c798
Use partial_const_range
2016-02-12 04:02:28 +00:00
Kp
eb3fe7acdb
Remove sprintf from menubar.cpp
2016-01-09 16:38:16 +00:00
Kp
dc8c0323d8
Uninline namespace dcx
2015-12-13 18:00:49 +00:00
Kp
22bd3ce8d8
Use inline namespace dcx for common/ui
2015-12-05 22:57:24 +00:00
Kp
ed55763603
Remove unused symbols
2015-12-04 03:36:31 +00:00
Kp
dad504cfef
Fix some -Wshadow warnings
2015-11-26 02:56:54 +00:00
Kp
50f672ba34
Reuse computed string length
2015-09-29 02:41:22 +00:00
Kp
d9cef82f81
Allow nullptr for gr_get_string_size
2015-09-29 02:41:22 +00:00
Kp
17b1943c5e
Mark various per-file structures as static
2015-08-12 03:11:46 +00:00
Kp
968cdbecf4
Add non-aborting UserError for user-caused fatal errors
2015-06-16 03:15:40 +00:00
Kp
06c363fb19
Fix UI_GADGET -fno-inline build
...
Fixes: 95e3ac1e5b
("Use integral_constant for UI kind")
2015-06-11 03:06:58 +00:00
Kp
25186ca984
Remove write-only keyd_last_released
2015-05-28 03:08:38 +00:00
Kp
badad2ef33
Remove write-only keyd_last_pressed
2015-05-28 03:08:38 +00:00
Kp
bdee338e34
Preserve array size for ui_get_filename
2015-05-09 17:38:58 +00:00
Kp
649993982f
Enable tail call optimization in menubar_close
2015-05-09 17:38:58 +00:00
Kp
fc4b686d9d
Store PHYSFS_list element count in list when needed
2015-05-09 17:38:57 +00:00
Kp
1d08cb6058
Fix file_get*list nullptr without constructor inheritance
2015-05-05 03:20:42 +00:00
Kp
c3925353fd
Use null_sentinel_iterator for PHYSFS_list_t
2015-04-26 20:15:51 +00:00
Kp
143c536c77
Use PHYSFS_list_t for more functions
2015-04-26 20:15:50 +00:00
Kp
44adc83ca4
Use std::remove_if in file_get*list
2015-04-26 20:15:50 +00:00
Kp
f00ec13c0f
Use std::move_backward for file_getdirlist
2015-04-26 20:15:50 +00:00
Kp
08ee591e21
Fix ODR collision between ui/file browser and main/menu browser
2015-04-22 02:44:30 +00:00
Kp
150e2d2686
Convert local arrays to array<>
2015-04-19 04:18:49 +00:00
Kp
2f92078413
Move ui_add_gadget_scrollbar arrows off stack
2015-04-02 02:36:56 +00:00
Kp
f88eaf43ac
Make UI_GADGET_LISTBOX char* const
2015-04-02 02:36:54 +00:00
Kp
92b6cd3883
Replace ui_create_dialog specialization with helper
...
Rename ui_create_dialog<void *> specialization with free function
untyped_ui_create_dialog. GCC 4.6 incorrectly considers a
specialization to be a redundant declaration, causing a
-Wredundant-decls failure with the specialization form.
Fixes: be041a9cfc
("Add type checking for ui_create_dialog")
2015-04-02 02:36:52 +00:00
Kp
d04e7902ee
Make file_get*list static
2015-03-22 18:49:21 +00:00
Kp
383e7703b6
Use ntstring in file_getdirlist
2015-03-22 18:49:21 +00:00
Kp
fca381727c
Add wrappers for screen width/height
2015-03-22 18:49:21 +00:00
Kp
f900d4a5ee
Remove RAIIdmem::operator pointer
...
Mac OS X defines uint_fast32_t to unsigned int, causing ambiguous
overloads between RAIIdmem::operator[](std::size_t) and
RAIIdmem::operator[](int). Adding a disambiguating overload for OS X
breaks Windows. Remove operator pointer and operator[]. Rely on the
inherited operator[] for indexing. Require users to call ->get() to
convert to a simple pointer.
First btb ambiguity reported: https://github.com/dxx-rebirth/dxx-rebirth/pull/34
Second btb ambiguity reported: https://github.com/dxx-rebirth/dxx-rebirth/pull/43
2015-02-17 03:52:59 +00:00
Kp
f38aec1212
Remove string copying in GetKeyDescription
2015-01-29 04:27:35 +00:00
Kp
71ec47b32e
Refactor ui_pad_activate
2015-01-29 04:27:35 +00:00
Kp
ff4a0ccd70
Fix RAIIdmem array usage
...
Some RAIIdmem instances managed a T[], but were declared to manage a T.
2015-01-28 03:42:53 +00:00
Kp
faee7c7302
Ignore empty lines when parsing pads
2015-01-28 03:42:53 +00:00
Kp
1110bed7bb
Use RAIIdmem for ITEM text
2015-01-23 03:55:04 +00:00
Kp
84e3a03451
Remove unused parameters
2015-01-18 01:58:33 +00:00
Kp
f7815810e8
Use RAIIPHYSFS_File to manage PHYSFS_File
...
Fixes a few leaks on error paths.
2015-01-17 18:31:42 +00:00
Kp
3bf1fd573c
Pass window_select arg by &
2015-01-17 18:31:41 +00:00
Kp
ee50d45e72
Pass window_send_event arg by &
2015-01-17 18:31:40 +00:00
Kp
fccb6814f8
Pass gr_create_sub_canvas arg by &
2015-01-17 18:31:40 +00:00
Kp
c2b7990550
Pass window_get_canvas arg by &
2015-01-17 18:31:40 +00:00
Kp
d185324a26
Use range_for in menubar
2015-01-17 18:31:39 +00:00
Kp
dc35b0ad88
Fix Win32 build
2015-01-03 23:44:32 +00:00
Kp
a9998476a9
Use ntstring for UI_KEYPAD description
2014-12-22 04:35:48 +00:00
Kp
df46499f85
Fix buffer overrun reading UI pad
2014-12-22 04:35:47 +00:00
Kp
ba88926780
Fix potential null dereference parsing UI pad
2014-12-22 04:35:47 +00:00
Kp
0af323c24d
Fix various buffer overruns parsing pad UI
2014-12-22 04:35:47 +00:00
Kp
2766114959
Make PHYSFSX_gets_line_t::line_t be array<>
2014-12-20 04:36:10 +00:00
Kp
c53a8cc30f
Initialize buttontext in UI_KEYPAD constructor
2014-12-20 04:36:10 +00:00
Kp
0bf2a6eb80
Return unique_ptr from ui_add_gadget_button
2014-12-20 04:36:10 +00:00
Kp
c43feee61d
Return unique_ptr from ui_add_gadget_listbox
2014-12-20 04:36:10 +00:00
Kp
1d363bbd5d
Return unique_ptr from ui_add_gadget_scrollbar
2014-12-20 04:36:10 +00:00
Kp
3b4fbd0bd5
Return unique_ptr from ui_add_gadget_radio
2014-12-20 04:36:10 +00:00
Kp
b16e8ecbec
Return unique_ptr from ui_add_gadget_checkbox
2014-12-20 04:36:09 +00:00
Kp
413a316154
Return unique_ptr from ui_add_gadget_inputbox
2014-12-20 04:36:09 +00:00
Kp
89b1ff8795
Return unique_ptr from ui_add_gadget_userbox
2014-12-20 04:36:09 +00:00
Kp
e1bb249176
Remove unused UI_GADGET_KEYTRAP
2014-12-20 04:36:09 +00:00
Kp
8d487b4883
Return unique_ptr from ui_add_gadget_icon
2014-12-20 04:36:09 +00:00
Kp
f1885ee4d4
Pass creation context to new windows
2014-12-20 04:36:09 +00:00
Kp
cf5e5620aa
Deduce input box text length
2014-12-20 04:36:09 +00:00
Kp
dbe882ea42
Fix memory leak in ui_messagebox
2014-12-20 04:36:08 +00:00
Kp
7cbf3c1e0e
Use unique_ptr for browser
2014-12-20 04:36:08 +00:00
Kp
6a62d3b49d
Cache KeyPad[n] address
2014-12-20 04:36:08 +00:00
Kp
b9ceceda3a
Use array<char,100> for UI_KEYPAD::buttontext
2014-12-20 04:36:08 +00:00
Kp
5600cea3ac
Use array<unique_ptr<UI_KEYPAD>> for KeyPad
2014-12-20 04:36:08 +00:00
Kp
d72fcfeef1
Remove unnecessary UI_GADGET* casts
2014-10-04 22:36:13 +00:00
Kp
a8f853aa7a
Pass d_event arg by const&
2014-10-04 22:36:13 +00:00
Kp
8750b6a4ad
Switch d_event subclasses to C++ inheritance
2014-10-04 18:05:26 +00:00
Kp
85d04abf60
Propagate for variables in common/ui/menu.cpp
2014-09-26 02:42:15 +00:00
Kp
d47ecc3bef
Propagate for variables in common/ui/keypress.cpp
2014-09-26 02:42:15 +00:00
Kp
b0e2188dd2
Propagate for variables in common/ui/keypad.cpp
2014-09-26 02:42:15 +00:00
Kp
92cf115de1
Propagate for variables in common/ui/file.cpp
2014-09-26 02:42:15 +00:00
Kp
e7bd80c9c8
Propagate for variables in common/ui/dialog.cpp
2014-09-26 02:42:15 +00:00
Kp
703f60ac3f
Fix -Wtype-limits warnings
2014-09-21 21:41:55 +00:00
Kp
ec4bb62a2c
Add break missed in C++ inheritance conversion
2014-09-08 00:08:17 +00:00
Kp
7d166a70e0
Prevent accidental RAIIdmem construction
2014-09-07 23:56:37 +00:00
Kp
425c4242c1
Use std::string for UI_GADGET_BUTTON text
2014-09-07 21:21:57 +00:00
Kp
e8f4b20d1d
Use special type for PHYSFSX_fgets
2014-09-07 20:07:20 +00:00
Kp
a02f78a171
Move saving window pointer into helper
2014-09-07 19:04:07 +00:00
Kp
fdef9fd04f
Use C++ allocation for window-specific data
2014-09-07 19:04:07 +00:00
Kp
ff31905181
Use unique_ptr for grs_subcanvas
2014-09-07 19:04:06 +00:00
Kp
8321b90a9a
Use C++ inheritance for UI gadgets
2014-09-07 19:04:06 +00:00
Kp
f9e9f0faa9
Use RAIIdmem for gadgets
2014-08-27 03:15:06 +00:00
Kp
94550355a8
Use make_unique instead of bare new
2014-08-24 18:28:09 +00:00
Kp
f47aa29cd9
Use color_t for color values
2014-08-08 02:07:47 +00:00
Kp
ee4773d3ba
Use unique_ptr for menu
2014-08-07 02:58:00 +00:00
Kp
37f5aa7960
Use unique_ptr for MenuX
2014-08-07 02:57:39 +00:00
Kp
4acbb40ad7
Use enum for window event result
2014-08-07 02:47:48 +00:00
Kp
c1d184240d
Use unique_ptr to manage fonts
2014-07-22 23:48:23 +00:00
Kp
bd1c6d8c5d
Reduce header includes of physfsx.h
2014-07-22 23:48:23 +00:00
Kp
7552ceb259
Remove unused arguments
2014-07-16 03:24:40 +00:00
zico
ad7cb106bc
Changed custom D1X license to GPLv3
2014-06-01 19:55:23 +02:00
Kp
094dfbf3d4
Reduce header inclusions
2013-12-31 03:22:03 +00:00
Kp
073f00974a
Eliminate uses of the typedef struct X { ... } X; pattern
...
C++ does not require this pattern.
import re, fileinput
to = re.compile(r'^typedef struct ([a-z_A-Z]+)\s*{')
tc = re.compile(r'^}(.*?)\s*([a-z_A-Z]+);$')
osn = None
for line in fileinput.input(inplace=True):
m = to.match(line)
if m:
osn = m.group(1)
print 'struct %s\n{' % osn
continue
if osn:
m = tc.match(line)
if m:
csn = m.group(2)
if osn == csn:
print '}%s;' % m.group(1)
osn = None
continue
else:
osn = None
print line,
2013-12-28 22:48:07 +00:00
Kp
1e8036bd24
Split compiler.h for PCH compatibility
2013-12-21 05:12:38 +00:00
Kp
21cc89e2c8
Use ui_dputs_at instead of ui_dprintf_at where possible
2013-12-17 04:03:34 +00:00
Kp
be041a9cfc
Add type checking for ui_create_dialog
2013-12-17 03:49:24 +00:00
Kp
d1fa9ff7a6
Simplify setup for ui_messagebox_n
2013-12-15 21:54:59 +00:00
Kp
cea46651fc
Check type of window handler function
2013-12-15 18:51:26 +00:00
Kp
60727dd7d5
Add missing va_end calls
2013-12-07 18:42:50 +00:00
Kp
a2cec5d71f
Switch PHYSFSX_fgets to auto-sized variant where possible
2013-12-07 18:39:19 +00:00
Kp
91b57e52c3
Mark ui_messagebox button strings const
2013-12-06 00:24:07 +00:00
Kp
1d3395cad1
Improve strlen usage
2013-12-06 00:24:07 +00:00
Kp
be0e9f5162
Use d_strdup for ui_add_gadget_button
2013-12-05 00:10:35 +00:00
Kp
accaef2ecb
Remove unused REMOVE_EOL macro in keypad.cpp
...
It conflicts with pre-compiled headers.
2013-12-05 00:08:58 +00:00
Kp
2714679284
Mark private functions static
2013-11-02 04:23:55 +00:00
Kp
a6b1bd58a2
Use MALLOC consistently
2013-10-26 03:50:27 +00:00
Kp
f9899a9f20
Mark various functions static
2013-10-03 03:11:51 +00:00
Kp
aa9127e3c1
Enable -Wwrite-strings
2013-09-15 21:34:03 +00:00
Kp
df69df56dc
Remove unused common/ui/popup.cpp
2013-09-07 16:39:25 +00:00
Kp
2d964c414c
Remove unused strcins/strndel
2013-09-07 16:39:25 +00:00
Kp
a3883ab6ac
Move restore_state into #if 0
2013-09-07 16:39:10 +00:00
Kp
2cd7748e93
Convert vsprintf to vsnprintf
2013-08-09 01:58:17 +00:00
Kp
a01dbc59d6
Make ui_messagebox_n static
2013-08-09 01:56:34 +00:00
Kp
a881ee455e
Remove fix.h
2013-08-08 03:01:48 +00:00
Kp
c0c396b4fd
Move common/ui/userbox.c -> common/ui/userbox.cpp
2013-08-04 18:02:28 +00:00
Kp
227da67a8d
Move common/ui/uidraw.c -> common/ui/uidraw.cpp
2013-08-04 18:02:14 +00:00
Kp
1741f7ec57
Move common/ui/ui.c -> common/ui/ui.cpp
2013-08-04 18:01:59 +00:00
Kp
c6c82f44ba
Move common/ui/scroll.c -> common/ui/scroll.cpp
2013-08-04 18:01:45 +00:00
Kp
0a9e1a6e9a
Move common/ui/radio.c -> common/ui/radio.cpp
2013-08-04 18:01:31 +00:00
Kp
5c32819c39
Move common/ui/popup.c -> common/ui/popup.cpp
2013-08-04 18:01:17 +00:00
Kp
0b36b406d9
Move common/ui/message.c -> common/ui/message.cpp
2013-08-04 18:01:03 +00:00
Kp
3f696829fb
Move common/ui/menubar.c -> common/ui/menubar.cpp
2013-08-04 18:00:48 +00:00
Kp
fca8ac2012
Move common/ui/menu.c -> common/ui/menu.cpp
2013-08-04 18:00:34 +00:00
Kp
a9652f1b9b
Move common/ui/listbox.c -> common/ui/listbox.cpp
2013-08-04 18:00:20 +00:00
Kp
bf0498ab52
Move common/ui/keytrap.c -> common/ui/keytrap.cpp
2013-08-04 18:00:06 +00:00
Kp
11cb41d024
Move common/ui/keypress.c -> common/ui/keypress.cpp
2013-08-04 17:59:52 +00:00
Kp
1fdc080c17
Move common/ui/keypad.c -> common/ui/keypad.cpp
2013-08-04 17:59:37 +00:00
Kp
c2b11da77d
Move common/ui/inputbox.c -> common/ui/inputbox.cpp
2013-08-04 17:59:23 +00:00
Kp
a9a464ba65
Move common/ui/icon.c -> common/ui/icon.cpp
2013-08-04 17:59:09 +00:00
Kp
d66063497b
Move common/ui/gadget.c -> common/ui/gadget.cpp
2013-08-04 17:58:55 +00:00
Kp
80b86f3f0d
Move common/ui/file.c -> common/ui/file.cpp
2013-08-04 17:58:40 +00:00
Kp
ad2d064410
Move common/ui/dialog.c -> common/ui/dialog.cpp
2013-08-04 17:58:26 +00:00
Kp
66874d419e
Move common/ui/checkbox.c -> common/ui/checkbox.cpp
2013-08-04 17:58:12 +00:00
Kp
000774f49d
Move common/ui/button.c -> common/ui/button.cpp
2013-08-04 17:57:20 +00:00
Kp
4577dd3977
Merge branch 'd2x-rebirth/master' into unification/master
2013-07-21 21:34:46 +00:00
Kp
a1ba420031
Mark various parameters and variables as const
2013-07-20 23:12:24 +00:00
Kp
29ede4c86c
Move */ui/button.c -> common/ui/button.c
2013-03-03 01:03:33 +00:00
Kp
ac04f4b247
Move */ui/checkbox.c -> common/ui/checkbox.c
2013-03-03 01:03:33 +00:00
Kp
7ecbc5b123
Move */ui/dialog.c -> common/ui/dialog.c
2013-03-03 01:03:33 +00:00
Kp
08e8d0e499
Move */ui/file.c -> common/ui/file.c
2013-03-03 01:03:33 +00:00
Kp
b42de62167
Move */ui/gadget.c -> common/ui/gadget.c
2013-03-03 01:03:33 +00:00
Kp
8657a99491
Move */ui/icon.c -> common/ui/icon.c
2013-03-03 01:03:33 +00:00
Kp
345b90bf3f
Move */ui/inputbox.c -> common/ui/inputbox.c
2013-03-03 01:03:33 +00:00
Kp
091b287c82
Move */ui/keypad.c -> common/ui/keypad.c
2013-03-03 01:03:33 +00:00
Kp
64708c932f
Move */ui/keypress.c -> common/ui/keypress.c
2013-03-03 01:03:33 +00:00
Kp
60f0b1e557
Move */ui/keytrap.c -> common/ui/keytrap.c
2013-03-03 01:03:33 +00:00
Kp
a0a6f508a5
Move */ui/listbox.c -> common/ui/listbox.c
2013-03-03 01:03:33 +00:00
Kp
2ecc20143a
Move */ui/menu.c -> common/ui/menu.c
2013-03-03 01:03:33 +00:00
Kp
53ef9150ed
Move */ui/menubar.c -> common/ui/menubar.c
2013-03-03 01:03:33 +00:00
Kp
eea0add439
Move */ui/message.c -> common/ui/message.c
2013-03-03 01:03:33 +00:00
Kp
d07828f8d2
Move */ui/popup.c -> common/ui/popup.c
2013-03-03 01:03:33 +00:00
Kp
96c0c1f06b
Move */ui/radio.c -> common/ui/radio.c
2013-03-03 01:03:33 +00:00
Kp
2c67ea8f66
Move */ui/scroll.c -> common/ui/scroll.c
2013-03-03 01:03:33 +00:00
Kp
9c047e69c0
Move */ui/ui.c -> common/ui/ui.c
2013-03-03 01:03:33 +00:00
Kp
daa5fbf373
Move */ui/uidraw.c -> common/ui/uidraw.c
2013-03-03 01:03:33 +00:00
Kp
975df703a8
Move */ui/userbox.c -> common/ui/userbox.c
2013-03-03 01:03:33 +00:00