From 6cc842a2ac50bf471279bb816b66395ba1581238 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 4 Sep 2021 15:38:07 +0200 Subject: [PATCH] #1721 fix mmap in ifcconvert --- src/ifcconvert/IfcConvert.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index 90e9139bad..d32a287de7 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -1183,19 +1183,23 @@ bool init_input_file(const std::string& filename, IfcParse::IfcFile*& ifc_file, if (no_progress) { Logger::SetOutput(NULL, &log_stream); } time(&start); -#ifdef USE_MMAP - ifc_file = new IfcParse::IfcFile(filename, mmap); -#else - (void)mmap; #ifdef WITH_IFCXML if (boost::ends_with(boost::to_lower_copy(filename), ".ifcxml")) { ifc_file = IfcParse::parse_ifcxml(filename); } else #endif - ifc_file = new IfcParse::IfcFile(filename); - if (!ifc_file || !ifc_file->good()) { + + { +#ifdef USE_MMAP + ifc_file = new IfcParse::IfcFile(filename, mmap); +#else + (void)mmap; + ifc_file = new IfcParse::IfcFile(filename); #endif + } + + if (!ifc_file || !ifc_file->good()) { Logger::Error("Unable to parse input file '" + filename + "'"); return false; }