From 04fc8dac85eac29c5c26e29f103c566868705da6 Mon Sep 17 00:00:00 2001 From: Alexander Dielen Date: Thu, 11 Feb 2016 14:04:52 +0100 Subject: [PATCH] Fixed CR LF newline handling for binary file headers. --- src/OpenMesh/Core/IO/reader/PLYReader.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/OpenMesh/Core/IO/reader/PLYReader.cc b/src/OpenMesh/Core/IO/reader/PLYReader.cc index 31e590e7..f86caae0 100644 --- a/src/OpenMesh/Core/IO/reader/PLYReader.cc +++ b/src/OpenMesh/Core/IO/reader/PLYReader.cc @@ -1275,7 +1275,19 @@ bool _PLYReader_::can_u_read(std::istream& _is) const { // As the binary data is directy after the end_header keyword // and the stream removes too many bytes, seek back to the right position if (options_.is_binary()) { - _is.seekg(streamPos + 12); + _is.seekg(streamPos); + + char c1 = 0; + char c2 = 0; + _is.get(c1); + _is.get(c2); + + if (c1 == 0x0D && c2 == 0x0A) { + _is.seekg(streamPos + 14); + } + else { + _is.seekg(streamPos + 12); + } } return true;