MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / write_buffer

Function write_buffer

extern/partio/src/lib/io/PRT.cpp:129–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129static bool write_buffer(std::ostream& os, z_stream& z, char* out_buf, void* p, size_t size, bool flush,std::ostream* errorStream) {
130 z.next_in=(Bytef*)p;
131 z.avail_in=(uInt)size;
132 while (z.avail_in!=0 || flush) {
133 z.next_out = (Bytef*)out_buf;
134 z.avail_out = OUT_BUFSIZE;
135 int ret=deflate(&z,flush?Z_FINISH:Z_NO_FLUSH);
136 if (!(ret!=Z_BUF_ERROR && ret!=Z_STREAM_ERROR)) {
137 if(errorStream) *errorStream<<"Zlib error "<<z.msg<<std::endl;;
138 return false;
139 }
140 int generated_output=(int)(z.next_out-(Bytef*)out_buf);
141 os.write((char*)out_buf,generated_output);
142 if (ret==Z_STREAM_END) break;
143 }
144 return true;
145}
146
147
148

Callers 1

writePRTFunction · 0.85

Calls 2

deflateFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected