[vtk-developers] simple VTKDataReader compiler warning
Mathieu Malaterre
mathieu.malaterre at gmail.com
Tue Sep 18 05:28:22 EDT 2007
On 9/14/07, Sean McBride <sean at rogue-research.com> wrote:
> Hi everyone,
>
> VTKDataReader.cxx has this piece of code:
>
> char nameOfAttribute[256];
> sscanf(line, "%*s %s", nameOfAttribute);
> if ( nameOfAttribute )
> {
> array[num-1] = new char [strlen(nameOfAttribute)+1];
> strcpy(array[num-1],nameOfAttribute);
> }
> }//found one
>
> The 'if' always evaluates to true, and causes a warning.
>
> Anyone know for sure what the code should be doing? Maybe 'if
> (strlen(nameOfAttribute))'?
Or even simplier :
if ( *nameOfAttribute )
Since you only need to know if string is empty. But this is not going
to be backward compatible. I think Paraview assume dataarray always
have a name, but I do not know if empty string is valid or not.
2 cents,
--
Mathieu
More information about the vtk-developers
mailing list