[Liblas-commits] hg: Missing casts of RGB components to uint16_t
after validatoin...
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Aug 26 16:41:03 EDT 2010
changeset 56d386d35727 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=56d386d35727
summary: Missing casts of RGB components to uint16_t after validatoin. Removed redundant validation in ctor taking array<uint16_t, 3> - values are never larger than max limit of uint16_t anyway.
diffstat:
src/lascolor.cpp | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diffs (26 lines):
diff -r d9076e050572 -r 56d386d35727 src/lascolor.cpp
--- a/src/lascolor.cpp Thu Aug 26 14:37:47 2010 -0600
+++ b/src/lascolor.cpp Thu Aug 26 21:40:53 2010 +0100
@@ -60,17 +60,15 @@
blue > std::numeric_limits<boost::uint16_t>::max())
throw_invalid_color_component();
- m_color[0] = red;
- m_color[1] = green;
- m_color[2] = blue;
+ using boost::uint16_t;
+
+ m_color[0] = static_cast<uint16_t>(red);
+ m_color[1] = static_cast<uint16_t>(green);
+ m_color[2] = static_cast<uint16_t>(blue);
}
Color::Color(boost::array<value_type, 3> const& color)
{
- if (color[0] > std::numeric_limits<boost::uint16_t>::max() ||
- color[1] > std::numeric_limits<boost::uint16_t>::max() ||
- color[2] > std::numeric_limits<boost::uint16_t>::max())
- throw_invalid_color_component();
m_color = color;
}
More information about the Liblas-commits
mailing list