From 00407096c2934d0d0d8e4e85936893054bb90899 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 18 Aug 2016 16:22:58 +0300 Subject: [PATCH] Fix compilation errors on CentOS --- src/Model/Model_SelectionNaming.cpp | 23 +++++++++++-------- .../ModelHighAPI_FeatureStore.cpp | 3 ++- src/ModelHighAPI/ModelHighAPI_FeatureStore.h | 1 + src/ModelHighAPI/ModelHighAPI_Tools.cpp | 8 +++---- src/SketchAPI/SketchAPI.i | 2 +- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/Model/Model_SelectionNaming.cpp b/src/Model/Model_SelectionNaming.cpp index ecfc26584..5d408bb86 100644 --- a/src/Model/Model_SelectionNaming.cpp +++ b/src/Model/Model_SelectionNaming.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef DEB_NAMING #include @@ -488,17 +489,18 @@ bool parseSubIndices(CompositeFeaturePtr theComp, //< to iterate names } else { int anOrientation = 1; // default if (theOriented) { // here must be a symbol in the end of digit 'f' or 'r' - const char aSymbol = anID.back(); - if (aSymbol == 'r') anOrientation = -1; - anID.pop_back(); + std::string::iterator aSymbol = anID.end() - 1; + if (*aSymbol == 'r') anOrientation = -1; + anID.erase(aSymbol); // remove last symbol } // check start/end symbols - if (anID.back() == 's') { + std::string::iterator aBack = anID.end() - 1; + if (*aBack == 's') { anOrientation *= 2; - anID.pop_back(); - } else if (anID.back() == 'e') { + anID.erase(aBack); // remove last symbol + } else if (*aBack == 'e') { anOrientation *= 3; - anID.pop_back(); + anID.erase(aBack); // remove last symbol } if (aNames.find(anID) != aNames.end()) { @@ -581,9 +583,12 @@ std::string Model_SelectionNaming::shortName( aName.erase(std::remove(aName.begin(), aName.end(), '&'), aName.end()); // remove the last 's', 'e', 'f' and 'r' symbols: they are used as markers of start/end/forward/rewersed indicators static const std::string aSyms("sefr"); - while(aSyms.find(aName.back()) != std::string::npos) { - aName.pop_back(); + std::string::iterator aSuffix = aName.end() - 1; + while(aSyms.find(*aSuffix) != std::string::npos) { + --aSuffix; } + aName.erase(aSuffix + 1, aName.end()); + if (theEdgeVertexPos == 1) { aName += "s"; // start } else if (theEdgeVertexPos == 2) { diff --git a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp index ac702d968..0200b851e 100644 --- a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp +++ b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp @@ -87,7 +87,8 @@ void ModelHighAPI_FeatureStore::storeData(std::shared_ptr theData } ResultPtr aShapeOwner = std::dynamic_pointer_cast(theData->owner()); if (aShapeOwner.get() && aShapeOwner->shape().get()) { - theAttrs["__shape__"] = dumpShape(aShapeOwner->shape()); + std::shared_ptr aShape = aShapeOwner->shape(); + theAttrs["__shape__"] = dumpShape(aShape); } } diff --git a/src/ModelHighAPI/ModelHighAPI_FeatureStore.h b/src/ModelHighAPI/ModelHighAPI_FeatureStore.h index d6d92d91d..fbe83c015 100644 --- a/src/ModelHighAPI/ModelHighAPI_FeatureStore.h +++ b/src/ModelHighAPI/ModelHighAPI_FeatureStore.h @@ -12,6 +12,7 @@ #include #include #include +#include class ModelAPI_Feature; class ModelAPI_Data; diff --git a/src/ModelHighAPI/ModelHighAPI_Tools.cpp b/src/ModelHighAPI/ModelHighAPI_Tools.cpp index ca56b3712..23f65ebc6 100644 --- a/src/ModelHighAPI/ModelHighAPI_Tools.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Tools.cpp @@ -347,8 +347,8 @@ bool checkPythonDump() std::string anError = storeFeatures( aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, false); if (!anError.empty()) { - Events_InfoMessage anError("checkPythonDump", anError); - anError.send(); + Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError); + anErrorMsg.send(); return false; } // close all before importation of the script @@ -364,8 +364,8 @@ bool checkPythonDump() aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, true); if (!anError.empty()) { std::cout<resultSubShapePair().first); + temp = ModelHighAPI_RefAttr(std::shared_ptr(temp_selection->resultSubShapePair().first)); if (newmem & SWIG_CAST_NEW_MEMORY) { delete temp_selection; } -- 2.39.2