Update of /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11568/src/libopenvrml/openvrml
Modified Files:
basetypes.cpp
Log Message:
Assert validity of input parameters.
Index: basetypes.cpp
===================================================================
RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/basetypes.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** basetypes.cpp 25 Feb 2006 08:37:27 -0000 1.31
--- basetypes.cpp 12 May 2006 20:39:37 -0000 1.32
***************
*** 35,38 ****
--- 35,42 ----
OPENVRML_NOTHROW
{
+ assert(inrgb[0] >= 0.0 && inrgb[0] <= 1.0);
+ assert(inrgb[1] >= 0.0 && inrgb[1] <= 1.0);
+ assert(inrgb[2] >= 0.0 && inrgb[2] <= 1.0);
+
const float maxrgb = *std::max_element(inrgb, inrgb + 3);
const float minrgb = *std::min_element(inrgb, inrgb + 3);
***************
*** 66,69 ****
--- 70,77 ----
OPENVRML_NOTHROW
{
+ assert(h >= 0.0 && h <= 360.0);
+ assert(s >= 0.0 && s <= 1.0);
+ assert(v >= 0.0 && v <= 1.0);
+
if (s == 0.0) {
outhsv[0] = outhsv[1] = outhsv[2] = v;
|