Changeset - r22935:dd88c75e2001
[Not reviewed]
master
0 9 0
Charles Pigott - 6 years ago 2018-05-13 17:34:57
charlespigott@googlemail.com
Codechange: Silence -Wclass-memaccess warnings with GCC8
9 files changed with 12 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/squirrel/squirrel/squtils.h
Show inline comments
 
@@ -87,13 +87,13 @@ public:
 
    	_vals[idx] = val;
 
	}
 
	void remove(SQUnsignedInteger idx)
 
	{
 
		_vals[idx].~T();
 
		if(idx < (_size - 1)) {
 
			memmove(&_vals[idx], &_vals[idx+1], sizeof(T) * (_size - (size_t)idx - 1));
 
			memmove(static_cast<void *>(&_vals[idx]), &_vals[idx+1], sizeof(T) * (_size - (size_t)idx - 1));
 
		}
 
		_size--;
 
	}
 
	SQUnsignedInteger capacity() { return _allocated; }
 
	inline T &back() const { return _vals[_size - 1]; }
 
	inline T& operator[](SQUnsignedInteger pos) const{ assert(pos < _allocated); return _vals[pos]; }
src/3rdparty/squirrel/squirrel/sqvm.cpp
Show inline comments
 
@@ -375,14 +375,13 @@ bool SQVM::StartCall(SQClosure *closure,
 

	
 
	if(type(closure->_env) == OT_WEAKREF) {
 
		_stack._vals[stackbase] = _weakref(closure->_env)->_obj;
 
	}
 

	
 
	if (!tailcall) {
 
		CallInfo lc;
 
		memset(&lc, 0, sizeof(lc));
 
		CallInfo lc = {};
 
		lc._generator = NULL;
 
		lc._etraps = 0;
 
		lc._prevstkbase = (SQInt32) ( stackbase - _stackbase );
 
		lc._target = (SQInt32) target;
 
		lc._prevtop = (SQInt32) (_top - _stackbase);
 
		lc._ncalls = 1;
 
@@ -1156,14 +1155,13 @@ bool SQVM::CallNative(SQNativeClosure *n
 
	if ((_top + MIN_STACK_OVERHEAD) > (SQInteger)_stack.size()) {
 
		_stack.resize(_stack.size() + (MIN_STACK_OVERHEAD<<1));
 
	}
 
	SQInteger oldtop = _top;
 
	SQInteger oldstackbase = _stackbase;
 
	_top = stackbase + nargs;
 
	CallInfo lci;
 
	memset(&lci, 0, sizeof(lci));
 
	CallInfo lci = {};
 
	lci._closure = nclosure;
 
	lci._generator = NULL;
 
	lci._etraps = 0;
 
	lci._prevstkbase = (SQInt32) (stackbase - _stackbase);
 
	lci._ncalls = 1;
 
	lci._prevtop = (SQInt32) (oldtop - oldstackbase);
src/base_media_func.h
Show inline comments
 
@@ -37,14 +37,12 @@
 
 * @param allow_empty_filename empty filenames are valid
 
 * @return true if loading was successful.
 
 */
 
template <class T, size_t Tnum_files, bool Tsearch_in_tars>
 
bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool allow_empty_filename)
 
{
 
	memset(this, 0, sizeof(*this));
 

	
 
	IniGroup *metadata = ini->GetGroup("metadata");
 
	IniItem *item;
 

	
 
	fetch_metadata("name");
 
	this->name = stredup(item->value);
 

	
src/blitter/32bpp_anim.cpp
Show inline comments
 
@@ -358,13 +358,13 @@ void Blitter_32bppAnim::CopyFromBuffer(v
 

	
 
	for (; height > 0; height--) {
 
		/* We need to keep those for palette animation. */
 
		Colour *dst_pal = dst;
 
		uint16 *anim_pal = anim_line;
 

	
 
		memcpy(dst, usrc, width * sizeof(uint32));
 
		memcpy(static_cast<void *>(dst), usrc, width * sizeof(uint32));
 
		usrc += width;
 
		dst += _screen.pitch;
 
		/* Copy back the anim-buffer */
 
		memcpy(anim_line, usrc, width * sizeof(uint16));
 
		usrc = (const uint32 *)((const uint16 *)usrc + width);
 
		anim_line += this->anim_buf_pitch;
src/core/alloc_func.hpp
Show inline comments
 
@@ -122,13 +122,13 @@ static inline T *ReallocT(T *t_ptr, size
 
		return NULL;
 
	}
 

	
 
	/* Ensure the size does not overflow. */
 
	CheckAllocationConstraints<T>(num_elements);
 

	
 
	t_ptr = (T*)realloc(t_ptr, num_elements * sizeof(T));
 
	t_ptr = (T*)realloc(static_cast<void *>(t_ptr), num_elements * sizeof(T));
 
	if (t_ptr == NULL) ReallocError(num_elements * sizeof(T));
 
	return t_ptr;
 
}
 

	
 
/** alloca() has to be called in the parent function, so define AllocaM() as a macro */
 
#define AllocaM(T, num_elements) \
src/economy.cpp
Show inline comments
 
@@ -693,15 +693,16 @@ static void CompaniesGenStatistics()
 
	cur_company.Restore();
 

	
 
	/* Only run the economic statics and update company stats every 3rd month (1st of quarter). */
 
	if (!HasBit(1 << 0 | 1 << 3 | 1 << 6 | 1 << 9, _cur_month)) return;
 

	
 
	FOR_ALL_COMPANIES(c) {
 
		memmove(&c->old_economy[1], &c->old_economy[0], sizeof(c->old_economy) - sizeof(c->old_economy[0]));
 
		/* Drop the oldest history off the end */
 
		std::copy_backward(c->old_economy, c->old_economy + MAX_HISTORY_QUARTERS - 1, c->old_economy + MAX_HISTORY_QUARTERS);
 
		c->old_economy[0] = c->cur_economy;
 
		memset(&c->cur_economy, 0, sizeof(c->cur_economy));
 
		c->cur_economy = {};
 

	
 
		if (c->num_valid_stat_ent != MAX_HISTORY_QUARTERS) c->num_valid_stat_ent++;
 

	
 
		UpdateCompanyRatingAndValue(c, true);
 
		if (c->block_preview != 0) c->block_preview--;
 
	}
src/landscape.cpp
Show inline comments
 
@@ -1077,14 +1077,13 @@ static uint River_Hash(uint tile, uint d
 
 * Actually build the river between the begin and end tiles using AyStar.
 
 * @param begin The begin of the river.
 
 * @param end The end of the river.
 
 */
 
static void BuildRiver(TileIndex begin, TileIndex end)
 
{
 
	AyStar finder;
 
	MemSetT(&finder, 0);
 
	AyStar finder = {};
 
	finder.CalculateG = River_CalculateG;
 
	finder.CalculateH = River_CalculateH;
 
	finder.GetNeighbours = River_GetNeighbours;
 
	finder.EndNodeCheck = River_EndNodeCheck;
 
	finder.FoundEndNode = River_FoundEndNode;
 
	finder.user_target = &end;
src/newgrf_object.cpp
Show inline comments
 
@@ -93,13 +93,15 @@ uint ObjectSpec::Index() const
 
}
 

	
 
/** This function initialize the spec arrays of objects. */
 
void ResetObjects()
 
{
 
	/* Clean the pool. */
 
	MemSetT(_object_specs, 0, lengthof(_object_specs));
 
	for (uint16 i = 0; i < NUM_OBJECTS; i++) {
 
		_object_specs[i] = {};
 
	}
 

	
 
	/* And add our originals. */
 
	MemCpyT(_object_specs, _original_objects, lengthof(_original_objects));
 

	
 
	for (uint16 i = 0; i < lengthof(_original_objects); i++) {
 
		_object_specs[i].grf_prop.local_id = i;
src/saveload/company_sl.cpp
Show inline comments
 
@@ -495,13 +495,12 @@ static void Load_PLYR()
 

	
 
static void Check_PLYR()
 
{
 
	int index;
 
	while ((index = SlIterateArray()) != -1) {
 
		CompanyProperties *cprops = new CompanyProperties();
 
		memset(cprops, 0, sizeof(*cprops));
 
		SaveLoad_PLYR_common(NULL, cprops);
 

	
 
		/* We do not load old custom names */
 
		if (IsSavegameVersionBefore(84)) {
 
			if (GetStringTab(cprops->name_1) == TEXT_TAB_OLD_CUSTOM) {
 
				cprops->name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
0 comments (0 inline, 0 general)