MCPcopy Create free account
hub / github.com/assaultcube/AC / read

Method read

source/src/stream.cpp:857–875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855 }
856
857 int read(void *buf, int len)
858 {
859 if(!reading || !buf || !len) return 0;
860 zfile.next_out = (Bytef *)buf;
861 zfile.avail_out = len;
862 while(zfile.avail_out > 0)
863 {
864 if(!zfile.avail_in)
865 {
866 readbuf(BUFSIZE);
867 if(!zfile.avail_in) { stopreading(); break; }
868 }
869 int err = inflate(&zfile, Z_NO_FLUSH);
870 if(err == Z_STREAM_END) { crc = crc32(crc, (Bytef *)buf, len - zfile.avail_out); finishreading(); stopreading(); return len - zfile.avail_out; }
871 else if(err != Z_OK) { stopreading(); break; }
872 }
873 crc = crc32(crc, (Bytef *)buf, len - zfile.avail_out);
874 return len - zfile.avail_out;
875 }
876
877 bool flush()
878 {

Callers 4

rwopsreadFunction · 0.45
readbufMethod · 0.45
loadfileFunction · 0.45
streamcopyFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected