Skip to content

Commit

Permalink
Make GlasbeyLUT at() and size() consistent
Browse files Browse the repository at this point in the history
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'".
  • Loading branch information
mintar committed May 2, 2018
1 parent d3b500a commit fe04456
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/include/pcl/common/colors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
4 changes: 2 additions & 2 deletions common/src/colors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fe04456

Please sign in to comment.