From efa37bd4c438601836ef2e726edce02ed34f7cf0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 27 Jun 2011 21:36:21 +0000 Subject: [PATCH] From Jean-Sebestien Guay, merged from svn/trunk changeset 12669/12670 - fix for windows bug when reading ascii files with unix file endings. --- src/osgPlugins/osg/AsciiStreamOperator.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/osg/AsciiStreamOperator.h b/src/osgPlugins/osg/AsciiStreamOperator.h index 98113d22d..9b21b19b6 100644 --- a/src/osgPlugins/osg/AsciiStreamOperator.h +++ b/src/osgPlugins/osg/AsciiStreamOperator.h @@ -278,7 +278,15 @@ public: { std::string s; readString(s); if ( s==str ) return true; - else _in->seekg( -(int)(s.length()), std::ios::cur ); + else + { + // originally "_in->seekg( -(int)(s.length()), std::ios::cur );" was used below but + // problems under windows occurred when reading ascii files with unix line endings. + // The workaround for this problem was to unget each of the characters in term, + // hacky yes, but at least it works! + for (unsigned int i = 0; i < s.length(); ++i) + _in->unget(); + } return false; }