From 80d35507cafef3a72332cee9468403169eae90fa Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 30 Sep 2015 20:49:02 +0300 Subject: [PATCH] Fixed warnings in Linux 1. correct structure members initialization 2. struct has pointer data members but has no copy constructor --HG-- branch : feature --- src/libs/vdxf/dxflib/dl_creationinterface.h | 14 ++- src/libs/vdxf/dxflib/dl_dxf.cpp | 52 ++++++------ src/libs/vdxf/dxflib/dl_dxf.h | 94 +++++++++++++++++++++ src/libs/vdxf/dxflib/dl_entities.h | 77 ++++++++++++++--- src/libs/vdxf/dxflib/dl_extrusion.h | 10 ++- src/libs/vdxf/dxflib/dl_writer.h | 2 +- src/libs/vdxf/vdxfengine.cpp | 2 +- 7 files changed, 211 insertions(+), 40 deletions(-) diff --git a/src/libs/vdxf/dxflib/dl_creationinterface.h b/src/libs/vdxf/dxflib/dl_creationinterface.h index a824d4aa6..2c80b4f86 100644 --- a/src/libs/vdxf/dxflib/dl_creationinterface.h +++ b/src/libs/vdxf/dxflib/dl_creationinterface.h @@ -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. diff --git a/src/libs/vdxf/dxflib/dl_dxf.cpp b/src/libs/vdxf/dxflib/dl_dxf.cpp index 3eea2dd09..0f3979320 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.cpp +++ b/src/libs/vdxf/dxflib/dl_dxf.cpp @@ -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; } diff --git a/src/libs/vdxf/dxflib/dl_dxf.h b/src/libs/vdxf/dxflib/dl_dxf.h index 32eb0c2a8..04d37cfea 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.h +++ b/src/libs/vdxf/dxflib/dl_dxf.h @@ -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, diff --git a/src/libs/vdxf/dxflib/dl_entities.h b/src/libs/vdxf/dxflib/dl_entities.h index 59d9f7084..2ff99bd39 100644 --- a/src/libs/vdxf/dxflib/dl_entities.h +++ b/src/libs/vdxf/dxflib/dl_entities.h @@ -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() { } diff --git a/src/libs/vdxf/dxflib/dl_extrusion.h b/src/libs/vdxf/dxflib/dl_extrusion.h index 75f6ff197..2a100c3ea 100644 --- a/src/libs/vdxf/dxflib/dl_extrusion.h +++ b/src/libs/vdxf/dxflib/dl_extrusion.h @@ -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); diff --git a/src/libs/vdxf/dxflib/dl_writer.h b/src/libs/vdxf/dxflib/dl_writer.h index 86a7f668e..659c525c3 100644 --- a/src/libs/vdxf/dxflib/dl_writer.h +++ b/src/libs/vdxf/dxflib/dl_writer.h @@ -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; } diff --git a/src/libs/vdxf/vdxfengine.cpp b/src/libs/vdxf/vdxfengine.cpp index 23624c555..2908e31cf 100644 --- a/src/libs/vdxf/vdxfengine.cpp +++ b/src/libs/vdxf/vdxfengine.cpp @@ -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() { }