MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / LoadCentralDirectoryRecord

Function LoadCentralDirectoryRecord

extlibs/minizip/src/zip.c:634–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

632}
633
634int LoadCentralDirectoryRecord(zip64_internal* pziinit)
635{
636 int err = ZIP_OK;
637 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
638
639 ZPOS64_T size_central_dir; /* size of the central directory */
640 ZPOS64_T offset_central_dir; /* offset of start of central directory */
641 ZPOS64_T central_pos;
642 uLong uL;
643
644 uLong number_disk; /* number of the current dist, used for
645 spaning ZIP, unsupported, always 0*/
646 uLong number_disk_with_CD; /* number the the disk with central dir, used
647 for spaning ZIP, unsupported, always 0*/
648 ZPOS64_T number_entry;
649 ZPOS64_T number_entry_CD; /* total number of entries in
650 the central dir
651 (same than number_entry on nospan) */
652 uLong VersionMadeBy;
653 uLong VersionNeeded;
654 uLong size_comment;
655
656 int hasZIP64Record = 0;
657
658 // check first if we find a ZIP64 record
659 central_pos = zip64local_SearchCentralDir64(&pziinit->z_filefunc, pziinit->filestream);
660 if (central_pos > 0)
661 {
662 hasZIP64Record = 1;
663 }
664 else if (central_pos == 0)
665 {
666 central_pos = zip64local_SearchCentralDir(&pziinit->z_filefunc, pziinit->filestream);
667 }
668
669 /* disable to allow appending to empty ZIP archive
670 if (central_pos==0)
671 err=ZIP_ERRNO;
672 */
673
674 if (hasZIP64Record)
675 {
676 ZPOS64_T sizeEndOfCentralDirectory;
677 if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, central_pos, ZLIB_FILEFUNC_SEEK_SET) != 0)
678 err = ZIP_ERRNO;
679
680 /* the signature, already checked */
681 if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream, &uL) != ZIP_OK)
682 err = ZIP_ERRNO;
683
684 /* size of zip64 end of central directory record */
685 if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream, &sizeEndOfCentralDirectory) != ZIP_OK)
686 err = ZIP_ERRNO;
687
688 /* version made by */
689 if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &VersionMadeBy) != ZIP_OK)
690 err = ZIP_ERRNO;
691

Callers 1

zipOpen3Function · 0.85

Calls 6

zip64local_getLongFunction · 0.85
zip64local_getLong64Function · 0.85
zip64local_getShortFunction · 0.85
add_data_in_datablockFunction · 0.85

Tested by

no test coverage detected