diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c index e83aff2773..af73f06137 100644 --- a/thirdparty/minizip/unzip.c +++ b/thirdparty/minizip/unzip.c @@ -408,6 +408,12 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, #define BUFREADCOMMENT (0x400) #endif +/* GODOT start */ +#ifndef CENTRALDIRINVALID +#define CENTRALDIRINVALID (0xffffffffffffffff) +#endif +/* GODOT end */ + /* Locate the Central directory of a zipfile (at the end, just before the global comment) @@ -419,10 +425,14 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f ZPOS64_T uSizeFile; ZPOS64_T uBackRead; ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ - ZPOS64_T uPosFound=0; + /* GODOT start */ + ZPOS64_T uPosFound=CENTRALDIRINVALID; + /* GODOT end */ if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) - return 0; + /* GODOT start */ + return CENTRALDIRINVALID; + /* GODOT end */ uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); @@ -432,7 +442,9 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); if (buf==NULL) - return 0; + /* GODOT start */ + return CENTRALDIRINVALID; + /* GODOT end */ uBackRead = 4; while (uBackRead