From c3fef2abd7edaf523e03fe49714341d6b2462a59 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 30 Sep 2015 20:57:50 +0300 Subject: [PATCH] Fixed warnings in Linux (old-style cast) --HG-- branch : feature --- src/libs/vdxf/dxflib/dl_dxf.cpp | 18 +++++++++--------- src/libs/vdxf/dxflib/dl_dxf.h | 2 +- src/libs/vdxf/dxflib/dl_writer.h | 14 +++++++------- src/libs/vdxf/dxflib/dl_writer_ascii.cpp | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/libs/vdxf/dxflib/dl_dxf.cpp b/src/libs/vdxf/dxflib/dl_dxf.cpp index 0f3979320..8a21cad61 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.cpp +++ b/src/libs/vdxf/dxflib/dl_dxf.cpp @@ -196,7 +196,7 @@ bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface) DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, fp) ) { - groupCode = (unsigned int)toInt(groupCodeTmp); + groupCode = static_cast(toInt(groupCodeTmp)); creationInterface->processCodeValuePair(groupCode, groupValue); line+=2; @@ -222,7 +222,7 @@ bool DL_Dxf::readDxfGroups(std::stringstream& stream, DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, stream) ) { - groupCode = (unsigned int)toInt(groupCodeTmp); + groupCode = static_cast(toInt(groupCodeTmp)); line+=2; processDXFGroup(creationInterface, groupCode, groupValue); @@ -427,7 +427,7 @@ bool DL_Dxf::processDXFGroup(DL_CreationInterface* creationInterface, width, // width linetype, // linetype handle); // handle - attrib.setInPaperSpace((bool)getIntValue(67, 0)); + attrib.setInPaperSpace(static_cast(getIntValue(67, 0))); attrib.setLinetypeScale(getRealValue(48, 1.0)); creationInterface->setAttributes(attrib); @@ -2323,7 +2323,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface) hatchEdge.angle2 = toReal(groupValue)/360.0*2*M_PI; return true; case 73: - hatchEdge.ccw = (bool)toInt(groupValue); + hatchEdge.ccw = static_cast(toInt(groupValue)); hatchEdge.defined = true; return true; } @@ -2356,7 +2356,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface) hatchEdge.angle2 = toReal(groupValue)/360.0*2*M_PI; return true; case 73: - hatchEdge.ccw = (bool)toInt(groupValue); + hatchEdge.ccw = static_cast(toInt(groupValue)); hatchEdge.defined = true; return true; } @@ -2731,7 +2731,7 @@ void DL_Dxf::writePolyline(DL_WriterA& dw, dw.entityAttributes(attrib); dw.dxfString(100, "AcDbEntity"); dw.dxfString(100, "AcDbPolyline"); - dw.dxfInt(90, (int)data.number); + dw.dxfInt(90, static_cast(data.number)); dw.dxfInt(70, data.flags); } else @@ -3814,7 +3814,7 @@ void DL_Dxf::writeHatch1(DL_WriterA& dw, { dw.dxfString(2, "SOLID"); } - dw.dxfInt(70, (int)data.solid); + dw.dxfInt(70, static_cast(data.solid)); dw.dxfInt(71, 0); // non-associative dw.dxfInt(91, data.numLoops); } @@ -3931,7 +3931,7 @@ void DL_Dxf::writeHatchEdge(DL_WriterA& dw, dw.dxfReal(40, data.radius); dw.dxfReal(50, data.angle1/(2*M_PI)*360.0); dw.dxfReal(51, data.angle2/(2*M_PI)*360.0); - dw.dxfInt(73, (int)(data.ccw)); + dw.dxfInt(73, static_cast((data.ccw))); break; // ellipse arc: @@ -3943,7 +3943,7 @@ void DL_Dxf::writeHatchEdge(DL_WriterA& dw, dw.dxfReal(40, data.ratio); dw.dxfReal(50, data.angle1/(2*M_PI)*360.0); dw.dxfReal(51, data.angle2/(2*M_PI)*360.0); - dw.dxfInt(73, (int)(data.ccw)); + dw.dxfInt(73, static_cast((data.ccw))); break; // spline: diff --git a/src/libs/vdxf/dxflib/dl_dxf.h b/src/libs/vdxf/dxflib/dl_dxf.h index 04d37cfea..f2b5383e2 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.h +++ b/src/libs/vdxf/dxflib/dl_dxf.h @@ -516,7 +516,7 @@ public: bool toBool(const std::string& str) { char* p; - return (bool)strtol(str.c_str(), &p, 10); + return static_cast(strtol(str.c_str(), &p, 10)); } std::string getStringValue(int code, const std::string& def) diff --git a/src/libs/vdxf/dxflib/dl_writer.h b/src/libs/vdxf/dxflib/dl_writer.h index 659c525c3..85c3ac562 100644 --- a/src/libs/vdxf/dxflib/dl_writer.h +++ b/src/libs/vdxf/dxflib/dl_writer.h @@ -423,7 +423,7 @@ public: } else { - dxfHex(5, h); + dxfHex(5, static_cast(h)); } dxfString(100, "AcDbSymbolTableRecord"); dxfString(100, "AcDbLayerTableRecord"); @@ -449,7 +449,7 @@ public: } else { - dxfHex(5, h); + dxfHex(5, static_cast(h)); } //dxfHex(330, 0x5); dxfString(100, "AcDbSymbolTableRecord"); @@ -476,7 +476,7 @@ public: } else { - dxfHex(5, h); + dxfHex(5, static_cast(h)); } //dxfHex(330, 0x9); dxfString(100, "AcDbSymbolTableRecord"); @@ -503,7 +503,7 @@ public: } else { - dxfHex(5, h); + dxfHex(5, static_cast(h)); } //dxfHex(330, blockHandle); dxfString(100, "AcDbEntity"); @@ -535,7 +535,7 @@ public: } else { - dxfHex(5, h); + dxfHex(5, static_cast(h)); } //dxfHex(330, blockHandle); dxfString(100, "AcDbEntity"); @@ -593,7 +593,7 @@ public: unsigned long handle(int gc=5) const { // handle has to be hex - dxfHex(gc, m_handle); + dxfHex(gc, static_cast(m_handle)); return m_handle++; } @@ -682,7 +682,7 @@ public: */ virtual void dxfBool(int gc, bool value) const { - dxfInt(gc, (int)value); + dxfInt(gc, static_cast(value)); } /** diff --git a/src/libs/vdxf/dxflib/dl_writer_ascii.cpp b/src/libs/vdxf/dxflib/dl_writer_ascii.cpp index f54a6fd1b..f52596e80 100644 --- a/src/libs/vdxf/dxflib/dl_writer_ascii.cpp +++ b/src/libs/vdxf/dxflib/dl_writer_ascii.cpp @@ -86,7 +86,7 @@ void DL_WriterA::dxfReal(int gc, double value) const end = i+1; } } - if (end>0 && end<(int)strlen(str)) + if (end>0 && end(strlen(str))) { str[end] = '\0'; }