[vtk-developers] cppcheck help with: vtkPlanes, vtkX3DExporterFIWriter, vtkXdmfHeavyData, vtkGPUVolumeRayCastMapper, vtkLineWidget
David Gobbi
david.gobbi at gmail.com
Wed Dec 2 21:28:33 EST 2015
On Wed, Dec 2, 2015 at 6:31 PM, Sean McBride <sean at rogue-research.com>
wrote:
> Hi all,
>
> Anyone know these classes? These cppcheck diagnostics are not false
> positives.
>
>
> (a)
> uselessAssignmentPtrArg,Common/DataModel/vtkPlanes.cxx:341,warning,Assignment
> of function parameter has no effect outside the function. Did you forget
> dereferencing it?
>
> This is likely copy-paste from method above. Fixing it may require
> changing the signature of this public API.
>
No need to change the API, just remove the "else" clause. Simple fix.
(b)
> stlcstr,IO/Export/vtkX3DExporterFIWriter.cxx:143,error,Dangerous usage of
> c_str(). The value returned by c_str() is invalid after this call.
>
> Change return type? Make copy?
>
Should return a std::string. Sebastien, can you take a look?
> (c)
> duplicateExpressionTernary,IO/Xdmf2/vtkXdmfHeavyData.cxx:1199,style,Same
> expression in both branches of ternary operator.
>
> count[0] += (update_extents[5] - update_extents[4] > 0)? 1 : 1;
>
> Clearly odd.
>
Should be 0 : 1. Utkarsh? Berk?
(d)
> duplicateExpression,Rendering/Volume/vtkGPUVolumeRayCastMapper.cxx:296,style,Same
> expression on both sides of '-'.
>
> Copy-paste? Missing +1?
>
Just change it to "extents[2*cc] = 0;" to silence the warning. It looks
correct as-is.
(e)
> knownConditionTrueFalse,Interaction/Widgets/vtkLineWidget.cxx:743,style,Condition
> '!forward' is always true
>
>
> Copy-paste? or failure to use return value of ForwardEvent()?
>
Looks like it. Calls should be "forward = this->ForwardEvent(..."
- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20151202/3310acae/attachment.html>
More information about the vtk-developers
mailing list