Codechange: Silence -Wclass-memaccess warnings with GCC8

save_ext
Charles Pigott 6 years ago committed by frosch
parent e1b9187e9b
commit 5f86e1a390

@ -90,7 +90,7 @@ public:
{
_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--;
}

@ -378,8 +378,7 @@ bool SQVM::StartCall(SQClosure *closure,SQInteger target,SQInteger args,SQIntege
}
if (!tailcall) {
CallInfo lc;
memset(&lc, 0, sizeof(lc));
CallInfo lc = {};
lc._generator = NULL;
lc._etraps = 0;
lc._prevstkbase = (SQInt32) ( stackbase - _stackbase );
@ -1159,8 +1158,7 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
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;

@ -40,8 +40,6 @@
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;

@ -361,7 +361,7 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
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 */

@ -125,7 +125,7 @@ static inline T *ReallocT(T *t_ptr, size_t num_elements)
/* 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;
}

@ -696,9 +696,10 @@ static void CompaniesGenStatistics()
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++;

@ -1080,8 +1080,7 @@ static uint River_Hash(uint tile, uint dir)
*/
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;

@ -96,7 +96,9 @@ uint ObjectSpec::Index() const
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));

@ -498,7 +498,6 @@ 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 */

Loading…
Cancel
Save