Commit graph

94 commits

Author SHA1 Message Date
Kp c5d154b6e0 Switch ignorecase.cpp to C++ static_cast 2016-09-04 00:02:52 +00:00
Kp 0c43357d85 Move HMP->MIDI magic numbers into magic_header[]
This removes some useless casts from the serializer.
2016-08-19 03:41:40 +00:00
Kp 59750d3c29 Rewrite declarations of ubyte * to standard uint8_t * 2016-07-14 01:59:02 +00:00
Kp 0bed5d4727 Rewrite simple HMIDIOUT casts from C style to reinterpret_cast<>
s/(\(HMIDIOUT\))(/reinterpret_cast<\1>(/g
2016-07-08 04:14:59 +00:00
Kp 95d3a9d31c Rewrite simple DWORD casts from C style to static_cast<>
s/(\(DWORD\))(/static_cast<\1>(/g
2016-07-08 04:14:59 +00:00
Kp c8e8c568ff Add parentheses around target of simple HMIDIOUT casts
s/(\s*HMIDIOUT\s*)\s*\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/(HMIDIOUT)(\1\2\3)\4/g
2016-07-08 04:14:58 +00:00
Kp 2bc994e673 Add parentheses around target of simple DWORD casts
s/(\s*DWORD\s*)\s*\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/(DWORD)(\1\2\3)\4/g
2016-07-08 04:14:58 +00:00
Kp 59fb7fa4cb Convert hmp casts from C style to reinterpret_cast<> 2016-07-07 03:08:13 +00:00
Kp b0a2205a4e Convert various pointer casts to reinterpret_cast 2016-07-06 01:54:24 +00:00
Kp b35a893d9a Rewrite simple pointer casts from C style to reinterpret_cast<>
s/(\s*\(\w\+\s*\*\+\)\s*)\s*(/reinterpret_cast<\1>(/g
2016-07-03 00:54:15 +00:00
Kp 19f31eb420 Rewrite simple pointer casts from C style to reinterpret_cast<>
This pass only targets int8_t and uint8_t.

s/(\s*\(u\?int8_t\s*\*\+\)\s*)\s*(/reinterpret_cast<\1>(/g
2016-07-03 00:54:14 +00:00
Kp a7ceee3c03 Add parentheses around target of simple unsigned char 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 simple C casts.

s/(\s*unsigned\s\+char\s*\(\*\+\)\s*)\s*\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/(uint8_t \1)(\2\3\4)\5/g
2016-07-03 00:54:14 +00:00
Kp c7953a3df1 Fix Win32 use of static_cast where reinterpret_cast is needed 2016-07-02 02:04:11 +00:00
Kp 231223895d Rewrite simple pointer casts from C style to reinterpret_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*)\s*(/reinterpret_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp b282bea173 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-05 01:04:26 +00:00
Kp 7fdce88558 Add parentheses around target of simple 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 simple C casts.

This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets.  It also works only on commonly used standard types.

	(int) a->b;	// changed
	(int) a[b];	// not changed

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*[^>]\)\)/\1(\5\6\7)\8/g
2016-06-05 01:04:25 +00:00
Kp 73b7905125 Fix -Wshadow warning in get_event (Windows only)
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/200>
2016-06-01 01:52:45 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp 1a4290002e Revert partial_const_range for HMP get_event
Fixes: b57f08c798 ("Use partial_const_range")
2016-02-17 03:34:30 +00:00
Kp b57f08c798 Use partial_const_range 2016-02-12 04:02:28 +00:00
Kp 86709f547b Fix capitalization of PHYSFS_File
Per comment in physfs.h, the spelling PHYSFS_file is deprecated.
Replace all instances with PHYSFS_File.
2016-01-09 16:38:14 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp 5b9e50a815 Use inline namespace dcx for common/misc 2015-12-05 22:57:24 +00:00
Kp dad504cfef Fix some -Wshadow warnings 2015-11-26 02:56:54 +00:00
Kp 3ceefb4189 Pass filename to Error 2015-10-11 22:21:00 +00:00
Kp 1d99084026 Use UserError when main hog is missing
Error traps to the debugger and then aborts, which is not appropriate
for a user setup error.
2015-10-09 02:46:11 +00:00
Kp a58e8f87a0 Move similar/misc/hash.cpp -> common/misc/hash.cpp 2015-07-18 21:01:56 +00:00
Kp 968cdbecf4 Add non-aborting UserError for user-caused fatal errors 2015-06-16 03:15:40 +00:00
Kp ce72014e2e Always parse WORDS_BIGENDIAN and !WORDS_BIGENDIAN 2015-06-13 22:42:21 +00:00
Kp 64ee9e0047 Improve memdebug d_strdup trace 2015-06-11 03:06:58 +00:00
Kp fc4b686d9d Store PHYSFS_list element count in list when needed 2015-05-09 17:38:57 +00:00
Kp 6792c1bc4b Enable -Wunused-parameter 2015-04-26 20:15:56 +00:00
Kp c3925353fd Use null_sentinel_iterator for PHYSFS_list_t 2015-04-26 20:15:51 +00:00
Kp 84c638ed64 Move PHYSFS_list_t to separate header 2015-04-19 04:18:49 +00:00
Kp 150e2d2686 Convert local arrays to array<> 2015-04-19 04:18:49 +00:00
Kp 3e520afc89 Reduce size of hmp_open buffer 2015-04-19 04:18:49 +00:00
Kp 66a70fd373 Prepare for global arrays to be array<> 2015-04-02 02:36:52 +00:00
Kp 08f6ad4bc7 Enable nested INI files 2015-03-22 18:49:21 +00:00
Kp ae0a00a893 Return timer_query() from timer_update()
Most timer_update sites immediately query the timer, so return it to
save them the call.
2015-02-05 03:03:48 +00:00
Kp 18a64e4281 Use RAII for PHYSFS_enumerateFiles result 2015-01-23 03:55:05 +00:00
Kp 705777db05 Reduce searches in locateOneElement 2015-01-23 03:55:05 +00:00
Kp b3050a8aa1 Fix adding string to empty string_array_t 2015-01-17 18:31:42 +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 484a2a705d Use strcasecmp when available 2015-01-12 00:26:03 +00:00
Kp 205b533c67 Fix d_strnicmp with zero length input 2015-01-11 05:08:30 +00:00
Kp 2b2da39d84 Fix unique invocation in string_array_t tidy 2014-12-20 04:36:11 +00:00
Kp 6e24954a97 Mark warn_printf static 2014-12-13 04:10:58 +00:00
Kp c6043419e9 Use std::abort in Error
Error is called for fatal errors.  Use std::abort to get a core dump.
2014-12-11 02:38:19 +00:00
Kp a2703177b9 Move Error Int3 to after printing the message 2014-12-09 01:10:24 +00:00
Kp 2ad59572e0 Use vector to manage string array memory 2014-09-29 00:02:43 +00:00