[Insight-developers] ConvertPixelBuffer has an annoying compiler warning

Karthik Krishnan Karthik.Krishnan at kitware.com
Mon Feb 20 11:36:40 EST 2006


Fixed. Thanks
-karthik

Kent Williams wrote:

> This error message:
>
> .../IO/itkConvertPixelBuffer.txx:550: warning: comparison between 
> signed and unsigned integer expressions
> ../IO/itkConvertPixelBuffer.txx: In static member function ‘static 
> void itk::ConvertPixelBuffer<InputPixelType, OutputPixelType, 
> OutputConvertTraits>::ConvertVectorImage(InputPixelType*, int, 
> OutputPixelType*, int) [with InputPixelType = char, OutputPixelType = 
> unsigned char, OutputConvertTraits = 
> itk::DefaultConvertPixelTraits<unsigned char>]’:
>
> Results from this code:
>
> template < typename InputPixelType, typename OutputPixelType, class 
> OutputConvertTraits >
> void ConvertPixelBuffer<InputPixelType, OutputPixelType, 
> OutputConvertTraits>
> ::ConvertVectorImage(InputPixelType* inputData, int 
> inputNumberOfComponents,
> OutputPixelType* outputData , int size)
> {
> for( unsigned long i=0; i< size * inputNumberOfComponents; i++ )
> {
> OutputConvertTraits::SetNthComponent( 0, *outputData,
> static_cast < OutputComponentType >( *inputData ));
> ++outputData;
> ++inputData;
> }
> }
>
> The FOR loop should have a cast on the righthand side of the 
> comparison, just to get rid of the warning, shouldn't it? I would just 
> change it and check it in but it seems like we're in the middle of a 
> freeze. It would be good to get rid of these 'noise' warnings because 
> they seem to crop up frequently when compiling the IO library.
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list