Thirdparty: Harmonize patches to document downstream changes

This commit is contained in:
Rémi Verschelde
2025-01-31 10:58:38 +01:00
parent 0d14ae58b0
commit 91907a89f7
141 changed files with 1274 additions and 3849 deletions

View File

@ -75,16 +75,12 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
/* GODOT start */
p_filefunc64_32->zfile_func64.alloc_mem = p_filefunc32->alloc_mem;
p_filefunc64_32->zfile_func64.free_mem = p_filefunc32->free_mem;
/* GODOT end */
}
/* GODOT start */
/*
// GODOT end
#if 0
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
FILE* file = NULL;
@ -236,6 +232,5 @@ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}
// GODOT start
*/
/* GODOT end */
#endif

View File

@ -155,10 +155,8 @@ typedef struct zlib_filefunc_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
/* GODOT start */
alloc_func alloc_mem;
free_func free_mem;
/* GODOT end */
} zlib_filefunc_def;
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
@ -175,10 +173,8 @@ typedef struct zlib_filefunc64_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
/* GODOT start */
alloc_func alloc_mem;
free_func free_mem;
/* GODOT end */
} zlib_filefunc64_def;
void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);

View File

@ -1,108 +1,97 @@
diff --git a/thirdparty/minizip/ioapi.c b/thirdparty/minizip/ioapi.c
index 782d32469a..2e89f5f41a 100644
index 782d32469a..2e393aca2d 100644
--- a/thirdparty/minizip/ioapi.c
+++ b/thirdparty/minizip/ioapi.c
@@ -75,8 +75,15 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
@@ -75,9 +75,12 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
+ /* GODOT start */
+ p_filefunc64_32->zfile_func64.alloc_mem = p_filefunc32->alloc_mem;
+ p_filefunc64_32->zfile_func64.free_mem = p_filefunc32->free_mem;
+ /* GODOT end */
}
+/* GODOT start */
+/*
+// GODOT end
+#if 0
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
@@ -229,3 +236,6 @@ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
FILE* file = NULL;
@@ -229,3 +232,5 @@ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}
+// GODOT start
+*/
+/* GODOT end */
+
+#endif
diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
index a2d2e6e60d..509b52da8a 100644
index a2d2e6e60d..556dd8ad18 100644
--- a/thirdparty/minizip/ioapi.h
+++ b/thirdparty/minizip/ioapi.h
@@ -155,6 +155,10 @@ typedef struct zlib_filefunc_def_s
@@ -155,6 +155,8 @@ typedef struct zlib_filefunc_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
+ /* GODOT start */
+ alloc_func alloc_mem;
+ free_func free_mem;
+ /* GODOT end */
} zlib_filefunc_def;
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
@@ -171,6 +175,10 @@ typedef struct zlib_filefunc64_def_s
@@ -171,6 +173,8 @@ typedef struct zlib_filefunc64_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
+ /* GODOT start */
+ alloc_func alloc_mem;
+ free_func free_mem;
+ /* GODOT end */
} zlib_filefunc64_def;
void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c
index ea05b7d62a..981ba3c0cb 100644
index ea05b7d62a..7e8a6ac2d3 100644
--- a/thirdparty/minizip/unzip.c
+++ b/thirdparty/minizip/unzip.c
@@ -152,6 +152,9 @@ typedef struct
@@ -152,6 +152,7 @@ typedef struct
uLong compression_method; /* compression method (0==store) */
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
int raw;
+ /* GODOT start */
+ int extra_size;
+ /* GODOT end */
} file_in_zip64_read_info_s;
@@ -513,9 +516,10 @@ local unzFile unzOpenInternal(const void *path,
@@ -513,9 +514,9 @@ local unzFile unzOpenInternal(const void *path,
us.z_filefunc.zseek32_file = NULL;
us.z_filefunc.ztell32_file = NULL;
if (pzlib_filefunc64_32_def==NULL)
- fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
- else
- us.z_filefunc = *pzlib_filefunc64_32_def;
+ /* GODOT start */
+ //fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
+ return NULL; // standard i/o not supported
+ us.z_filefunc = *pzlib_filefunc64_32_def;
+ /* GODOT end */
us.is64bitOpenFunction = is64bitOpenFunction;
@@ -703,6 +707,18 @@ extern unzFile ZEXPORT unzOpen64(const void *path) {
@@ -703,6 +704,15 @@ extern unzFile ZEXPORT unzOpen64(const void *path) {
return unzOpenInternal(path, NULL, 1);
}
+/* GODOT start */
+extern void* unzGetOpaque(unzFile file) {
+
+ unz64_s* s;
+ if (file==NULL)
+ return NULL;
+ s=(unz64_s*)file;
+
+ return s->z_filefunc.zfile_func64.opaque;
+};
+/* GODOT end */
+}
+
/*
Close a ZipFile opened with unzOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
@@ -905,10 +921,23 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
@@ -905,10 +915,19 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
if (lSeek!=0)
{
+ /* GODOT start */
- if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
- lSeek=0;
- else
- err=UNZ_ERRNO;
+ if (lSeek<0) {
+ // WORKAROUND for backwards seeking
+ ZPOS64_T pos = ZTELL64(s->z_filefunc, s->filestream);
@ -111,47 +100,38 @@ index ea05b7d62a..981ba3c0cb 100644
+ else
+ err=UNZ_ERRNO;
+ } else {
+ /* GODOT end */
if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
+ /* GODOT start */
+ if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ }
+ /* GODOT end */
}
while(acc < file_info.size_file_extra)
@@ -1446,8 +1475,10 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
@@ -1446,8 +1465,8 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
}
else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
{
- pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
- pfile_in_zip_read_info->stream.zfree = (free_func)0;
+ /* GODOT start */
+ pfile_in_zip_read_info->stream.zalloc = s->z_filefunc.zfile_func64.alloc_mem;
+ pfile_in_zip_read_info->stream.zfree = s->z_filefunc.zfile_func64.free_mem;
+ /* GODOT end */
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = 0;
pfile_in_zip_read_info->stream.avail_in = 0;
@@ -1480,6 +1511,9 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
@@ -1480,6 +1499,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
iSizeVar;
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
+ /* GODOT start */
+ pfile_in_zip_read_info->extra_size = iSizeVar;
+ /* GODOT end */
s->pfile_in_zip_read = pfile_in_zip_read_info;
s->encrypted = 0;
@@ -1510,6 +1544,85 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
@@ -1510,6 +1530,82 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
return UNZ_OK;
}
+/* GODOT start */
+extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
+
+ unz64_s* s;
+ file_in_zip64_read_info_s* pfile_in_zip_read_info;
+ if (file==NULL)
@ -226,69 +206,60 @@ index ea05b7d62a..981ba3c0cb 100644
+
+ return pos;
+}
+/* GODOT end */
+
extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
}
diff --git a/thirdparty/minizip/unzip.h b/thirdparty/minizip/unzip.h
index 5cfc9c6274..0639674574 100644
index 5cfc9c6274..37ff29b22a 100644
--- a/thirdparty/minizip/unzip.h
+++ b/thirdparty/minizip/unzip.h
@@ -202,6 +202,10 @@ extern int ZEXPORT unzClose(unzFile file);
@@ -202,6 +202,8 @@ extern int ZEXPORT unzClose(unzFile file);
these files MUST be closed with unzCloseCurrentFile before call unzClose.
return UNZ_OK if there is no problem. */
+/* GODOT start */
+extern void* unzGetOpaque(unzFile file);
+/* GODOT end */
+
extern int ZEXPORT unzGetGlobalInfo(unzFile file,
unz_global_info *pglobal_info);
@@ -390,6 +394,13 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file,
@@ -390,6 +392,11 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file,
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/
+/* GODOT start */
+extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos);
+/*
+ Seek to position in uncompressed data
+*/
+/* GODOT end */
+
extern z_off_t ZEXPORT unztell(unzFile file);
extern ZPOS64_T ZEXPORT unztell64(unzFile file);
diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
index 60bdffac34..1d2d918e72 100644
index 60bdffac34..078a0a82ec 100644
--- a/thirdparty/minizip/zip.c
+++ b/thirdparty/minizip/zip.c
@@ -820,9 +820,11 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo
@@ -820,9 +820,9 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo
ziinit.z_filefunc.zseek32_file = NULL;
ziinit.z_filefunc.ztell32_file = NULL;
- if (pzlib_filefunc64_32_def==NULL)
- fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
- else
+ /* GODOT start */
+ if (pzlib_filefunc64_32_def==NULL) {
+ //fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
+ } else
+ /* GODOT end */
ziinit.z_filefunc = *pzlib_filefunc64_32_def;
ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
@@ -1182,8 +1184,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
@@ -1182,8 +1182,8 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
{
if(zi->ci.method == Z_DEFLATED)
{
- zi->ci.stream.zalloc = (alloc_func)0;
- zi->ci.stream.zfree = (free_func)0;
+ /* GODOT start */
+ zi->ci.stream.zalloc = zi->z_filefunc.zfile_func64.alloc_mem;
+ zi->ci.stream.zfree = zi->z_filefunc.zfile_func64.free_mem;
+ /* GODOT end */
zi->ci.stream.opaque = (voidpf)0;
if (windowBits>0)

View File

@ -152,9 +152,7 @@ typedef struct
uLong compression_method; /* compression method (0==store) */
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
int raw;
/* GODOT start */
int extra_size;
/* GODOT end */
} file_in_zip64_read_info_s;
@ -516,10 +514,9 @@ local unzFile unzOpenInternal(const void *path,
us.z_filefunc.zseek32_file = NULL;
us.z_filefunc.ztell32_file = NULL;
if (pzlib_filefunc64_32_def==NULL)
/* GODOT start */
//fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
return NULL; // standard i/o not supported
us.z_filefunc = *pzlib_filefunc64_32_def;
/* GODOT end */
us.is64bitOpenFunction = is64bitOpenFunction;
@ -707,17 +704,14 @@ extern unzFile ZEXPORT unzOpen64(const void *path) {
return unzOpenInternal(path, NULL, 1);
}
/* GODOT start */
extern void* unzGetOpaque(unzFile file) {
unz64_s* s;
if (file==NULL)
return NULL;
s=(unz64_s*)file;
return s->z_filefunc.zfile_func64.opaque;
};
/* GODOT end */
}
/*
Close a ZipFile opened with unzOpen.
@ -921,7 +915,6 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
if (lSeek!=0)
{
/* GODOT start */
if (lSeek<0) {
// WORKAROUND for backwards seeking
ZPOS64_T pos = ZTELL64(s->z_filefunc, s->filestream);
@ -930,14 +923,11 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
else
err=UNZ_ERRNO;
} else {
/* GODOT end */
if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
/* GODOT start */
if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
}
/* GODOT end */
}
while(acc < file_info.size_file_extra)
@ -1475,10 +1465,8 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
}
else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
{
/* GODOT start */
pfile_in_zip_read_info->stream.zalloc = s->z_filefunc.zfile_func64.alloc_mem;
pfile_in_zip_read_info->stream.zfree = s->z_filefunc.zfile_func64.free_mem;
/* GODOT end */
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = 0;
pfile_in_zip_read_info->stream.avail_in = 0;
@ -1511,9 +1499,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
iSizeVar;
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
/* GODOT start */
pfile_in_zip_read_info->extra_size = iSizeVar;
/* GODOT end */
s->pfile_in_zip_read = pfile_in_zip_read_info;
s->encrypted = 0;
@ -1544,9 +1530,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
return UNZ_OK;
}
/* GODOT start */
extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
unz64_s* s;
file_in_zip64_read_info_s* pfile_in_zip_read_info;
if (file==NULL)
@ -1621,7 +1605,6 @@ extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
return pos;
}
/* GODOT end */
extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);

