ProtoStream: comments, FIXMEs

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1315 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-06-06 14:27:32 +00:00
parent 7573010685
commit 3284fba7d3
2 changed files with 13 additions and 13 deletions

View File

@ -32,7 +32,7 @@ ProtoIStream::ProtoIStream(std::istream *infile) : m_infile(infile)
m_log.showTime(false);
}
void ProtoIStream:: reset()
void ProtoIStream::reset()
{
m_infile->clear();
m_infile->seekg(0,ios::beg);
@ -45,11 +45,12 @@ bool ProtoIStream::getNext(google::protobuf::Message* m)
return false;
m_size = ntohl(m_size);
//FIXME: This could be inefficient because for each data buf is
//allocated each time new
// FIXME reuse buffer (efficiency)
// FIXME new[] may fail (i.e., return 0)
char *buf = new char[m_size];
m_infile->read(buf, m_size);
if (!m_infile->good())
// FIXME we're leaking buf[]
return false;
std::string st(buf, m_size);
m->ParseFromString(st);