Updates will be applied April 15th at 12pm EDT (UTC-0400). GitLab could be a little slow between 12 - 12:45pm EDT.

Commit 863dab72 authored by Brad King's avatar Brad King

BUG: Parser should clear the stream eof/fail bits when the end of the stream is reached.

parent b09ebbe1
......@@ -25,7 +25,7 @@
#include "vtkObjectFactory.h"
#include "vtkXMLDataElement.h"
vtkCxxRevisionMacro(vtkXMLDataParser, "1.13");
vtkCxxRevisionMacro(vtkXMLDataParser, "1.14");
vtkStandardNewMacro(vtkXMLDataParser);
vtkCxxSetObjectMacro(vtkXMLDataParser, Compressor, vtkDataCompressor);
......@@ -188,15 +188,6 @@ int vtkXMLDataParser::ParsingComplete()
return this->Superclass::ParsingComplete();
}
//----------------------------------------------------------------------------
void vtkXMLDataParser::ClearStreamEOF()
{
// Clear the fail bit on the input stream. This allows code to go
// back to read more data after the end-of-file has been reached.
this->Stream->clear(this->Stream->rdstate() & ~ios::eofbit);
this->Stream->clear(this->Stream->rdstate() & ~ios::failbit);
}
//----------------------------------------------------------------------------
int vtkXMLDataParser::CheckPrimaryAttributes()
{
......@@ -226,7 +217,6 @@ void vtkXMLDataParser::FindAppendedDataPosition()
// Scan for the start of the actual appended data.
char c=0;
unsigned long returnPosition = this->Stream->tellg();
this->ClearStreamEOF();
this->Stream->seekg(this->GetXMLByteIndex());
while(this->Stream->get(c) && (c != '>'));
while(this->Stream->get(c) && this->IsSpace(c));
......@@ -254,7 +244,6 @@ unsigned long vtkXMLDataParser::FindInlineDataPosition(unsigned long start)
// Scan for the start of the actual inline data.
char c=0;
this->Stream->seekg(start);
this->ClearStreamEOF();
while(this->Stream->get(c) && (c != '>'));
while(this->Stream->get(c) && this->IsSpace(c));
......@@ -722,7 +711,6 @@ unsigned long vtkXMLDataParser::ReadBinaryData(void* in_buffer, int startWord,
// Make sure our streams are setup correctly.
this->DataStream->SetStream(this->Stream);
this->ClearStreamEOF();
// Read the data.
unsigned char* d = reinterpret_cast<unsigned char*>(buffer);
......
......@@ -124,7 +124,6 @@ protected:
void StartElement(const char* name, const char** atts);
void EndElement(const char*);
int ParsingComplete();
void ClearStreamEOF();
int CheckPrimaryAttributes();
void FindAppendedDataPosition();
unsigned long FindInlineDataPosition(unsigned long start);
......
......@@ -22,7 +22,7 @@
#include <ctype.h>
#include <sys/stat.h>
vtkCxxRevisionMacro(vtkXMLParser, "1.16");
vtkCxxRevisionMacro(vtkXMLParser, "1.17");
vtkStandardNewMacro(vtkXMLParser);
//----------------------------------------------------------------------------
......@@ -254,6 +254,12 @@ int vtkXMLParser::ParseXML()
}
}
}
// Clear the fail and eof bits on the input stream so we can later
// seek back to read data.
this->Stream->clear(this->Stream->rdstate() & ~ios::eofbit);
this->Stream->clear(this->Stream->rdstate() & ~ios::failbit);
return 1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment