Skip to content

Add files larger than INT32_MAX to zip archive #697

Closed Answered by Nekto89
FedericoGnesotto asked this question in Q&A
Discussion options

You must be logged in to vote

I'm calling zipWriteInFileInZip multiple times.

while (i_size != 0) {
  // minizip-ng has limit in zipWriteInFileInZip
  constexpr auto max_chunk_size = static_cast<std::size_t>(std::numeric_limits<std::int32_t>::max() - 1);
  const auto write_size = std::min(max_chunk_size, i_size);
  i_size -= write_size;
  if (zipWriteInFileInZip(mp_impl->mh_archive, ip_buffer, static_cast<std::uint32_t>(write_size)) < 0)
    return false;
  ip_buffer += write_size;
}
return true;

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@FedericoGnesotto
Comment options

Answer selected by FedericoGnesotto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants