Mercurial > hg > orthanc
annotate OrthancFramework/Sources/Compression/ZipWriter.cpp @ 4492:0b2484663233
Fix build on big-endian architectures
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 30 Jan 2021 18:19:11 +0100 |
parents | d9473bd5ed43 |
children | b12faca76a52 |
rev | line source |
---|---|
136 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1278
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4297
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
136 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * the License, or (at your option) any later version. |
136 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 * Lesser General Public License for more details. |
136 | 16 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
136 | 20 **/ |
21 | |
824
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
22 |
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
23 #include "../PrecompiledHeaders.h" |
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
24 |
658
e8e59e80868c
note about glog-0.3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
644
diff
changeset
|
25 #ifndef NOMINMAX |
568 | 26 #define NOMINMAX |
27 #endif | |
136 | 28 |
81 | 29 #include "ZipWriter.h" |
30 | |
1278 | 31 #include <limits> |
32 #include <boost/filesystem.hpp> | |
81 | 33 #include <boost/date_time/posix_time/posix_time.hpp> |
34 | |
1278 | 35 #include "../../Resources/ThirdParty/minizip/zip.h" |
81 | 36 #include "../OrthancException.h" |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
37 #include "../Logging.h" |
81 | 38 |
39 | |
40 static void PrepareFileInfo(zip_fileinfo& zfi) | |
41 { | |
42 memset(&zfi, 0, sizeof(zfi)); | |
43 | |
44 using namespace boost::posix_time; | |
45 ptime now = second_clock::local_time(); | |
46 | |
47 boost::gregorian::date today = now.date(); | |
48 ptime midnight(today); | |
49 | |
50 time_duration sinceMidnight = now - midnight; | |
3128
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
51 zfi.tmz_date.tm_sec = static_cast<unsigned int>(sinceMidnight.seconds()); // seconds after the minute - [0,59] |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
52 zfi.tmz_date.tm_min = static_cast<unsigned int>(sinceMidnight.minutes()); // minutes after the hour - [0,59] |
972cc98959a3
fix build of civetweb for Visual Studio 2008 and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
53 zfi.tmz_date.tm_hour = static_cast<unsigned int>(sinceMidnight.hours()); // hours since midnight - [0,23] |
81 | 54 |
55 // http://www.boost.org/doc/libs/1_35_0/doc/html/boost/gregorian/greg_day.html | |
56 zfi.tmz_date.tm_mday = today.day(); // day of the month - [1,31] | |
57 | |
58 // http://www.boost.org/doc/libs/1_35_0/doc/html/boost/gregorian/greg_month.html | |
59 zfi.tmz_date.tm_mon = today.month() - 1; // months since January - [0,11] | |
60 | |
61 // http://www.boost.org/doc/libs/1_35_0/doc/html/boost/gregorian/greg_year.html | |
62 zfi.tmz_date.tm_year = today.year(); // years - [1980..2044] | |
63 } | |
64 | |
65 | |
66 | |
67 namespace Orthanc | |
68 { | |
69 struct ZipWriter::PImpl | |
70 { | |
71 zipFile file_; | |
1277
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
72 |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
73 PImpl() : file_(NULL) |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
74 { |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
75 } |
81 | 76 }; |
77 | |
1277
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
78 ZipWriter::ZipWriter() : |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
79 pimpl_(new PImpl), |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
80 isZip64_(false), |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
81 hasFileInZip_(false), |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
82 append_(false), |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
83 compressionLevel_(6) |
81 | 84 { |
85 } | |
86 | |
87 ZipWriter::~ZipWriter() | |
88 { | |
89 Close(); | |
90 } | |
91 | |
92 void ZipWriter::Close() | |
93 { | |
94 if (IsOpen()) | |
95 { | |
96 zipClose(pimpl_->file_, "Created by Orthanc"); | |
97 pimpl_->file_ = NULL; | |
98 hasFileInZip_ = false; | |
99 } | |
100 } | |
101 | |
102 bool ZipWriter::IsOpen() const | |
103 { | |
104 return pimpl_->file_ != NULL; | |
105 } | |
106 | |
107 void ZipWriter::Open() | |
108 { | |
109 if (IsOpen()) | |
110 { | |
111 return; | |
112 } | |
113 | |
114 if (path_.size() == 0) | |
115 { | |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
116 throw OrthancException(ErrorCode_BadSequenceOfCalls, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
117 "Please call SetOutputPath() before creating the file"); |
81 | 118 } |
119 | |
120 hasFileInZip_ = false; | |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
121 |
1278 | 122 int mode = APPEND_STATUS_CREATE; |
123 if (append_ && | |
124 boost::filesystem::exists(path_)) | |
125 { | |
126 mode = APPEND_STATUS_ADDINZIP; | |
127 } | |
1277
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
128 |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
129 if (isZip64_) |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
130 { |
1277
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
131 pimpl_->file_ = zipOpen64(path_.c_str(), mode); |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
132 } |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
133 else |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
134 { |
1277
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
135 pimpl_->file_ = zipOpen(path_.c_str(), mode); |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
136 } |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
137 |
81 | 138 if (!pimpl_->file_) |
139 { | |
3184 | 140 throw OrthancException(ErrorCode_CannotWriteFile, |
141 "Cannot create new ZIP archive: " + path_); | |
81 | 142 } |
143 } | |
144 | |
145 void ZipWriter::SetOutputPath(const char* path) | |
146 { | |
147 Close(); | |
148 path_ = path; | |
149 } | |
150 | |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
151 const std::string &ZipWriter::GetOutputPath() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
152 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
153 return path_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
154 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
155 |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
156 void ZipWriter::SetZip64(bool isZip64) |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
157 { |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
158 Close(); |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
159 isZip64_ = isZip64; |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
160 } |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
161 |
81 | 162 void ZipWriter::SetCompressionLevel(uint8_t level) |
163 { | |
164 if (level >= 10) | |
165 { | |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
166 throw OrthancException(ErrorCode_ParameterOutOfRange, |
3181
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3128
diff
changeset
|
167 "ZIP compression level must be between 0 (no compression) " |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3128
diff
changeset
|
168 "and 9 (highest compression)"); |
81 | 169 } |
170 | |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
171 Close(); |
81 | 172 compressionLevel_ = level; |
173 } | |
174 | |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
175 uint8_t ZipWriter::GetCompressionLevel() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
176 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
177 return compressionLevel_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
178 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
179 |
249 | 180 void ZipWriter::OpenFile(const char* path) |
81 | 181 { |
182 Open(); | |
183 | |
184 zip_fileinfo zfi; | |
185 PrepareFileInfo(zfi); | |
186 | |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
187 int result; |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
188 |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
189 if (isZip64_) |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
190 { |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
191 result = zipOpenNewFileInZip64(pimpl_->file_, path, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
192 &zfi, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
193 NULL, 0, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
194 NULL, 0, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
195 "", // Comment |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
196 Z_DEFLATED, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
197 compressionLevel_, 1); |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
198 } |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
199 else |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
200 { |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
201 result = zipOpenNewFileInZip(pimpl_->file_, path, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
202 &zfi, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
203 NULL, 0, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
204 NULL, 0, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
205 "", // Comment |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
206 Z_DEFLATED, |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
207 compressionLevel_); |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
208 } |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
209 |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
210 if (result != 0) |
81 | 211 { |
3184 | 212 throw OrthancException(ErrorCode_CannotWriteFile, |
213 "Cannot add new file inside ZIP archive: " + std::string(path)); | |
81 | 214 } |
215 | |
216 hasFileInZip_ = true; | |
217 } | |
218 | |
219 | |
220 void ZipWriter::Write(const std::string& data) | |
221 { | |
222 if (data.size()) | |
223 { | |
224 Write(&data[0], data.size()); | |
225 } | |
226 } | |
227 | |
228 | |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
229 void ZipWriter::Write(const void* data, size_t length) |
81 | 230 { |
231 if (!hasFileInZip_) | |
232 { | |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
233 throw OrthancException(ErrorCode_BadSequenceOfCalls, "Call first OpenFile()"); |
81 | 234 } |
235 | |
236 const size_t maxBytesInAStep = std::numeric_limits<int32_t>::max(); | |
237 | |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
238 const char* p = reinterpret_cast<const char*>(data); |
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
239 |
81 | 240 while (length > 0) |
241 { | |
242 int bytes = static_cast<int32_t>(length <= maxBytesInAStep ? length : maxBytesInAStep); | |
243 | |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
244 if (zipWriteInFileInZip(pimpl_->file_, p, bytes)) |
81 | 245 { |
3184 | 246 throw OrthancException(ErrorCode_CannotWriteFile, |
247 "Cannot write data to ZIP archive: " + path_); | |
81 | 248 } |
249 | |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
250 p += bytes; |
81 | 251 length -= bytes; |
252 } | |
253 } | |
1277
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
254 |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
255 |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
256 void ZipWriter::SetAppendToExisting(bool append) |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
257 { |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
258 Close(); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
259 append_ = append; |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
950
diff
changeset
|
260 } |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
261 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
262 bool ZipWriter::IsAppendToExisting() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
263 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
264 return append_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
265 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
266 |
4297 | 267 bool ZipWriter::IsZip64() const |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
268 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
269 return isZip64_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
270 } |
81 | 271 } |