mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
deps: update zlib to 1.3.0.1-motley-788cb3c
PR-URL: https://github.com/nodejs/node/pull/56655 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
1 parent
a194dd9bd4
commit
0e3cd9ec00
21 files changed
+830
-160
No files matched your search
Vendored
+1
@@ -386,6 +386,7 @@ if (BUILD_MINIZIP_BIN)
|
||||
add_executable(minizip_bin contrib/minizip/minizip.c contrib/minizip/ioapi.c
|
||||
contrib/minizip/ioapi.h contrib/minizip/unzip.c
|
||||
contrib/minizip/unzip.h contrib/minizip/zip.c contrib/minizip/zip.h
|
||||
contrib/minizip/ints.h contrib/minizip/skipset.h
|
||||
)
|
||||
target_link_libraries(minizip_bin zlib)
|
||||
endif()
|
||||
|
||||
+8
-7
@@ -18,18 +18,19 @@
|
||||
* g++|clang++ -O3 -Wall -std=c++11 zlib_bench.cc -lstdc++ -lz
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <memory.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
void error_exit(const char* error, int code) {
|
||||
|
||||
Vendored
+13
-5
@@ -1,5 +1,5 @@
|
||||
CC=cc
|
||||
CFLAGS := $(CFLAGS) -O -I../..
|
||||
CC?=cc
|
||||
CFLAGS := -O $(CFLAGS) -I../..
|
||||
|
||||
UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
|
||||
ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
|
||||
@@ -9,13 +9,21 @@ ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
|
||||
|
||||
all: miniunz minizip
|
||||
|
||||
miniunz: $(UNZ_OBJS)
|
||||
miniunz.o: miniunz.c unzip.h iowin32.h
|
||||
minizip.o: minizip.c zip.h iowin32.h ints.h
|
||||
unzip.o: unzip.c unzip.h crypt.h
|
||||
zip.o: zip.c zip.h crypt.h skipset.h ints.h
|
||||
ioapi.o: ioapi.c ioapi.h ints.h
|
||||
iowin32.o: iowin32.c iowin32.h ioapi.h
|
||||
mztools.o: mztools.c unzip.h
|
||||
|
||||
miniunz: $(UNZ_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
|
||||
|
||||
minizip: $(ZIP_OBJS)
|
||||
minizip: $(ZIP_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
|
||||
|
||||
test: miniunz minizip
|
||||
test: miniunz minizip
|
||||
@rm -f test.*
|
||||
@echo hello hello hello > test.txt
|
||||
./minizip test test.txt
|
||||
|
||||
+9
-2
@@ -1,8 +1,8 @@
|
||||
Name: ZIP file API for reading file entries in a ZIP archive
|
||||
Short Name: minizip
|
||||
URL: https://github.com/madler/zlib/tree/master/contrib/minizip
|
||||
Version: 1.3.0.1
|
||||
Revision: 643e17b7498d12ab8d15565662880579692f769d
|
||||
Version: 1.3.1.1
|
||||
Revision: ef24c4c7502169f016dcd2a26923dbaf3216748c
|
||||
License: Zlib
|
||||
License File: //third_party/zlib/LICENSE
|
||||
Shipped: yes
|
||||
@@ -14,6 +14,13 @@ Minizip provides API on top of zlib that can enumerate and extract ZIP archive
|
||||
files. See minizip.md for chromium build instructions.
|
||||
|
||||
Local Modifications:
|
||||
- OS macro tweaks for Android and Fuchsia
|
||||
0000-build.patch (the contrib/minizip/ parts)
|
||||
0008-minizip-zip-unzip-tools.patch (crrev.com/886990)
|
||||
|
||||
- Fix build on UWP. (crrev.com/750639)
|
||||
0004-fix-uwp.patch
|
||||
|
||||
- Fixed uncompressing files with wrong uncompressed size set
|
||||
crrev.com/268940
|
||||
0014-minizip-unzip-with-incorrect-size.patch
|
||||
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
/* ints.h -- create integer types for 8, 16, 32, and 64 bits
|
||||
* Copyright (C) 2024 Mark Adler
|
||||
* For conditions of distribution and use, see the copyright notice in zlib.h
|
||||
*
|
||||
* There exist compilers with limits.h, but not stdint.h or inttypes.h.
|
||||
*/
|
||||
|
||||
#ifndef INTS_H
|
||||
#define INTS_H
|
||||
#include <limits.h>
|
||||
#if defined(UCHAR_MAX) && UCHAR_MAX == 0xff
|
||||
typedef signed char i8_t;
|
||||
typedef unsigned char ui8_t;
|
||||
#else
|
||||
# error "no 8-bit integer"
|
||||
#endif
|
||||
#if defined(USHRT_MAX) && USHRT_MAX == 0xffff
|
||||
typedef short i16_t;
|
||||
typedef unsigned short ui16_t;
|
||||
#elif defined(UINT_MAX) && UINT_MAX == 0xffff
|
||||
typedef int i16_t;
|
||||
typedef unsigned ui16_t;
|
||||
#else
|
||||
# error "no 16-bit integer"
|
||||
#endif
|
||||
#if defined(UINT_MAX) && UINT_MAX == 0xffffffff
|
||||
typedef int i32_t;
|
||||
typedef unsigned ui32_t;
|
||||
# define PI32 "d"
|
||||
# define PUI32 "u"
|
||||
#elif defined(ULONG_MAX) && ULONG_MAX == 0xffffffff
|
||||
typedef long i32_t;
|
||||
typedef unsigned long ui32_t;
|
||||
# define PI32 "ld"
|
||||
# define PUI32 "lu"
|
||||
#else
|
||||
# error "no 32-bit integer"
|
||||
#endif
|
||||
#if defined(ULONG_MAX) && ULONG_MAX == 0xffffffffffffffff
|
||||
typedef long i64_t;
|
||||
typedef unsigned long ui64_t;
|
||||
# define PI64 "ld"
|
||||
# define PUI64 "lu"
|
||||
#elif defined(ULLONG_MAX) && ULLONG_MAX == 0xffffffffffffffff
|
||||
typedef long long i64_t;
|
||||
typedef unsigned long long ui64_t;
|
||||
# define PI64 "lld"
|
||||
# define PUI64 "llu"
|
||||
#elif defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 0xffffffffffffffff
|
||||
typedef long long i64_t;
|
||||
typedef unsigned long long ui64_t;
|
||||
# define PI64 "lld"
|
||||
# define PUI64 "llu"
|
||||
#else
|
||||
# error "no 64-bit integer"
|
||||
#endif
|
||||
#endif
|
||||
Vendored
+4
-31
@@ -18,8 +18,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _ZLIBIOAPI64_H
|
||||
#define _ZLIBIOAPI64_H
|
||||
#ifndef ZLIBIOAPI64_H
|
||||
#define ZLIBIOAPI64_H
|
||||
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
||||
|
||||
@@ -67,39 +67,12 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifndef ZPOS64_T
|
||||
#ifdef _WIN32
|
||||
#define ZPOS64_T fpos_t
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#define ZPOS64_T uint64_t
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifdef HAVE_MINIZIP64_CONF_H
|
||||
#include "mz64conf.h"
|
||||
#endif
|
||||
|
||||
/* a type chosen by DEFINE */
|
||||
#ifdef HAVE_64BIT_INT_CUSTOM
|
||||
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
||||
#else
|
||||
#ifdef HAS_STDINT_H
|
||||
#include "stdint.h"
|
||||
typedef uint64_t ZPOS64_T;
|
||||
#else
|
||||
|
||||
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef unsigned __int64 ZPOS64_T;
|
||||
#else
|
||||
typedef unsigned long long int ZPOS64_T;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#include "ints.h"
|
||||
typedef ui64_t ZPOS64_T;
|
||||
|
||||
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
|
||||
#ifndef MAXU32
|
||||
|
||||
Vendored
+12
-4
@@ -88,7 +88,7 @@ static voidpf win32_build_iowin(HANDLE hFile) {
|
||||
}
|
||||
|
||||
voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int mode) {
|
||||
const char* mode_fopen = NULL;
|
||||
(void)opaque;
|
||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@@ -116,7 +116,7 @@ voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int
|
||||
|
||||
|
||||
voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, int mode) {
|
||||
const char* mode_fopen = NULL;
|
||||
(void)opaque;
|
||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@@ -139,7 +139,7 @@ voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, in
|
||||
|
||||
|
||||
voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, int mode) {
|
||||
const char* mode_fopen = NULL;
|
||||
(void)opaque;
|
||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@@ -158,7 +158,7 @@ voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, in
|
||||
|
||||
|
||||
voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int mode) {
|
||||
const char* mode_fopen = NULL;
|
||||
(void)opaque;
|
||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@@ -186,6 +186,7 @@ voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int m
|
||||
|
||||
|
||||
uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLong size) {
|
||||
(void)opaque;
|
||||
uLong ret=0;
|
||||
HANDLE hFile = NULL;
|
||||
if (stream!=NULL)
|
||||
@@ -207,6 +208,7 @@ uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLo
|
||||
|
||||
|
||||
uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
|
||||
(void)opaque;
|
||||
uLong ret=0;
|
||||
HANDLE hFile = NULL;
|
||||
if (stream!=NULL)
|
||||
@@ -246,6 +248,7 @@ static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *n
|
||||
}
|
||||
|
||||
long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
|
||||
(void)opaque;
|
||||
long ret=-1;
|
||||
HANDLE hFile = NULL;
|
||||
if (stream!=NULL)
|
||||
@@ -268,6 +271,7 @@ long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
|
||||
}
|
||||
|
||||
ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {
|
||||
(void)opaque;
|
||||
ZPOS64_T ret= (ZPOS64_T)-1;
|
||||
HANDLE hFile = NULL;
|
||||
if (stream!=NULL)
|
||||
@@ -292,6 +296,7 @@ ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {
|
||||
|
||||
|
||||
long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
|
||||
(void)opaque;
|
||||
DWORD dwMoveMethod=0xFFFFFFFF;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@@ -329,6 +334,7 @@ long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset,
|
||||
}
|
||||
|
||||
long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
|
||||
(void)opaque;
|
||||
DWORD dwMoveMethod=0xFFFFFFFF;
|
||||
HANDLE hFile = NULL;
|
||||
long ret=-1;
|
||||
@@ -367,6 +373,7 @@ long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T off
|
||||
}
|
||||
|
||||
int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
|
||||
(void)opaque;
|
||||
int ret=-1;
|
||||
|
||||
if (stream!=NULL)
|
||||
@@ -384,6 +391,7 @@ int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
|
||||
}
|
||||
|
||||
int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) {
|
||||
(void)opaque;
|
||||
int ret=-1;
|
||||
if (stream!=NULL)
|
||||
{
|
||||
|
||||
Vendored
+24
-8
@@ -39,6 +39,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -79,10 +82,11 @@
|
||||
|
||||
/* change_file_date : change the date/time of a file
|
||||
filename : the filename of the file where date/time must be modified
|
||||
dosdate : the new date at the MSDos format (4 bytes)
|
||||
dosdate : the new date at the MSDOS format (4 bytes)
|
||||
tmu_date : the SAME new date at the tm_unz format */
|
||||
static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) {
|
||||
#ifdef _WIN32
|
||||
(void)tmu_date;
|
||||
HANDLE hFile;
|
||||
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
|
||||
|
||||
@@ -93,8 +97,7 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
|
||||
LocalFileTimeToFileTime(&ftLocal,&ftm);
|
||||
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
|
||||
CloseHandle(hFile);
|
||||
#else
|
||||
#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
(void)dosdate;
|
||||
struct utimbuf ut;
|
||||
struct tm newdate;
|
||||
@@ -116,7 +119,6 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
|
||||
(void)dosdate;
|
||||
(void)tmu_date;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -125,9 +127,9 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
|
||||
|
||||
static int mymkdir(const char* dirname) {
|
||||
int ret=0;
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
ret = _mkdir(dirname);
|
||||
#elif defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
ret = mkdir (dirname,0775);
|
||||
#else
|
||||
(void)dirname;
|
||||
@@ -238,7 +240,7 @@ static int do_list(unzFile uf) {
|
||||
printf(" ------ ------ ---- ----- ---- ---- ------ ----\n");
|
||||
for (i=0;i<gi.number_entry;i++)
|
||||
{
|
||||
char filename_inzip[256];
|
||||
char filename_inzip[65536+1];
|
||||
unz_file_info64 file_info;
|
||||
uLong ratio=0;
|
||||
const char *string_method = "";
|
||||
@@ -303,7 +305,7 @@ static int do_list(unzFile uf) {
|
||||
|
||||
|
||||
static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
|
||||
char filename_inzip[256];
|
||||
char filename_inzip[65536+1];
|
||||
char* filename_withoutpath;
|
||||
char* p;
|
||||
int err=UNZ_OK;
|
||||
@@ -354,6 +356,20 @@ static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_pa
|
||||
else
|
||||
write_filename = filename_withoutpath;
|
||||
|
||||
if (write_filename[0]!='\0')
|
||||
{
|
||||
const char* relative_check = write_filename;
|
||||
while (relative_check[1]!='\0')
|
||||
{
|
||||
if (relative_check[0]=='.' && relative_check[1]=='.')
|
||||
write_filename = relative_check;
|
||||
relative_check++;
|
||||
}
|
||||
}
|
||||
|
||||
while (write_filename[0]=='/' || write_filename[0]=='.')
|
||||
write_filename++;
|
||||
|
||||
err = unzOpenCurrentFilePassword(uf,password);
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
|
||||
Vendored
+10
-7
@@ -40,6 +40,9 @@
|
||||
|
||||
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -58,6 +61,7 @@
|
||||
#endif
|
||||
|
||||
#include "zip.h"
|
||||
#include "ints.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define USEWIN32IOAPI
|
||||
@@ -73,6 +77,7 @@
|
||||
/* f: name of file to get info on, tmzip: return value: access,
|
||||
modification and creation times, dt: dostime */
|
||||
static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||
(void)tmzip;
|
||||
int ret = 0;
|
||||
{
|
||||
FILETIME ftLocal;
|
||||
@@ -90,8 +95,7 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
/* f: name of file to get info on, tmzip: return value: access,
|
||||
modification and creation times, dt: dostime */
|
||||
static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||
@@ -142,7 +146,6 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -191,7 +194,7 @@ static int getFileCrc(const char* filenameinzip, void* buf, unsigned long size_b
|
||||
do
|
||||
{
|
||||
err = ZIP_OK;
|
||||
size_read = fread(buf,1,size_buf,fin);
|
||||
size_read = (unsigned long)fread(buf,1,size_buf,fin);
|
||||
if (size_read < size_buf)
|
||||
if (feof(fin)==0)
|
||||
{
|
||||
@@ -223,7 +226,7 @@ static int isLargeFile(const char* filename) {
|
||||
FSEEKO_FUNC(pFile, 0, SEEK_END);
|
||||
pos = (ZPOS64_T)FTELLO_FUNC(pFile);
|
||||
|
||||
printf("File : %s is %llu bytes\n", filename, pos);
|
||||
printf("File : %s is %"PUI64" bytes\n", filename, pos);
|
||||
|
||||
if(pos >= 0xffffffff)
|
||||
largeFile = 1;
|
||||
@@ -243,7 +246,7 @@ int main(int argc, char *argv[]) {
|
||||
char filename_try[MAXFILENAME+16];
|
||||
int zipok;
|
||||
int err=0;
|
||||
size_t size_buf=0;
|
||||
unsigned long size_buf=0;
|
||||
void* buf=NULL;
|
||||
const char* password=NULL;
|
||||
|
||||
@@ -305,7 +308,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
else
|
||||
{
|
||||
int i,len;
|
||||
int len;
|
||||
int dot_found=0;
|
||||
|
||||
zipok = 1 ;
|
||||
|
||||
Vendored
+32
-29
@@ -5,6 +5,9 @@
|
||||
*/
|
||||
|
||||
/* Code */
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -140,28 +143,28 @@ extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char*
|
||||
|
||||
/* Central directory entry */
|
||||
{
|
||||
char header[46];
|
||||
char central[46];
|
||||
char* comment = "";
|
||||
int comsize = (int) strlen(comment);
|
||||
WRITE_32(header, 0x02014b50);
|
||||
WRITE_16(header + 4, version);
|
||||
WRITE_16(header + 6, version);
|
||||
WRITE_16(header + 8, gpflag);
|
||||
WRITE_16(header + 10, method);
|
||||
WRITE_16(header + 12, filetime);
|
||||
WRITE_16(header + 14, filedate);
|
||||
WRITE_32(header + 16, crc);
|
||||
WRITE_32(header + 20, cpsize);
|
||||
WRITE_32(header + 24, uncpsize);
|
||||
WRITE_16(header + 28, fnsize);
|
||||
WRITE_16(header + 30, extsize);
|
||||
WRITE_16(header + 32, comsize);
|
||||
WRITE_16(header + 34, 0); /* disk # */
|
||||
WRITE_16(header + 36, 0); /* int attrb */
|
||||
WRITE_32(header + 38, 0); /* ext attrb */
|
||||
WRITE_32(header + 42, currentOffset);
|
||||
WRITE_32(central, 0x02014b50);
|
||||
WRITE_16(central + 4, version);
|
||||
WRITE_16(central + 6, version);
|
||||
WRITE_16(central + 8, gpflag);
|
||||
WRITE_16(central + 10, method);
|
||||
WRITE_16(central + 12, filetime);
|
||||
WRITE_16(central + 14, filedate);
|
||||
WRITE_32(central + 16, crc);
|
||||
WRITE_32(central + 20, cpsize);
|
||||
WRITE_32(central + 24, uncpsize);
|
||||
WRITE_16(central + 28, fnsize);
|
||||
WRITE_16(central + 30, extsize);
|
||||
WRITE_16(central + 32, comsize);
|
||||
WRITE_16(central + 34, 0); /* disk # */
|
||||
WRITE_16(central + 36, 0); /* int attrb */
|
||||
WRITE_32(central + 38, 0); /* ext attrb */
|
||||
WRITE_32(central + 42, currentOffset);
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 46, fpOutCD) == 46) {
|
||||
if (fwrite(central, 1, 46, fpOutCD) == 46) {
|
||||
offsetCD += 46;
|
||||
|
||||
/* Filename */
|
||||
@@ -215,23 +218,23 @@ extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char*
|
||||
/* Final central directory */
|
||||
{
|
||||
int entriesZip = entries;
|
||||
char header[22];
|
||||
char end[22];
|
||||
char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
|
||||
int comsize = (int) strlen(comment);
|
||||
if (entriesZip > 0xffff) {
|
||||
entriesZip = 0xffff;
|
||||
}
|
||||
WRITE_32(header, 0x06054b50);
|
||||
WRITE_16(header + 4, 0); /* disk # */
|
||||
WRITE_16(header + 6, 0); /* disk # */
|
||||
WRITE_16(header + 8, entriesZip); /* hack */
|
||||
WRITE_16(header + 10, entriesZip); /* hack */
|
||||
WRITE_32(header + 12, offsetCD); /* size of CD */
|
||||
WRITE_32(header + 16, offset); /* offset to CD */
|
||||
WRITE_16(header + 20, comsize); /* comment */
|
||||
WRITE_32(end, 0x06054b50);
|
||||
WRITE_16(end + 4, 0); /* disk # */
|
||||
WRITE_16(end + 6, 0); /* disk # */
|
||||
WRITE_16(end + 8, entriesZip); /* hack */
|
||||
WRITE_16(end + 10, entriesZip); /* hack */
|
||||
WRITE_32(end + 12, offsetCD); /* size of CD */
|
||||
WRITE_32(end + 16, offset); /* offset to CD */
|
||||
WRITE_16(end + 20, comsize); /* comment */
|
||||
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 22, fpOutCD) == 22) {
|
||||
if (fwrite(end, 1, 22, fpOutCD) == 22) {
|
||||
|
||||
/* Comment field */
|
||||
if (comsize > 0) {
|
||||
|
||||
Vendored
+361
@@ -0,0 +1,361 @@
|
||||
// skipset.h -- set operations using a skiplist
|
||||
// Copyright (C) 2024 Mark Adler
|
||||
// See MiniZip_info.txt for the license.
|
||||
|
||||
// This implements a skiplist set, i.e. just keys, no data, with ~O(log n) time
|
||||
// insert and search operations. The application defines the type of a key, and
|
||||
// provides a function to compare two keys.
|
||||
|
||||
// This header is not definitions of functions found in another source file --
|
||||
// it creates the set functions, with the application's key type, right where
|
||||
// the #include is. Before this header is #included, these must be defined:
|
||||
//
|
||||
// 1. A macro or typedef for set_key_t, the type of a key.
|
||||
// 2. A macro or function set_cmp(a, b) to compare two keys. The return values
|
||||
// are < 0 for a < b, 0 for a == b, and > 0 for a > b.
|
||||
// 3. A macro or function set_drop(s, k) to release the key k's resources, if
|
||||
// any, when doing a set_end() or set_clear(). s is a pointer to the set
|
||||
// that key is in, for use with set_free() if desired.
|
||||
//
|
||||
// Example usage:
|
||||
//
|
||||
// typedef int set_key_t;
|
||||
// #define set_cmp(a, b) ((a) < (b) ? -1 : (a) == (b) ? 0 : 1)
|
||||
// #define set_drop(s, k)
|
||||
// #include "skipset.h"
|
||||
//
|
||||
// int test(void) { // return 0: good, 1: bad, -1: out of memory
|
||||
// set_t set;
|
||||
// if (setjmp(set.env))
|
||||
// return -1;
|
||||
// set_start(&set);
|
||||
// set_insert(&set, 2);
|
||||
// set_insert(&set, 1);
|
||||
// set_insert(&set, 7);
|
||||
// int bad = !set_found(&set, 2);
|
||||
// bad = bad || set_found(&set, 5);
|
||||
// set_end(&set);
|
||||
// return bad;
|
||||
// }
|
||||
//
|
||||
// Interface summary (see more details below):
|
||||
// - set_t is the type of the set being operated on (a set_t pointer is passed)
|
||||
// - set_start() initializes a new, empty set (initialize set.env first)
|
||||
// - set_insert() inserts a new key into the set, or not if it's already there
|
||||
// - set_found() determines whether or not a key is in the set
|
||||
// - set_end() ends the use of the set, freeing all memory
|
||||
// - set_clear() empties the set, equivalent to set_end() and then set_start()
|
||||
// - set_ok() checks if set appears to be usable, i.e. started and not ended
|
||||
//
|
||||
// Auxiliary functions available to the application:
|
||||
// - set_alloc() allocates memory with optional tracking (#define SET_TRACK)
|
||||
// - set_free() deallocates memory allocated by set_alloc()
|
||||
// - set_rand() returns 32 random bits (seeded by set_start())
|
||||
|
||||
#ifndef SKIPSET_H
|
||||
#define SKIPSET_H
|
||||
|
||||
#include <stdlib.h> // realloc(), free(), NULL, size_t
|
||||
#include <stddef.h> // ptrdiff_t
|
||||
#include <setjmp.h> // jmp_buf, longjmp()
|
||||
#include <errno.h> // ENOMEM
|
||||
#include <time.h> // time(), clock()
|
||||
#include <assert.h> // assert.h
|
||||
#include "ints.h" // i16_t, ui32_t, ui64_t
|
||||
|
||||
// Structures and functions below noted as "--private--" should not be used by
|
||||
// the application. set_t is partially private and partially public -- see the
|
||||
// comments there.
|
||||
|
||||
// There is no POSIX random() in MSVC, and rand() is awful. For portability, we
|
||||
// cannot rely on a library function for random numbers. Instead we use the
|
||||
// fast and effective algorithm below, invented by Melissa O'Neill.
|
||||
|
||||
// *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / www.pcg-random.org
|
||||
// Licensed under Apache License 2.0 (NO WARRANTY, etc. see website)
|
||||
// --private-- Random number generator state.
|
||||
typedef struct {
|
||||
ui64_t state; // 64-bit generator state
|
||||
ui64_t inc; // 63-bit sequence id
|
||||
} set_rand_t;
|
||||
// --private-- Initialize the state *gen using seed and seq. seed seeds the
|
||||
// advancing 64-bit state. seq is a sequence selection constant.
|
||||
void set_seed(set_rand_t *gen, ui64_t seed, ui64_t seq) {
|
||||
gen->inc = (seq << 1) | 1;
|
||||
gen->state = (seed + gen->inc) * 6364136223846793005ULL + gen->inc;
|
||||
}
|
||||
// Return 32 random bits, advancing the state *gen.
|
||||
ui32_t set_rand(set_rand_t *gen) {
|
||||
ui64_t state = gen->state;
|
||||
gen->state = state * 6364136223846793005ULL + gen->inc;
|
||||
ui32_t mix = (ui32_t)(((state >> 18) ^ state) >> 27);
|
||||
int rot = state >> 59;
|
||||
return (mix >> rot) | (mix << ((-rot) & 31));
|
||||
}
|
||||
// End of PCG32 code.
|
||||
|
||||
// --private-- Linked-list node.
|
||||
typedef struct set_node_s set_node_t;
|
||||
struct set_node_s {
|
||||
set_key_t key; // the key (not used for head or path)
|
||||
i16_t size; // number of allocated pointers in right[]
|
||||
i16_t fill; // number of pointers in right[] filled in
|
||||
set_node_t **right; // pointer for each level, each to the right
|
||||
};
|
||||
|
||||
// A set. The application sets env, may use gen with set_rand(), and may read
|
||||
// allocs and memory. The remaining variables are --private-- .
|
||||
typedef struct set_s {
|
||||
set_node_t *head; // skiplist head -- no key, just links
|
||||
set_node_t *path; // right[] is path to key from set_found()
|
||||
set_node_t *node; // node under construction, in case of longjmp()
|
||||
i16_t depth; // maximum depth of the skiplist
|
||||
ui64_t ran; // a precious trove of random bits
|
||||
set_rand_t gen; // random number generator state
|
||||
jmp_buf env; // setjmp() environment for allocation errors
|
||||
#ifdef SET_TRACK
|
||||
size_t allocs; // number of allocations
|
||||
size_t memory; // total amount of allocated memory (>= requests)
|
||||
#endif
|
||||
} set_t;
|
||||
|
||||
// Memory allocation and deallocation. set_alloc(set, ptr, size) returns a
|
||||
// pointer to an allocation of size bytes if ptr is NULL, or the previous
|
||||
// allocation ptr resized to size bytes. set_alloc() will never return NULL.
|
||||
// set_free(set, ptr) frees an allocation created by set_alloc(). These may be
|
||||
// used by the application. e.g. if allocation tracking is desired.
|
||||
#ifdef SET_TRACK
|
||||
// Track the number of allocations and the total backing memory size.
|
||||
# if defined(_WIN32)
|
||||
# include <malloc.h>
|
||||
# define SET_ALLOC_SIZE(ptr) _msize(ptr)
|
||||
# elif defined(__MACH__)
|
||||
# include <malloc/malloc.h>
|
||||
# define SET_ALLOC_SIZE(ptr) malloc_size(ptr)
|
||||
# elif defined(__linux__)
|
||||
# include <malloc.h>
|
||||
# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
|
||||
# elif defined(__FreeBSD__)
|
||||
# include <malloc_np.h>
|
||||
# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
|
||||
# elif defined(__NetBSD__)
|
||||
# include <jemalloc/jemalloc.h>
|
||||
# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
|
||||
# else // e.g. OpenBSD
|
||||
# define SET_ALLOC_SIZE(ptr) 0
|
||||
# endif
|
||||
// With tracking.
|
||||
void *set_alloc(set_t *set, void *ptr, size_t size) {
|
||||
size_t had = ptr == NULL ? 0 : SET_ALLOC_SIZE(ptr);
|
||||
void *mem = realloc(ptr, size);
|
||||
if (mem == NULL)
|
||||
longjmp(set->env, ENOMEM);
|
||||
set->allocs += ptr == NULL;
|
||||
set->memory += SET_ALLOC_SIZE(mem) - had;
|
||||
return mem;
|
||||
}
|
||||
void set_free(set_t *set, void *ptr) {
|
||||
if (ptr != NULL) {
|
||||
set->allocs--;
|
||||
set->memory -= SET_ALLOC_SIZE(ptr);
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Without tracking.
|
||||
void *set_alloc(set_t *set, void *ptr, size_t size) {
|
||||
void *mem = realloc(ptr, size);
|
||||
if (mem == NULL)
|
||||
longjmp(set->env, ENOMEM);
|
||||
return mem;
|
||||
}
|
||||
void set_free(set_t *set, void *ptr) {
|
||||
(void)set;
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
// --private-- Grow node's array right[] as needed to be able to hold at least
|
||||
// want links. If fill is true, assure that the first want links are filled in,
|
||||
// setting them to set->head if not previously filled in. Otherwise it is
|
||||
// assumed that the first want links are about to be filled in.
|
||||
void set_grow(set_t *set, set_node_t *node, int want, int fill) {
|
||||
if (node->size < want) {
|
||||
int more = node->size ? node->size : 1;
|
||||
while (more < want)
|
||||
more <<= 1;
|
||||
node->right = set_alloc(set, node->right, more * sizeof(set_node_t *));
|
||||
node->size = (i16_t)more;
|
||||
}
|
||||
int i;
|
||||
if (fill)
|
||||
for (i = node->fill; i < want; i++)
|
||||
node->right[i] = set->head;
|
||||
node->fill = (i16_t)want;
|
||||
}
|
||||
|
||||
// --private-- Return a new node. key is left uninitialized.
|
||||
set_node_t *set_node(set_t *set) {
|
||||
set_node_t *node = set_alloc(set, NULL, sizeof(set_node_t));
|
||||
node->size = 0;
|
||||
node->fill = 0;
|
||||
node->right = NULL;
|
||||
return node;
|
||||
}
|
||||
|
||||
// --private-- Free the list linked from head, along with the keys.
|
||||
void set_sweep(set_t *set) {
|
||||
set_node_t *step = set->head->right[0];
|
||||
while (step != set->head) {
|
||||
set_node_t *next = step->right[0]; // save link to next node
|
||||
set_drop(set, step->key);
|
||||
set_free(set, step->right);
|
||||
set_free(set, step);
|
||||
step = next;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize a new set. set->env must be initialized using setjmp() before
|
||||
// set_start() is called. A longjmp(set->env, ENOMEM) will be used to handle a
|
||||
// memory allocation failure during any of the operations. (See setjmp.h and
|
||||
// errno.h.) The set can still be used if this happens, assuming that it didn't
|
||||
// happen during set_start(). Whether set_start() completed or not, set_end()
|
||||
// can be used to free the set's memory after a longjmp().
|
||||
void set_start(set_t *set) {
|
||||
#ifdef SET_TRACK
|
||||
set->allocs = 0;
|
||||
set->memory = 0;
|
||||
#endif
|
||||
set->head = set->path = set->node = NULL; // in case set_node() fails
|
||||
set->path = set_node(set);
|
||||
set->head = set_node(set);
|
||||
set_grow(set, set->head, 1, 1); // one link back to head for an empty set
|
||||
*(unsigned char *)&set->head->key = 137; // set id
|
||||
set->depth = 0;
|
||||
set_seed(&set->gen, ((ui64_t)(ptrdiff_t)set << 32) ^
|
||||
((ui64_t)time(NULL) << 12) ^ clock(), 0);
|
||||
set->ran = 1;
|
||||
}
|
||||
|
||||
// Return true if *set appears to be in a usable state. If *set has been zeroed
|
||||
// out, then set_ok(set) will be false and set_end(set) will be safe.
|
||||
int set_ok(set_t *set) {
|
||||
return set->head != NULL &&
|
||||
set->head->right != NULL &&
|
||||
*(unsigned char *)&set->head->key == 137;
|
||||
}
|
||||
|
||||
// Empty the set. This frees the memory used for the previous set contents.
|
||||
// After set_clear(), *set is ready for use, as if after a set_start().
|
||||
void set_clear(set_t *set) {
|
||||
assert(set_ok(set) && "improper use");
|
||||
|
||||
// Free all the keys and their nodes.
|
||||
set_sweep(set);
|
||||
|
||||
// Leave the head and path allocations as is. Clear their contents, with
|
||||
// head pointing to itself and setting depth to zero, for an empty set.
|
||||
set->head->right[0] = set->head;
|
||||
set->head->fill = 1;
|
||||
set->path->fill = 0;
|
||||
set->depth = 0;
|
||||
}
|
||||
|
||||
// Done using the set -- free all allocations. The only operation on *set
|
||||
// permitted after this is set_start(). Though another set_end() would do no
|
||||
// harm. This can be done at any time after a set_start(), or after a longjmp()
|
||||
// on any allocation failure, including during a set_start().
|
||||
void set_end(set_t *set) {
|
||||
if (set->head != NULL) {
|
||||
// Empty the set and free the head node.
|
||||
if (set->head->right != NULL) {
|
||||
set_sweep(set);
|
||||
set_free(set, set->head->right);
|
||||
}
|
||||
set_free(set, set->head);
|
||||
set->head = NULL;
|
||||
}
|
||||
if (set->path != NULL) {
|
||||
// Free the path work area.
|
||||
set_free(set, set->path->right);
|
||||
set_free(set, set->path);
|
||||
set->path = NULL;
|
||||
}
|
||||
if (set->node != NULL) {
|
||||
// Free the node that was under construction when longjmp() hit.
|
||||
set_drop(set, set->node->key);
|
||||
set_free(set, set->node->right);
|
||||
set_free(set, set->node);
|
||||
set->node = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Look for key. Return 1 if found or 0 if not. This also puts the path to get
|
||||
// there in set->path, for use by set_insert().
|
||||
int set_found(set_t *set, set_key_t key) {
|
||||
assert(set_ok(set) && "improper use");
|
||||
|
||||
// Start at depth and work down and right as determined by key comparisons.
|
||||
set_node_t *head = set->head, *here = head;
|
||||
int i = set->depth;
|
||||
set_grow(set, set->path, i + 1, 0);
|
||||
do {
|
||||
while (here->right[i] != head &&
|
||||
set_cmp(here->right[i]->key, key) < 0)
|
||||
here = here->right[i];
|
||||
set->path->right[i] = here;
|
||||
} while (i--);
|
||||
|
||||
// See if the key matches.
|
||||
here = here->right[0];
|
||||
return here != head && set_cmp(here->key, key) == 0;
|
||||
}
|
||||
|
||||
// Insert the key key. Return 0 on success, or 1 if key is already in the set.
|
||||
int set_insert(set_t *set, set_key_t key) {
|
||||
assert(set_ok(set) && "improper use");
|
||||
|
||||
if (set_found(set, key))
|
||||
// That key is already in the set.
|
||||
return 1;
|
||||
|
||||
// Randomly generate a new level-- level 0 with probability 1/2, 1 with
|
||||
// probability 1/4, 2 with probability 1/8, etc.
|
||||
int level = 0;
|
||||
for (;;) {
|
||||
if (set->ran == 1)
|
||||
// Ran out. Get another 32 random bits.
|
||||
set->ran = set_rand(&set->gen) | (1ULL << 32);
|
||||
int bit = set->ran & 1;
|
||||
set->ran >>= 1;
|
||||
if (bit)
|
||||
break;
|
||||
assert(level < 32767 &&
|
||||
"Overhead, without any fuss, the stars were going out.");
|
||||
level++;
|
||||
}
|
||||
if (level > set->depth) {
|
||||
// The maximum depth is now deeper. Update the structures.
|
||||
set_grow(set, set->path, level + 1, 1);
|
||||
set_grow(set, set->head, level + 1, 1);
|
||||
set->depth = (i16_t)level;
|
||||
}
|
||||
|
||||
// Make a new node for the provided key, and insert it in the lists up to
|
||||
// and including level.
|
||||
set->node = set_node(set);
|
||||
set->node->key = key;
|
||||
set_grow(set, set->node, level + 1, 0);
|
||||
int i;
|
||||
for (i = 0; i <= level; i++) {
|
||||
set->node->right[i] = set->path->right[i]->right[i];
|
||||
set->path->right[i]->right[i] = set->node;
|
||||
}
|
||||
set->node = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#error ** another skiplist set already created here
|
||||
// Would need to implement a prefix in order to support multiple sets.
|
||||
#endif
|
||||
Vendored
+6
-7
@@ -88,7 +88,7 @@
|
||||
|
||||
|
||||
#ifndef CASESENSITIVITYDEFAULT_NO
|
||||
# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
|
||||
# if (!defined(__unix__) && !defined(__unix) || defined(__CYGWIN__)) && !defined(CASESENSITIVITYDEFAULT_YES)
|
||||
# define CASESENSITIVITYDEFAULT_NO
|
||||
# endif
|
||||
#endif
|
||||
@@ -113,7 +113,7 @@
|
||||
const char unz_copyright[] =
|
||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
|
||||
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
||||
/* unz_file_info64_internal contain internal info about a file in zipfile*/
|
||||
typedef struct unz_file_info64_internal_s
|
||||
{
|
||||
ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */
|
||||
@@ -336,7 +336,6 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
|
||||
#define CENTRALDIRINVALID ((ZPOS64_T)(-1))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Locate the Central directory of a zipfile (at the end, just before
|
||||
the global comment)
|
||||
@@ -467,7 +466,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||
return CENTRALDIRINVALID;
|
||||
|
||||
/* number of the disk with the start of the zip64 end of central directory */
|
||||
/* number of the disk with the start of the zip64 end of central directory */
|
||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||
return CENTRALDIRINVALID;
|
||||
if (uL != 0)
|
||||
@@ -514,9 +513,9 @@ local unzFile unzOpenInternal(const void *path,
|
||||
ZPOS64_T central_pos;
|
||||
uLong uL;
|
||||
|
||||
uLong number_disk; /* number of the current dist, used for
|
||||
uLong number_disk; /* number of the current disk, used for
|
||||
spanning ZIP, unsupported, always 0*/
|
||||
uLong number_disk_with_CD; /* number the the disk with central dir, used
|
||||
uLong number_disk_with_CD; /* number the disk with central dir, used
|
||||
for spanning ZIP, unsupported, always 0*/
|
||||
ZPOS64_T number_entry_CD; /* total number of entries in
|
||||
the central dir
|
||||
@@ -1682,7 +1681,7 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
|
||||
uInt i;
|
||||
for(i=0;i<uReadThis;i++)
|
||||
pfile_in_zip_read_info->read_buffer[i] =
|
||||
zdecode(s->keys,s->pcrc_32_tab,
|
||||
(char)zdecode(s->keys,s->pcrc_32_tab,
|
||||
pfile_in_zip_read_info->read_buffer[i]);
|
||||
}
|
||||
# endif
|
||||
|
||||
Vendored
+5
-1
@@ -306,13 +306,17 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
|
||||
Get Info about the current file
|
||||
if pfile_info!=NULL, the *pfile_info structure will contain some info about
|
||||
the current file
|
||||
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||
if szFileName!=NULL, the filename string will be copied in szFileName
|
||||
(fileNameBufferSize is the size of the buffer)
|
||||
if extraField!=NULL, the extra field information will be copied in extraField
|
||||
(extraFieldBufferSize is the size of the buffer).
|
||||
This is the Central-header version of the extra field
|
||||
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||
(commentBufferSize is the size of the buffer)
|
||||
The file name and comment will be zero-terminated if there is room in the
|
||||
provided buffer. Otherwise the buffer will contain as much as will fit. If at
|
||||
least 65537 bytes of room is provided, then the result will always be
|
||||
complete and zero-terminated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Vendored
+249
-6
@@ -25,8 +25,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#ifndef ZLIB_CONST
|
||||
# define ZLIB_CONST
|
||||
#endif
|
||||
#include "zlib.h"
|
||||
#include "zip.h"
|
||||
|
||||
@@ -123,6 +125,19 @@ typedef struct linkedlist_data_s
|
||||
} linkedlist_data;
|
||||
|
||||
|
||||
// zipAlreadyThere() set functions for a set of zero-terminated strings, and
|
||||
// a block_t type for reading the central directory datablocks.
|
||||
typedef char *set_key_t;
|
||||
#define set_cmp(a, b) strcmp(a, b)
|
||||
#define set_drop(s, k) set_free(s, k)
|
||||
#include "skipset.h"
|
||||
typedef struct {
|
||||
unsigned char *next; // next byte in datablock data
|
||||
size_t left; // number of bytes left in data (at least)
|
||||
linkedlist_datablock_internal *node; // current datablock
|
||||
} block_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
z_stream stream; /* zLib stream structure for inflate */
|
||||
@@ -174,6 +189,10 @@ typedef struct
|
||||
char *globalcomment;
|
||||
#endif
|
||||
|
||||
// Support for zipAlreadyThere().
|
||||
set_t set; // set for detecting name collisions
|
||||
block_t block; // block for reading the central directory
|
||||
|
||||
} zip64_internal;
|
||||
|
||||
|
||||
@@ -264,6 +283,228 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
||||
return ZIP_OK;
|
||||
}
|
||||
|
||||
// zipAlreadyThere() operations. "set" in the zip internal structure keeps the
|
||||
// set of names that are in the under-construction central directory so far. A
|
||||
// skipset provides ~O(log n) time insertion and searching. Central directory
|
||||
// records, stored in a linked list of allocated memory datablocks, is read
|
||||
// through "block" in the zip internal structure.
|
||||
|
||||
// The block_*() functions support extracting the central directory file names
|
||||
// from the datablocks. They are designed to support a growing directory by
|
||||
// automatically continuing once more data has been appended to the linked
|
||||
// datablocks.
|
||||
|
||||
// Initialize *block to the head of list. This should only be called once the
|
||||
// list has at least some data in it, i.e. list->first_block is not NULL.
|
||||
local void block_init(block_t *block, linkedlist_data *list) {
|
||||
block->node = list->first_block;
|
||||
block->next = block->node->data;
|
||||
block->left = block->node->filled_in_this_block;
|
||||
}
|
||||
|
||||
// Mark *block as bad, with all subsequent reads returning end, even if more
|
||||
// data is added to the datablocks. This is invoked if the central directory is
|
||||
// invalid, so there is no longer any point in attempting to interpret it.
|
||||
local void block_stop(block_t *block) {
|
||||
block->left = 0;
|
||||
block->next = NULL;
|
||||
}
|
||||
|
||||
// Return true if *block has reached the end of the data in the datablocks.
|
||||
local int block_end(block_t *block) {
|
||||
linkedlist_datablock_internal *node = block->node;
|
||||
if (node == NULL)
|
||||
// This block was previously terminated with extreme prejudice.
|
||||
return 1;
|
||||
if (block->next < node->data + node->filled_in_this_block)
|
||||
// There are more bytes to read in the current datablock.
|
||||
return 0;
|
||||
while (node->next_datablock != NULL) {
|
||||
if (node->filled_in_this_block != 0)
|
||||
// There are some bytes in a later datablock.
|
||||
return 0;
|
||||
node = node->next_datablock;
|
||||
}
|
||||
// Reached the end of the list of datablocks. There's nothing.
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Return one byte from *block, or -1 if the end is reached.
|
||||
local int block_get(block_t *block) {
|
||||
while (block->left == 0) {
|
||||
if (block->node == NULL)
|
||||
// We've been marked bad. Return end.
|
||||
return -1;
|
||||
// Update left in case more was filled in since we were last here.
|
||||
block->left = block->node->filled_in_this_block -
|
||||
(block->next - block->node->data);
|
||||
if (block->left != 0)
|
||||
// There was indeed more data appended in the current datablock.
|
||||
break;
|
||||
if (block->node->next_datablock == NULL)
|
||||
// No more data here, and there is no next datablock. At the end.
|
||||
return -1;
|
||||
// Try the next datablock for more data.
|
||||
block->node = block->node->next_datablock;
|
||||
block->next = block->node->data;
|
||||
block->left = block->node->filled_in_this_block;
|
||||
}
|
||||
// We have a byte to return.
|
||||
block->left--;
|
||||
return *block->next++;
|
||||
}
|
||||
|
||||
// Return a 16-bit unsigned little-endian value from block, or a negative value
|
||||
// if the end is reached.
|
||||
local long block_get2(block_t *block) {
|
||||
long got = block_get(block);
|
||||
return got | ((unsigned long)block_get(block) << 8);
|
||||
}
|
||||
|
||||
// Read up to len bytes from block into buf. Return the number of bytes read.
|
||||
local size_t block_read(block_t *block, unsigned char *buf, size_t len) {
|
||||
size_t need = len;
|
||||
while (need) {
|
||||
if (block->left == 0) {
|
||||
// Get a byte to update and step through the linked list as needed.
|
||||
int got = block_get(block);
|
||||
if (got == -1)
|
||||
// Reached the end.
|
||||
break;
|
||||
*buf++ = (unsigned char)got;
|
||||
need--;
|
||||
continue;
|
||||
}
|
||||
size_t take = need > block->left ? block->left : need;
|
||||
memcpy(buf, block->next, take);
|
||||
block->next += take;
|
||||
block->left -= take;
|
||||
buf += take;
|
||||
need -= take;
|
||||
}
|
||||
return len - need; // return the number of bytes copied
|
||||
}
|
||||
|
||||
// Skip n bytes in block. Return 0 on success or -1 if there are less than n
|
||||
// bytes to the end.
|
||||
local int block_skip(block_t *block, size_t n) {
|
||||
while (n > block->left) {
|
||||
n -= block->left;
|
||||
block->next += block->left;
|
||||
block->left = 0;
|
||||
if (block_get(block) == -1)
|
||||
return -1;
|
||||
n--;
|
||||
}
|
||||
block->next += n;
|
||||
block->left -= n;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Process the next central directory record at *block. Return the allocated,
|
||||
// zero-terminated file name, or NULL for end of input or invalid data. If
|
||||
// invalid, *block is marked bad. This uses *set for the allocation of memory.
|
||||
local char *block_central_name(block_t *block, set_t *set) {
|
||||
char *name = NULL;
|
||||
for (;;) {
|
||||
if (block_end(block))
|
||||
// At the end of the central directory (so far).
|
||||
return NULL;
|
||||
|
||||
// Check for a central directory record signature.
|
||||
if (block_get2(block) != (CENTRALHEADERMAGIC & 0xffff) ||
|
||||
block_get2(block) != (CENTRALHEADERMAGIC >> 16))
|
||||
// Incorrect signature.
|
||||
break;
|
||||
|
||||
// Go through the remaining fixed-length portion of the record,
|
||||
// extracting the lengths of the three variable-length fields.
|
||||
block_skip(block, 24);
|
||||
unsigned flen = block_get2(block); // file name length
|
||||
unsigned xlen = block_get2(block); // extra field length
|
||||
unsigned clen = block_get2(block); // comment field length
|
||||
if (block_skip(block, 12) == -1)
|
||||
// Premature end of the record.
|
||||
break;
|
||||
|
||||
// Extract the name and skip over the extra and comment fields.
|
||||
name = set_alloc(set, NULL, flen + 1);
|
||||
if (block_read(block, (unsigned char *)name, flen) < flen ||
|
||||
block_skip(block, xlen + clen) == -1)
|
||||
// Premature end of the record.
|
||||
break;
|
||||
|
||||
// Check for embedded nuls in the name.
|
||||
if (memchr(name, 0, flen) != NULL) {
|
||||
// This name can never match the zero-terminated name provided to
|
||||
// zipAlreadyThere(), so we discard it and go back to get another
|
||||
// name. (Who the heck is putting nuls inside their zip file entry
|
||||
// names anyway?)
|
||||
set_free(set, name);
|
||||
continue;
|
||||
}
|
||||
|
||||
// All good. Return the zero-terminated file name.
|
||||
name[flen] = 0;
|
||||
return name;
|
||||
}
|
||||
|
||||
// Invalid signature or premature end of the central directory record.
|
||||
// Abandon trying to process the central directory.
|
||||
set_free(set, name);
|
||||
block_stop(block);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Return 0 if name is not in the central directory so far, 1 if it is, -1 if
|
||||
// the central directory is invalid, -2 if out of memory, or ZIP_PARAMERROR if
|
||||
// file is NULL.
|
||||
extern int ZEXPORT zipAlreadyThere(zipFile file, char const *name) {
|
||||
zip64_internal *zip = file;
|
||||
if (zip == NULL)
|
||||
return ZIP_PARAMERROR;
|
||||
if (zip->central_dir.first_block == NULL)
|
||||
// No central directory yet, so no, name isn't there.
|
||||
return 0;
|
||||
if (setjmp(zip->set.env)) {
|
||||
// Memory allocation failure.
|
||||
set_end(&zip->set);
|
||||
return -2;
|
||||
}
|
||||
if (!set_ok(&zip->set)) {
|
||||
// This is the first time here with some central directory content. We
|
||||
// construct this set of names only on demand. Prepare set and block.
|
||||
set_start(&zip->set);
|
||||
block_init(&zip->block, &zip->central_dir);
|
||||
}
|
||||
|
||||
// Update the set of names from the current central directory contents.
|
||||
// This reads any new central directory records since the last time we were
|
||||
// here.
|
||||
for (;;) {
|
||||
char *there = block_central_name(&zip->block, &zip->set);
|
||||
if (there == NULL) {
|
||||
if (zip->block.next == NULL)
|
||||
// The central directory is invalid.
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
// Add there to the set.
|
||||
if (set_insert(&zip->set, there))
|
||||
// There's already a duplicate in the central directory! We'll just
|
||||
// let this be and carry on.
|
||||
set_free(&zip->set, there);
|
||||
}
|
||||
|
||||
// Return true if name is in the central directory.
|
||||
size_t len = strlen(name);
|
||||
char *copy = set_alloc(&zip->set, NULL, len + 1);
|
||||
strcpy(copy, name);
|
||||
int found = set_found(&zip->set, copy);
|
||||
set_free(&zip->set, copy);
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
@@ -551,7 +792,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||
|
||||
for (i=(int)uReadSize-3; (i--)>0;)
|
||||
{
|
||||
// Signature "0x07064b50" Zip64 end of central directory locater
|
||||
// Signature "0x07064b50" Zip64 end of central directory locator
|
||||
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
|
||||
{
|
||||
uPosFound = uReadPos+(unsigned)i;
|
||||
@@ -575,7 +816,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
||||
return 0;
|
||||
|
||||
/* number of the disk with the start of the zip64 end of central directory */
|
||||
/* number of the disk with the start of the zip64 end of central directory */
|
||||
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
||||
return 0;
|
||||
if (uL != 0)
|
||||
@@ -843,6 +1084,7 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo
|
||||
ziinit.number_entry = 0;
|
||||
ziinit.add_position_when_writing_offset = 0;
|
||||
init_linkedlist(&(ziinit.central_dir));
|
||||
memset(&ziinit.set, 0, sizeof(set_t)); // make sure set appears dormant
|
||||
|
||||
|
||||
|
||||
@@ -1027,7 +1269,6 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
|
||||
int err = ZIP_OK;
|
||||
|
||||
# ifdef NOCRYPT
|
||||
(crcForCrypting);
|
||||
if (password != NULL)
|
||||
return ZIP_PARAMERROR;
|
||||
# endif
|
||||
@@ -1412,7 +1653,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))
|
||||
@@ -1608,7 +1849,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si
|
||||
|
||||
if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
|
||||
{
|
||||
// we can not write more data to the buffer that we have room for.
|
||||
// we cannot write more data to the buffer that we have room for.
|
||||
return ZIP_BADZIPFILE;
|
||||
}
|
||||
|
||||
@@ -1871,6 +2112,8 @@ extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
|
||||
}
|
||||
free_linkedlist(&(zi->central_dir));
|
||||
|
||||
set_end(&zi->set); // set was zeroed, so this is safe
|
||||
|
||||
pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
||||
if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF)
|
||||
{
|
||||
|
||||
Vendored
+15
-9
@@ -35,7 +35,7 @@
|
||||
|
||||
See header of zip.h
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef _zip12_H
|
||||
#define _zip12_H
|
||||
@@ -127,12 +127,12 @@ extern zipFile ZEXPORT zipOpen64(const void *pathname, int append);
|
||||
If the zipfile cannot be opened, the return value is NULL.
|
||||
Else, the return value is a zipFile Handle, usable with other function
|
||||
of this zip package.
|
||||
*/
|
||||
*/
|
||||
|
||||
/* Note : there is no delete function into a zipfile.
|
||||
If you want delete file into a zipfile, you must open a zipfile, and create another
|
||||
Of course, you can use RAW reading and writing to copy the file you did not want delete
|
||||
*/
|
||||
*/
|
||||
|
||||
extern zipFile ZEXPORT zipOpen2(const char *pathname,
|
||||
int append,
|
||||
@@ -186,7 +186,7 @@ extern int ZEXPORT zipOpenNewFileInZip64(zipFile file,
|
||||
zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
|
||||
this MUST be '1' if the uncompressed size is >= 0xffffffff.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file,
|
||||
@@ -311,12 +311,12 @@ extern int ZEXPORT zipWriteInFileInZip(zipFile file,
|
||||
unsigned len);
|
||||
/*
|
||||
Write data in the zipfile
|
||||
*/
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZip(zipFile file);
|
||||
/*
|
||||
Close the current file in the zipfile
|
||||
*/
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file,
|
||||
uLong uncompressed_size,
|
||||
@@ -326,17 +326,23 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file,
|
||||
ZPOS64_T uncompressed_size,
|
||||
uLong crc32);
|
||||
|
||||
extern int ZEXPORT zipAlreadyThere(zipFile file,
|
||||
char const* name);
|
||||
/*
|
||||
See if name is already in file's central directory.
|
||||
*/
|
||||
|
||||
/*
|
||||
Close the current file in the zipfile, for file opened with
|
||||
parameter raw=1 in zipOpenNewFileInZip2
|
||||
uncompressed_size and crc32 are value for the uncompressed size
|
||||
*/
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipClose(zipFile file,
|
||||
const char* global_comment);
|
||||
/*
|
||||
Close the zipfile
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader);
|
||||
@@ -355,7 +361,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHea
|
||||
|
||||
Remove ZIP64 Extra information from a Local File Header extra field data
|
||||
zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001);
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+5
-6
@@ -89,19 +89,18 @@ bool GzipUncompress(const std::string& input, std::string* output) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GzipUncompress(base::span<const char> input,
|
||||
base::span<const char> output) {
|
||||
return GzipUncompress(base::as_bytes(input), base::as_bytes(output));
|
||||
bool GzipUncompress(base::span<const char> input, base::span<char> output) {
|
||||
return GzipUncompress(base::as_bytes(input), base::as_writable_bytes(output));
|
||||
}
|
||||
|
||||
bool GzipUncompress(base::span<const uint8_t> input,
|
||||
base::span<const uint8_t> output) {
|
||||
base::span<uint8_t> output) {
|
||||
uLongf uncompressed_size = GetUncompressedSize(input);
|
||||
if (uncompressed_size > output.size())
|
||||
return false;
|
||||
return zlib_internal::GzipUncompressHelper(
|
||||
reinterpret_cast<Bytef*>(const_cast<uint8_t*>(output.data())),
|
||||
&uncompressed_size, reinterpret_cast<const Bytef*>(input.data()),
|
||||
reinterpret_cast<Bytef*>(output.data()), &uncompressed_size,
|
||||
reinterpret_cast<const Bytef*>(input.data()),
|
||||
static_cast<uLongf>(input.size())) == Z_OK;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-3
@@ -43,12 +43,11 @@ bool GzipUncompress(const std::string& input, std::string* output);
|
||||
// needed. |output|'s size must be at least as large as the return value from
|
||||
// GetUncompressedSize.
|
||||
// Returns true for success.
|
||||
bool GzipUncompress(base::span<const char> input,
|
||||
base::span<const char> output);
|
||||
bool GzipUncompress(base::span<const char> input, base::span<char> output);
|
||||
|
||||
// Like the above method, but using uint8_t instead.
|
||||
bool GzipUncompress(base::span<const uint8_t> input,
|
||||
base::span<const uint8_t> output);
|
||||
base::span<uint8_t> output);
|
||||
|
||||
// Uncompresses the data in |input| using gzip, and writes the results to
|
||||
// |output|, which must NOT be the underlying string of |input|, and is resized
|
||||
|
||||
Vendored
+2
-2
@@ -397,14 +397,14 @@ Compression GetCompressionMethod(const base::FilePath& path) {
|
||||
|
||||
|
||||
// Skip the leading dot.
|
||||
base::FilePath::StringPieceType ext_without_dot = ext;
|
||||
base::FilePath::StringViewType ext_without_dot = ext;
|
||||
DCHECK_EQ(ext_without_dot.front(), FILE_PATH_LITERAL('.'));
|
||||
ext_without_dot.remove_prefix(1);
|
||||
|
||||
// Well known filename extensions of files that a likely to be already
|
||||
// compressed. The extensions are in lower case without the leading dot.
|
||||
static constexpr auto kExts =
|
||||
base::MakeFixedFlatSet<base::FilePath::StringPieceType>({
|
||||
base::MakeFixedFlatSet<base::FilePath::StringViewType>({
|
||||
FILE_PATH_LITERAL("3g2"), //
|
||||
FILE_PATH_LITERAL("3gp"), //
|
||||
FILE_PATH_LITERAL("7z"), //
|
||||
|
||||
+14
-21
@@ -9,7 +9,7 @@ Subject: [PATCH] Build minizip zip and unzip tools
|
||||
2 files changed, 9 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/third_party/zlib/contrib/minizip/miniunz.c b/third_party/zlib/contrib/minizip/miniunz.c
|
||||
index 8ada038dbd4e7..5b4312e5647cd 100644
|
||||
index 616c30325e07c..f4ad16bdd377b 100644
|
||||
--- a/third_party/zlib/contrib/minizip/miniunz.c
|
||||
+++ b/third_party/zlib/contrib/minizip/miniunz.c
|
||||
@@ -12,7 +12,7 @@
|
||||
@@ -30,31 +30,26 @@ index 8ada038dbd4e7..5b4312e5647cd 100644
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
@@ -94,7 +94,7 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
|
||||
@@ -97,7 +97,7 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
|
||||
LocalFileTimeToFileTime(&ftLocal,&ftm);
|
||||
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
|
||||
CloseHandle(hFile);
|
||||
#else
|
||||
-#if defined(unix) || defined(__APPLE__)
|
||||
+#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
-#elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
||||
+#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
(void)dosdate;
|
||||
struct utimbuf ut;
|
||||
struct tm newdate;
|
||||
@@ -125,11 +125,9 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
|
||||
|
||||
static int mymkdir(const char* dirname) {
|
||||
@@ -129,7 +129,7 @@ static int mymkdir(const char* dirname) {
|
||||
int ret=0;
|
||||
-#ifdef _WIN32
|
||||
+#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
ret = _mkdir(dirname);
|
||||
-#elif unix
|
||||
- ret = mkdir (dirname,0775);
|
||||
-#elif __APPLE__
|
||||
+#elif defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
-#elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
||||
+#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
ret = mkdir (dirname,0775);
|
||||
#else
|
||||
(void)dirname;
|
||||
diff --git a/third_party/zlib/contrib/minizip/minizip.c b/third_party/zlib/contrib/minizip/minizip.c
|
||||
index 26ee8d029efe6..9eb3956a55e00 100644
|
||||
index a44e36a01869d..53fdd363e6222 100644
|
||||
--- a/third_party/zlib/contrib/minizip/minizip.c
|
||||
+++ b/third_party/zlib/contrib/minizip/minizip.c
|
||||
@@ -12,8 +12,7 @@
|
||||
@@ -76,14 +71,12 @@ index 26ee8d029efe6..9eb3956a55e00 100644
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
@@ -92,7 +91,7 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||
@@ -96,7 +95,7 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
-#if defined(unix) || defined(__APPLE__)
|
||||
+#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
-#elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
||||
+#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
|
||||
/* f: name of file to get info on, tmzip: return value: access,
|
||||
modification and creation times, dt: dostime */
|
||||
static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||
--
|
||||
2.31.1.818.g46aad6cb9e-goog
|
||||
@@ -18,17 +18,6 @@ diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib
|
||||
index 82275d6c1775d..c8a01b23efd42 100644
|
||||
--- a/third_party/zlib/contrib/minizip/unzip.c
|
||||
+++ b/third_party/zlib/contrib/minizip/unzip.c
|
||||
@@ -68,10 +68,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
-#ifndef NOUNCRYPT
|
||||
- #define NOUNCRYPT
|
||||
-#endif
|
||||
-
|
||||
#include "zlib.h"
|
||||
#include "unzip.h"
|
||||
|
||||
@@ -1502,6 +1498,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
|
||||
zdecode(s->keys,s->pcrc_32_tab,source[i]);
|
||||
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@
|
||||
// Refer to tools/dep_updaters/update-zlib.sh
|
||||
#ifndef SRC_ZLIB_VERSION_H_
|
||||
#define SRC_ZLIB_VERSION_H_
|
||||
#define ZLIB_VERSION "1.3.0.1-motley-82a5fec"
|
||||
#define ZLIB_VERSION "1.3.0.1-motley-788cb3c"
|
||||
#endif // SRC_ZLIB_VERSION_H_
|
||||
Reference in new issue
Block a user