File 0001-import-Hotfix-for-build-failure-from-bad-debug-code.patch of Package FreeCAD

From 063515f65007c116c4c0e05c1fcf82637b8bf152 Mon Sep 17 00:00:00 2001
From: Gabriel Wicke <gswicke@gmail.com>
Date: Sun, 17 May 2020 21:09:19 -0700
Subject: [PATCH] [import] Hotfix for build failure from bad debug code

Quick fix for a build failure with latest opencascade. Directly use
std::cout instead of custom streams.
---
 src/Mod/Import/App/StepShape.cpp | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/src/Mod/Import/App/StepShape.cpp b/src/Mod/Import/App/StepShape.cpp
index acd4a9e706..ec714c891e 100644
--- a/src/Mod/Import/App/StepShape.cpp
+++ b/src/Mod/Import/App/StepShape.cpp
@@ -65,38 +65,33 @@ int StepShape::read(const char* fileName)
         throw Base::FileException("Cannot open STEP file");
     }
 
-    //Standard_Integer ic = Interface_Static::IVal("read.precision.mode"); 
-    //Standard_Real rp = Interface_Static::RVal("read.maxprecision.val"); 
-    //Standard_Integer ic = Interface_Static::IVal("read.maxprecision.mode"); 
-    //Standard_Integer mv = Interface_Static::IVal("read.stdsameparameter.mode"); 
-    //Standard_Integer rp = Interface_Static::IVal("read.surfacecurve.mode"); 
-    //Standard_Real era = Interface_Static::RVal("read.encoderegularity.angle"); 
-    //Standard_Integer ic = Interface_Static::IVal("read.step.product.mode"); 
+    //Standard_Integer ic = Interface_Static::IVal("read.precision.mode");
+    //Standard_Real rp = Interface_Static::RVal("read.maxprecision.val");
+    //Standard_Integer ic = Interface_Static::IVal("read.maxprecision.mode");
+    //Standard_Integer mv = Interface_Static::IVal("read.stdsameparameter.mode");
+    //Standard_Integer rp = Interface_Static::IVal("read.surfacecurve.mode");
+    //Standard_Real era = Interface_Static::RVal("read.encoderegularity.angle");
+    //Standard_Integer ic = Interface_Static::IVal("read.step.product.mode");
     //Standard_Integer ic = Interface_Static::IVal("read.step.product.context");
-    //Standard_Integer ic = Interface_Static::IVal("read.step.shape.repr"); 
+    //Standard_Integer ic = Interface_Static::IVal("read.step.shape.repr");
     //Standard_Integer ic = Interface_Static::IVal("read.step.assembly.level");
     //Standard_Integer ic = Interface_Static::IVal("read.step.shape.relationship");
-    //Standard_Integer ic = Interface_Static::IVal("read.step.shape.aspect"); 
+    //Standard_Integer ic = Interface_Static::IVal("read.step.shape.aspect");
 
-    Handle(TColStd_HSequenceOfTransient) list = aReader.GiveList(); 
+    Handle(TColStd_HSequenceOfTransient) list = aReader.GiveList();
 
     //Use method StepData_StepModel::NextNumberForLabel to find its rank with the following:
     //Standard_CString label = "#...";
     Handle(StepData_StepModel) model = aReader.StepModel();
     //rank = model->NextNumberForLabe(label, 0, Standard_False);
 
-    Handle(Message_PrinterOStream) mstr = new Message_PrinterOStream();
-    Handle(Message_Messenger) msg = new Message_Messenger(mstr);
-
     std::cout << "dump of step header:" << std::endl;
-
-    model->DumpHeader(msg);
+    model->DumpHeader(std::cout);
 
     for(int nent=1;nent<=model->NbEntities();nent++) {
       Handle(Standard_Transient) entity=model->Entity(nent);
-      
       std::cout << "label entity " << nent << ":" ;
-      model->PrintLabel(entity,msg);
+      model->PrintLabel(entity, std::cout);
       std::cout << ";"<< entity->DynamicType()->Name() << std::endl;
     }
 
-- 
2.30.1

From 2cb9b147f13419f019f9808ace21d3d2ceae99c5 Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Sat, 30 May 2020 11:56:14 +0200
Subject: [PATCH] Import: handle OCC versions 7.4.1 and earlier

---
 src/Mod/Import/App/StepShape.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/Mod/Import/App/StepShape.cpp b/src/Mod/Import/App/StepShape.cpp
index ec714c891e..a27ff781b6 100644
--- a/src/Mod/Import/App/StepShape.cpp
+++ b/src/Mod/Import/App/StepShape.cpp
@@ -34,6 +34,7 @@
 # include <Interface_Static.hxx>
 # include <Message_Messenger.hxx>
 # include <Message_PrinterOStream.hxx>
+# include <Standard_Version.hxx>
 
 # include <Base/FileInfo.h>
 # include <Base/Exception.h>
@@ -86,12 +87,22 @@ int StepShape::read(const char* fileName)
     //rank = model->NextNumberForLabe(label, 0, Standard_False);
 
     std::cout << "dump of step header:" << std::endl;
+#if OCC_VERSION_HEX < 0x070401
+    Handle(Message_PrinterOStream) mstr = new Message_PrinterOStream();
+    Handle(Message_Messenger) msg = new Message_Messenger(mstr);
+    model->DumpHeader(msg);
+#else
     model->DumpHeader(std::cout);
+#endif
 
-    for(int nent=1;nent<=model->NbEntities();nent++) {
+    for (int nent=1;nent<=model->NbEntities();nent++) {
       Handle(Standard_Transient) entity=model->Entity(nent);
       std::cout << "label entity " << nent << ":" ;
+#if OCC_VERSION_HEX < 0x070401
+      model->PrintLabel(entity, msg);
+#else
       model->PrintLabel(entity, std::cout);
+#endif
       std::cout << ";"<< entity->DynamicType()->Name() << std::endl;
     }
 
-- 
2.30.1

openSUSE Build Service is sponsored by