Get info about the current file in the zipfile, with internal only info */
| 693 | |
| 694 | /* Get info about the current file in the zipfile, with internal only info */ |
| 695 | static int unzGetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_info, |
| 696 | unz_file_info64_internal *pfile_info_internal, char *filename, uint16_t filename_size, void *extrafield, |
| 697 | uint16_t extrafield_size, char *comment, uint16_t comment_size) |
| 698 | { |
| 699 | unz64_internal *s = NULL; |
| 700 | unz_file_info64 file_info; |
| 701 | unz_file_info64_internal file_info_internal; |
| 702 | uint32_t magic = 0; |
| 703 | uint64_t current_pos = 0; |
| 704 | uint32_t seek = 0; |
| 705 | uint32_t extra_pos = 0; |
| 706 | uint16_t extra_header_id = 0; |
| 707 | uint16_t extra_data_size = 0; |
| 708 | uint16_t value16 = 0; |
| 709 | uint32_t value32 = 0; |
| 710 | uint64_t value64 = 0; |
| 711 | int err = UNZ_OK; |
| 712 | |
| 713 | if (file == NULL) |
| 714 | return UNZ_PARAMERROR; |
| 715 | s = (unz64_internal*)file; |
| 716 | |
| 717 | if (ZSEEK64(s->z_filefunc, s->filestream_with_CD, |
| 718 | s->pos_in_central_dir + s->byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0) |
| 719 | err = UNZ_ERRNO; |
| 720 | |
| 721 | /* Check the magic */ |
| 722 | if (err == UNZ_OK) |
| 723 | { |
| 724 | if (unzReadUInt32(&s->z_filefunc, s->filestream_with_CD, &magic) != UNZ_OK) |
| 725 | err = UNZ_ERRNO; |
| 726 | else if (magic != CENTRALHEADERMAGIC) |
| 727 | err = UNZ_BADZIPFILE; |
| 728 | } |
| 729 | |
| 730 | /* Read central directory header */ |
| 731 | if (unzReadUInt16(&s->z_filefunc, s->filestream_with_CD, &file_info.version) != UNZ_OK) |
| 732 | err = UNZ_ERRNO; |
| 733 | if (unzReadUInt16(&s->z_filefunc, s->filestream_with_CD, &file_info.version_needed) != UNZ_OK) |
| 734 | err = UNZ_ERRNO; |
| 735 | if (unzReadUInt16(&s->z_filefunc, s->filestream_with_CD, &file_info.flag) != UNZ_OK) |
| 736 | err = UNZ_ERRNO; |
| 737 | if (unzReadUInt16(&s->z_filefunc, s->filestream_with_CD, &file_info.compression_method) != UNZ_OK) |
| 738 | err = UNZ_ERRNO; |
| 739 | if (unzReadUInt32(&s->z_filefunc, s->filestream_with_CD, &file_info.dos_date) != UNZ_OK) |
| 740 | err = UNZ_ERRNO; |
| 741 | if (unzReadUInt32(&s->z_filefunc, s->filestream_with_CD, &file_info.crc) != UNZ_OK) |
| 742 | err = UNZ_ERRNO; |
| 743 | if (unzReadUInt32(&s->z_filefunc, s->filestream_with_CD, &value32) != UNZ_OK) |
| 744 | err = UNZ_ERRNO; |
| 745 | file_info.compressed_size = value32; |
| 746 | if (unzReadUInt32(&s->z_filefunc, s->filestream_with_CD, &value32) != UNZ_OK) |
| 747 | err = UNZ_ERRNO; |
| 748 | file_info.uncompressed_size = value32; |
| 749 | if (unzReadUInt16(&s->z_filefunc, s->filestream_with_CD, &file_info.size_filename) != UNZ_OK) |
| 750 | err = UNZ_ERRNO; |
| 751 | if (unzReadUInt16(&s->z_filefunc, s->filestream_with_CD, &file_info.size_file_extra) != UNZ_OK) |
| 752 | err = UNZ_ERRNO; |
no test coverage detected