MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / unzOpenInternal

Function unzOpenInternal

lib/QuaZip/quazip/unzip.c:584–766  ·  view source on GitHub ↗

Open a Zip file. path contain the full pathname (by example, on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer "zlib/zlib114.zip". If the zipfile cannot be opened (file doesn't exist or in not valid), the return value is NULL. Else, the return value is a unzFile Handle, usable with other function of this unzip package. */

Source from the content-addressed store, hash-verified

582 of this unzip package.
583*/
584extern unzFile unzOpenInternal (voidpf file,
585 zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
586 int is64bitOpenFunction, unsigned flags)
587{
588 unz64_s us;
589 unz64_s *s;
590 ZPOS64_T central_pos;
591 uLong uL;
592
593 uLong number_disk; /* number of the current dist, used for
594 spaning ZIP, unsupported, always 0*/
595 uLong number_disk_with_CD; /* number the the disk with central dir, used
596 for spaning ZIP, unsupported, always 0*/
597 ZPOS64_T number_entry_CD; /* total number of entries in
598 the central dir
599 (same than number_entry on nospan) */
600
601 int err=UNZ_OK;
602
603 if (unz_copyright[0]!=' ')
604 return NULL;
605
606 us.flags = flags;
607 us.z_filefunc.zseek32_file = NULL;
608 us.z_filefunc.ztell32_file = NULL;
609 if (pzlib_filefunc64_32_def==NULL)
610 fill_qiodevice64_filefunc(&us.z_filefunc.zfile_func64);
611 else
612 us.z_filefunc = *pzlib_filefunc64_32_def;
613 us.is64bitOpenFunction = is64bitOpenFunction;
614
615
616
617 us.filestream = ZOPEN64(us.z_filefunc,
618 file,
619 ZLIB_FILEFUNC_MODE_READ |
620 ZLIB_FILEFUNC_MODE_EXISTING);
621 if (us.filestream==NULL)
622 return NULL;
623
624 central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
625 if (central_pos)
626 {
627 uLong uS;
628 ZPOS64_T uL64;
629
630 us.isZip64 = 1;
631
632 if (ZSEEK64(us.z_filefunc, us.filestream,
633 central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
634 err=UNZ_ERRNO;
635
636 /* the signature, already checked */
637 if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
638 err=UNZ_ERRNO;
639
640 /* size of zip64 end of central directory record */
641 if (unz64local_getLong64(&us.z_filefunc, us.filestream,&uL64)!=UNZ_OK)

Callers 5

unzOpen2Function · 0.85
unzOpen2_64Function · 0.85
unzOpenFunction · 0.85
unzOpen64Function · 0.85
openMethod · 0.85

Calls 7

unz64local_getLongFunction · 0.85
unz64local_getLong64Function · 0.85
unz64local_getShortFunction · 0.85
unzGoToFirstFileFunction · 0.85

Tested by

no test coverage detected