From 6547a59f0b2fb557125fa3469ba27ea6383122ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 7 Sep 2015 00:06:43 +0200 Subject: [PATCH] ObjImporter: open the file as binary. Apparently opening the file as text would NOT properly handle \r\n and will break everything posssible instead. What a day! --- src/MagnumPlugins/ObjImporter/ObjImporter.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp index 09be6142d..0ca0b581b 100644 --- a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp +++ b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp @@ -120,8 +120,7 @@ void ObjImporter::doClose() { _file.reset(); } bool ObjImporter::doIsOpened() const { return !!_file; } void ObjImporter::doOpenFile(const std::string& filename) { - /* Open file in *text* mode (to avoid \r handling) */ - std::unique_ptr in{new std::ifstream{filename}}; + std::unique_ptr in{new std::ifstream{filename, std::ios::binary}}; if(!in->good()) { Error() << "Trade::ObjImporter::openFile(): cannot open file" << filename; return; @@ -133,7 +132,6 @@ void ObjImporter::doOpenFile(const std::string& filename) { } void ObjImporter::doOpenData(Containers::ArrayView data) { - /* Open file in *text* mode (to avoid \r handling) */ _file.reset(new File); _file->in.reset(new std::istringstream{{data.begin(), data.size()}});