Mercurial > hg > orthanc
diff Core/Compression/ZipWriter.cpp @ 3956:6e14f2da7c7e
integration transcoding->mainline
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 20 May 2020 16:42:44 +0200 |
parents | 0b3256c3ee14 |
children |
line wrap: on
line diff
--- a/Core/Compression/ZipWriter.cpp Wed May 06 08:40:48 2020 +0200 +++ b/Core/Compression/ZipWriter.cpp Wed May 20 16:42:44 2020 +0200 @@ -227,7 +227,7 @@ } - void ZipWriter::Write(const char* data, size_t length) + void ZipWriter::Write(const void* data, size_t length) { if (!hasFileInZip_) { @@ -236,17 +236,19 @@ const size_t maxBytesInAStep = std::numeric_limits<int32_t>::max(); + const char* p = reinterpret_cast<const char*>(data); + while (length > 0) { int bytes = static_cast<int32_t>(length <= maxBytesInAStep ? length : maxBytesInAStep); - if (zipWriteInFileInZip(pimpl_->file_, data, bytes)) + if (zipWriteInFileInZip(pimpl_->file_, p, bytes)) { throw OrthancException(ErrorCode_CannotWriteFile, "Cannot write data to ZIP archive: " + path_); } - data += bytes; + p += bytes; length -= bytes; } }