[Insight-developers] ConvertPixelBuffer has an annoying compiler warning

Kent Williams kent at psychiatry.uiowa.edu
Mon Feb 20 11:12:42 EST 2006


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.



More information about the Insight-developers mailing list