0026872: Coding - pointless instantiations of local variables in BinTools
[occt.git] / src / BinTools / BinTools_CurveSet.cxx
index ea89b0c..f0bb5f9 100644 (file)
@@ -4,8 +4,8 @@
 //
 // This file is part of Open CASCADE Technology software library.
 //
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
 // by the Free Software Foundation, with special exception defined in the file
 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
 // distribution for complete text of the license and disclaimer of any warranty.
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <BinTools_CurveSet.ixx>
+
 #include <BinTools.hxx>
+#include <BinTools_CurveSet.hxx>
+#include <Geom_BezierCurve.hxx>
+#include <Geom_BSplineCurve.hxx>
 #include <Geom_Circle.hxx>
-#include <Geom_Line.hxx>
+#include <Geom_Curve.hxx>
 #include <Geom_Ellipse.hxx>
-#include <Geom_Parabola.hxx>
 #include <Geom_Hyperbola.hxx>
-#include <Geom_BezierCurve.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_TrimmedCurve.hxx>
+#include <Geom_Line.hxx>
 #include <Geom_OffsetCurve.hxx>
-
-#include <gp_Lin.hxx>
+#include <Geom_Parabola.hxx>
+#include <Geom_TrimmedCurve.hxx>
 #include <gp_Circ.hxx>
 #include <gp_Elips.hxx>
-#include <gp_Parab.hxx>
 #include <gp_Hypr.hxx>
-
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <Standard_Failure.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Parab.hxx>
 #include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_OutOfRange.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_Array1OfReal.hxx>
 
 #define LINE      1
 #define CIRCLE    2
@@ -310,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
@@ -342,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;
@@ -612,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();
@@ -694,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);
@@ -720,7 +719,7 @@ void  BinTools_CurveSet::Read(Standard_IStream& IS)
   if (IS.fail() || strcmp(buffer,"Curves")) {
     Standard_SStream aMsg;
     aMsg << "BinTools_CurveSet::Read:  Not a Curve table"<<endl;
-#ifdef DEB
+#ifdef OCCT_DEBUG
     cout <<"CurveSet buffer: " << buffer << endl;
 #endif
     Standard_Failure::Raise(aMsg);