Lines Matching refs:archive
52 // The "end of central directory" (EOCD) record. Each archive
54 // the archive. It contains archive wide information like the
55 // number of entries in the archive and the offset to the central
66 // This implementation assumes that each archive spans a single
71 // This implementation assumes that each archive spans a single
76 // This implementation assumes that each archive spans a single
94 // record in the central directory of the archive. In addition to
140 // beginning of this archive.
148 // present in the central directory of the archive. It is an error for
216 "Duplicate entries in archive",
217 "Empty archive",
234 // The input file cannot be processed as a zip archive. Usually because
242 // The zip archive contained two (or possibly more) entries with the same
246 // The zip archive contains no entries.
249 // The specified entry was not found in the archive.
252 // The zip archive contained an invalid local file header pointer.
255 // The zip archive contained inconsistent entry information. This could
273 * A Read-only Zip archive.
282 * It's possible that somebody has handed us a massive (~1GB) zip archive,
292 /* open Zip archive */
300 /* number of entries in the Zip archive */
304 * We know how many entries are in the Zip archive, so we can have a
410 ZipArchive* archive, off64_t file_length,
428 * Scan backward for the EOCD magic. In an archive without a trailing
464 * archive and verify that they look reasonable.
472 ALOGW("Zip: empty archive?");
481 * in archive.
483 if (!archive->directory_map.create(debug_file_name, fd,
489 archive->num_entries = eocd->num_records;
490 archive->directory_offset = eocd->cd_start_offset;
504 ZipArchive* archive) {
530 * 18 bytes of EOCD stuff and up to 64KB of archive comment. We
543 int32_t result = MapCentralDirectory0(fd, debug_file_name, archive,
551 * Parses the Zip archive's Central Directory. Allocates and populates the
556 static int32_t ParseZipArchive(ZipArchive* archive) {
558 reinterpret_cast<const uint8_t*>(archive->directory_map.getDataPtr());
559 const size_t cd_length = archive->directory_map.getDataLength();
560 const uint16_t num_entries = archive->num_entries;
567 archive->hash_table_size = RoundUpPower2(1 + (num_entries * 4) / 3);
568 archive->hash_table = reinterpret_cast<ZipEntryName*>(calloc(archive->hash_table_size,
591 if (local_header_offset >= archive->directory_offset) {
611 const int add_result = AddToHash(archive->hash_table,
612 archive->hash_table_size, entry_name);
630 static int32_t OpenArchiveInternal(ZipArchive* archive,
633 if ((result = MapCentralDirectory(archive->fd, debug_file_name, archive))) {
637 if ((result = ParseZipArchive(archive))) {
646 ZipArchive* archive = new ZipArchive(fd, assume_ownership);
647 *handle = archive;
648 return OpenArchiveInternal(archive, debug_file_name);
653 ZipArchive* archive = new ZipArchive(fd, true);
654 *handle = archive;
661 return OpenArchiveInternal(archive, fileName);
668 ZipArchive* archive = reinterpret_cast<ZipArchive*>(handle);
669 ALOGV("Closing archive %p", archive);
670 delete archive;
715 static int32_t FindEntry(const ZipArchive* archive, const int ent,
717 const uint16_t nameLen = archive->hash_table[ent].name_length;
722 const uint8_t* ptr = archive->hash_table[ent].name;
729 archive->directory_map.getDataPtr());
730 if (ptr < base_ptr || ptr > base_ptr + archive->directory_map.getDataLength()) {
741 const off64_t cd_offset = archive->directory_offset;
762 ssize_t actual = ReadAtOffset(archive->fd, lfh_buf, sizeof(lfh_buf),
805 ssize_t actual = ReadAtOffset(archive->fd, name_buf, nameLen,
814 if (memcmp(archive->hash_table[ent].name, name_buf, nameLen)) {
858 ZipArchive* archive;
887 ZipArchive* archive = reinterpret_cast<ZipArchive*>(handle);
889 if (archive == NULL || archive->hash_table == NULL) {
896 cookie->archive = archive;
908 const ZipArchive* archive = reinterpret_cast<ZipArchive*>(handle);
914 const int64_t ent = EntryToIndex(archive->hash_table,
915 archive->hash_table_size, entryName);
922 return FindEntry(archive, ent, data);
931 ZipArchive* archive = handle->archive;
932 if (archive == NULL || archive->hash_table == NULL) {
938 const uint32_t hash_table_length = archive->hash_table_size;
939 const ZipEntryName *hash_table = archive->hash_table;
952 const int error = FindEntry(archive, i, data);
1224 ZipArchive* archive = reinterpret_cast<ZipArchive*>(handle);
1228 if (lseek64(archive->fd, data_offset, SEEK_SET) != data_offset) {
1237 return_value = CopyEntryToWriter(archive->fd, entry, writer, &crc);
1239 return_value = InflateEntryToWriter(archive->fd, entry, writer, &crc);
1243 return_value = UpdateEntryFromDataDescriptor(archive->fd, entry);