Skip to content

Commit bb94f8b

Browse files
committed
Update minizip
They don't do versioning, but it's @ 61a56bc from https://github.com/madler/zlib/tree/develop/contrib/minizip
1 parent cb7782e commit bb94f8b

File tree

9 files changed

+279
-241
lines changed

9 files changed

+279
-241
lines changed

vendor/zip/ints.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* ints.h -- create integer types for 8, 16, 32, and 64 bits
2+
* Copyright (C) 2024 Mark Adler
3+
* For conditions of distribution and use, see the copyright notice in zlib.h
4+
*
5+
* There exist compilers with limits.h, but not stdint.h or inttypes.h.
6+
*/
7+
8+
#ifndef INTS_H
9+
#define INTS_H
10+
#include <limits.h>
11+
#if defined(UCHAR_MAX) && UCHAR_MAX == 0xff
12+
typedef signed char i8_t;
13+
typedef unsigned char ui8_t;
14+
#else
15+
# error "no 8-bit integer"
16+
#endif
17+
#if defined(USHRT_MAX) && USHRT_MAX == 0xffff
18+
typedef short i16_t;
19+
typedef unsigned short ui16_t;
20+
#elif defined(UINT_MAX) && UINT_MAX == 0xffff
21+
typedef int i16_t;
22+
typedef unsigned ui16_t;
23+
#else
24+
# error "no 16-bit integer"
25+
#endif
26+
#if defined(UINT_MAX) && UINT_MAX == 0xffffffff
27+
typedef int i32_t;
28+
typedef unsigned ui32_t;
29+
# define PI32 "d"
30+
# define PUI32 "u"
31+
#elif defined(ULONG_MAX) && ULONG_MAX == 0xffffffff
32+
typedef long i32_t;
33+
typedef unsigned long ui32_t;
34+
# define PI32 "ld"
35+
# define PUI32 "lu"
36+
#else
37+
# error "no 32-bit integer"
38+
#endif
39+
#if defined(ULONG_MAX) && ULONG_MAX == 0xffffffffffffffff
40+
typedef long i64_t;
41+
typedef unsigned long ui64_t;
42+
# define PI64 "ld"
43+
# define PUI64 "lu"
44+
#elif defined(ULLONG_MAX) && ULLONG_MAX == 0xffffffffffffffff
45+
typedef long long i64_t;
46+
typedef unsigned long long ui64_t;
47+
# define PI64 "lld"
48+
# define PUI64 "llu"
49+
#elif defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 0xffffffffffffffff
50+
typedef long long i64_t;
51+
typedef unsigned long long ui64_t;
52+
# define PI64 "lld"
53+
# define PUI64 "llu"
54+
#else
55+
# error "no 64-bit integer"
56+
#endif
57+
#endif

vendor/zip/ioapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#endif
1616

1717
#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
18-
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
18+
/* In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions */
1919
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
2020
#define FTELLO_FUNC(stream) ftello(stream)
2121
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)

vendor/zip/ioapi.h

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
1919
*/
2020

21-
#ifndef _ZLIBIOAPI64_H
22-
#define _ZLIBIOAPI64_H
21+
#ifndef ZLIBIOAPI64_H
22+
#define ZLIBIOAPI64_H
2323

2424
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
2525

26-
// Linux needs this to support file operation on files larger then 4+GB
27-
// But might need better if/def to select just the platforms that needs them.
26+
/* Linux needs this to support file operation on files larger then 4+GB */
27+
/* But might need better if/def to select just the platforms that needs them.*/
2828

2929
#ifndef __USE_FILE_OFFSET64
3030
#define __USE_FILE_OFFSET64
@@ -67,39 +67,12 @@
6767
#endif
6868
#endif
6969

70-
/*
71-
#ifndef ZPOS64_T
72-
#ifdef _WIN32
73-
#define ZPOS64_T fpos_t
74-
#else
75-
#include <stdint.h>
76-
#define ZPOS64_T uint64_t
77-
#endif
78-
#endif
79-
*/
80-
8170
#ifdef HAVE_MINIZIP64_CONF_H
8271
#include "mz64conf.h"
8372
#endif
8473

85-
/* a type chosen by DEFINE */
86-
#ifdef HAVE_64BIT_INT_CUSTOM
87-
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
88-
#else
89-
#ifdef HAS_STDINT_H
90-
#include "stdint.h"
91-
typedef uint64_t ZPOS64_T;
92-
#else
93-
94-
95-
96-
#if defined(_MSC_VER) || defined(__BORLANDC__)
97-
typedef unsigned __int64 ZPOS64_T;
98-
#else
99-
typedef unsigned long long int ZPOS64_T;
100-
#endif
101-
#endif
102-
#endif
74+
#include "ints.h"
75+
typedef ui64_t ZPOS64_T;
10376

10477
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
10578
#ifndef MAXU32
@@ -188,8 +161,8 @@ typedef struct zlib_filefunc64_32_def_s
188161

189162
#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
190163
#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
191-
//#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
192-
//#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
164+
/*#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) */
165+
/*#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) */
193166
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
194167
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
195168

vendor/zip/iowin32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#endif
2727

2828

29-
// see Include/shared/winapifamily.h in the Windows Kit
29+
/* see Include/shared/winapifamily.h in the Windows Kit */
3030
#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API)))
3131

3232
#if !defined(WINAPI_FAMILY_ONE_PARTITION)

vendor/zip/mztools.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char*
219219
{
220220
int entriesZip = entries;
221221
char end[22];
222-
char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
222+
char* comment = ""; /* "ZIP File recovered by zlib/minizip/mztools"; */
223223
int comsize = (int) strlen(comment);
224224
if (entriesZip > 0xffff) {
225225
entriesZip = 0xffff;

0 commit comments

Comments
 (0)