[Insight-developers] Wrong type in ConnectedComponentImageFilter
Luis Ibanez
luis.ibanez at kitware.com
Wed Jan 5 09:24:59 EST 2011
Hi Bill,
Yeap, you are right.
The variable (*I) is an OffsetValueType (which is a signed type),
so the result of the addition should be stored in an OffsetValueType
as well.
Here is the patch that I come up with:
http://review.source.kitware.com/#change,671
Luis
---------------
On Wed, Jan 5, 2011 at 8:59 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> Dave and Luis,
>
> I looked at this new warning today:
> In file included from
> /Users/builder/kitware/ITK/Testing/Code/BasicFilters/itkRelabelComponentImageFilterTest.cxx:22:
> In file included from
> /Users/builder/kitware/ITK/Code/BasicFilters/itkConnectedComponentImageFilter.h:263:
> /Users/builder/kitware/ITK/Code/BasicFilters/itkConnectedComponentImageFilter.txx:273:23:
> warning: comparison of unsigned expression >= 0 is always true
> [-Wtautological-compare]
> if ( NeighIdx >= 0 && NeighIdx < linecount &&
> !m_LineMap[NeighIdx].empty() )
> ~~~~~~~~ ^ ~
>
> It shows up on a couple of platforms.
>
> I looked at the code.
>
> the types of ThisIdx and NeighIdx used to be long. Now they are
> SizeValueType (which is unsigned long). I believe they should be
> IndexValueType (which is long).
>
> Bill
>
More information about the Insight-developers
mailing list