+ fix -Wnull-conversion, -Woverloaded-virtual, -Wlogical-not-parentheses, -Wsometimes-uninitialized

This commit is contained in:
wmayer 2014-08-26 19:14:13 +02:00
parent 55cf9ddeaa
commit cc775f9254
30 changed files with 43 additions and 41 deletions

View File

@ -199,7 +199,7 @@ void DocumentObserverPython::slotChangedObject(const App::DocumentObject& Obj,
Py::Callable method(this->inst.getAttr(std::string("slotChangedObject")));
Py::Tuple args(2);
args.setItem(0, Py::Object(const_cast<App::DocumentObject&>(Obj).getPyObject(), true));
std::string prop_name = Obj.getName(&Prop);
std::string prop_name = Obj.getPropertyName(&Prop);
args.setItem(1, Py::String(prop_name));
method.apply(args);
}

View File

@ -106,13 +106,13 @@ void DynamicProperty::addDynamicProperties(const PropertyContainer* cont)
}
}
const char* DynamicProperty::getName(const Property* prop) const
const char* DynamicProperty::getPropertyName(const Property* prop) const
{
for (std::map<std::string,PropData>::const_iterator it = props.begin(); it != props.end(); ++it) {
if (it->second.property == prop)
return it->first.c_str();
}
return this->pc->PropertyContainer::getName(prop);
return this->pc->PropertyContainer::getPropertyName(prop);
}
unsigned int DynamicProperty::getMemSize (void) const

View File

@ -74,7 +74,7 @@ public:
std::vector<std::string> getDynamicPropertyNames() const;
void addDynamicProperties(const PropertyContainer*);
/// get the name of a property
const char* getName(const Property* prop) const;
const char* getPropertyName(const Property* prop) const;
//@}
/** @name Property attributes */

View File

@ -88,7 +88,7 @@ void FeaturePythonImp::onChanged(const Property* prop)
if (feature.hasAttr("__object__")) {
Py::Callable method(feature.getAttr(std::string("onChanged")));
Py::Tuple args(1);
std::string prop_name = object->getName(prop);
std::string prop_name = object->getPropertyName(prop);
args.setItem(0, Py::String(prop_name));
method.apply(args);
}
@ -96,7 +96,7 @@ void FeaturePythonImp::onChanged(const Property* prop)
Py::Callable method(feature.getAttr(std::string("onChanged")));
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true));
std::string prop_name = object->getName(prop);
std::string prop_name = object->getPropertyName(prop);
args.setItem(1, Py::String(prop_name));
method.apply(args);
}

View File

@ -124,8 +124,8 @@ public:
return props->getPropertyByName(name);
}
/// get the name of a property
virtual const char* getName(const Property* prop) const {
return props->getName(prop);
virtual const char* getPropertyName(const Property* prop) const {
return props->getPropertyName(prop);
}
//@}

View File

@ -58,7 +58,7 @@ Property::~Property()
const char* Property::getName(void) const
{
return father->getName(this);
return father->getPropertyName(this);
}
short Property::getType(void) const

View File

@ -143,7 +143,7 @@ bool PropertyContainer::isHidden(const char *name) const
return (getPropertyData().getType(this,name) & Prop_Hidden) == Prop_Hidden;
}
const char* PropertyContainer::getName(const Property* prop)const
const char* PropertyContainer::getPropertyName(const Property* prop)const
{
return getPropertyData().getName(this,prop);
}

View File

@ -104,7 +104,7 @@ public:
/// find a property by its name
virtual Property *getPropertyByName(const char* name) const;
/// get the name of a property
virtual const char* getName(const Property* prop) const;
virtual const char* getPropertyName(const Property* prop) const;
/// get all properties of the class (including properties of the parent)
virtual void getPropertyMap(std::map<std::string,Property*> &Map) const;
/// get all properties of the class (including properties of the parent)

View File

@ -1130,7 +1130,7 @@ namespace Py
// TMM: added this seqref ctor for use with STL algorithms
seqref (Object& obj)
: s(dynamic_cast< SeqBase<T>&>(obj))
, offset( NULL )
, offset( 0 )
, the_item(s.getItem(offset))
{}
~seqref()

