Commit ab5c95fb authored by Brad King's avatar Brad King

BUG: The HP compiler sets the badbit too often and prevents the SeekG/TellG...

BUG: The HP compiler sets the badbit too often and prevents the SeekG/TellG wrappers from working correctly.  This is a work-around.
parent ece14218
......@@ -34,7 +34,7 @@
#include <ctype.h>
#include <sys/stat.h>
vtkCxxRevisionMacro(vtkXMLParser, "1.21");
vtkCxxRevisionMacro(vtkXMLParser, "1.22");
vtkStandardNewMacro(vtkXMLParser);
//----------------------------------------------------------------------------
......@@ -71,11 +71,23 @@ void vtkXMLParser::PrintSelf(ostream& os, vtkIndent indent)
<< "\n";
}
//----------------------------------------------------------------------------
static int vtkXMLParserFail(istream* stream)
{
// The fail() method returns true if either the failbit or badbit is set.
#if defined(__HP_aCC)
// The HP compiler sets the badbit too often, so we ignore it.
return (stream->rdstate() & ios::failbit)? 1:0;
#else
return stream->fail()? 1:0;
#endif
}
//----------------------------------------------------------------------------
long vtkXMLParser::TellG()
{
// Standard tellg returns -1 if fail() is true.
if(!this->Stream || this->Stream->fail())
if(!this->Stream || vtkXMLParserFail(this->Stream))
{
return -1;
}
......@@ -124,7 +136,7 @@ long vtkXMLParser::TellG()
void vtkXMLParser::SeekG(long position)
{
// Standard seekg does nothing if fail() is true.
if(!this->Stream || this->Stream->fail())
if(!this->Stream || vtkXMLParserFail(this->Stream))
{
return;
}
......
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