From 92a7f21621e27d026cf7a7fc52ea9f69c32a24f6 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 30 Sep 2015 21:10:13 +0300 Subject: [PATCH] Fixed warnings in Linux 1. fixed old-style cast 2. correct order of variables --HG-- branch : feature --- src/libs/vdxf/dxflib/dl_dxf.cpp | 32 ++++++++++++++++---------------- src/libs/vdxf/dxflib/dl_dxf.h | 2 +- src/libs/vdxf/vdxfengine.cpp | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/libs/vdxf/dxflib/dl_dxf.cpp b/src/libs/vdxf/dxflib/dl_dxf.cpp index 5b5ba7ffd..f6f2ff402 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.cpp +++ b/src/libs/vdxf/dxflib/dl_dxf.cpp @@ -327,7 +327,7 @@ bool DL_Dxf::getStrippedLine(std::string &s, unsigned int size, bool DL_Dxf::stripWhiteSpace(char** s) { // last non-NULL char: - int lastChar = strlen(*s) - 1; + int lastChar = static_cast(strlen(*s) - 1); // Is last character CR or LF? while ( (lastChar >= 0) && @@ -2181,7 +2181,7 @@ void DL_Dxf::addHatch(DL_CreationInterface* creationInterface) for (unsigned int i=0; iaddHatchLoop(DL_HatchLoopData(hatchEdges[i].size())); + creationInterface->addHatchLoop(DL_HatchLoopData(static_cast(hatchEdges[i].size()))); for (unsigned int k=0; kaddHatchEdge(DL_HatchEdgeData(hatchEdges[i][k])); @@ -3143,7 +3143,7 @@ void DL_Dxf::writeMText(DL_WriterA& dw, dw.dxfInt(72, data.drawingDirection); // Creare text chunks of 250 characters each: - int length = data.text.length(); + int length = static_cast(data.text.length()); char chunk[251]; int i; for (i=250; i(data.linearFactor)); dw.dxfString(1002, "}"); } } @@ -4052,7 +4052,7 @@ int DL_Dxf::writeImage(DL_WriterA& dw, dw.dxfReal(23, data.height); // handle of IMAGEDEF object - int handle = dw.incHandle(); + int handle = static_cast(dw.incHandle()); dw.dxfHex(340, handle); // flags @@ -4687,7 +4687,7 @@ void DL_Dxf::writeDimStyle(DL_WriterA& dw, dw.dxfInt(278, 44); dw.dxfInt(283, 0); dw.dxfInt(284, 8); - dw.dxfHex(340, styleHandleStd); + dw.dxfHex(340, static_cast(styleHandleStd)); //dw.dxfHex(340, 0x11); } // * / @@ -4818,7 +4818,7 @@ void DL_Dxf::writeObjects(DL_WriterA& dw, const std::string& appDictionaryName) dw.dxfString( 3, "ACAD_PLOTSTYLENAME"); dw.dxfHex(350, 0xE); dw.dxfString( 3, "AcDbVariableDictionary"); - int acDbVariableDictionaryHandle = dw.handle(350); + int acDbVariableDictionaryHandle = static_cast(dw.handle(350)); //int acDbVariableDictionaryHandle = dw.getNextHandle(); //dw.dxfHex(350, acDbVariableDictionaryHandle); //dw.incHandle(); @@ -5120,10 +5120,10 @@ void DL_Dxf::writeObjects(DL_WriterA& dw, const std::string& appDictionaryName) dw.dxfInt(281, 1); dw.dxfString( 3, "DIMASSOC"); //dw.dxfHex(350, 0x2F); - dw.dxfHex(350, dw.getNextHandle()+1); // 2E + dw.dxfHex(350, static_cast(dw.getNextHandle()+1)); // 2E dw.dxfString( 3, "HIDETEXT"); //dw.dxfHex(350, 0x2E); - dw.dxfHex(350, dw.getNextHandle()); // 2D + dw.dxfHex(350, static_cast(dw.getNextHandle())); // 2D dw.dxfString( 0, "DICTIONARYVAR"); @@ -5148,7 +5148,7 @@ void DL_Dxf::writeAppDictionary(DL_WriterA& dw) { dw.dxfString( 0, "DICTIONARY"); //dw.handle(); - dw.dxfHex(5, appDictionaryHandle); + dw.dxfHex(5, static_cast(appDictionaryHandle)); dw.dxfString(100, "AcDbDictionary"); dw.dxfInt(281, 1); } @@ -5156,7 +5156,7 @@ void DL_Dxf::writeAppDictionary(DL_WriterA& dw) int DL_Dxf::writeDictionaryEntry(DL_WriterA& dw, const std::string& name) { dw.dxfString( 3, name); - int handle = dw.getNextHandle(); + int handle = static_cast(dw.getNextHandle()); dw.dxfHex(350, handle); dw.incHandle(); return handle; @@ -5166,7 +5166,7 @@ void DL_Dxf::writeXRecord(DL_WriterA& dw, int handle, int value) { dw.dxfString( 0, "XRECORD"); dw.dxfHex(5, handle); - dw.dxfHex(330, appDictionaryHandle); + dw.dxfHex(330, static_cast(appDictionaryHandle)); dw.dxfString(100, "AcDbXrecord"); dw.dxfInt(280, 1); dw.dxfInt(90, value); @@ -5176,7 +5176,7 @@ void DL_Dxf::writeXRecord(DL_WriterA& dw, int handle, double value) { dw.dxfString( 0, "XRECORD"); dw.dxfHex(5, handle); - dw.dxfHex(330, appDictionaryHandle); + dw.dxfHex(330, static_cast(appDictionaryHandle)); dw.dxfString(100, "AcDbXrecord"); dw.dxfInt(280, 1); dw.dxfReal(40, value); @@ -5186,7 +5186,7 @@ void DL_Dxf::writeXRecord(DL_WriterA& dw, int handle, bool value) { dw.dxfString( 0, "XRECORD"); dw.dxfHex(5, handle); - dw.dxfHex(330, appDictionaryHandle); + dw.dxfHex(330, static_cast(appDictionaryHandle)); dw.dxfString(100, "AcDbXrecord"); dw.dxfInt(280, 1); dw.dxfBool(290, value); @@ -5196,7 +5196,7 @@ void DL_Dxf::writeXRecord(DL_WriterA& dw, int handle, const std::string& value) { dw.dxfString( 0, "XRECORD"); dw.dxfHex(5, handle); - dw.dxfHex(330, appDictionaryHandle); + dw.dxfHex(330, static_cast(appDictionaryHandle)); dw.dxfString(100, "AcDbXrecord"); dw.dxfInt(280, 1); dw.dxfString(1000, value); @@ -5830,7 +5830,7 @@ int DL_Dxf::getLibVersion(const std::string& str) if (idx>=2) { - d[3] = str.length(); + d[3] = static_cast(str.length()); v[0] = str.substr(0, d[0]); v[1] = str.substr(d[0]+1, d[1]-d[0]-1); diff --git a/src/libs/vdxf/dxflib/dl_dxf.h b/src/libs/vdxf/dxflib/dl_dxf.h index f2b5383e2..f9a2d3456 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.h +++ b/src/libs/vdxf/dxflib/dl_dxf.h @@ -510,7 +510,7 @@ public: int toInt(const std::string& str) { char* p; - return strtol(str.c_str(), &p, 10); + return static_cast(strtol(str.c_str(), &p, 10)); } bool toBool(const std::string& str) diff --git a/src/libs/vdxf/vdxfengine.cpp b/src/libs/vdxf/vdxfengine.cpp index 2908e31cf..1256fe05e 100644 --- a/src/libs/vdxf/vdxfengine.cpp +++ b/src/libs/vdxf/vdxfengine.cpp @@ -54,8 +54,8 @@ static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures() //--------------------------------------------------------------------------------------------------------------------- VDxfEngine::VDxfEngine() :QPaintEngine(svgEngineFeatures()), - size(), resolution(PrintDPI), matrix(), varMeasurement(VarMeasurement::Metric), - varInsunits(VarInsunits::Centimeters), dw(), dxf(), fileName() + size(), resolution(PrintDPI), fileName(), matrix(), dxf(), dw(), + varMeasurement(VarMeasurement::Metric), varInsunits(VarInsunits::Centimeters) { }