Skip to content
Snippets Groups Projects
Commit 9c777256 authored by gregorycu's avatar gregorycu Committed by paramat
Browse files

Replace instance of readsome with read in decompressZlib Make decompressZlib more robust

parent 386d190e
No related branches found
No related tags found
No related merge requests found
...@@ -133,7 +133,8 @@ void decompressZlib(std::istream &is, std::ostream &os) ...@@ -133,7 +133,8 @@ void decompressZlib(std::istream &is, std::ostream &os)
if(z.avail_in == 0) if(z.avail_in == 0)
{ {
z.next_in = (Bytef*)input_buffer; 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; z.avail_in = input_buffer_len;
//dstream<<"read fail="<<is.fail()<<" bad="<<is.bad()<<std::endl; //dstream<<"read fail="<<is.fail()<<" bad="<<is.bad()<<std::endl;
} }
...@@ -166,6 +167,7 @@ void decompressZlib(std::istream &is, std::ostream &os) ...@@ -166,6 +167,7 @@ void decompressZlib(std::istream &is, std::ostream &os)
//dstream<<"z.avail_in="<<z.avail_in<<std::endl; //dstream<<"z.avail_in="<<z.avail_in<<std::endl;
//dstream<<"fail="<<is.fail()<<" bad="<<is.bad()<<std::endl; //dstream<<"fail="<<is.fail()<<" bad="<<is.bad()<<std::endl;
// Unget all the data that inflate didn't take // 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++) for(u32 i=0; i < z.avail_in; i++)
{ {
is.unget(); is.unget();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment