Fix: GCC9's warnings about deprecated implicit assignment operators

This commit is contained in:
Charles Pigott 2019-06-29 19:58:30 +01:00
parent acf0242961
commit 71a3e83468
6 changed files with 17 additions and 51 deletions

View File

@ -20,12 +20,6 @@ struct SQOuterVar
_src=src;
_type=t;
}
SQOuterVar(const SQOuterVar &ov)
{
_type=ov._type;
_src=ov._src;
_name=ov._name;
}
SQOuterType _type;
SQObjectPtr _name;
SQObjectPtr _src;
@ -34,13 +28,6 @@ struct SQOuterVar
struct SQLocalVarInfo
{
SQLocalVarInfo():_start_op(0),_end_op(0), _pos(0){}
SQLocalVarInfo(const SQLocalVarInfo &lvi)
{
_name=lvi._name;
_start_op=lvi._start_op;
_end_op=lvi._end_op;
_pos=lvi._pos;
}
SQObjectPtr _name;
SQUnsignedInteger _start_op;
SQUnsignedInteger _end_op;

View File

@ -12,9 +12,8 @@
void sq_base_register(HSQUIRRELVM v);
struct SQExceptionTrap{
SQExceptionTrap() {}
SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target){ _stacksize = ss; _stackbase = stackbase; _ip = ip; _extarget = ex_target;}
SQExceptionTrap(const SQExceptionTrap &et) { (*this) = et; }
SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target)
: _stackbase(stackbase), _stacksize(ss), _ip(ip), _extarget(ex_target) {}
SQInteger _stackbase;
SQInteger _stacksize;
SQInstruction *_ip;

View File

@ -72,9 +72,11 @@ static WindowDesc _errmsg_face_desc(
* Copy the given data into our instance.
* @param data The data to copy.
*/
ErrorMessageData::ErrorMessageData(const ErrorMessageData &data)
ErrorMessageData::ErrorMessageData(const ErrorMessageData &data) :
duration(data.duration), textref_stack_grffile(data.textref_stack_grffile), textref_stack_size(data.textref_stack_size),
summary_msg(data.summary_msg), detailed_msg(data.detailed_msg), position(data.position), face(data.face)
{
*this = data;
memcpy(this->textref_stack, data.textref_stack, sizeof(this->textref_stack));
for (size_t i = 0; i < lengthof(this->strings); i++) {
if (this->strings[i] != nullptr) {
this->strings[i] = stredup(this->strings[i]);

View File

@ -91,15 +91,6 @@ public:
this->SetPort(port);
}
/**
* Make a clone of another address
* @param address the address to clone
*/
NetworkAddress(const NetworkAddress &address)
{
memcpy(this, &address, sizeof(*this));
}
const char *GetHostname();
void GetAddressAsString(char *buffer, const char *last, bool with_family = true);
const char *GetAddressAsString(bool with_family = true);

View File

@ -18,6 +18,10 @@
*/
#include "stdafx.h"
#include <algorithm>
#include <array>
#include "newgrf.h"
#include "strings_func.h"
#include "newgrf_storage.h"
@ -812,22 +816,14 @@ void CleanUpStrings()
}
struct TextRefStack {
byte stack[0x30];
std::array<byte, 0x30> stack;
byte position;
const GRFFile *grffile;
bool used;
TextRefStack() : position(0), grffile(nullptr), used(false) {}
TextRefStack(const TextRefStack &stack) :
position(stack.position),
grffile(stack.grffile),
used(stack.used)
{
memcpy(this->stack, stack.stack, sizeof(this->stack));
}
uint8 PopUnsignedByte() { assert(this->position < lengthof(this->stack)); return this->stack[this->position++]; }
uint8 PopUnsignedByte() { assert(this->position < this->stack.size()); return this->stack[this->position++]; }
int8 PopSignedByte() { return (int8)this->PopUnsignedByte(); }
uint16 PopUnsignedWord()
@ -865,9 +861,8 @@ struct TextRefStack {
if (this->position >= 2) {
this->position -= 2;
} else {
for (int i = lengthof(stack) - 1; i >= this->position + 2; i--) {
this->stack[i] = this->stack[i - 2];
}
// Rotate right 2 positions
std::rotate(this->stack.rbegin(), this->stack.rbegin() + 2, this->stack.rend());
}
this->stack[this->position] = GB(word, 0, 8);
this->stack[this->position + 1] = GB(word, 8, 8);
@ -939,12 +934,12 @@ void StartTextRefStackUsage(const GRFFile *grffile, byte numEntries, const uint3
_newgrf_textrefstack.ResetStack(grffile);
byte *p = _newgrf_textrefstack.stack;
auto stack_it = _newgrf_textrefstack.stack.begin();
for (uint i = 0; i < numEntries; i++) {
uint32 value = values != nullptr ? values[i] : _temp_store.GetValue(0x100 + i);
for (uint j = 0; j < 32; j += 8) {
*p = GB(value, j, 8);
p++;
*stack_it = GB(value, j, 8);
stack_it++;
}
}
}

View File

@ -47,14 +47,6 @@ protected:
this->tile_type = GetTileType(tile);
this->rail_type = GetTileRailType(tile);
}
TILE(const TILE &src)
{
tile = src.tile;
td = src.td;
tile_type = src.tile_type;
rail_type = src.rail_type;
}
};
protected: