mirror of
https://github.com/QuasarApp/zip.git
synced 2025-05-08 18:09:33 +00:00
fixed compilation with MINIZ_NO_TIME (#151)
This commit is contained in:
parent
a67b0b7074
commit
d7df626f3a
@ -6316,7 +6316,10 @@ mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
mz_uint32 ext_attributes) {
|
||||
mz_uint uncomp_crc32 = MZ_CRC32_INIT, level, num_alignment_padding_bytes;
|
||||
mz_uint16 method = 0, dos_time = 0, dos_date = 0;
|
||||
#ifndef MINIZ_NO_TIME
|
||||
time_t file_modified_time;
|
||||
#endif
|
||||
|
||||
mz_uint64 local_dir_header_ofs, cur_archive_file_ofs, uncomp_size = 0,
|
||||
comp_size = 0;
|
||||
size_t archive_name_size;
|
||||
@ -6353,10 +6356,12 @@ mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
comment_size + archive_name_size) > 0xFFFFFFFF))
|
||||
return MZ_FALSE;
|
||||
|
||||
#ifndef MINIZ_NO_TIME
|
||||
memset(&file_modified_time, 0, sizeof(file_modified_time));
|
||||
if (!mz_zip_get_file_modified_time(pSrc_filename, &file_modified_time))
|
||||
return MZ_FALSE;
|
||||
mz_zip_time_t_to_dos_time(file_modified_time, &dos_time, &dos_date);
|
||||
#endif
|
||||
|
||||
pSrc_file = MZ_FOPEN(pSrc_filename, "rb");
|
||||
if (!pSrc_file)
|
||||
|
@ -313,7 +313,9 @@ int zip_entry_open(struct zip_t *zip, const char *entryname) {
|
||||
zip->entry.header_offset = stats.m_local_header_ofs;
|
||||
zip->entry.method = stats.m_method;
|
||||
zip->entry.external_attr = stats.m_external_attr;
|
||||
#ifndef MINIZ_NO_TIME
|
||||
zip->entry.m_time = stats.m_time;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -466,7 +468,9 @@ int zip_entry_openbyindex(struct zip_t *zip, int index) {
|
||||
zip->entry.header_offset = stats.m_local_header_ofs;
|
||||
zip->entry.method = stats.m_method;
|
||||
zip->entry.external_attr = stats.m_external_attr;
|
||||
#ifndef MINIZ_NO_TIME
|
||||
zip->entry.m_time = stats.m_time;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -476,7 +480,7 @@ int zip_entry_close(struct zip_t *zip) {
|
||||
mz_uint level;
|
||||
tdefl_status done;
|
||||
mz_uint16 entrylen;
|
||||
mz_uint16 dos_time, dos_date;
|
||||
mz_uint16 dos_time = 0, dos_date = 0;
|
||||
int status = -1;
|
||||
|
||||
if (!zip) {
|
||||
@ -509,7 +513,10 @@ int zip_entry_close(struct zip_t *zip) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
#ifndef MINIZ_NO_TIME
|
||||
mz_zip_time_t_to_dos_time(zip->entry.m_time, &dos_time, &dos_date);
|
||||
#endif
|
||||
|
||||
if (!mz_zip_writer_create_local_dir_header(
|
||||
pzip, zip->entry.header, entrylen, 0, zip->entry.uncomp_size,
|
||||
zip->entry.comp_size, zip->entry.uncomp_crc32, zip->entry.method, 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user