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. */
| 582 | of this unzip package. |
| 583 | */ |
| 584 | local unzFile unzOpenInternal (const void *path, |
| 585 | zlib_filefunc64_32_def* pzlib_filefunc64_32_def, |
| 586 | int is64bitOpenFunction) |
| 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.z_filefunc.zseek32_file = NULL; |
| 607 | us.z_filefunc.ztell32_file = NULL; |
| 608 | if (pzlib_filefunc64_32_def==NULL) |
| 609 | fill_fopen64_filefunc(&us.z_filefunc.zfile_func64); |
| 610 | else |
| 611 | us.z_filefunc = *pzlib_filefunc64_32_def; |
| 612 | us.is64bitOpenFunction = is64bitOpenFunction; |
| 613 | |
| 614 | |
| 615 | |
| 616 | us.filestream = ZOPEN64(us.z_filefunc, |
| 617 | path, |
| 618 | ZLIB_FILEFUNC_MODE_READ | |
| 619 | ZLIB_FILEFUNC_MODE_EXISTING); |
| 620 | if (us.filestream==NULL) |
| 621 | return NULL; |
| 622 | |
| 623 | central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream); |
| 624 | if (central_pos) |
| 625 | { |
| 626 | uLong uS; |
| 627 | ZPOS64_T uL64; |
| 628 | |
| 629 | us.isZip64 = 1; |
| 630 | |
| 631 | if (ZSEEK64(us.z_filefunc, us.filestream, |
| 632 | central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) |
| 633 | err=UNZ_ERRNO; |
| 634 | |
| 635 | /* the signature, already checked */ |
| 636 | if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) |
| 637 | err=UNZ_ERRNO; |
| 638 | |
| 639 | /* size of zip64 end of central directory record */ |
| 640 | if (unz64local_getLong64(&us.z_filefunc, us.filestream,&uL64)!=UNZ_OK) |
| 641 | err=UNZ_ERRNO; |
no test coverage detected