-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiz.diff
More file actions
76 lines (68 loc) · 3.86 KB
/
Copy pathminiz.diff
File metadata and controls
76 lines (68 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
diff --git a/miniz.c b/miniz.c
index d07b98d..a7aeb18 100644
--- a/miniz.c
+++ b/miniz.c
@@ -558,7 +558,7 @@ mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len)
}
return MZ_OK;
}
- int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len)
+ int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len, mz_alloc_func alloc, mz_free_func free, void *allocator)
{
mz_stream stream;
int status;
@@ -572,6 +572,9 @@ mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len)
stream.avail_in = (mz_uint32)*pSource_len;
stream.next_out = pDest;
stream.avail_out = (mz_uint32)*pDest_len;
+ stream.zalloc = alloc;
+ stream.zfree = free;
+ stream.opaque = allocator;
status = mz_inflateInit(&stream);
if (status != MZ_OK)
@@ -589,9 +592,9 @@ mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len)
return mz_inflateEnd(&stream);
}
- int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
+ int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, mz_alloc_func alloc, mz_free_func free, void *allocator)
{
- return mz_uncompress2(pDest, pDest_len, pSource, &source_len);
+ return mz_uncompress2(pDest, pDest_len, pSource, &source_len, alloc, free, allocator);
}
#endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
diff --git a/miniz.h b/miniz.h
index 49c2861..b23291a 100644
--- a/miniz.h
+++ b/miniz.h
@@ -430,8 +430,8 @@ extern "C"
/* Single-call decompression. */
/* Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. */
- MINIZ_EXPORT int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
- MINIZ_EXPORT int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len);
+ MINIZ_EXPORT int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, mz_alloc_func alloc, mz_free_func free, void *allocator);
+ MINIZ_EXPORT int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len, mz_alloc_func alloc, mz_free_func free, void *allocator);
#endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
/* Returns a string description of the specified error code, or NULL if the error code is invalid. */
@@ -554,14 +554,14 @@ extern "C"
return mz_inflateEnd(pStream);
}
- static int uncompress(unsigned char* pDest, mz_ulong* pDest_len, const unsigned char* pSource, mz_ulong source_len)
+ static int uncompress(unsigned char* pDest, mz_ulong* pDest_len, const unsigned char* pSource, mz_ulong source_len, mz_alloc_func alloc, mz_free_func free, void *allocator)
{
- return mz_uncompress(pDest, pDest_len, pSource, source_len);
+ return mz_uncompress(pDest, pDest_len, pSource, source_len, alloc, free, allocator);
}
- static int uncompress2(unsigned char* pDest, mz_ulong* pDest_len, const unsigned char* pSource, mz_ulong* pSource_len)
+ static int uncompress2(unsigned char* pDest, mz_ulong* pDest_len, const unsigned char* pSource, mz_ulong* pSource_len, mz_alloc_func alloc, mz_free_func free, void *allocator)
{
- return mz_uncompress2(pDest, pDest_len, pSource, pSource_len);
+ return mz_uncompress2(pDest, pDest_len, pSource, pSource_len, alloc, free, allocator);
}
#endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
@@ -602,4 +602,4 @@ extern "C"
#include "miniz_common.h"
#include "miniz_tdef.h"
#include "miniz_tinfl.h"
-#include "miniz_zip.h"
\ No newline at end of file
+#include "miniz_zip.h"