Fixed warnings in Linux

1. correct structure members initialization
2. struct has pointer data members but has no copy constructor

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2015-09-30 20:49:02 +03:00
parent 139027926e
commit 80d35507ca
7 changed files with 211 additions and 40 deletions

View File

@ -47,7 +47,7 @@
class DXFLIB_EXPORT DL_CreationInterface
{
public:
DL_CreationInterface()
DL_CreationInterface() : extrusion(), attributes()
{
extrusion = new DL_Extrusion;
}
@ -56,6 +56,18 @@ public:
delete extrusion;
}
DL_CreationInterface(const DL_CreationInterface &L) : extrusion(L.extrusion), attributes(L.attributes)
{
}
DL_CreationInterface & operator=(const DL_CreationInterface &L)
{
extrusion = L.extrusion;
attributes = L.attributes;
return *this;
}
/**
* Called for every code / value tuple of the DXF file. The complete DXF file
* contents can be handled by the implemetation of this function.

View File

@ -41,31 +41,35 @@
* Default constructor.
*/
DL_Dxf::DL_Dxf()
: version(DL_VERSION_2000),
vertices(NULL),
maxVertices(0),
vertexIndex(0),
knots(NULL),
maxKnots(0),
knotIndex(0),
weights(NULL),
weightIndex(0),
controlPoints(NULL),
maxControlPoints(0),
controlPointIndex(0),
fitPoints(NULL),
maxFitPoints(0),
fitPointIndex(0),
leaderVertices(NULL),
maxLeaderVertices(0),
leaderVertexIndex(0),
polylineLayer(), firstHatchLoop(), hatchEdge(), hatchEdges(),
xRecordHandle(), xRecordValues(), groupCodeTmp(), groupCode(), groupValue(),
currentObjectType(), settingKey(), values(), firstCall(), attrib(),
libVersion(), appDictionaryHandle(), styleHandleStd()
{
version = DL_VERSION_2000;
vertices = NULL;
maxVertices = 0;
vertexIndex = 0;
knots = NULL;
maxKnots = 0;
knotIndex = 0;
weights = NULL;
weightIndex = 0;
controlPoints = NULL;
maxControlPoints = 0;
controlPointIndex = 0;
fitPoints = NULL;
maxFitPoints = 0;
fitPointIndex = 0;
leaderVertices = NULL;
maxLeaderVertices = 0;
leaderVertexIndex = 0;
}

View File

