Commit graph

41 commits

Author SHA1 Message Date
Kp b2f744f1f8 Remove unnecessary diminish_palette in pcx_write_bitmap
The variable is never read after that diminish_palette call, whether in
pcx_write_bitmap or in its sole caller.
2016-10-02 00:34:49 +00:00
Kp e11ac102a6 Cache bitmap properties in pcx_write_bitmap 2016-10-02 00:34:49 +00:00
Kp 6dc16bf468 Remove useless cast in similar/2d/pcx.cpp 2016-08-17 04:44:22 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +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 c00f918a8e Propagate bm_mode::linear into bald_guy_load 2016-05-28 17:31:26 +00:00
Kp 3fb16c1d7a Propagate bm_mode::linear into pcx_read_bitmap 2016-05-28 17:31:26 +00:00
Kp 398596c468 Use enum for bitmap mode 2016-05-28 17:31:26 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +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 26e948d5f1 Uninline namespace dsx 2015-12-13 18:00:49 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp 85d7c495e8 Use inline namespace dsx for similar/2d 2015-12-13 18:00:48 +00:00
Kp c942d28197 Use accessor for grs_bitmap::bm_type 2015-07-25 23:10:47 +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 99a4a0ed62 Capture range_for by-value temporaries as const
Modifying a by-value temporary does not affect the underlying container,
so modifying it is almost always a bug.  Require use of a by-reference
capture when modification is desired.

sed -i -e 's/range_for\s*(\s*\(const\s\+\)\?auto\s\+\([[:alpha:]_]\)/range_for (const auto \2/g'
2015-02-05 03:03:49 +00:00
Kp 93589368c9 Move PHYSFSX_putc to the one file that uses it 2015-01-29 04:27:36 +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 49bf64c9b6 Use range_for in pcx_encode_line 2015-01-20 02:46: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 95539512d5 Pass pcx_read_bitmap arg by & 2014-12-02 03:35:01 +00:00
Kp 5eddc2c197 Make bitmap bm_data const where easy 2014-12-02 03:24:38 +00:00
Kp 0e63b3c300 Pass pcx_encode_line input as const 2014-11-30 22:09:22 +00:00
Kp 2697918223 Pass gr_bm_pixel arg by & 2014-11-30 22:09:22 +00:00
Kp f6dde1c593 Pass gr_init_bitmap_alloc arg by & 2014-11-30 22:09:21 +00:00
Kp 703f60ac3f Fix -Wtype-limits warnings 2014-09-21 21:41:55 +00:00
Kp e63e46f8f0 List initialize PCX header 2014-07-04 03:46:40 +00:00
Kp 048d4bcc8f List initialize bitmap 2014-07-04 03:45:35 +00:00
zico ad7cb106bc Changed custom D1X license to GPLv3 2014-06-01 19:55:23 +02: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 b1c5307eb1 Use array for palette_array_t 2013-12-22 00:37:36 +00:00
Kp e9f9cb676f Centralize palette utilities 2013-12-22 00:05:13 +00:00
Kp a3d66a3b37 Add typedef palette_array_t for palette data 2013-12-22 00:05:13 +00:00
Kp 1e8036bd24 Split compiler.h for PCH compatibility 2013-12-21 05:12:38 +00:00
Kp 3b9b5ebfb0 Use RAII to manage function-local heap objects 2013-12-08 19:04:52 +00:00
Kp f6125b5f2d Fix array overstep on invalid PCX error number 2013-12-07 18:41:40 +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 4d026f8b69 Move similar/2d/pcx.c -> similar/2d/pcx.cpp 2013-10-01 02:53:09 +00:00
Renamed from similar/2d/pcx.c (Browse further)