[vtk-developers] simple VTKDataReader compiler warning
Berk Geveci
berk.geveci at kitware.com
Tue Sep 18 07:02:28 EDT 2007
Empty strings are not valid array names. Either solution should work.
Cheers,
-berk
On 9/18/07, Mathieu Malaterre <mathieu.malaterre at gmail.com> wrote:
> 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
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
More information about the vtk-developers
mailing list