tmp fix zipfile for jittorllama

This commit is contained in:
lidongyang 2024-12-19 16:32:37 +08:00
parent 30bb3dbf22
commit 14f000f867
2 changed files with 5 additions and 5 deletions

View File

@ -6283,7 +6283,7 @@ mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_n
if (!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA))
{
// uncomp_crc32 = (mz_uint32)mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, buf_size);
uncomp_crc32 = (mz_uint32)mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, buf_size);
uncomp_size = buf_size;
if (uncomp_size <= 3)
{

View File

@ -1333,16 +1333,16 @@ struct ZipFile {
memset(zip_archive.get(), 0, sizeof(mz_zip_archive));
if (mode == "r") {
this->mode = 'r';
if (!mz_zip_reader_init_file(zip_archive.get(), filename.c_str(), 0))
zip_archive = nullptr;
if (!mz_zip_reader_init_file(zip_archive.get(), filename.c_str(), 0))
zip_archive = nullptr;
} else if (mode == "w") {
this->mode = 'w';
if (!mz_zip_writer_init_file_v2(zip_archive.get(), filename.c_str(), 0, MZ_ZIP_FLAG_WRITE_ZIP64)) {
zip_archive = nullptr;
}
}
if (!zip_archive)
throw std::runtime_error("Failed to open zip file: " + filename);
// if (!zip_archive)
// throw std::runtime_error("Failed to open zip file: " + filename);
}
// @pyjt(__dealloc__)
inline ~ZipFile() {