Skip to content

Commit

Permalink
Replace instance of readsome with read in decompressZlib Make decompr…
Browse files Browse the repository at this point in the history
…essZlib more robust
  • Loading branch information
gregorycu authored and paramat committed Jan 9, 2016
1 parent 386d190 commit 9c77725
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/serialization.cpp
Expand Up @@ -133,7 +133,8 @@ void decompressZlib(std::istream &is, std::ostream &os)
if(z.avail_in == 0)
{
z.next_in = (Bytef*)input_buffer;
input_buffer_len = is.readsome(input_buffer, bufsize);
is.read(input_buffer, bufsize);
input_buffer_len = is.gcount();
z.avail_in = input_buffer_len;
//dstream<<"read fail="<<is.fail()<<" bad="<<is.bad()<<std::endl;
}
Expand Down Expand Up @@ -166,6 +167,7 @@ void decompressZlib(std::istream &is, std::ostream &os)
//dstream<<"z.avail_in="<<z.avail_in<<std::endl;
//dstream<<"fail="<<is.fail()<<" bad="<<is.bad()<<std::endl;
// Unget all the data that inflate didn't take
is.clear(); // Just in case EOF is set
for(u32 i=0; i < z.avail_in; i++)
{
is.unget();
Expand Down

0 comments on commit 9c77725

Please sign in to comment.