Commit 8d60cf86 authored by Sean McBride's avatar Sean McBride
Browse files

Removed redundant logic warned by cppcheck

Mostly of the form:

A || (!A && B)

to simply:

A || B
parent d74d0cf4
Pipeline #5124 passed with stage
......@@ -1165,7 +1165,7 @@ void vtkCellLocator::BuildLocator()
void vtkCellLocator::BuildLocatorIfNeeded()
{
if (this->LazyEvaluation) {
if (!this->Tree || (this->Tree && (this->MTime>this->BuildTime))) {
if (!this->Tree || (this->MTime>this->BuildTime)) {
this->Modified();
vtkDebugMacro(<< "Forcing BuildLocator");
this->ForceBuildLocator();
......
......@@ -168,8 +168,8 @@ void vtkOpenGLStickMapper::ReplaceShaderValues(
bool picking = (ren->GetRenderWindow()->GetIsPicking() || selector != NULL);
if (picking)
{
if (!selector || (selector &&
this->LastSelectionState >= vtkHardwareSelector::ID_LOW24))
if (!selector ||
(this->LastSelectionState >= vtkHardwareSelector::ID_LOW24))
{
vtkShaderProgram::Substitute(VSSource,
"//VTK::Picking::Dec",
......@@ -290,8 +290,8 @@ void vtkOpenGLStickMapper::SetMapperShaderParameters(
vtkErrorMacro(<< "Error setting 'radiusMC' in shader VAO.");
}
if (picking &&
(!selector || (selector &&
this->LastSelectionState >= vtkHardwareSelector::ID_LOW24)))
(!selector ||
(this->LastSelectionState >= vtkHardwareSelector::ID_LOW24)))
{
if (!cellBO.VAO->AddAttributeArray(cellBO.Program, this->VBO,
"selectionId", this->VBO->ColorOffset+6*sizeof(float),
......
......@@ -251,7 +251,7 @@ void __fastcall TvtkBorlandRenderWindow::WMChar(TWMKey &Message)
case 'e':
case 'E':
case 'q':
case 'Q': if (!FOnVtkClose || (FOnVtkClose && FOnVtkClose(this)))
case 'Q': if (!FOnVtkClose || FOnVtkClose(this))
{
FInteractor->OnChar(Handle,Message.CharCode, 0, 0);
}
......
......@@ -148,7 +148,7 @@ void vtkModifiedBSPTree::BuildLocatorIfNeeded()
{
if (this->LazyEvaluation)
{
if (!this->mRoot || (this->mRoot && (this->MTime>this->BuildTime)))
if (!this->mRoot || (this->MTime>this->BuildTime))
{
this->Modified();
vtkDebugMacro(<< "Forcing BuildLocator");
......
......@@ -548,7 +548,7 @@ void vtkCellTreeLocator::BuildLocatorIfNeeded()
{
if (this->LazyEvaluation)
{
if (!this->Tree || (this->Tree && (this->MTime>this->BuildTime)))
if (!this->Tree || (this->MTime>this->BuildTime))
{
this->Modified();
vtkDebugMacro(<< "Forcing BuildLocator");
......
......@@ -476,8 +476,7 @@ int vtkSelectPolyData::RequestData(
unPolys->Allocate(numCells/2, numCells/2);
for (i=0; i< numCells; i++)
{
if ( (cellMarks->GetValue(i) >= 0) ||
(cellMarks->GetValue(i) < 0 && this->InsideOut) )
if ( (cellMarks->GetValue(i) >= 0) || this->InsideOut )
{
this->Mesh->GetCellPoints(i, npts, pts);
unPolys->InsertNextCell(npts,pts);
......
......@@ -67,7 +67,7 @@ void vtkQtConnection::DoCallback(vtkObject* vtk_obj, unsigned long event,
void vtkQtConnection::Execute(vtkObject* caller, unsigned long e, void* call_data)
{
if(e != vtkCommand::DeleteEvent ||
(e == vtkCommand::DeleteEvent && this->VTKEvent == vtkCommand::DeleteEvent))
(this->VTKEvent == vtkCommand::DeleteEvent))
{
emit EmitExecute(caller, e, ClientData, call_data, this->Callback);
}
......
......@@ -981,7 +981,7 @@ void vtkEnzoReaderInternal::GetAttributeNames()
)
{
if ( !wasFound ||
( wasFound && tmpBlock.NumberOfParticles > 0 )
( tmpBlock.NumberOfParticles > 0 )
)
{
numCells = tempNumb;
......
......@@ -2125,7 +2125,7 @@ int vtkLSDynaReader::ReadHeaderInformation( int curAdapt )
p->AddCellArray( LSDynaMetaData::SHELL, LS_ARRAYNAME_STRAIN "InnerSurf", 6, 1 );
p->AddCellArray( LSDynaMetaData::SHELL, LS_ARRAYNAME_STRAIN "OuterSurf", 6, 1 );
}
if ( ! p->Dict["ISTRN"] || (p->Dict["ISTRN"] && p->Dict["NV2D"] >= 45) )
if ( ! p->Dict["ISTRN"] || (p->Dict["NV2D"] >= 45) )
{
p->AddCellArray( LSDynaMetaData::SHELL, LS_ARRAYNAME_INTERNALENERGY, 1, 1 );
}
......@@ -2959,7 +2959,7 @@ int vtkLSDynaReader::ReadCellStateInfo( vtkIdType vtkNotUsed(step) )
//we use a temp boolean so that we have less of a chance of causing a bug.
//if you just insert the or conditions into the macro it becomes a || b && c
//when you really want (a ||b) && c
bool valid =(! p->Dict["ISTRN"] || (p->Dict["ISTRN"] && p->Dict["NV2D"] >= 45));
bool valid =(! p->Dict["ISTRN"] || (p->Dict["NV2D"] >= 45));
VTK_LS_CELLARRAY(valid,LSDynaMetaData::SHELL,LS_ARRAYNAME_INTERNALENERGY,1);
this->ReadCellProperties(LSDynaMetaData::SHELL, p->Dict["NV2D"]);
......
......@@ -1069,7 +1069,7 @@ void vtkEnSightWriter::WriteElementTypeToFile(int elementType,FILE* fd)
//----------------------------------------------------------------------------
bool vtkEnSightWriter::ShouldWriteGeometry()
{
return ((this->TransientGeometry || (!this->TransientGeometry && this->TimeStep==0)));
return (this->TransientGeometry || (this->TimeStep==0));
}
//----------------------------------------------------------------------------
......
......@@ -261,14 +261,10 @@ void vtkRenderWindow::SetStereoRender(int stereo)
}
if (this->StereoCapableWindow ||
(!this->StereoCapableWindow
&& this->StereoType != VTK_STEREO_CRYSTAL_EYES))
(this->StereoType != VTK_STEREO_CRYSTAL_EYES))
{
if (stereo != this->StereoRender)
{
this->StereoRender = stereo;
this->Modified();
}
this->StereoRender = stereo;
this->Modified();
}
else
{
......
......@@ -176,8 +176,7 @@ void vtkParseOutput(FILE *fp, FileInfo *data)
/* and the next comment either doesn't exist */
(!data->Functions[i+1].Comment ||
/* or it does exist but is different */
(data->Functions[i+1].Comment &&
strcmp(data->Functions[i].Comment,
(strcmp(data->Functions[i].Comment,
data->Functions[i+1].Comment)))))
{
closed = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment