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
{
public:
DL_CreationInterface() : extrusion(), attributes()
DL_CreationInterface() : extrusion(new DL_Extrusion), attributes()
{
extrusion = new DL_Extrusion;
}
virtual ~DL_CreationInterface()
{

View File

@ -561,7 +561,7 @@ struct DXFLIB_EXPORT DL_SplineData
*/
struct DXFLIB_EXPORT DL_KnotData
{
DL_KnotData() : k() {}
DL_KnotData() : k(0.0) {}
/**
* Constructor.
* Parameters: see member variables.
@ -1366,7 +1366,7 @@ struct DXFLIB_EXPORT DL_HatchData
/**
* 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.
*/
DL_HatchLoopData() : numEdges() {}
DL_HatchLoopData() : numEdges(0)
{}
/**
* Constructor.
* Parameters: see member variables.

View File

@ -44,11 +44,9 @@ public:
/**
* 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);
setElevation(0.0);
}
@ -74,9 +72,8 @@ public:
* world coordinate system
*/
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);
}
@ -141,13 +138,14 @@ public:
*/
DL_Extrusion & operator = (const DL_Extrusion& extru)
{
setDirection(extru.direction[0], extru.direction[1], extru.direction[2]);
setElevation(extru.elevation);
if ( &extru == 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.
*/
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() {}

View File

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