Fix zip file extraction error

This commit is contained in:
MysterD 2023-04-03 21:09:15 -07:00
parent c437b386f6
commit 4d545fd2ca
2 changed files with 4 additions and 4 deletions

View file

@ -132,7 +132,7 @@ static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) {
}
// Try to extract all the files to the heap.
size_t uncompSize;
size_t uncompSize = 0;
const char* p = mz_zip_reader_extract_file_to_heap(&zip_archive, file_stat.m_filename, &uncompSize, 0);
if (!p) {
LOG_ERROR("mz_zip_reader_extract_file_to_heap() failed!");
@ -155,11 +155,11 @@ static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) {
return false;
}
size_t wbytes = fwrite(p, 1, uncompSize, fout);
fclose(fout);
size_t wbytes = fwrite(p, 1, uncompSize, fout);
if (wbytes != uncompSize) {
LOG_ERROR("Write error on zip mod import");
LOG_ERROR("Write error on zip mod import: %u != %u", (u32)wbytes, (u32)uncompSize);
}
LOG_INFO("Successfully extracted file \"%s\", size %u", file_stat.m_filename, (u32)uncompSize);

View file

@ -25,7 +25,7 @@
*
**************************************************************************/
#pragma GCC diagnostic ignored "-Wtype-limits"
typedef unsigned char mz_validate_uint16[sizeof(mz_uint16) == 2 ? 1 : -1];
typedef unsigned char mz_validate_uint32[sizeof(mz_uint32) == 4 ? 1 : -1];