PVS: V560 A part of conditional expression is always true

This commit is contained in:
wmayer
2019-02-17 13:56:48 +01:00
parent b52f8d1e1d
commit f581d5c8cb
16 changed files with 42 additions and 42 deletions
+2 -2
View File
@@ -146,7 +146,7 @@ ConsoleSingleton::~ConsoleSingleton()
*/
void ConsoleSingleton::SetConsoleMode(ConsoleMode m)
{
if(m && Verbose)
if (m & Verbose)
_bVerbose = true;
}
@@ -155,7 +155,7 @@ void ConsoleSingleton::SetConsoleMode(ConsoleMode m)
*/
void ConsoleSingleton::UnsetConsoleMode(ConsoleMode m)
{
if(m && Verbose)
if (m & Verbose)
_bVerbose = false;
}
+1 -1
View File
@@ -120,7 +120,7 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
}
// give the nodes in the foreground root the chance to handle events (e.g color bar)
if (!processed && !viewer->isEditing()) {
if (!viewer->isEditing()) {
processed = handleEventInForeground(ev);
if (processed)
return true;
+1 -1
View File
@@ -124,7 +124,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
}
// give the nodes in the foreground root the chance to handle events (e.g color bar)
if (!processed && !viewer->isEditing()) {
if (!viewer->isEditing()) {
processed = handleEventInForeground(ev);
if (processed)
return true;
+1 -1
View File
@@ -122,7 +122,7 @@ Gui::View3DInventor* DemoMode::activeView() const
Document* doc = Application::Instance->activeDocument();
if (doc) {
MDIView* view = doc->getActiveView();
if (doc && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
return static_cast<Gui::View3DInventor*>(view);
}
}
+21 -23
View File
@@ -108,31 +108,29 @@ bool GUIApplication::notify (QObject * receiver, QEvent * event)
}
// Print some more information to the log file (if active) to ease bug fixing
if (receiver && event) {
try {
std::stringstream dump;
dump << "The event type " << (int)event->type() << " was sent to "
<< receiver->metaObject()->className() << "\n";
dump << "Object tree:\n";
if (receiver->isWidgetType()) {
QWidget* w = qobject_cast<QWidget*>(receiver);
while (w) {
dump << "\t";
dump << w->metaObject()->className();
QString name = w->objectName();
if (!name.isEmpty())
dump << " (" << (const char*)name.toUtf8() << ")";
w = w->parentWidget();
if (w)
dump << " is child of\n";
}
std::string str = dump.str();
Base::Console().Log("%s",str.c_str());
try {
std::stringstream dump;
dump << "The event type " << (int)event->type() << " was sent to "
<< receiver->metaObject()->className() << "\n";
dump << "Object tree:\n";
if (receiver->isWidgetType()) {
QWidget* w = qobject_cast<QWidget*>(receiver);
while (w) {
dump << "\t";
dump << w->metaObject()->className();
QString name = w->objectName();
if (!name.isEmpty())
dump << " (" << (const char*)name.toUtf8() << ")";
w = w->parentWidget();
if (w)
dump << " is child of\n";
}
std::string str = dump.str();
Base::Console().Log("%s",str.c_str());
}
catch (...) {
Base::Console().Log("Invalid recipient and/or event in GUIApplication::notify\n");
}
}
catch (...) {
Base::Console().Log("Invalid recipient and/or event in GUIApplication::notify\n");
}
return true;
+1 -1
View File
@@ -126,7 +126,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
}
// give the nodes in the foreground root the chance to handle events (e.g color bar)
if (!processed && !viewer->isEditing()) {
if (!viewer->isEditing()) {
processed = handleEventInForeground(ev);
if (processed)
return true;
+2 -2
View File
@@ -521,11 +521,11 @@ void NavigationStyle::boxZoom(const SbBox2s& box)
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;
+2 -2
View File
@@ -120,7 +120,7 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev)
}
// give the nodes in the foreground root the chance to handle events (e.g color bar)
if (!processed && !viewer->isEditing()) {
if (!viewer->isEditing()) {
processed = handleEventInForeground(ev);
if (processed)
return true;
@@ -252,7 +252,7 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev)
this->panningplane = vv.getPlane(viewer->getSoRenderManager()->getCamera()->focalDistance.getValue());
this->lockrecenter = false;
}
else if (!press && (this->currentmode == NavigationStyle::PANNING)) {
else if (this->currentmode == NavigationStyle::PANNING) {
newmode = NavigationStyle::IDLE;
processed = true;
}
+1 -1
View File
@@ -120,7 +120,7 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev)
}
// give the nodes in the foreground root the chance to handle events (e.g color bar)
if (!processed && !viewer->isEditing()) {
if (!viewer->isEditing()) {
processed = handleEventInForeground(ev);
if (processed)
return true;
+1 -1
View File
@@ -120,7 +120,7 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev)
}
// give the nodes in the foreground root the chance to handle events (e.g color bar)
if (!processed && !viewer->isEditing()) {
if (!viewer->isEditing()) {
processed = handleEventInForeground(ev);
if (processed)
return true;
+2 -2
View File
@@ -235,7 +235,7 @@ Base::Placement AttachEngine::placementFactory(const gp_Dir &ZAxis,
gp_Ax3 ax3;//OCC representation of the final placement
if (!makeYVertical) {
ax3 = gp_Ax3(Origin, ZAxis, XAxis);
} else if (makeYVertical && !makeLegacyFlatFaceOrientation) {
} else if (!makeLegacyFlatFaceOrientation) {
//align Y along Z, if possible
gp_Vec YAxis(0.0,0.0,1.0);
XAxis = YAxis.Crossed(gp_Vec(ZAxis));
@@ -1163,7 +1163,7 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origP
throw Base::ValueError("AttachEngine3D::calculateAttachedPlacement: not enough subshapes (need one false and one vertex).");
bool bThruVertex = false;
if (shapes[0]->ShapeType() == TopAbs_VERTEX && shapes.size()>=2) {
if (shapes[0]->ShapeType() == TopAbs_VERTEX) {
std::swap(shapes[0],shapes[1]);
bThruVertex = true;
}
+3 -1
View File
@@ -2507,8 +2507,10 @@ TopoDS_Shape TopoShape::makeOffset2D(double offset, short joinType, bool fill, b
{
if (_Shape.IsNull())
throw Base::ValueError("makeOffset2D: input shape is null!");
if (allowOpenResult && OCC_VERSION_HEX < 0x060900)
#if OCC_VERSION_HEX < 0x060900
if (allowOpenResult)
throw Base::AttributeError("openResult argument is not supported on OCC < 6.9.0.");
#endif
// OUTLINE OF MAKEOFFSET2D
// * Prepare shapes to process
+1 -1
View File
@@ -281,7 +281,7 @@ PyObject* TopoShapeSolidPy::offsetFaces(PyObject *args)
}
bool paramOK = false;
if (!paramOK && PyArg_ParseTuple(args, "Od", &obj,&offset)) {
if (PyArg_ParseTuple(args, "Od", &obj,&offset)) {
paramOK = true;
Py::Sequence list(obj);
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
+1 -1
View File
@@ -758,7 +758,7 @@ void finishFeature(const Gui::Command* cmd, const std::string& FeatName,
pcActiveBody = PartDesignGui::getBody(/*messageIfNot = */false);
}
if (hidePrevSolid && prevSolidFeature && (prevSolidFeature != NULL))
if (hidePrevSolid && prevSolidFeature)
cmd->doCommand(cmd->Gui,"Gui.activeDocument().hide(\"%s\")", prevSolidFeature->getNameInDocument());
if (updateDocument)
+1 -1
View File
@@ -205,7 +205,7 @@ void ViewProvider::onChanged(const App::Property* prop) {
return;
Gui::ViewProviderDocumentObject* vpd = static_cast<ViewProviderDocumentObject*>(vp);
if(vpd && vpd->Visibility.getValue())
if (vpd->Visibility.getValue())
vpd->Visibility.setValue(false);
}
}
+1 -1
View File
@@ -5425,7 +5425,7 @@ const Part::Geometry* SketchObject::getGeometry(int GeoId) const
if (GeoId < int(geomlist.size()))
return geomlist[GeoId];
}
else if (GeoId <= -1 && -GeoId <= int(ExternalGeo.size()))
else if (-GeoId <= int(ExternalGeo.size()))
return ExternalGeo[-GeoId-1];
return 0;