diff --git a/src/libs/vdxf/dxflib/dl_creationinterface.h b/src/libs/vdxf/dxflib/dl_creationinterface.h index f2ad0c1b0..e5c980eea 100644 --- a/src/libs/vdxf/dxflib/dl_creationinterface.h +++ b/src/libs/vdxf/dxflib/dl_creationinterface.h @@ -65,7 +65,10 @@ public: extrusion = L.extrusion; attributes = L.attributes; - return *this; + if ( &L == this ) + { + return *this; + } } /** diff --git a/src/libs/vdxf/dxflib/dl_dxf.cpp b/src/libs/vdxf/dxflib/dl_dxf.cpp index f6f2ff402..c25dc359f 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.cpp +++ b/src/libs/vdxf/dxflib/dl_dxf.cpp @@ -43,26 +43,26 @@ DL_Dxf::DL_Dxf() : version(DL_VERSION_2000), polylineLayer(), - vertices(NULL), + vertices(nullptr), maxVertices(0), vertexIndex(0), - knots(NULL), + knots(nullptr), maxKnots(0), knotIndex(0), - weights(NULL), + weights(nullptr), weightIndex(0), - controlPoints(NULL), + controlPoints(nullptr), maxControlPoints(0), controlPointIndex(0), - fitPoints(NULL), + fitPoints(nullptr), maxFitPoints(0), fitPointIndex(0), - leaderVertices(NULL), + leaderVertices(nullptr), maxLeaderVertices(0), leaderVertexIndex(0), @@ -80,27 +80,27 @@ DL_Dxf::DL_Dxf() */ DL_Dxf::~DL_Dxf() { - if (vertices!=NULL) + if (vertices!=nullptr) { delete[] vertices; } - if (knots!=NULL) + if (knots!=nullptr) { delete[] knots; } - if (controlPoints!=NULL) + if (controlPoints!=nullptr) { delete[] controlPoints; } - if (fitPoints!=NULL) + if (fitPoints!=nullptr) { delete[] fitPoints; } - if (weights!=NULL) + if (weights!=nullptr) { delete[] weights; } - if (leaderVertices!=NULL) + if (leaderVertices!=nullptr) { delete[] leaderVertices; } @@ -1617,7 +1617,7 @@ bool DL_Dxf::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/) maxVertices = toInt(groupValue); if (maxVertices>0) { - if (vertices!=NULL) + if (vertices!=nullptr) { delete[] vertices; } @@ -1673,7 +1673,7 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/) maxKnots = toInt(groupValue); if (maxKnots>0) { - if (knots!=NULL) + if (knots!=nullptr) { delete[] knots; } @@ -1693,11 +1693,11 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/) maxControlPoints = toInt(groupValue); if (maxControlPoints>0) { - if (controlPoints!=NULL) + if (controlPoints!=nullptr) { delete[] controlPoints; } - if (weights!=NULL) + if (weights!=nullptr) { delete[] weights; } @@ -1722,7 +1722,7 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/) maxFitPoints = toInt(groupValue); if (maxFitPoints>0) { - if (fitPoints!=NULL) + if (fitPoints!=nullptr) { delete[] fitPoints; } @@ -1812,7 +1812,7 @@ bool DL_Dxf::handleLeaderData(DL_CreationInterface* /*creationInterface*/) maxLeaderVertices = toInt(groupValue); if (maxLeaderVertices>0) { - if (leaderVertices!=NULL) + if (leaderVertices!=nullptr) { delete[] leaderVertices; } @@ -2279,7 +2279,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface) } return true; default: - return true; + return false; } } else @@ -2303,7 +2303,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface) hatchEdge.defined = true; return true; default: - return true; + return false; } } @@ -2332,7 +2332,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface) hatchEdge.defined = true; return true; default: - return true; + return false; } } @@ -2367,7 +2367,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface) hatchEdge.defined = true; return true; default: - return true; + return false; } } @@ -2449,7 +2449,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface) hatchEdge.endTangentY = toReal(groupValue); return true; default: - return true; + return false; } } } diff --git a/src/libs/vdxf/dxflib/dl_dxf.h b/src/libs/vdxf/dxflib/dl_dxf.h index f9a2d3456..460b5e61b 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.h +++ b/src/libs/vdxf/dxflib/dl_dxf.h @@ -210,7 +210,10 @@ public: appDictionaryHandle = L.appDictionaryHandle; styleHandleStd = L.styleHandleStd; - return *this; + if ( &L == this ) + { + return *this; + } } bool in(const std::string& file, diff --git a/src/libs/vdxf/dxflib/dl_entities.h b/src/libs/vdxf/dxflib/dl_entities.h index fb546cbb9..83a188e31 100644 --- a/src/libs/vdxf/dxflib/dl_entities.h +++ b/src/libs/vdxf/dxflib/dl_entities.h @@ -95,7 +95,7 @@ struct DXFLIB_EXPORT DL_LinetypeData int flags, int numberOfDashes, double patternLength, - double* pattern = NULL + double* pattern = nullptr ) : name(name), description(description), @@ -129,7 +129,10 @@ struct DXFLIB_EXPORT DL_LinetypeData patternLength = L.patternLength; pattern = L.pattern; - return *this; + if ( &L == this ) + { + return *this; + } } /** Linetype name */ @@ -1279,7 +1282,7 @@ struct DXFLIB_EXPORT DL_DimOrdinateData DL_DimOrdinateData(double ddpx1, double ddpy1, double ddpz1, double ddpx2, double ddpy2, double ddpz2, bool dxtype) - : dpx1(ddpx1), dpy1(ddpy1), dpz1(ddpz1), + : dpx1(ddpx1), dpy1(ddpy1), dpz1(ddpz1), dpx2(ddpx2), dpy2(ddpy2), dpz2(ddpz2), xtype(dxtype) { diff --git a/src/libs/vdxf/dxflib/dl_extrusion.h b/src/libs/vdxf/dxflib/dl_extrusion.h index 2a100c3ea..3e6c78b78 100644 --- a/src/libs/vdxf/dxflib/dl_extrusion.h +++ b/src/libs/vdxf/dxflib/dl_extrusion.h @@ -144,7 +144,10 @@ public: setDirection(extru.direction[0], extru.direction[1], extru.direction[2]); setElevation(extru.elevation); - return *this; + if ( &extru == this ) + { + return *this; + } }