Small protocol bugfix.

This commit is contained in:
Daniel Önnerby 2009-04-28 11:09:04 +00:00
parent d8d7aa6af5
commit dff9ba2702

View File

@ -175,15 +175,19 @@ void Parser::ContinueParsing(){
this->Exit(); this->Exit();
return; return;
} }
if(!this->supplier->Read()){
return;
}
{ {
// create a temporary buffer to be able to remove null characters // create a temporary buffer to be able to remove null characters
std::string tempBuffer(this->nextBuffer); std::string tempBuffer(this->nextBuffer);
this->nextBuffer.clear(); this->nextBuffer.clear();
if(tempBuffer.empty()){
if(!this->supplier->Read()){
return;
}
tempBuffer.append(this->supplier->Buffer(),this->supplier->BufferSize()); tempBuffer.append(this->supplier->Buffer(),this->supplier->BufferSize());
}
static std::string nullCharacter("\0",1); static std::string nullCharacter("\0",1);
std::string::size_type nullPosition(tempBuffer.find(nullCharacter)); std::string::size_type nullPosition(tempBuffer.find(nullCharacter));
if(nullPosition!=std::string::npos){ if(nullPosition!=std::string::npos){
@ -192,6 +196,7 @@ void Parser::ContinueParsing(){
tempBuffer.resize(nullPosition); tempBuffer.resize(nullPosition);
} }
// this->xmlParserStatus = XML_Parse(this->xmlParser,this->supplier->Buffer(),(int)this->supplier->BufferSize(),0); // this->xmlParserStatus = XML_Parse(this->xmlParser,this->supplier->Buffer(),(int)this->supplier->BufferSize(),0);
this->xmlParserStatus = XML_Parse(this->xmlParser,tempBuffer.c_str(),(int)tempBuffer.size(),0); this->xmlParserStatus = XML_Parse(this->xmlParser,tempBuffer.c_str(),(int)tempBuffer.size(),0);
} }