View File

@ -202,9 +202,7 @@ extern int ZEXPORT unzClose(unzFile file);
these files MUST be closed with unzCloseCurrentFile before call unzClose.
return UNZ_OK if there is no problem. */
/* GODOT start */
extern void* unzGetOpaque(unzFile file);
/* GODOT end */
extern int ZEXPORT unzGetGlobalInfo(unzFile file,
unz_global_info *pglobal_info);
@ -394,12 +392,10 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file,
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/
/* GODOT start */
extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos);
/*
Seek to position in uncompressed data
*/
/* GODOT end */
extern z_off_t ZEXPORT unztell(unzFile file);

View File

@ -820,11 +820,9 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo
ziinit.z_filefunc.zseek32_file = NULL;
ziinit.z_filefunc.ztell32_file = NULL;
/* GODOT start */
if (pzlib_filefunc64_32_def==NULL) {
//fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
} else
/* GODOT end */
ziinit.z_filefunc = *pzlib_filefunc64_32_def;
ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
@ -1184,10 +1182,8 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
{
if(zi->ci.method == Z_DEFLATED)
{
/* GODOT start */
zi->ci.stream.zalloc = zi->z_filefunc.zfile_func64.alloc_mem;
zi->ci.stream.zfree = zi->z_filefunc.zfile_func64.free_mem;
/* GODOT end */
zi->ci.stream.opaque = (voidpf)0;
if (windowBits>0)