PVS: V794 The assignment operator should be protected from the case of 'this == ...'

This commit is contained in:
wmayer
2019-03-13 12:38:46 +01:00
parent 51811e4bf4
commit f611102db3
3 changed files with 11 additions and 0 deletions

View File

@@ -65,6 +65,9 @@ Toolpath::~Toolpath()
Toolpath &Toolpath::operator=(const Toolpath& otherPath)
{
if (this == &otherPath)
return *this;
clear();
vpcCommands.resize(otherPath.vpcCommands.size());
int i = 0;

View File

@@ -34,6 +34,8 @@ namespace geoff_geometry {
const SpanVertex& SpanVertex::operator= (const SpanVertex& spv ){
///
if (this == &spv)
return *this;
memcpy(x, spv.x, SPANSTORAGE * sizeof(double));
memcpy(y, spv.y, SPANSTORAGE * sizeof(double));
@@ -430,6 +432,9 @@ namespace geoff_geometry {
}
const Kurve& Kurve::operator=( const Kurve &k) {
if (this == &k)
return *this;
memcpy(e, k.e, 16 * sizeof(double));
m_unit = k.m_unit;
m_mirrored = k.m_mirrored;

View File

@@ -81,6 +81,9 @@ Trajectory::~Trajectory()
Trajectory &Trajectory::operator=(const Trajectory& Trac)
{
if (this == &Trac)
return *this;
for(std::vector<Waypoint*>::iterator it = vpcWaypoints.begin();it!=vpcWaypoints.end();++it)
delete ( *it );
vpcWaypoints.clear();