From 9da1a2c1a7c78dbe3884cbde1d2efc102860f99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 4 Jan 2010 12:02:09 +0000 Subject: [PATCH] Fixed crash in offreader with dos line endings. (Thanks to git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@257 fdac6126-5c0c-442c-9429-916003d36597 --- src/OpenMesh/Core/IO/reader/OFFReader.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenMesh/Core/IO/reader/OFFReader.cc b/src/OpenMesh/Core/IO/reader/OFFReader.cc index 5f015389..0c12ee37 100644 --- a/src/OpenMesh/Core/IO/reader/OFFReader.cc +++ b/src/OpenMesh/Core/IO/reader/OFFReader.cc @@ -355,10 +355,10 @@ int _OFFReader_::getColorType(std::string& _line, bool _texCoordsAvailable) cons return 0; //first remove spaces at start/end of the line - while (_line[0] == ' ') + while (std::isspace(_line[0])) _line = _line.substr(1); - while (_line[ _line.length()-1 ] == ' ') - _line = _line.substr(0, _line.length()-2); + while (std::isspace(_line[ _line.length()-1 ])) + _line = _line.substr(0, _line.length()-1); //count the remaining items in the line size_t found; @@ -370,7 +370,7 @@ int _OFFReader_::getColorType(std::string& _line, bool _texCoordsAvailable) cons found=_line.find_first_of(" ",found+1); } - if (_line != "") count++; + if (!_line.empty()) count++; if (_texCoordsAvailable) count -= 2;