Commit graph

72 commits

Author SHA1 Message Date
Kp 99bbd0cf26 Mark global constants as constexpr
s/^const \([^*]*=.*;\)/constexpr \1/
2016-07-23 04:10:42 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +00:00
Kp 81da15382b Remove useless cast in scanline 2016-07-15 03:43:02 +00:00
Kp 59750d3c29 Rewrite declarations of ubyte * to standard uint8_t * 2016-07-14 01:59:02 +00:00
Kp b0a2205a4e Convert various pointer casts to reinterpret_cast 2016-07-06 01:54:24 +00:00
Kp 275355994d Remove useless scanline casts 2016-07-06 01:54:24 +00:00
Kp efce2e50dc Rewrite simple integer casts from C style to static_cast<>
s/(\s*\(u\?int[[:digit:]]\+_t\s*\)\s*)\s*(/static_cast<\1>(/g
2016-07-03 00:54:15 +00:00
Kp 89ddc1b911 Add parentheses around casts of simple array subscripts
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*\(\(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(\5\6\7\8)\9/g
2016-06-25 23:21:36 +00:00
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 0cb099c5e4 Add parentheses around casts of simple function calls
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.

Exclude float|double from the second substitution.  Including it
rewrites medmisc.cpp in an incorrect way, and excluding it does not
exclude any valid rewrites.

s/(\(int\|signed\|float\|double\|long\|short\|unsigned\))\s*\(\w\+\s*(\s*\w\+\s*)\)/(\1)(\2)/
s/(\((\(int\|signed\|long\|short\|unsigned\))(\w\+\s*(\s*\w\+\s*))\))/\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 17d71ee0ae Rewrite cast of (uint) to standard type uint32_t
s/(uint)\s*\(\w\)/(uint32_t) \1/g
2016-06-12 03:45:37 +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 4324ed3771 Fix scanline casts when sizeof(size_t) is not sizeof(void*) 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 b31446340c Rewrite cast of (ubyte*) to standard type uint8_t
s/(\s*ubyte\s*\*\s*)/(uint8_t *)/g
2016-06-05 01:04:25 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp f4e1ebb576 Remove unnecessary gr_setcolor calls 2016-02-12 04:02:28 +00:00
Kp 6b9a03cf2d Pass color to gr_upoly_tmap 2016-02-12 04:02:28 +00:00
Kp 61821d0b42 Pass color to gr_upoly_tmap_ylr 2016-02-12 04:02:28 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp e784fd96fa Use inline namespace dcx for common/texmap 2015-12-05 22:57:24 +00:00
Kp 43dd620557 Use inline namespace dcx for common/3d 2015-12-05 22:57:24 +00:00
Kp 6210d1008b Add if !OGL to SDL-only functions 2015-12-04 03:36:31 +00:00
Kp ccee595321 Remove Interpolation_method from OGL build 2015-11-06 03:51:10 +00:00
Kp cf9f777187 Simplify select_tmap
Remove unreachable nullptr case.  Use case-sensitive comparison.  Remove
unsupported entry i386 from documentation.
2015-10-21 02:45:44 +00:00
Kp 720cc9db98 Move tmap scanline pointers to structure 2015-07-25 23:10:47 +00:00
Kp 1738870b22 Make some c_tmap scanline functions static 2015-07-25 23:10:47 +00:00
Kp 3905f1a668 Enable -Wcast-qual 2015-06-13 22:42:21 +00:00
Bradley Bell bdacd2f7d7 change u_int*_t to C99 standard uint*_t 2015-05-18 17:12:53 -07:00
Kp 9f6cbbe0e0 Move Vertex_list to local scope 2015-03-11 02:19:15 +00:00
Kp 492d6fd996 Remove draw_tmap from OGL build
It is only used as a placeholder.  Replace it with a number.

Compile out various non-OGL functions when building for OGL.
2015-01-22 03:34:20 +00:00
Kp bf3bb0b144 Pass uint_fast32_t nverts for texture drawers 2015-01-20 02:46:42 +00:00
Kp 2c2b6c67d2 Use array<> for g3ds_tmap::verts 2014-12-13 17:46:55 +00:00
Kp f91a378f6e Remove write-only per2_flag 2014-12-11 02:34:13 +00:00
Kp 4cadc18e52 Pass merge_textures_new arg by & 2014-11-30 22:09:18 +00:00
Kp 634f97e8d2 Pass tmap drawer grs_bitmap by & 2014-11-30 22:09:18 +00:00
Kp dd4a0db47f Pass rle_expand_texture arg as const & 2014-11-30 22:09:17 +00:00
Kp 6ac655ec53 Pass various texture mapping args by & 2014-11-30 22:09:17 +00:00
Kp 2c07191681 Pass ntexture_map_lighted_linear arg by const & 2014-11-30 22:09:17 +00:00
Kp c3ce8fe9e6 Move Mike's temporary texture onto stack 2014-11-16 19:14:50 +00:00
Kp 11769c5fc0 Pass draw_tmap* arg as const 2014-11-16 19:14:50 +00:00
Kp 84fd2b027a Clip tmap p3_z locally 2014-11-16 19:14:50 +00:00
Kp 18e4ca1b2c Fix SDL build after for propagation 2014-11-11 04:21:57 +00:00
Kp 3067419dab Switch texture map y->boty
y is always equal to boty, but y will be limited to loop scope
2014-09-29 03:22:21 +00:00
Kp 53bb4d8bb1 Propagate for variables in common/texmap/ntmap.cpp 2014-09-29 03:22:02 +00:00
Kp f744b53cc2 Propagate for variables in common/texmap/tmapflat.cpp 2014-09-26 02:42:15 +00:00
Kp 04b75b979a Propagate for variables in common/texmap/scanline.cpp 2014-09-26 02:42:15 +00:00
Kp 703f60ac3f Fix -Wtype-limits warnings 2014-09-21 21:41:55 +00:00