@ -119,6 +119,100 @@ public:
DL_Dxf();
~DL_Dxf();
DL_Dxf(const DL_Dxf &L)
: version(L.version),
polylineLayer(L.polylineLayer),
vertices(L.vertices),
maxVertices(L.maxVertices),
vertexIndex(L.vertexIndex),
knots(L.knots),
maxKnots(L.maxKnots),
knotIndex(L.knotIndex),
weights(L.weights),
weightIndex(L.weightIndex),
controlPoints(L.controlPoints),
maxControlPoints(L.maxControlPoints),
controlPointIndex(L.controlPointIndex),
fitPoints(L.fitPoints),
maxFitPoints(L.maxFitPoints),
fitPointIndex(L.fitPointIndex),
leaderVertices(L.leaderVertices),
maxLeaderVertices(L.maxLeaderVertices),
leaderVertexIndex(L.leaderVertexIndex),
firstHatchLoop(L.firstHatchLoop),
hatchEdge(L.hatchEdge),
hatchEdges(L.hatchEdges),
xRecordHandle(L.xRecordHandle),
xRecordValues(L.xRecordValues),
groupCodeTmp(L.groupCodeTmp),
groupCode(L.groupCode),
groupValue(L.groupValue),
currentObjectType(L.currentObjectType),
settingKey(L.settingKey),
values(L.values),
firstCall(L.firstCall),
attrib(L.attrib),
libVersion(L.libVersion),
appDictionaryHandle(L.appDictionaryHandle),
styleHandleStd(L.styleHandleStd)
{
}
DL_Dxf & operator=(const DL_Dxf &L)
{
version = L.version;
polylineLayer = L.polylineLayer;
vertices = L.vertices;
maxVertices = L.maxVertices;
vertexIndex = L.vertexIndex;
knots = L.knots;
maxKnots = L.maxKnots;
knotIndex = L.knotIndex;
weights = L.weights;
weightIndex = L.weightIndex;
controlPoints = L.controlPoints;
maxControlPoints = L.maxControlPoints;
controlPointIndex = L.controlPointIndex;
fitPoints = L.fitPoints;
maxFitPoints = L.maxFitPoints;
fitPointIndex = L.fitPointIndex;
leaderVertices = L.leaderVertices;
maxLeaderVertices = L.maxLeaderVertices;
leaderVertexIndex = L.leaderVertexIndex;
firstHatchLoop = L.firstHatchLoop;
hatchEdge = L.hatchEdge;
hatchEdges = L.hatchEdges;
xRecordHandle = L.xRecordHandle;
xRecordValues = L.xRecordValues;
groupCodeTmp = L.groupCodeTmp;
groupCode = L.groupCode;
groupValue = L.groupValue;
currentObjectType = L.currentObjectType;
settingKey = L.settingKey;
values = L.values;
firstCall = L.firstCall;
attrib = L.attrib;
libVersion = L.libVersion;
appDictionaryHandle = L.appDictionaryHandle;
styleHandleStd = L.styleHandleStd;
return *this;
}
bool in(const std::string& file,
DL_CreationInterface* creationInterface);
bool readDxfGroups(FILE* fp,

View File

@ -103,7 +103,34 @@ struct DXFLIB_EXPORT DL_LinetypeData
numberOfDashes(numberOfDashes),
patternLength(patternLength),
pattern(pattern)
{}
{
}
~DL_LinetypeData()
{
}
DL_LinetypeData(const DL_LinetypeData &L)
: name(L.name),
description(L.description),
flags(L.flags),
numberOfDashes(L.numberOfDashes),
patternLength(L.patternLength),
pattern(L.pattern)
{
}
DL_LinetypeData & operator=(const DL_LinetypeData &L)
{
name = L.name;
description = L.description;
flags = L.flags;
numberOfDashes = L.numberOfDashes;
patternLength = L.patternLength;
pattern = L.pattern;
return *this;
}
/** Linetype name */
std::string name;
@ -513,7 +540,13 @@ struct DXFLIB_EXPORT DL_SplineData
nKnots(nKnots),
nControl(nControl),
nFit(nFit),
flags(flags)
flags(flags),
tangentStartX(),
tangentStartY(),
tangentStartZ(),
tangentEndX(),
tangentEndY(),
tangentEndZ()
{
}
@ -547,7 +580,7 @@ struct DXFLIB_EXPORT DL_SplineData
*/
struct DXFLIB_EXPORT DL_KnotData
{
DL_KnotData() {}
DL_KnotData() : k() {}
/**
* Constructor.
* Parameters: see member variables.
@ -1352,7 +1385,8 @@ struct DXFLIB_EXPORT DL_HatchData
/**
* Default constructor.
*/
DL_HatchData() {}
DL_HatchData() : numLoops(), solid(), scale(), angle(), pattern(), originX(), originY()
{}
/**
* Constructor.
@ -1400,7 +1434,7 @@ struct DXFLIB_EXPORT DL_HatchLoopData
/**
* Default constructor.
*/
DL_HatchLoopData() {}
DL_HatchLoopData() : numEdges() {}
/**
* Constructor.
* Parameters: see member variables.
@ -1424,7 +1458,12 @@ struct DXFLIB_EXPORT DL_HatchEdgeData
/**
* Default constructor.
*/
DL_HatchEdgeData() : defined(false), x1(0.0), y1(0.0), x2(0.0), y2(0.0)
DL_HatchEdgeData() : defined(false), x1(0.0), y1(0.0), x2(0.0), y2(0.0),
type(), cx(), cy(), radius(), angle1(), angle2(), ccw(),
mx(), my(), ratio(), degree(), rational(), periodic(),
nKnots(), nControl(), nFit(), controlPoints(), knots(),
weights(), fitPoints(), startTangentX(), startTangentY(),
endTangentX(), endTangentY(), vertices()
{
}
@ -1439,7 +1478,12 @@ struct DXFLIB_EXPORT DL_HatchEdgeData
x1(x1),
y1(y1),
x2(x2),
y2(y2)
y2(y2),
cx(), cy(), radius(), angle1(), angle2(), ccw(),
mx(), my(), ratio(), degree(), rational(), periodic(),
nKnots(), nControl(), nFit(), controlPoints(), knots(),
weights(), fitPoints(), startTangentX(), startTangentY(),
endTangentX(), endTangentY(), vertices()
{
}
@ -1458,7 +1502,12 @@ struct DXFLIB_EXPORT DL_HatchEdgeData
radius(radius),
angle1(angle1),
angle2(angle2),
ccw(ccw)
ccw(ccw),
x1(), y1(), x2(), y2(),
mx(), my(), ratio(), degree(), rational(), periodic(),
nKnots(), nControl(), nFit(), controlPoints(), knots(),
weights(), fitPoints(), startTangentX(), startTangentY(),
endTangentX(), endTangentY(), vertices()
{
}
@ -1480,7 +1529,12 @@ struct DXFLIB_EXPORT DL_HatchEdgeData
ccw(ccw),
mx(mx),
my(my),
ratio(ratio)
ratio(ratio),
x1(), y1(), x2(), y2(),
degree(), rational(), periodic(), radius(),
nKnots(), nControl(), nFit(), controlPoints(), knots(),
weights(), fitPoints(), startTangentX(), startTangentY(),
endTangentX(), endTangentY(), vertices()
{
}
@ -1517,7 +1571,10 @@ struct DXFLIB_EXPORT DL_HatchEdgeData
startTangentX(startTangentX),
startTangentY(startTangentY),
endTangentX(endTangentX),
endTangentY(endTangentY)
endTangentY(endTangentY),
x1(), y1(), x2(), y2(),
mx(), my(), ratio(), vertices(),
cx(), cy(), radius(), angle1(), angle2(), ccw()
{
}

View File

@ -44,7 +44,7 @@ public:
/**
* Default constructor.
*/
DL_Extrusion()
DL_Extrusion() : direction(), elevation()
{
direction = new double[3];
setDirection(0.0, 0.0, 1.0);
@ -60,6 +60,10 @@ public:
delete[] direction ;
}
DL_Extrusion(const DL_Extrusion &L)
: direction(L.direction), elevation(L.elevation)
{
}
/**
* Constructor for DXF extrusion.
@ -70,10 +74,10 @@ public:
* world coordinate system
*/
DL_Extrusion(double dx, double dy, double dz, double elevation)
: direction(), elevation(elevation)
{
direction = new double[3];
setDirection(dx, dy, dz);
setElevation(elevation);
}
@ -135,7 +139,7 @@ public:
/**
* Copies extrusion (deep copies) from another extrusion object.
*/
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);

View File

@ -62,7 +62,7 @@ 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)
DL_Writer(DL_Codes::version version) : m_handle(0x30), modelSpaceHandle(0), paperSpaceHandle(0), paperSpace0Handle(0), version()
{
this->version = version;
}

View File

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