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

Function ExtractToWriter

Bcore/src/main/cpp/ziparchive/zip_archive.cc:1050–1077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1048}
1049
1050int32_t ExtractToWriter(ZipArchiveHandle handle, ZipEntry* entry, zip_archive_lkchan::Writer* writer) {
1051 ZipArchive* archive = reinterpret_cast<ZipArchive*>(handle);
1052 const uint16_t method = entry->method;
1053
1054 // this should default to kUnknownCompressionMethod.
1055 int32_t return_value = -1;
1056 uint64_t crc = 0;
1057 if (method == kCompressStored) {
1058 return_value = CopyEntryToWriter(archive->mapped_zip, entry, writer, &crc);
1059 } else if (method == kCompressDeflated) {
1060 return_value = InflateEntryToWriter(archive->mapped_zip, entry, writer, &crc);
1061 }
1062
1063 if (!return_value && entry->has_data_descriptor) {
1064 return_value = ValidateDataDescriptor(archive->mapped_zip, entry);
1065 if (return_value) {
1066 return return_value;
1067 }
1068 }
1069
1070 // Validate that the CRC matches the calculated value.
1071 if (kCrcChecksEnabled && (entry->crc32 != static_cast<uint32_t>(crc))) {
1072 //chensenhua ALOGW("Zip: crc mismatch: expected %" PRIu32 ", was %" PRIu64, entry->crc32, crc);
1073 return kInconsistentInformation;
1074 }
1075
1076 return return_value;
1077}
1078
1079int32_t ExtractToMemory(ZipArchiveHandle handle, ZipEntry* entry, uint8_t* begin, uint32_t size) {
1080 MemoryWriter writer(begin, size);

Callers 3

ExtractToMemoryFunction · 0.85
ExtractEntryToFileFunction · 0.85
ProcessZipEntryContentsFunction · 0.85

Calls 3

CopyEntryToWriterFunction · 0.85
InflateEntryToWriterFunction · 0.85
ValidateDataDescriptorFunction · 0.85

Tested by

no test coverage detected