File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -338,11 +338,14 @@ void Scanner::SetInputStream(SourcePtr stream)
338338
339339bool Scanner::SetInputStream (SourcePtr stream, const Bookmark& bookmark)
340340{
341+ bool seekOk;
342+
341343 if ((mpSource == stream) && (bookmark.offset >= mBase ) &&
342344 ((bookmark.offset - mBase ) < (mpBufferEnd - maBuffer)))
343345 {
344346 // Bookmark is already loaded in the buffer.
345347 // Just advance/rewind the next character accordingly.
348+ seekOk = true ;
346349 mpNextChar = maBuffer + (bookmark.offset - mBase );
347350 }
348351 else
@@ -353,11 +356,12 @@ bool Scanner::SetInputStream(SourcePtr stream, const Bookmark& bookmark)
353356 mpSource = stream;
354357
355358 // Refill the buffer.
356- mEndOfStream = ! mpSource->seekg (bookmark.offset );
359+ seekOk = mpSource->seekg (bookmark.offset );
357360 mBase = mpSource->tellg ();
358361 mpBufferEnd = maBuffer;
359362 mpNextChar = maBuffer;
360- if (!mEndOfStream )
363+ mEndOfStream = !seekOk;
364+ if (seekOk)
361365 RefillBuffer ();
362366 }
363367
@@ -370,7 +374,7 @@ bool Scanner::SetInputStream(SourcePtr stream, const Bookmark& bookmark)
370374 mNominalEndOfLine = bookmark.nominalEndOfLine ;
371375 mAllowNestedBlockComments = bookmark.allowNestedBlockComments ;
372376
373- return ! mEndOfStream ;
377+ return seekOk ;
374378}
375379
376380void pov_parser::Scanner::SetStringEncoding (StringEncoding encoding)
You can’t perform that action at this time.
0 commit comments