diff --git a/mz_compat.c b/mz_compat.c index 5be4c8a1..d8cabb4d 100644 --- a/mz_compat.c +++ b/mz_compat.c @@ -480,8 +480,8 @@ int zipOpenNewFileInZip5(zipFile file, const char *filename, const zip_fileinfo dos_date = mz_zip_tm_to_dosdate(&zipfi->tmz_date); file_info.modified_date = mz_zip_dosdate_to_time_t(dos_date); - file_info.external_fa = zipfi->external_fa; - file_info.internal_fa = zipfi->internal_fa; + file_info.external_fa = (uint32_t)zipfi->external_fa; + file_info.internal_fa = (uint16_t)zipfi->internal_fa; } if (!filename) diff --git a/mz_compat.h b/mz_compat.h index 24b6899f..24249ea0 100644 --- a/mz_compat.h +++ b/mz_compat.h @@ -130,10 +130,10 @@ typedef struct tm tm_unz; typedef struct tm tm_zip; typedef struct { - uint32_t mz_dos_date; - struct tm tmz_date; - uint16_t internal_fa; /* internal file attributes 2 bytes */ - uint32_t external_fa; /* external file attributes 4 bytes */ + struct tm tmz_date; /* date in understandable format */ + unsigned long mz_dos_date; /* if dos_date == 0, tmz_date is used */ + unsigned long internal_fa; /* internal file attributes 2 bytes */ + unsigned long external_fa; /* external file attributes 4 bytes */ } zip_fileinfo; typedef const char *zipcharpc; @@ -252,33 +252,34 @@ typedef void *unzFile; typedef struct unz_global_info64_s { uint64_t number_entry; /* total number of entries in the central dir on this disk */ + unsigned long size_comment; /* size of the global comment of the zipfile */ uint32_t number_disk_with_CD; /* number the the disk with central dir, used for spanning ZIP */ - uint16_t size_comment; /* size of the global comment of the zipfile */ } unz_global_info64; typedef struct unz_global_info_s { - uint32_t number_entry; /* total number of entries in the central dir on this disk */ + unsigned long number_entry; /* total number of entries in the central dir on this disk */ + unsigned long size_comment; /* size of the global comment of the zipfile */ uint32_t number_disk_with_CD; /* number the the disk with central dir, used for spanning ZIP */ - uint16_t size_comment; /* size of the global comment of the zipfile */ } unz_global_info; typedef struct unz_file_info64_s { - uint16_t version; /* version made by 2 bytes */ - uint16_t version_needed; /* version needed to extract 2 bytes */ - uint16_t flag; /* general purpose bit flag 2 bytes */ - uint16_t compression_method; /* compression method 2 bytes */ - uint32_t mz_dos_date; /* last mod file date in Dos fmt 4 bytes */ - struct tm tmu_date; - uint32_t crc; /* crc-32 4 bytes */ - uint64_t compressed_size; /* compressed size 8 bytes */ - uint64_t uncompressed_size; /* uncompressed size 8 bytes */ - uint16_t size_filename; /* filename length 2 bytes */ - uint16_t size_file_extra; /* extra field length 2 bytes */ - uint16_t size_file_comment; /* file comment length 2 bytes */ + unsigned long version; /* version made by 2 bytes */ + unsigned long version_needed; /* version needed to extract 2 bytes */ + unsigned long flag; /* general purpose bit flag 2 bytes */ + unsigned long compression_method; /* compression method 2 bytes */ + unsigned long mz_dos_date; /* last mod file date in Dos fmt 4 bytes */ + unsigned long crc; /* crc-32 4 bytes */ + uint64_t compressed_size; /* compressed size 8 bytes */ + uint64_t uncompressed_size; /* uncompressed size 8 bytes */ + unsigned long size_filename; /* filename length 2 bytes */ + unsigned long size_file_extra; /* extra field length 2 bytes */ + unsigned long size_file_comment; /* file comment length 2 bytes */ + + unsigned long disk_num_start; /* disk number start 4 bytes */ + unsigned long internal_fa; /* internal file attributes 2 bytes */ + unsigned long external_fa; /* external file attributes 4 bytes */ - uint32_t disk_num_start; /* disk number start 4 bytes */ - uint16_t internal_fa; /* internal file attributes 2 bytes */ - uint32_t external_fa; /* external file attributes 4 bytes */ + struct tm tmu_date; uint64_t disk_offset; @@ -286,22 +287,23 @@ typedef struct unz_file_info64_s { } unz_file_info64; typedef struct unz_file_info_s { - uint16_t version; /* version made by 2 bytes */ - uint16_t version_needed; /* version needed to extract 2 bytes */ - uint16_t flag; /* general purpose bit flag 2 bytes */ - uint16_t compression_method; /* compression method 2 bytes */ - uint32_t mz_dos_date; /* last mod file date in Dos fmt 4 bytes */ + unsigned long version; /* version made by 2 bytes */ + unsigned long version_needed; /* version needed to extract 2 bytes */ + unsigned long flag; /* general purpose bit flag 2 bytes */ + unsigned long compression_method; /* compression method 2 bytes */ + unsigned long mz_dos_date; /* last mod file date in Dos fmt 4 bytes */ + unsigned long crc; /* crc-32 4 bytes */ + unsigned long compressed_size; /* compressed size 4 bytes */ + unsigned long uncompressed_size; /* uncompressed size 4 bytes */ + unsigned long size_filename; /* filename length 2 bytes */ + unsigned long size_file_extra; /* extra field length 2 bytes */ + unsigned long size_file_comment; /* file comment length 2 bytes */ + + unsigned long disk_num_start; /* disk number start 2 bytes */ + unsigned long internal_fa; /* internal file attributes 2 bytes */ + unsigned long external_fa; /* external file attributes 4 bytes */ + struct tm tmu_date; - uint32_t crc; /* crc-32 4 bytes */ - uint32_t compressed_size; /* compressed size 4 bytes */ - uint32_t uncompressed_size; /* uncompressed size 4 bytes */ - uint16_t size_filename; /* filename length 2 bytes */ - uint16_t size_file_extra; /* extra field length 2 bytes */ - uint16_t size_file_comment; /* file comment length 2 bytes */ - - uint16_t disk_num_start; /* disk number start 2 bytes */ - uint16_t internal_fa; /* internal file attributes 2 bytes */ - uint32_t external_fa; /* external file attributes 4 bytes */ uint64_t disk_offset; } unz_file_info;