View File

@ -863,7 +863,7 @@ void PythonCommand::languageChange()
}
}
const char* PythonCommand::getHelpUrl(void)
const char* PythonCommand::getHelpUrl(void) const
{
PyObject* pcTemp;
pcTemp = Interpreter().runMethodObject(_pcPyCommand, "CmdHelpURL");

View File

@ -328,7 +328,7 @@ protected:
/// if the command is not always active
virtual bool isActive(void);
/// Get the help URL
const char* getHelpUrl(void);
const char* getHelpUrl(void) const;
/// Creates the used Action
virtual Action * createAction(void);
//@}

View File

@ -151,7 +151,7 @@ void DlgDisplayPropertiesImp::slotChangedObject(const Gui::ViewProvider& obj,
std::bind2nd(std::equal_to<Gui::ViewProvider*>(),
const_cast<Gui::ViewProvider*>(&obj)));
if (vp != Provider.end()) {
std::string prop_name = obj.getName(&prop);
std::string prop_name = obj.getPropertyName(&prop);
if (prop.getTypeId() == App::PropertyColor::getClassTypeId()) {
App::Color value = static_cast<const App::PropertyColor&>(prop).getValue();
if (prop_name == "ShapeColor") {

View File

@ -1240,7 +1240,7 @@ bool ManualAlignment::applyPickedProbe(Gui::ViewProviderDocumentObject* prov, co
// add to the list for the non-aligned view in the left view
if (myAlignModel.activeGroup().hasView(prov)) {
std::vector<Base::Vector3d> pts = prov->getPickedPoints(pnt);
std::vector<Base::Vector3d> pts = prov->getModelPoints(pnt);
if (pts.empty())
return false;
myAlignModel.activeGroup().addPoint(pts.front());
@ -1249,7 +1249,7 @@ bool ManualAlignment::applyPickedProbe(Gui::ViewProviderDocumentObject* prov, co
return true;
}
else if (myFixedGroup.hasView(prov)) {
std::vector<Base::Vector3d> pts = prov->getPickedPoints(pnt);
std::vector<Base::Vector3d> pts = prov->getModelPoints(pnt);
if (pts.empty())
return false;
myFixedGroup.addPoint(pts.front());

View File

@ -134,7 +134,7 @@ void PropertyView::onSelectionChanged(const SelectionChanges& msg)
if (ob) {
for (pt = dataList.begin(); pt != dataList.end(); ++pt) {
PropInfo nameType;
nameType.propName = ob->getName(*pt);
nameType.propName = ob->getPropertyName(*pt);
nameType.propId = (*pt)->getTypeId().getKey();
if (!ob->isHidden(*pt) && !(*pt)->StatusBits.test(3)) {

View File

@ -126,9 +126,8 @@ void SelectionView::onUpdate(void)
{
}
bool SelectionView::onMsg(const char* pMsg)
bool SelectionView::onMsg(const char* pMsg,const char** ppReturn)
{
// no messages yet
return false;
}
/// @endcond

View File

@ -75,7 +75,7 @@ public:
Gui::SelectionSingleton::MessageType Reason);
bool onMsg(const char* pMsg);
bool onMsg(const char* pMsg,const char** ppReturn);
virtual const char *getName(void) const {return "SelectionView";}

View File

@ -169,9 +169,8 @@ void TaskPanelView::onUpdate(void)
{
}
bool TaskPanelView::onMsg(const char* pMsg)
bool TaskPanelView::onMsg(const char* pMsg,const char** ppReturn)
{
// no messages yet
return false;
}
/// @endcond

View File

@ -55,8 +55,7 @@ public:
Gui::SelectionSingleton::MessageType Reason);
bool onMsg(const char* pMsg);
virtual bool onMsg(const char* pMsg,const char** ppReturn);
virtual const char *getName(void) const {return "TaskPanelView";}
/// get called when the document is changed or updated

View File

@ -103,7 +103,7 @@ void TaskAppearance::slotChangedObject(const Gui::ViewProvider& obj,
std::bind2nd(std::equal_to<Gui::ViewProvider*>(),
const_cast<Gui::ViewProvider*>(&obj)));
if (vp != Provider.end()) {
std::string prop_name = obj.getName(&prop);
std::string prop_name = obj.getPropertyName(&prop);
if (prop.getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
long value = static_cast<const App::PropertyInteger&>(prop).getValue();
if (prop_name == "Transparency") {

View File

@ -387,7 +387,7 @@ SoPickedPoint* ViewProvider::getPointOnRay(const SbVec3f& pos,const SbVec3f& dir
return (pick ? new SoPickedPoint(*pick) : 0);
}
std::vector<Base::Vector3d> ViewProvider::getPickedPoints(const SoPickedPoint* pp) const
std::vector<Base::Vector3d> ViewProvider::getModelPoints(const SoPickedPoint* pp) const
{
// the default implementation just returns the picked point from the visual representation
std::vector<Base::Vector3d> pts;

View File

@ -121,7 +121,7 @@ public:
/// return a hit element to the selection path or 0
virtual std::string getElement(const SoDetail *) const { return std::string(); }
virtual SoDetail* getDetail(const char*) const { return 0; }
virtual std::vector<Base::Vector3d> getPickedPoints(const SoPickedPoint *) const;
virtual std::vector<Base::Vector3d> getModelPoints(const SoPickedPoint *) const;
/// return the higlight lines for a given element or the whole shape
virtual std::vector<Base::Vector3d> getSelectionShape(const char* Element) const
{ return std::vector<Base::Vector3d>(); }

View File

@ -562,7 +562,7 @@ void ViewProviderPythonFeatureImp::updateData(const App::Property* prop)
if (vp.hasAttr("__object__")) {
Py::Callable method(vp.getAttr(std::string("updateData")));
Py::Tuple args(1);
const char* prop_name = object->getObject()->getName(prop);
const char* prop_name = object->getObject()->getPropertyName(prop);
if (prop_name) {
args.setItem(0, Py::String(prop_name));
method.apply(args);
@ -572,7 +572,7 @@ void ViewProviderPythonFeatureImp::updateData(const App::Property* prop)
Py::Callable method(vp.getAttr(std::string("updateData")));
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getObject()->getPyObject(), true));
const char* prop_name = object->getObject()->getName(prop);
const char* prop_name = object->getObject()->getPropertyName(prop);
if (prop_name) {
args.setItem(1, Py::String(prop_name));
method.apply(args);
@ -599,7 +599,7 @@ void ViewProviderPythonFeatureImp::onChanged(const App::Property* prop)
if (vp.hasAttr("__object__")) {
Py::Callable method(vp.getAttr(std::string("onChanged")));
Py::Tuple args(1);
std::string prop_name = object->getName(prop);
std::string prop_name = object->getPropertyName(prop);
args.setItem(0, Py::String(prop_name));
method.apply(args);
}
@ -607,7 +607,7 @@ void ViewProviderPythonFeatureImp::onChanged(const App::Property* prop)
Py::Callable method(vp.getAttr(std::string("onChanged")));
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true));
std::string prop_name = object->getName(prop);
std::string prop_name = object->getPropertyName(prop);
args.setItem(1, Py::String(prop_name));
method.apply(args);
}

View File

@ -219,8 +219,8 @@ public:
return props->getPropertyByName(name);
}
/// get the name of a property
virtual const char* getName(const App::Property* prop) const {
return props->getName(prop);
virtual const char* getPropertyName(const App::Property* prop) const {
return props->getPropertyName(prop);
}
//@}

View File

@ -193,7 +193,7 @@ QString PropertyItem::pythonIdentifier(const App::Property* prop) const
if (parent->getTypeId() == App::Document::getClassTypeId()) {
App::Document* doc = static_cast<App::Document*>(parent);
QString docName = QString::fromAscii(App::GetApplication().getDocumentName(doc));
QString propName = QString::fromAscii(parent->getName(prop));
QString propName = QString::fromAscii(parent->getPropertyName(prop));
return QString::fromAscii("FreeCAD.getDocument(\"%1\").%2").arg(docName).arg(propName);
}
if (parent->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId())) {
@ -201,7 +201,7 @@ QString PropertyItem::pythonIdentifier(const App::Property* prop) const
App::Document* doc = obj->getDocument();
QString docName = QString::fromAscii(App::GetApplication().getDocumentName(doc));
QString objName = QString::fromAscii(obj->getNameInDocument());
QString propName = QString::fromAscii(parent->getName(prop));
QString propName = QString::fromAscii(parent->getPropertyName(prop));
return QString::fromAscii("FreeCAD.getDocument(\"%1\").getObject(\"%2\").%3")
.arg(docName).arg(objName).arg(propName);
}
@ -210,7 +210,7 @@ QString PropertyItem::pythonIdentifier(const App::Property* prop) const
App::Document* doc = obj->getDocument();
QString docName = QString::fromAscii(App::GetApplication().getDocumentName(doc));
QString objName = QString::fromAscii(obj->getNameInDocument());
QString propName = QString::fromAscii(parent->getName(prop));
QString propName = QString::fromAscii(parent->getPropertyName(prop));
return QString::fromAscii("FreeCADGui.getDocument(\"%1\").getObject(\"%2\").%3")
.arg(docName).arg(objName).arg(propName);
}

View File

@ -54,6 +54,7 @@ App::Color calcColor(double value,double min, double max)
return App::Color (0.0,1-((value-(min/2.0)) / (min/2.0)),1.0);
if ( value < 0.0 )
return App::Color (0.0,1.0,value/(min/2.0)) ;
return App::Color (0,0,0);
}

View File

@ -99,4 +99,6 @@ int StepShape::read(const char* fileName)
model->PrintLabel(entity,msg);
std::cout << ";"<< entity->DynamicType()->Name() << std::endl;
}
return 0;
}

View File

@ -476,7 +476,7 @@ SoDetail* ViewProviderPartExt::getDetail(const char* subelement) const
return detail;
}
std::vector<Base::Vector3d> ViewProviderPartExt::getPickedPoints(const SoPickedPoint* pp) const
std::vector<Base::Vector3d> ViewProviderPartExt::getModelPoints(const SoPickedPoint* pp) const
{
try {
std::vector<Base::Vector3d> pts;

View File

@ -101,7 +101,7 @@ public:
/// return a hit element to the selection path or 0
virtual std::string getElement(const SoDetail*) const;
virtual SoDetail* getDetail(const char*) const;
virtual std::vector<Base::Vector3d> getPickedPoints(const SoPickedPoint *) const;
virtual std::vector<Base::Vector3d> getModelPoints(const SoPickedPoint *) const;
/// return the higlight lines for a given element or the whole shape
virtual std::vector<Base::Vector3d> getSelectionShape(const char* Element) const;
//@}

View File

@ -146,7 +146,7 @@ App::DocumentObjectExecReturn *Draft::execute(void)
TopoDS_Shape face = TopShape.getSubShape(SubVals[0].c_str());
TopTools_IndexedMapOfShape mapOfEdges;
TopExp::MapShapes(face, TopAbs_EDGE, mapOfEdges);
bool found;
bool found = false;
for (int i = 1; i <= mapOfEdges.Extent(); i++) {
// Note: What happens if mapOfEdges(i) is the degenerated edge of a cone?
@ -212,7 +212,7 @@ App::DocumentObjectExecReturn *Draft::execute(void)
if (refEdge.IsNull())
throw Base::Exception("Failed to extract neutral plane reference edge");
BRepAdaptor_Curve c(refEdge);
if (!c.GetType() == GeomAbs_Line)
if (c.GetType() != GeomAbs_Line)
throw Base::Exception("Neutral plane reference edge must be linear");
double a = c.Line().Angle(gp_Lin(c.Value(c.FirstParameter()), pullDirection));
if (std::fabs(a - M_PI_2) > Precision::Confusion())

View File

@ -889,6 +889,8 @@ int System::solve(SubSystem *subsys, bool isFine, Algorithm alg)
return solve_LM(subsys);
else if (alg == DogLeg)
return solve_DL(subsys);
else
return Failed;
}
int System::solve_BFGS(SubSystem *subsys, bool isFine)