mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0026872: Coding - pointless instantiations of local variables in BinTools
Instantiations of local stringstream variables used in error handling moved from upper function scope to places where they are actually needed
This commit is contained in:
parent
eece3af2e2
commit
4525373bf3
@ -298,7 +298,6 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom2d_O
|
||||
void BinTools_Curve2dSet::WriteCurve2d(const Handle(Geom2d_Curve)& C,
|
||||
Standard_OStream& OS)
|
||||
{
|
||||
Standard_SStream aMsg;
|
||||
Handle(Standard_Type) TheType = C->DynamicType();
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
@ -330,11 +329,11 @@ void BinTools_Curve2dSet::WriteCurve2d(const Handle(Geom2d_Curve)& C,
|
||||
OS << Handle(Geom2d_OffsetCurve)::DownCast(C);
|
||||
}
|
||||
else {
|
||||
aMsg << "UNKNOWN CURVE2d TYPE" << endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
Standard_Failure::Raise("UNKNOWN CURVE2d TYPE");
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "EXCEPTION in BinTools_Curve2dSet::WriteCurve2d(..)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
aMsg << anExc << endl;
|
||||
@ -594,7 +593,6 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
|
||||
Standard_IStream& BinTools_Curve2dSet::ReadCurve2d(Standard_IStream& IS,
|
||||
Handle(Geom2d_Curve)& C)
|
||||
{
|
||||
Standard_SStream aMsg;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
const Standard_Byte ctype = (Standard_Byte) IS.get();
|
||||
@ -675,14 +673,14 @@ Standard_IStream& BinTools_Curve2dSet::ReadCurve2d(Standard_IStream& IS,
|
||||
default:
|
||||
{
|
||||
C = NULL;
|
||||
aMsg << "UNKNOWN CURVE2d TYPE" << endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
Standard_Failure::Raise("UNKNOWN CURVE2d TYPE");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
C = NULL;
|
||||
Standard_SStream aMsg;
|
||||
aMsg <<"EXCEPTION in BinTools_Curve2dSet::ReadCurve2d(...)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
aMsg << anExc << endl;
|
||||
|
@ -311,7 +311,6 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_Off
|
||||
void BinTools_CurveSet::WriteCurve(const Handle(Geom_Curve)& C,
|
||||
Standard_OStream& OS)
|
||||
{
|
||||
Standard_SStream aMsg;
|
||||
Handle(Standard_Type) TheType = C->DynamicType();
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
@ -343,11 +342,11 @@ void BinTools_CurveSet::WriteCurve(const Handle(Geom_Curve)& C,
|
||||
OS << Handle(Geom_OffsetCurve)::DownCast(C);
|
||||
}
|
||||
else {
|
||||
aMsg << "UNKNOWN CURVE TYPE" <<endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
Standard_Failure::Raise("UNKNOWN CURVE TYPE");
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "EXCEPTION in BinTools_CurveSet::WriteCurve(..)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
aMsg << anExc << endl;
|
||||
@ -613,7 +612,6 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
|
||||
Standard_IStream& BinTools_CurveSet::ReadCurve(Standard_IStream& IS,
|
||||
Handle(Geom_Curve)& C)
|
||||
{
|
||||
Standard_SStream aMsg;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
const Standard_Byte ctype = (Standard_Byte) IS.get();
|
||||
@ -695,13 +693,13 @@ Standard_IStream& BinTools_CurveSet::ReadCurve(Standard_IStream& IS,
|
||||
default:
|
||||
{
|
||||
C = NULL;
|
||||
aMsg << "UNKNOWN CURVE TYPE" << endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
Standard_Failure::Raise("UNKNOWN CURVE TYPE");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
C = NULL;
|
||||
Standard_SStream aMsg;
|
||||
aMsg <<"EXCEPTION in BinTools_CurveSet::ReadCurve(..)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
Standard_Failure::Raise(aMsg);
|
||||
|
@ -773,7 +773,6 @@ void BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
|
||||
Standard_Real PfX,PfY,PlX,PlY;
|
||||
gp_Pnt2d aPf, aPl;
|
||||
Standard_Boolean closed, bval;
|
||||
Standard_SStream aMsg;
|
||||
GeomAbs_Shape reg = GeomAbs_C0;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
@ -873,6 +872,7 @@ void BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
|
||||
|
||||
default:
|
||||
{
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "BinTools_SurfaceSet::ReadGeometry: UnExpected BRep_PointRepresentation = "<< val <<endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
}
|
||||
@ -1067,6 +1067,7 @@ void BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
|
||||
break;
|
||||
default:
|
||||
{
|
||||
Standard_SStream aMsg;
|
||||
aMsg <<"Unexpected Curve Representation ="<< val << endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
}
|
||||
@ -1153,12 +1154,16 @@ void BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
|
||||
break;
|
||||
|
||||
default:
|
||||
aMsg << "Unexpected topology type = "<< T <<endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
break;
|
||||
{
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "Unexpected topology type = "<< T <<endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadGeometry(S,OS)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
aMsg << anExc << endl;
|
||||
@ -1233,10 +1238,8 @@ void BinTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
|
||||
{
|
||||
char buffer[255];
|
||||
IS >> buffer;
|
||||
Standard_SStream aMsg;
|
||||
if (IS.fail() || (strstr(buffer,"PolygonOnTriangulations") == NULL)) {
|
||||
aMsg << "BinTools_ShapeSet::ReadPolygonOnTriangulation: Not a PolygonOnTriangulation section" <<endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
Standard_Failure::Raise("BinTools_ShapeSet::ReadPolygonOnTriangulation: Not a PolygonOnTriangulation section");
|
||||
}
|
||||
Standard_Integer i, j, val, nbpol = 0, nbnodes =0;
|
||||
Standard_Boolean hasparameters;
|
||||
@ -1272,6 +1275,7 @@ void BinTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygonOnTriangulation(..)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
aMsg << anExc << endl;
|
||||
@ -1337,14 +1341,12 @@ void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
|
||||
Standard_Boolean hasparameters = Standard_False;
|
||||
Standard_Real d, x, y, z;
|
||||
IS >> buffer;
|
||||
Standard_SStream aMsg;
|
||||
|
||||
if (IS.fail() || strstr(buffer,"Polygon3D") == NULL) {
|
||||
aMsg << "BinTools_ShapeSet::ReadPolygon3D: Not a Polygon3D section" <<endl;
|
||||
#ifdef OCCT_DEBUG
|
||||
cout <<"Buffer: " << buffer << endl;
|
||||
#endif
|
||||
Standard_Failure::Raise(aMsg);
|
||||
Standard_Failure::Raise("BinTools_ShapeSet::ReadPolygon3D: Not a Polygon3D section");
|
||||
}
|
||||
Handle(Poly_Polygon3D) P;
|
||||
IS >> nbpol;
|
||||
@ -1376,6 +1378,7 @@ void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygon3D(..)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
aMsg << anExc << endl;
|
||||
@ -1456,10 +1459,8 @@ void BinTools_ShapeSet::ReadTriangulation(Standard_IStream& IS)
|
||||
Handle(Poly_Triangulation) T;
|
||||
IS >> buffer;
|
||||
|
||||
Standard_SStream aMsg;
|
||||
if (IS.fail() || (strstr(buffer,"Triangulations") == NULL)) {
|
||||
aMsg << "BinTools_ShapeSet::Triangulation: Not a Triangulation section" <<endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
Standard_Failure::Raise("BinTools_ShapeSet::Triangulation: Not a Triangulation section");
|
||||
}
|
||||
IS >> nbtri;
|
||||
IS.get();// remove LF
|
||||
@ -1505,6 +1506,7 @@ void BinTools_ShapeSet::ReadTriangulation(Standard_IStream& IS)
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadTriangulation(..)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
aMsg << anExc << endl;
|
||||
|
@ -383,7 +383,6 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_Off
|
||||
void BinTools_SurfaceSet::WriteSurface(const Handle(Geom_Surface)& S,
|
||||
Standard_OStream& OS)
|
||||
{
|
||||
Standard_SStream aMsg;
|
||||
Handle(Standard_Type) TheType = S->DynamicType();
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
@ -421,11 +420,11 @@ void BinTools_SurfaceSet::WriteSurface(const Handle(Geom_Surface)& S,
|
||||
OS << Handle(Geom_OffsetSurface)::DownCast(S);
|
||||
}
|
||||
else {
|
||||
aMsg <<"UNKNOWN SURFACE TYPE" <<endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
Standard_Failure::Raise("UNKNOWN SURFACE TYPE");
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "EXCEPTION in BinTools_SurfaceSet::WriteSurface(..)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
aMsg << anExc << endl;
|
||||
@ -759,7 +758,6 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
|
||||
Standard_IStream& BinTools_SurfaceSet::ReadSurface(Standard_IStream& IS,
|
||||
Handle(Geom_Surface)& S)
|
||||
{
|
||||
Standard_SStream aMsg;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
const Standard_Byte stype = (Standard_Byte) IS.get();
|
||||
@ -856,14 +854,14 @@ Standard_IStream& BinTools_SurfaceSet::ReadSurface(Standard_IStream& IS,
|
||||
default :
|
||||
{
|
||||
S = NULL;
|
||||
aMsg << "UNKNOWN SURFACE TYPE" << endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
Standard_Failure::Raise("UNKNOWN SURFACE TYPE");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
S = NULL;
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "EXCEPTION in BinTools_SurfaceSet::ReadSurface(..)" << endl;
|
||||
Handle(Standard_Failure) anExc = Standard_Failure::Caught();
|
||||
aMsg << anExc << endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user