Correct structure members initialization

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2015-10-02 04:07:07 +03:00
parent c298be342d
commit 55ab727d78
5 changed files with 13 additions and 16 deletions

View File

@ -47,9 +47,8 @@
class DXFLIB_EXPORT DL_CreationInterface class DXFLIB_EXPORT DL_CreationInterface
{ {
public: public:
DL_CreationInterface() : extrusion(), attributes() DL_CreationInterface() : extrusion(new DL_Extrusion), attributes()
{ {
extrusion = new DL_Extrusion;
} }
virtual ~DL_CreationInterface() virtual ~DL_CreationInterface()
{ {

View File

@ -561,7 +561,7 @@ struct DXFLIB_EXPORT DL_SplineData
*/ */
struct DXFLIB_EXPORT DL_KnotData struct DXFLIB_EXPORT DL_KnotData
{ {
DL_KnotData() : k() {} DL_KnotData() : k(0.0) {}
/** /**
* Constructor. * Constructor.
* Parameters: see member variables. * Parameters: see member variables.
@ -1366,7 +1366,7 @@ struct DXFLIB_EXPORT DL_HatchData
/** /**
* Default constructor. * Default constructor.
*/ */
DL_HatchData() : numLoops(), solid(), scale(), angle(), pattern(), originX(), originY() DL_HatchData() : numLoops(0), solid(), scale(0.0), angle(0.0), pattern(), originX(0.0), originY(0.0)
{} {}
/** /**
@ -1415,7 +1415,8 @@ struct DXFLIB_EXPORT DL_HatchLoopData
/** /**
* Default constructor. * Default constructor.
*/ */
DL_HatchLoopData() : numEdges() {} DL_HatchLoopData() : numEdges(0)
{}
/** /**
* Constructor. * Constructor.
* Parameters: see member variables. * Parameters: see member variables.

View File

@ -44,11 +44,9 @@ public:
/** /**
* Default constructor. * Default constructor.
*/ */
DL_Extrusion() : direction(), elevation() DL_Extrusion() : direction(new double[3]), elevation(0.0)
{ {
direction = new double[3];
setDirection(0.0, 0.0, 1.0); setDirection(0.0, 0.0, 1.0);
setElevation(0.0);
} }
@ -74,9 +72,8 @@ public:
* world coordinate system * world coordinate system
*/ */
DL_Extrusion(double dx, double dy, double dz, double elevation) DL_Extrusion(double dx, double dy, double dz, double elevation)
: direction(), elevation(elevation) : direction(new double[3]), elevation(elevation)
{ {
direction = new double[3];
setDirection(dx, dy, dz); setDirection(dx, dy, dz);
} }
@ -141,13 +138,14 @@ public:
*/ */
DL_Extrusion & operator = (const DL_Extrusion& extru) DL_Extrusion & operator = (const DL_Extrusion& extru)
{ {
setDirection(extru.direction[0], extru.direction[1], extru.direction[2]);
setElevation(extru.elevation);
if ( &extru == this ) if ( &extru == this )
{ {
return *this; return *this;
} }
setDirection(extru.direction[0], extru.direction[1], extru.direction[2]);
setElevation(extru.elevation);
return *this;
} }

View File

@ -62,9 +62,8 @@ public:
/** /**
* @param version DXF version. Defaults to DL_VERSION_2002. * @param version DXF version. Defaults to DL_VERSION_2002.
*/ */
DL_Writer(DL_Codes::version version) : m_handle(0x30), modelSpaceHandle(0), paperSpaceHandle(0), paperSpace0Handle(0), version() DL_Writer(DL_Codes::version version) : m_handle(0x30), modelSpaceHandle(0), paperSpaceHandle(0), paperSpace0Handle(0), version(version)
{ {
this->version = version;
} }
virtual ~DL_Writer() {} virtual ~DL_Writer() {}

View File

@ -54,7 +54,7 @@ static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VDxfEngine::VDxfEngine() VDxfEngine::VDxfEngine()
:QPaintEngine(svgEngineFeatures()), :QPaintEngine(svgEngineFeatures()),
size(), resolution(PrintDPI), fileName(), matrix(), dxf(), dw(), size(), resolution(PrintDPI), fileName(), matrix(), dxf(nullptr), dw(nullptr),
varMeasurement(VarMeasurement::Metric), varInsunits(VarInsunits::Centimeters) varMeasurement(VarMeasurement::Metric), varInsunits(VarInsunits::Centimeters)
{ {
} }