+ fixes #0002075: Analysis of FreeCAD by PVS-Studio static analyzer
This commit is contained in:
parent
d8f63bcfd1
commit
dd2b39ddd6
|
@ -270,9 +270,9 @@ void Application::renameDocument(const char *OldName, const char *NewName)
|
|||
DocMap[NewName] = temp;
|
||||
signalRenameDocument(*temp);
|
||||
}
|
||||
else
|
||||
Base::Exception("Application::renameDocument(): no document with this name to rename!");
|
||||
|
||||
else {
|
||||
throw Base::Exception("Application::renameDocument(): no document with this name to rename!");
|
||||
}
|
||||
}
|
||||
|
||||
Document* Application::newDocument(const char * Name, const char * UserName)
|
||||
|
@ -1464,8 +1464,6 @@ pair<string, string> customSyntax(const string& s)
|
|||
return make_pair(string("fg"), string("null"));
|
||||
else if (s.find("-button") == 0)
|
||||
return make_pair(string("button"), string("null"));
|
||||
else if (s.find("-button") == 0)
|
||||
return make_pair(string("button"), string("null"));
|
||||
else if (s.find("-btn") == 0)
|
||||
return make_pair(string("btn"), string("null"));
|
||||
else if (s.find("-name") == 0)
|
||||
|
|
|
@ -516,7 +516,7 @@ bool FileInfo::deleteDirectoryRecursive(void) const
|
|||
It->deleteFile();
|
||||
}
|
||||
else {
|
||||
Base::Exception("FileInfo::deleteDirectoryRecursive(): Unknown object Type in directory!");
|
||||
throw Base::FileException("FileInfo::deleteDirectoryRecursive(): Unknown object Type in directory!");
|
||||
}
|
||||
}
|
||||
return deleteDirectory();
|
||||
|
|
|
@ -219,7 +219,7 @@ int __cdecl MemDebug::sAllocHook(
|
|||
if ( pvData != NULL )
|
||||
fprintf( logFile, " at %p\n", pvData );
|
||||
else
|
||||
fprintf( logFile, "\n", pvData );
|
||||
fprintf( logFile, "\n" );
|
||||
|
||||
return( 7 ); // Allow the memory operation to proceed (True = 7, False = 0)
|
||||
}
|
||||
|
|
|
@ -257,7 +257,6 @@ Rotation & Rotation::invert(void)
|
|||
this->quat[0] = -this->quat[0];
|
||||
this->quat[1] = -this->quat[1];
|
||||
this->quat[2] = -this->quat[2];
|
||||
this->quat[3] = this->quat[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,18 +188,6 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
this->centerTime = ev->getTime();
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) {
|
||||
SbTime tmp = (ev->getTime() - this->centerTime);
|
||||
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
|
||||
if (tmp.getValue() < dci) {
|
||||
newmode = NavigationStyle::ZOOMING;
|
||||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) {
|
||||
this->setViewing(false);
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (viewer->isEditing() && (this->currentmode == NavigationStyle::SPINNING)) {
|
||||
processed = TRUE;
|
||||
}
|
||||
|
@ -229,14 +217,6 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
this->centerTime = ev->getTime();
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) {
|
||||
SbTime tmp = (ev->getTime() - this->centerTime);
|
||||
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
|
||||
if (tmp.getValue() < dci) {
|
||||
newmode = NavigationStyle::ZOOMING;
|
||||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
this->button2down = press;
|
||||
break;
|
||||
case SoMouseButtonEvent::BUTTON3:
|
||||
|
@ -340,6 +320,9 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
else
|
||||
newmode = NavigationStyle::SELECTION;
|
||||
break;
|
||||
//case BUTTON1DOWN|BUTTON3DOWN:
|
||||
// newmode = NavigationStyle::PANNING;
|
||||
// break;
|
||||
case SHIFTDOWN|BUTTON3DOWN:
|
||||
newmode = NavigationStyle::PANNING;
|
||||
break;
|
||||
|
@ -349,6 +332,9 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
}
|
||||
newmode = NavigationStyle::DRAGGING;
|
||||
break;
|
||||
//case BUTTON1DOWN|BUTTON2DOWN|BUTTON3DOWN:
|
||||
// newmode = NavigationStyle::ZOOMING;
|
||||
// break;
|
||||
case CTRLDOWN|SHIFTDOWN|BUTTON2DOWN:
|
||||
newmode = NavigationStyle::ZOOMING;
|
||||
break;
|
||||
|
|
|
@ -224,10 +224,6 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) {
|
||||
this->setViewing(false);
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (viewer->isEditing() && (this->currentmode == NavigationStyle::SPINNING)) {
|
||||
processed = TRUE;
|
||||
}
|
||||
|
|
|
@ -153,6 +153,7 @@ TaskPanelView::~TaskPanelView()
|
|||
void TaskPanelView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
|
||||
Gui::SelectionSingleton::MessageType Reason)
|
||||
{
|
||||
/*
|
||||
std::string temp;
|
||||
|
||||
if (Reason.Type == SelectionChanges::AddSelection) {
|
||||
|
@ -161,8 +162,7 @@ void TaskPanelView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
|
|||
}
|
||||
else if (Reason.Type == SelectionChanges::RmvSelection) {
|
||||
}
|
||||
else if (Reason.Type == SelectionChanges::RmvSelection) {
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void TaskPanelView::onUpdate(void)
|
||||
|
|
|
@ -192,18 +192,6 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
this->centerTime = ev->getTime();
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) {
|
||||
SbTime tmp = (ev->getTime() - this->centerTime);
|
||||
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
|
||||
if (tmp.getValue() < dci) {
|
||||
newmode = NavigationStyle::ZOOMING;
|
||||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) {
|
||||
this->setViewing(false);
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (viewer->isEditing() && (this->currentmode == NavigationStyle::SPINNING)) {
|
||||
processed = TRUE;
|
||||
}
|
||||
|
@ -233,14 +221,6 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
this->centerTime = ev->getTime();
|
||||
processed = TRUE;
|
||||
}
|
||||
else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) {
|
||||
SbTime tmp = (ev->getTime() - this->centerTime);
|
||||
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
|
||||
if (tmp.getValue() < dci) {
|
||||
newmode = NavigationStyle::ZOOMING;
|
||||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
this->button2down = press;
|
||||
break;
|
||||
case SoMouseButtonEvent::BUTTON4:
|
||||
|
|
|
@ -290,8 +290,8 @@ void LightManip(SoSeparator * root)
|
|||
SoInput in;
|
||||
in.setBuffer((void *)scenegraph, std::strlen(scenegraph));
|
||||
SoSeparator * _root = SoDB::readAll( &in );
|
||||
if ( _root == NULL ) return; // Shouldn't happen.
|
||||
root->addChild(_root);
|
||||
if ( root == NULL ) return; // Shouldn't happen.
|
||||
root->ref();
|
||||
|
||||
const char * pointlightnames[3] = { "RedLight", "GreenLight", "BlueLight" };
|
||||
|
|
|
@ -1007,12 +1007,14 @@ void PropertyVectorDistanceItem::setValue(const QVariant& variant)
|
|||
return;
|
||||
const Base::Vector3d& value = variant.value<Base::Vector3d>();
|
||||
|
||||
Base::Quantity q = Base::Quantity(value.x, Base::Unit::Length);
|
||||
QString unit = QString::fromLatin1("('%1 %2'").arg(q.getValue()).arg(q.getUnit().getString());
|
||||
q = Base::Quantity(value.y, Base::Unit::Length);
|
||||
unit + QString::fromLatin1("'%1 %2'").arg(q.getValue()).arg(q.getUnit().getString());
|
||||
|
||||
setPropertyValue(unit);
|
||||
Base::Quantity x = Base::Quantity(value.x, Base::Unit::Length);
|
||||
Base::Quantity y = Base::Quantity(value.y, Base::Unit::Length);
|
||||
Base::Quantity z = Base::Quantity(value.z, Base::Unit::Length);
|
||||
QString data = QString::fromAscii("(%1, %2, %3)")
|
||||
.arg(x.getUserString())
|
||||
.arg(y.getUserString())
|
||||
.arg(z.getUserString());
|
||||
setPropertyValue(data);
|
||||
}
|
||||
|
||||
void PropertyVectorDistanceItem::setEditorData(QWidget *editor, const QVariant& data) const
|
||||
|
|
|
@ -78,9 +78,9 @@ SET(Drawing_Templates
|
|||
)
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_PreComp_)
|
||||
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" Drawing_CPP_SRCS ${Drawing_SRCS} ${Features_SRCS} ${DrawingAlgos_SRCS})
|
||||
ADD_MSVC_PRECOMPILED_HEADER(Drawing PreCompiled.h PreCompiled.cpp Drawing_CPP_SRCS)
|
||||
#add_definitions(-D_PreComp_)
|
||||
#GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" Drawing_CPP_SRCS ${Drawing_SRCS} ${Features_SRCS} ${DrawingAlgos_SRCS})
|
||||
#ADD_MSVC_PRECOMPILED_HEADER(Drawing PreCompiled.h PreCompiled.cpp Drawing_CPP_SRCS)
|
||||
endif(MSVC)
|
||||
|
||||
add_library(Drawing SHARED ${Drawing_SRCS} ${Features_SRCS} ${DrawingAlgos_SRCS})
|
||||
|
|
|
@ -81,9 +81,9 @@ SET(DrawingGuiTaskDlgs_SRCS
|
|||
SOURCE_GROUP("TaskDialogs" FILES ${DrawingGuiTaskDlgs_SRCS})
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_PreComp_)
|
||||
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${DrawingGui_SRCS} ${DrawingGuiView_SRCS} ${DrawingGuiViewProvider_SRCS})
|
||||
ADD_MSVC_PRECOMPILED_HEADER(DrawingGui PreCompiled.h PreCompiled.cpp PCH_SRCS)
|
||||
#add_definitions(-D_PreComp_)
|
||||
#GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${DrawingGui_SRCS} ${DrawingGuiView_SRCS} ${DrawingGuiViewProvider_SRCS})
|
||||
#ADD_MSVC_PRECOMPILED_HEADER(DrawingGui PreCompiled.h PreCompiled.cpp PCH_SRCS)
|
||||
endif(MSVC)
|
||||
|
||||
add_library(DrawingGui SHARED ${DrawingGui_SRCS} ${DrawingGuiView_SRCS} ${DrawingGuiViewProvider_SRCS})
|
||||
|
|
|
@ -689,9 +689,10 @@ void ViewProviderFEMMeshBuilder::buildNodes(const App::Property* prop, std::vect
|
|||
|
||||
inline void insEdgeVec(std::map<int,std::set<int> > &map, int n1, int n2)
|
||||
{
|
||||
if(n1<n2)
|
||||
map[n2].insert(n1);
|
||||
else
|
||||
//FIXME: The if-else distinction doesn't make sense
|
||||
//if (n1<n2)
|
||||
// map[n2].insert(n1);
|
||||
//else
|
||||
map[n2].insert(n1);
|
||||
};
|
||||
|
||||
|
|
|
@ -1053,11 +1053,11 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion & vp,
|
|||
float scaleX = (float)sizeX/(float)size[0];
|
||||
float scaleY = (float)sizeY/(float)size[1];
|
||||
float scale = std::max<float>(scaleX, scaleY);
|
||||
if (cam && cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) {
|
||||
if (cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) {
|
||||
float height = static_cast<SoOrthographicCamera*>(cam)->height.getValue() * scale;
|
||||
static_cast<SoOrthographicCamera*>(cam)->height = height;
|
||||
}
|
||||
else if (cam && cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) {
|
||||
else if (cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) {
|
||||
float height = static_cast<SoPerspectiveCamera*>(cam)->heightAngle.getValue() / 2.0f;
|
||||
height = 2.0f * atan(tan(height) * scale);
|
||||
static_cast<SoPerspectiveCamera*>(cam)->heightAngle = height;
|
||||
|
|
|
@ -777,7 +777,7 @@ bool FaceTypedBSpline::isEqual(const TopoDS_Face &faceOne, const TopoDS_Face &fa
|
|||
return false;
|
||||
|
||||
if (surfaceOne->IsURational() != surfaceTwo->IsURational()) return false;
|
||||
if (surfaceTwo->IsVRational() != surfaceTwo->IsVRational()) return false;
|
||||
if (surfaceOne->IsVRational() != surfaceTwo->IsVRational()) return false;
|
||||
if (surfaceOne->IsUPeriodic() != surfaceTwo->IsUPeriodic()) return false;
|
||||
if (surfaceOne->IsVPeriodic() != surfaceTwo->IsVPeriodic()) return false;
|
||||
if (surfaceOne->IsUClosed() != surfaceTwo->IsUClosed()) return false;
|
||||
|
|
|
@ -183,10 +183,10 @@ ResultEntry::ResultEntry()
|
|||
|
||||
ResultEntry::~ResultEntry()
|
||||
{
|
||||
if (boxSep)
|
||||
if (boxSep && viewProviderRoot)
|
||||
viewProviderRoot->removeChild(boxSep);
|
||||
if (viewProviderRoot)
|
||||
viewProviderRoot->unref();
|
||||
viewProviderRoot->unref();
|
||||
qDeleteAll(children);
|
||||
}
|
||||
|
||||
|
|
|
@ -225,10 +225,11 @@ Py::Int WaypointPy::getTool(void) const
|
|||
|
||||
void WaypointPy::setTool(Py::Int arg)
|
||||
{
|
||||
if((int)arg.operator long() > 0)
|
||||
getWaypointPtr()->Tool = (int)arg.operator long();
|
||||
long value = static_cast<long>(arg);
|
||||
if (value >= 0)
|
||||
getWaypointPtr()->Tool = value;
|
||||
else
|
||||
Base::Exception("negativ tool not allowed!");
|
||||
throw Py::ValueError("negative tool not allowed!");
|
||||
}
|
||||
|
||||
Py::Int WaypointPy::getBase(void) const
|
||||
|
@ -238,10 +239,11 @@ Py::Int WaypointPy::getBase(void) const
|
|||
|
||||
void WaypointPy::setBase(Py::Int arg)
|
||||
{
|
||||
if((int)arg.operator long() > 0)
|
||||
getWaypointPtr()->Base = (int)arg.operator long();
|
||||
long value = static_cast<long>(arg);
|
||||
if (value >= 0)
|
||||
getWaypointPtr()->Base = value;
|
||||
else
|
||||
Base::Exception("negativ base not allowed!");
|
||||
throw Py::ValueError("negative base not allowed!");
|
||||
}
|
||||
|
||||
PyObject *WaypointPy::getCustomAttributes(const char* /*attr*/) const
|
||||
|
|
|
@ -206,9 +206,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
|
|||
path = searchAction.getPath();
|
||||
if(path){
|
||||
SoNode* node = path->getTail();
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
|
||||
throw; // should not happen
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
Axis1Node = static_cast<SoVRMLTransform *>(node);
|
||||
}
|
||||
// Axis 2
|
||||
|
@ -219,9 +219,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
|
|||
path = searchAction.getPath();
|
||||
if(path){
|
||||
SoNode* node = path->getTail();
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
|
||||
throw; // should not happen
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
Axis2Node = static_cast<SoVRMLTransform *>(node);
|
||||
}
|
||||
// Axis 3
|
||||
|
@ -232,9 +232,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
|
|||
path = searchAction.getPath();
|
||||
if(path){
|
||||
SoNode* node = path->getTail();
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
|
||||
throw; // should not happen
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
Axis3Node = static_cast<SoVRMLTransform *>(node);
|
||||
}
|
||||
// Axis 4
|
||||
|
@ -245,9 +245,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
|
|||
path = searchAction.getPath();
|
||||
if(path){
|
||||
SoNode* node = path->getTail();
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
|
||||
throw; // should not happen
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
Axis4Node = static_cast<SoVRMLTransform *>(node);
|
||||
}
|
||||
// Axis 5
|
||||
|
@ -258,9 +258,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
|
|||
path = searchAction.getPath();
|
||||
if(path){
|
||||
SoNode* node = path->getTail();
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
|
||||
throw; // should not happen
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
Axis5Node = static_cast<SoVRMLTransform *>(node);
|
||||
}
|
||||
// Axis 6
|
||||
|
@ -271,9 +271,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop)
|
|||
path = searchAction.getPath();
|
||||
if(path){
|
||||
SoNode* node = path->getTail();
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
|
||||
throw; // should not happen
|
||||
std::string typeName = (const char*)node->getTypeId().getName();
|
||||
Axis6Node = static_cast<SoVRMLTransform *>(node);
|
||||
}
|
||||
if(Axis1Node)
|
||||
|
|
|
@ -182,8 +182,7 @@ int Sketch::addGeometry(const Part::Geometry *geo, bool fixed)
|
|||
// create the definition struct for that geom
|
||||
return addArcOfEllipse(*aoe, fixed);
|
||||
} else {
|
||||
Base::Exception("Sketch::addGeometry(): Unknown or unsupported type added to a sketch");
|
||||
return 0;
|
||||
throw Base::TypeError("Sketch::addGeometry(): Unknown or unsupported type added to a sketch");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace GCS
|
|||
class Curve //a base class for all curve-based objects (line, circle/arc, ellipse/arc)
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~Curve(){}
|
||||
//returns normal vector. The vector should point to the left when one
|
||||
// walks along the curve from start to end. Ellipses and circles are
|
||||
// assumed to be walked counterclockwise, so the vector should point
|
||||
|
@ -111,6 +111,7 @@ namespace GCS
|
|||
{
|
||||
public:
|
||||
Line(){}
|
||||
virtual ~Line(){}
|
||||
Point p1;
|
||||
Point p2;
|
||||
DeriVector2 CalculateNormal(Point &p, double* derivparam = 0);
|
||||
|
@ -123,6 +124,7 @@ namespace GCS
|
|||
{
|
||||
public:
|
||||
Circle(){rad = 0;}
|
||||
virtual ~Circle(){}
|
||||
Point center;
|
||||
double *rad;
|
||||
DeriVector2 CalculateNormal(Point &p, double* derivparam = 0);
|
||||
|
@ -135,6 +137,7 @@ namespace GCS
|
|||
{
|
||||
public:
|
||||
Arc(){startAngle=0;endAngle=0;rad=0;}
|
||||
virtual ~Arc(){}
|
||||
double *startAngle;
|
||||
double *endAngle;
|
||||
//double *rad; //inherited
|
||||
|
@ -150,6 +153,7 @@ namespace GCS
|
|||
{
|
||||
public:
|
||||
Ellipse(){ radmin = 0;}
|
||||
virtual ~Ellipse(){}
|
||||
Point center;
|
||||
Point focus1;
|
||||
double *radmin;
|
||||
|
@ -166,6 +170,7 @@ namespace GCS
|
|||
{
|
||||
public:
|
||||
ArcOfEllipse(){startAngle=0;endAngle=0;radmin = 0;}
|
||||
virtual ~ArcOfEllipse(){}
|
||||
double *startAngle;
|
||||
double *endAngle;
|
||||
//double *radmin; //inherited
|
||||
|
|
|
@ -992,7 +992,7 @@ void PropertySheet::recomputeDependants(const Property *prop)
|
|||
|
||||
assert(name != 0);
|
||||
|
||||
if (owner && name) {
|
||||
if (name) {
|
||||
const char * docName = owner->getDocument()->Label.getValue();
|
||||
const char * nameInDoc = owner->getNameInDocument();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user