fix Coverity issues

This commit is contained in:
wmayer
2016-08-21 18:46:40 +02:00
parent 82f7944966
commit e8b36592c0
20 changed files with 50 additions and 53 deletions

View File

@@ -212,8 +212,6 @@ App::DocumentObjectExecReturn *Loft::execute(void)
}
return App::DocumentObject::StdReturn;
return ProfileBased::execute();
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();

View File

@@ -80,9 +80,9 @@ const std::list<gp_Trsf> MultiTransform::getTransformations(const std::vector<Ap
if (originalFeature->getTypeId().isDerivedFrom(PartDesign::FeatureAddSub::getClassTypeId())) {
PartDesign::FeatureAddSub* addFeature = static_cast<PartDesign::FeatureAddSub*>(originalFeature);
if(addFeature->getAddSubType() == FeatureAddSub::Additive)
original = addFeature->AddSubShape.getShape().getShape();
else
//if (addFeature->getAddSubType() == FeatureAddSub::Additive)
// original = addFeature->AddSubShape.getShape().getShape();
//else
original = addFeature->AddSubShape.getShape().getShape();
}

View File

@@ -317,10 +317,8 @@ App::DocumentObjectExecReturn *Pipe::execute(void)
boolOp = refineShapeIfActive(boolOp);
Shape.setValue(getSolid(boolOp));
}
return App::DocumentObject::StdReturn;
return ProfileBased::execute();
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();

View File

@@ -74,9 +74,9 @@ const std::list<gp_Trsf> Scaled::getTransformations(const std::vector<App::Docum
if (originalFeature->getTypeId().isDerivedFrom(PartDesign::FeatureAddSub::getClassTypeId())) {
PartDesign::FeatureAddSub* Feature = static_cast<PartDesign::FeatureAddSub*>(originalFeature);
if(Feature->getAddSubType() == FeatureAddSub::Additive)
original = Feature->AddSubShape.getShape().getShape();
else
//if(Feature->getAddSubType() == FeatureAddSub::Additive)
// original = Feature->AddSubShape.getShape().getShape();
//else
original = Feature->AddSubShape.getShape().getShape();
}

View File

@@ -726,29 +726,28 @@ void prepareProfileBased(Gui::Command* cmd, const std::string& which,
//if a profie is selected we can make our life easy and fast
auto selection = cmd->getSelection().getSelectionEx();
if(!selection.empty() && selection.front().hasSubNames()) {
if (!selection.empty() && selection.front().hasSubNames()) {
base_worker(selection.front().getObject(), selection.front().getSubNames().front());
return;
}
//no face profile was selected, do he extended sketch logic
bool bNoSketchWasSelected = false;
// Get a valid sketch from the user
// First check selections
std::vector<App::DocumentObject*> sketches = cmd->getSelection().getObjectsOfType(Part::Part2DObject::getClassTypeId());
if (sketches.size() == 0) {//no sketches were selected. Let user pick an object from valid ones available in document
if (sketches.empty()) {//no sketches were selected. Let user pick an object from valid ones available in document
sketches = cmd->getDocument()->getObjectsOfType(Part::Part2DObject::getClassTypeId());
bNoSketchWasSelected = true;
}
if(sketches.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No sketch to work on"),
QObject::tr("No sketch is available in the document"));
return;
if (sketches.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No sketch to work on"),
QObject::tr("No sketch is available in the document"));
return;
}
std::vector<PartDesignGui::TaskFeaturePick::featureStatus> status;
std::vector<App::DocumentObject*>::iterator firstFreeSketch;
int freeSketches = validateSketches(sketches, status, firstFreeSketch);
@@ -778,7 +777,7 @@ void prepareProfileBased(Gui::Command* cmd, const std::string& which,
// TODO Clean this up (2015-10-20, Fat-Zer)
auto* pcActiveBody = PartDesignGui::getBody(false);
if(pcActiveBody && !bNoSketchWasSelected && ext) {
if (pcActiveBody && !bNoSketchWasSelected && ext) {
auto* pcActivePart = PartDesignGui::getPartFor(pcActiveBody, false);
@@ -805,7 +804,7 @@ void prepareProfileBased(Gui::Command* cmd, const std::string& which,
// Show sketch choose dialog and let user pick sketch if no sketch was selected and no free one available or
// multiple free ones are available
if ( bNoSketchWasSelected && (freeSketches != 1) ) {
if (bNoSketchWasSelected && (freeSketches != 1) ) {
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
PartDesignGui::TaskDlgFeaturePick *pickDlg = qobject_cast<PartDesignGui::TaskDlgFeaturePick *>(dlg);
@@ -827,21 +826,20 @@ void prepareProfileBased(Gui::Command* cmd, const std::string& which,
Gui::Selection().clearSelection();
pickDlg = new PartDesignGui::TaskDlgFeaturePick(sketches, status, accepter, sketch_worker);
if(!bNoSketchWasSelected && ext)
if (!bNoSketchWasSelected && ext)
pickDlg->showExternal(true);
Gui::Control().showDialog(pickDlg);
}
else {
std::vector<App::DocumentObject*> theSketch;
if(!bNoSketchWasSelected)
if (!bNoSketchWasSelected)
theSketch.push_back(sketches[0]);
else
theSketch.push_back(*firstFreeSketch);
sketch_worker(theSketch);
}
}
void finishProfileBased(const Gui::Command* cmd, const Part::Feature* sketch, const std::string& FeatName)

View File

@@ -666,7 +666,6 @@ void CmdPartDesignMoveFeature::activated(int iMsg)
bool CmdPartDesignMoveFeature::isActive(void)
{
return hasActiveDocument () && !PartDesignGui::isLegacyWorkflow ( getDocument () );
return hasActiveDocument ();
}
DEF_STD_CMD_A(CmdPartDesignMoveFeatureInTree);

View File

@@ -177,10 +177,9 @@ void TaskBooleanParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
void TaskBooleanParameters::onButtonBodyAdd(bool checked)
{
if (checked) {
Gui::Document* doc = Gui::Application::Instance->activeDocument();
if (doc != NULL)
BooleanView->hide();
PartDesign::Boolean* pcBoolean = static_cast<PartDesign::Boolean*>(BooleanView->getObject());
Gui::Document* doc = BooleanView->getDocument();
BooleanView->hide();
if (pcBoolean->Bodies.getValues().empty() && pcBoolean->BaseFeature.getValue())
doc->setHide(pcBoolean->BaseFeature.getValue()->getNameInDocument());
selectionMode = bodyAdd;

View File

@@ -51,8 +51,11 @@ TaskDressUpParameters::TaskDressUpParameters(ViewProviderDressUp *DressUpView, b
: TaskBox(Gui::BitmapFactory().pixmap((std::string("PartDesign_") + DressUpView->featureName()).c_str()),
QString::fromLatin1((DressUpView->featureName() + " parameters").c_str()),
true,
parent),
DressUpView(DressUpView), allowFaces(selectFaces), allowEdges(selectEdges)
parent)
, proxy(0)
, DressUpView(DressUpView)
, allowFaces(selectFaces)
, allowEdges(selectEdges)
{
selectionMode = none;
}
@@ -192,6 +195,7 @@ void TaskDressUpParameters::exitSelectionMode()
TaskDlgDressUpParameters::TaskDlgDressUpParameters(ViewProviderDressUp *DressUpView)
: TaskDlgFeatureParameters(DressUpView)
, parameter(0)
{
assert(DressUpView);
}