From fe04456715e77777142aed78d9be279d2e60938d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20G=C3=BCnther?= Date: Wed, 2 May 2018 16:13:20 +0200 Subject: [PATCH] Make GlasbeyLUT at() and size() consistent Without this, code such as this: size_t i = 10000; pcl::RGB color = pcl::GlasbeyLUT::at(i % pcl::GlasbeyLUT::size()); ... produces the warning "Parameter type mismatch: Values of type 'size_t' may not fit into the receiver type 'unsigned int'". --- common/include/pcl/common/colors.h | 2 +- common/src/colors.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/include/pcl/common/colors.h b/common/include/pcl/common/colors.h index 6fa78e37c57..0cff5752b9c 100644 --- a/common/include/pcl/common/colors.h +++ b/common/include/pcl/common/colors.h @@ -59,7 +59,7 @@ namespace pcl /** Get a color from the lookup table with a given id. * * The id should be less than the size of the LUT (see size()). */ - static RGB at (unsigned int color_id); + static RGB at (size_t color_id); /** Get the number of colors in the lookup table. * diff --git a/common/src/colors.cpp b/common/src/colors.cpp index 63dbbf35090..345b483d2d3 100644 --- a/common/src/colors.cpp +++ b/common/src/colors.cpp @@ -300,10 +300,10 @@ static const unsigned char GLASBEY_LUT[] = }; /// Number of colors in Glasbey lookup table -static const unsigned int GLASBEY_LUT_SIZE = sizeof (GLASBEY_LUT) / (sizeof (GLASBEY_LUT[0]) * 3); +static const size_t GLASBEY_LUT_SIZE = sizeof (GLASBEY_LUT) / (sizeof (GLASBEY_LUT[0]) * 3); pcl::RGB -pcl::GlasbeyLUT::at (unsigned int color_id) +pcl::GlasbeyLUT::at (size_t color_id) { assert (color_id < GLASBEY_LUT_SIZE); pcl::RGB color;