Skip to content

Commit

Permalink
STYLE: Fix build warnings on linux
Browse files Browse the repository at this point in the history
Fixed build warnings reported by this github action:
https://github.com/Slicer/Slicer/actions/runs/11829892124/job/32962501349
  • Loading branch information
lassoan committed Nov 14, 2024
1 parent d6f6b7d commit 801f848
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 30 deletions.
25 changes: 14 additions & 11 deletions Libs/MRML/Core/vtkImageMathematicsAddon.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ void vtkImageMathematicsAddonExecute2(vtkImageMathematicsAddon* self, vtkImageDa
unsigned long count = 0;
unsigned long target;
int op = self->GetOperation();
int divideByZeroToC = self->GetDivideByZeroToC();
double constantc = self->GetConstantC();

double normalizeScalarRange[2] = { 0.0, 1.0 };
self->GetRange(normalizeScalarRange);
double normalizeMagnitude = normalizeScalarRange[1] - normalizeScalarRange[0];
Expand All @@ -170,6 +169,18 @@ void vtkImageMathematicsAddonExecute2(vtkImageMathematicsAddon* self, vtkImageDa
inData->GetContinuousIncrements(outExt, inIncX, inIncY, inIncZ);
outData->GetContinuousIncrements(outExt, outIncX, outIncY, outIncZ);

if (op != VTK_MULTIPLYBYSCALEDRANGE)
{
vtkErrorWithObjectMacro(self, << "Execute: Unknown operation: " << op);
return;
}

if (normalizeMagnitude == 0.0)
{
vtkErrorWithObjectMacro(self, << "Execute: normalizeScalarRange width is zero");
return;
}

// Loop through output pixels
for (idxZ = 0; idxZ <= maxZ; idxZ++)
{
Expand All @@ -185,15 +196,7 @@ void vtkImageMathematicsAddonExecute2(vtkImageMathematicsAddon* self, vtkImageDa
}
for (idxR = 0; idxR < rowLength; idxR++)
{
// Pixel operation
switch (op)
{
case VTK_MULTIPLYBYSCALEDRANGE:
*outPtr = *inPtr * static_cast<float>((*outPtr - normalizeScalarRange[0]) / normalizeMagnitude);
break;
default:
break;
}
*outPtr = *inPtr * static_cast<float>((*outPtr - normalizeScalarRange[0]) / normalizeMagnitude);
outPtr++;
inPtr++;
}
Expand Down
1 change: 1 addition & 0 deletions Libs/MRML/Core/vtkImplicitInvertableBoolean.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class VTK_MRML_EXPORT vtkImplicitInvertableBoolean : public vtkImplicitBoolean
/**
* Evaluate boolean combinations of implicit function using current operator.
*/
using vtkImplicitBoolean::EvaluateFunction;
double EvaluateFunction(double x[3]) override;
//@}

Expand Down
4 changes: 2 additions & 2 deletions Libs/MRML/Core/vtkMRMLClipNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ int vtkMRMLClipNode::GetClippingNodeState(const char* nodeID)
int vtkMRMLClipNode::GetNthClippingNodeState(int n)
{
NodeReferenceListType references = this->NodeReferences[ClippingNodeReferenceRole];
if (references.size() <= n)
if (references.size() <= static_cast<size_t>(n))
{
return ClipOff;
}
Expand Down Expand Up @@ -596,7 +596,7 @@ void vtkMRMLClipNode::SetClippingNodeState(const char* nodeID, int state)
void vtkMRMLClipNode::SetNthClippingNodeState(int n, int state)
{
NodeReferenceListType references = this->NodeReferences[ClippingNodeReferenceRole];
if (references.size() <= n)
if (references.size() <= static_cast<size_t>(n))
{
return;
}
Expand Down
4 changes: 2 additions & 2 deletions Libs/MRML/Core/vtkMRMLNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2068,7 +2068,7 @@ bool vtkMRMLNode::vtkMRMLNodeReference::SetProperty(const std::string& key, cons
bool modified = false;
if (propertiesIt != this->Properties.end())
{
if (propertiesIt->second != value);
if (propertiesIt->second != value)
{
modified = true;
propertiesIt->second = value;
Expand Down Expand Up @@ -2160,7 +2160,7 @@ void vtkMRMLNode::SetNthNodeReferenceProperty(const std::string& referenceRole,
}

NodeReferenceListType& references = this->NodeReferences[std::string(referenceRole)];
if (n < 0 || n >= references.size())
if (n < 0 || static_cast<size_t>(n) >= references.size())
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Libs/MRML/Core/vtkMRMLTextStorageNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const char* vtkMRMLTextStorageNode::GetDefaultWriteFileExtension()
vtkStringArray* fileTypes = this->GetSupportedWriteFileTypes();
if (fileTypes && fileTypes->GetNumberOfValues() > 0)
{
std::string fileExtension = vtkDataFileFormatHelper::GetFileExtensionFromFormatString(fileTypes->GetValue(0));
std::string fileExtension = vtkDataFileFormatHelper::GetFileExtensionFromFormatString(fileTypes->GetValue(0).c_str());
if (!fileExtension.empty())
{
// Remove leading "."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ qSlicerSegmentEditorPaintEffectPrivate::qSlicerSegmentEditorPaintEffectPrivate(q
, ActiveViewWidget(nullptr)
, PaintOptionsFrame(nullptr)
, BrushDiameterFrame(nullptr)
, BrushDiameterSliderWidget(nullptr)
, BrushDiameterSizeFrame(nullptr)
, BrushDiameterSliderWidget(nullptr)
, BrushDiameterIsAbsoluteButton(nullptr)
, BrushSphereCheckbox(nullptr)
, EditIn3DViewsCheckbox(nullptr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,19 @@ void vtkMRMLLinearTransformsDisplayableManager::OnMRMLSceneNodeAdded(vtkMRMLNode
return;
}

vtkMRMLTransformNode* transformNode = nullptr;
vtkMRMLTransformDisplayNode* displayNode = nullptr;
if (transformNode = vtkMRMLTransformNode::SafeDownCast(node))
vtkMRMLTransformNode* transformNode = vtkMRMLTransformNode::SafeDownCast(node);
if (transformNode)
{
this->Internal->AddObservations(transformNode);
return;
}
else if (displayNode = vtkMRMLTransformDisplayNode::SafeDownCast(node))

vtkMRMLTransformDisplayNode* displayNode = vtkMRMLTransformDisplayNode::SafeDownCast(node);
if (displayNode)
{
this->Internal->UpdatePipelineFromDisplayNode(vtkMRMLTransformDisplayNode::SafeDownCast(node));
this->RequestRender();
return;
}
}

Expand All @@ -298,19 +301,22 @@ void vtkMRMLLinearTransformsDisplayableManager::OnMRMLSceneNodeRemoved(vtkMRMLNo
return;
}

vtkMRMLTransformNode* transformNode = nullptr;
vtkMRMLTransformDisplayNode* displayNode = nullptr;

bool modified = false;
if (transformNode = vtkMRMLTransformNode::SafeDownCast(node))

vtkMRMLTransformNode* transformNode = vtkMRMLTransformNode::SafeDownCast(node);
if (transformNode)
{
this->Internal->RemoveObservations(transformNode);
modified = true;
}
else if (displayNode = vtkMRMLTransformDisplayNode::SafeDownCast(node))
else
{
this->Internal->UpdatePipelineFromDisplayNode(displayNode);
modified = true;
vtkMRMLTransformDisplayNode* displayNode = vtkMRMLTransformDisplayNode::SafeDownCast(node);
if (displayNode)
{
this->Internal->UpdatePipelineFromDisplayNode(displayNode);
modified = true;
}
}

if (modified)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ void qSlicerTransformsModuleWidget::updateCenterOfTransformationWidgets()
{
vtkNew<vtkGeneralTransform> transform;
d->MRMLTransformNode->GetTransformToWorld(transform);
double coordinates_World[3] = { 0.0, 0.0, 0.0 };
transform->TransformPoint(centerOfTransformation, centerOfTransformation);
}

Expand Down
1 change: 0 additions & 1 deletion Modules/Loadable/Transforms/qSlicerTransformsReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ double qSlicerTransformsReader::canLoadFileConfidence(const QString& fileName)co
using ImageIOType = itk::NiftiImageIO;
ImageIOType::Pointer niftiIO = ImageIOType::New();
niftiIO->SetFileName(fileName.toStdString());
bool readSuccessful = false;
try
{
niftiIO->ReadImageInformation();
Expand Down

0 comments on commit 801f848

Please sign in to comment.