From abece517b09d8492197182584e1f0ea6570efe7a Mon Sep 17 00:00:00 2001 From: ifcquery Date: Sun, 16 Jul 2023 17:23:26 +0200 Subject: [PATCH] fix bug in bufferedGetStepLine --- IfcPlusPlus/src/ifcpp/geometry/CSG_Adapter.h | 7 +++++-- IfcPlusPlus/src/ifcpp/reader/ReaderUtil.cpp | 14 +++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/IfcPlusPlus/src/ifcpp/geometry/CSG_Adapter.h b/IfcPlusPlus/src/ifcpp/geometry/CSG_Adapter.h index 3cc40bb5f..1c2e203d8 100644 --- a/IfcPlusPlus/src/ifcpp/geometry/CSG_Adapter.h +++ b/IfcPlusPlus/src/ifcpp/geometry/CSG_Adapter.h @@ -191,9 +191,12 @@ namespace CSG_Adapter } bool dump_result_mesh = false; - //if (csg_compute_count == 24 || tag == 1311603) + if ( tag == 1311603) + { + dump_result_mesh = true; + } + if (csg_compute_count == 24 ) { - //GeomDebugDump::dumpOperands(op1, op2, result, tag, op1_dumped, op2_dumped, dumpColorSettings, paramsScaled); dump_result_mesh = true; } diff --git a/IfcPlusPlus/src/ifcpp/reader/ReaderUtil.cpp b/IfcPlusPlus/src/ifcpp/reader/ReaderUtil.cpp index 14896a7b6..d1bcb391e 100644 --- a/IfcPlusPlus/src/ifcpp/reader/ReaderUtil.cpp +++ b/IfcPlusPlus/src/ifcpp/reader/ReaderUtil.cpp @@ -174,14 +174,19 @@ std::istream& bufferedGetStepLine(std::istream& inputStream, std::string& lineOu std::streambuf* sb = inputStream.rdbuf(); bool inString = false; +#ifdef _DEBUG + std::string string40; +#endif + // std::getline does not work with all line endings, reads complete file instead. // Handle \n (unix), \r\n (windows), \r (mac) line endings here while(true) { - int c = sb->sbumpc(); + int c = sb->sbumpc(); // sbumpc: character at the current position and advances the current position to the next character #ifdef _DEBUG std::string charAsString; charAsString += ((char)c); + string40 += charAsString; #endif switch (c) { @@ -200,12 +205,11 @@ std::istream& bufferedGetStepLine(std::istream& inputStream, std::string& lineOu continue; } case '\'': - if( sb->sgetc() != '/' ) // sgetc: character at the current position - { - inString = !inString; - } + { + inString = !inString; lineOut += (char)c; continue; + } case '/': if( !inString ) {