Manually re-apply diff: zip.c

This commit is contained in:
James Addison
2023-11-17 16:01:30 +00:00
parent b84e710a29
commit c3407c59a1
2 changed files with 20 additions and 90 deletions

View File

@@ -1401,7 +1401,7 @@ extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned i
else
#endif
{
zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf;
zi->ci.stream.next_in = buf;
zi->ci.stream.avail_in = len;
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
@@ -1819,6 +1819,18 @@ local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) {
return err;
}
extern int ZEXPORT zipFlush (zipFile file)
{
zip64_internal* zi;
if (file == NULL)
return ZIP_PARAMERROR;
zi = (zip64_internal*)file;
return ZFLUSH64(zi->z_filefunc,zi->filestream);
}
extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
zip64_internal* zi;
int err = 0;

View File

@@ -1,97 +1,15 @@
--- zip.c.orig 2014-06-10 18:55:32.778807408 +0200
+++ zip.c 2014-06-11 20:27:18.355848501 +0200
@@ -186,7 +186,7 @@
#include "crypt.h"
#endif
-local linkedlist_datablock_internal* allocate_new_datablock()
+local linkedlist_datablock_internal* allocate_new_datablock(void)
{
linkedlist_datablock_internal* ldi;
ldi = (linkedlist_datablock_internal*)
@@ -238,7 +238,7 @@
}
ldi = ll->last_block;
- from_copy = (unsigned char*)buf;
+ from_copy = (const unsigned char*)buf;
while (len>0)
{
@@ -637,7 +637,7 @@
return relativeOffset;
}
-int LoadCentralDirectoryRecord(zip64_internal* pziinit)
+local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
{
int err=ZIP_OK;
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
@@ -955,7 +955,7 @@
return zipOpen3(pathname,append,NULL,NULL);
}
-int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
+local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
{
/* write the local header */
int err;
@@ -1416,7 +1416,7 @@
#ifdef HAVE_BZIP2
if(zi->ci.method == Z_BZIP2ED && (!zi->ci.raw))
{
- zi->ci.bstream.next_in = (void*)buf;
+ zi->ci.bstream.next_in = buf;
zi->ci.bstream.avail_in = len;
err = BZ_RUN_OK;
@@ -1450,7 +1450,7 @@
--- zip.c.orig 2023-11-17 16:21:50.363864777 +0000
+++ zip.c 2023-11-17 16:26:04.671858368 +0000
@@ -1401,7 +1401,7 @@
else
#endif
{
- zi->ci.stream.next_in = (Bytef*)buf;
- zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf;
+ zi->ci.stream.next_in = buf;
zi->ci.stream.avail_in = len;
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
@@ -1752,7 +1752,7 @@
return zipCloseFileInZipRaw (file,0,0);
}
-int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
+local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
{
int err = ZIP_OK;
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset;
@@ -1774,7 +1774,7 @@
return err;
}
-int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
int err = ZIP_OK;
@@ -1813,7 +1813,8 @@
}
return err;
}
-int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+
+local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
int err = ZIP_OK;
@@ -1861,7 +1862,7 @@
return err;
}
-int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
+local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
{
int err = ZIP_OK;
uInt size_global_comment = 0;
@@ -1879,6 +1880,18 @@
@@ -1819,6 +1819,18 @@
return err;
}
@@ -107,6 +25,6 @@
+ return ZFLUSH64(zi->z_filefunc,zi->filestream);
+}
+
extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
{
extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
zip64_internal* zi;
int err = 0;