1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-08 18:40:55 +03:00

0024456: Graphic3d_MaterialAspect - use static assert instead of runtime exception

Graphic3d_MaterialAspect::NumberOfMaterials() : Standard_ASSERT_RAISE instead of run-time check is now used.
Replaced with Standard_STATIC_ASSERT
This commit is contained in:
omy 2013-12-19 14:17:33 +04:00 committed by bugmaster
parent 30ecd5f8bf
commit b5eb716691

View File

@ -63,7 +63,7 @@
// for the class // for the class
#include <Graphic3d_MaterialAspect.ixx> #include <Graphic3d_MaterialAspect.ixx>
#include <Standard_Assert.hxx>
//-Aliases //-Aliases
//-Global data definitions //-Global data definitions
@ -887,10 +887,8 @@ static Material theMaterials[] = {
}; };
Standard_Integer Graphic3d_MaterialAspect::NumberOfMaterials() { Standard_Integer Graphic3d_MaterialAspect::NumberOfMaterials() {
Standard_Integer n =sizeof(theMaterials)/sizeof(Material); Standard_STATIC_ASSERT(sizeof(theMaterials)/sizeof(Material) == Graphic3d_NOM_DEFAULT);
if( n > Graphic3d_NOM_DEFAULT ) {
cout << " *** Graphic3d_MaterialAspect::NumberOfMaterials() may return a badvalue due to incoherente size between material name array and enum" << endl;
}
return Graphic3d_NOM_DEFAULT; return Graphic3d_NOM_DEFAULT;
} }