summaryrefslogtreecommitdiff
path: root/media-libs/opencolorio/files/opencolorio-2.2.1-support-minizip-ng-4.patch
blob: 8ee4ceaf997085e470a8c29e4e3cacd6318e13a6 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# From https://github.com/AcademySoftwareFoundation/OpenColorIO/pull/1806
From d15ccddd4d20d66749577d7444de861112f6864c Mon Sep 17 00:00:00 2001
From: Brad Smith <brad@comstyle.com>
Date: Thu, 29 Jun 2023 09:57:28 -0400
Subject: [PATCH] Add support for minizip-ng 4 API

Signed-off-by: Brad Smith <brad@comstyle.com>
---
 src/OpenColorIO/OCIOZArchive.cpp | 22 +++++++++++++++++++++-
 src/apps/ocioarchive/main.cpp    |  4 ++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/OpenColorIO/OCIOZArchive.cpp b/src/OpenColorIO/OCIOZArchive.cpp
index 85fc7bb76..24d836e95 100644
--- a/src/OpenColorIO/OCIOZArchive.cpp
+++ b/src/OpenColorIO/OCIOZArchive.cpp
@@ -225,7 +225,11 @@ void archiveConfig(std::ostream & ostream, const Config & config, const char * c
     std::string configStr = ss.str();
 
     // Write zip to memory stream.
+#if MZ_VERSION_BUILD >= 040000
+    write_mem_stream = mz_stream_mem_create();
+#else
     mz_stream_mem_create(&write_mem_stream);
+#endif
     mz_stream_mem_set_grow_size(write_mem_stream, 128 * 1024);
     mz_stream_open(write_mem_stream, NULL, MZ_OPEN_MODE_CREATE);
 
@@ -237,7 +241,11 @@ void archiveConfig(std::ostream & ostream, const Config & config, const char * c
     options.compress_level  = ArchiveCompressionLevels::BEST;
 
     // Create the writer handle.
+#if MZ_VERSION_BUILD >= 040000
+    archiver = mz_zip_writer_create();
+#else
     mz_zip_writer_create(&archiver);
+#endif
 
     // Archive options.
     // Compression method
@@ -332,7 +340,11 @@ void ExtractOCIOZArchive(const char * archivePath, const char * destination)
     std::string outputDestination = pystring::os::path::normpath(destination);
 
     // Create zip reader.
+#if MZ_VERSION_BUILD >= 040000
+    extracter = mz_zip_reader_create();
+#else
     mz_zip_reader_create(&extracter);
+#endif
 
     MinizipNgHandlerGuard extracterGuard(extracter, false, false);
 
@@ -450,7 +462,11 @@ std::vector<uint8_t> getFileStringFromArchiveFile(const std::string & filepath,
     std::vector<uint8_t> buffer;
 
     // Create the reader object.
+#if MZ_VERSION_BUILD >= 040000
+    reader = mz_zip_reader_create();
+#else
     mz_zip_reader_create(&reader);
+#endif
 
     MinizipNgHandlerGuard extracterGuard(reader, false, true);
 
@@ -510,7 +526,11 @@ void getEntriesMappingFromArchiveFile(const std::string & archivePath,
     void *reader = NULL;
 
     // Create the reader object.
+#if MZ_VERSION_BUILD >= 040000
+    reader = mz_zip_reader_create();
+#else
     mz_zip_reader_create(&reader);
+#endif
 
     MinizipNgHandlerGuard extracterGuard(reader, false, false);
 
diff --git a/src/apps/ocioarchive/main.cpp b/src/apps/ocioarchive/main.cpp
index 190cadee5..68054a6da 100644
--- a/src/apps/ocioarchive/main.cpp
+++ b/src/apps/ocioarchive/main.cpp
@@ -235,7 +235,11 @@ int main(int argc, const char **argv)
         }
 
         std::string path = args[0];
+#if MZ_VERSION_BUILD >= 040000
+        reader = mz_zip_reader_create();
+#else
         mz_zip_reader_create(&reader);
+#endif
         struct tm tmu_date;
         
         err = mz_zip_reader_open_file(reader, path.c_str());