added support for writing utf-8 filenames
This commit is contained in:
parent
28f5066e33
commit
c0031c46d3
9
miniz.c
9
miniz.c
@ -4417,6 +4417,11 @@ mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
size_t archive_name_size;
|
||||
mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE];
|
||||
MZ_FILE *pSrc_file = NULL;
|
||||
#ifdef MINIZ_NO_UTF8
|
||||
mz_uint16 bit_flags = 0x0000;
|
||||
#else
|
||||
mz_uint16 bit_flags = 0x0800;
|
||||
#endif // MINIZ_NO_UTF8
|
||||
|
||||
if ((int)level_and_flags < 0)
|
||||
level_and_flags = MZ_DEFAULT_LEVEL;
|
||||
@ -4571,13 +4576,13 @@ mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name,
|
||||
if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF))
|
||||
return MZ_FALSE;
|
||||
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date))
|
||||
if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, dos_date))
|
||||
return MZ_FALSE;
|
||||
|
||||
if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header))
|
||||
return MZ_FALSE;
|
||||
|
||||
if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date, local_dir_header_ofs, ext_attributes))
|
||||
if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, comment_size, uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, dos_date, local_dir_header_ofs, ext_attributes))
|
||||
return MZ_FALSE;
|
||||
|
||||
pZip->m_total_files++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user