MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / PrepareDeflate

Method PrepareDeflate

Bcore/src/main/cpp/ziparchive/zip_writer.cc:292–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292int32_t ZipWriter::PrepareDeflate() {
293 CHECK(state_ == State::kWritingZip);
294
295 // Initialize the z_stream for compression.
296 z_stream_ = std::unique_ptr<z_stream, void (*)(z_stream*)>(new z_stream(), DeleteZStream);
297
298#pragma GCC diagnostic push
299#pragma GCC diagnostic ignored "-Wold-style-cast"
300 int zerr = deflateInit2(z_stream_.get(), Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS,
301 DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
302#pragma GCC diagnostic pop
303
304 if (zerr != Z_OK) {
305 if (zerr == Z_VERSION_ERROR) {
306 //chensenhua ALOGE("Installed zlib is not compatible with linked version (%s)", ZLIB_VERSION);
307 return HandleError(kZlibError);
308 } else {
309 //chensenhuaALOGE("deflateInit2 failed (zerr=%d)", zerr);
310 return HandleError(kZlibError);
311 }
312 }
313
314 z_stream_->next_out = buffer_.data();
315 z_stream_->avail_out = buffer_.size();
316 return kNoError;
317}
318
319int32_t ZipWriter::WriteBytes(const void* data, size_t len) {
320 if (state_ != State::kWritingEntry) {

Callers

nothing calls this directly

Calls 3

getMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected