0026872: Coding - pointless instantiations of local variables in BinTools
[occt.git] / src / BinTools / BinTools_CurveSet.cxx
index 4fe3b77..f0bb5f9 100644 (file)
@@ -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);