aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/singlejar/combiners.cc
diff options
context:
space:
mode:
authorGravatar Sasha Smundak <asmundak@google.com>2017-01-04 21:20:10 +0000
committerGravatar John Cater <jcater@google.com>2017-01-04 21:41:25 +0000
commitcf2263c389f962c018bba7295d233af17e87651b (patch)
treed9cb2a58a66c415d6f75e1585cb3627f5b114d1a /src/tools/singlejar/combiners.cc
parent0b06ac45882d8c23f4f53817a0b6e7b3dffc8957 (diff)
Handle huge (>4GB) output jars.
RELNOTES: singlejar can now create jar files larger than 4GB. -- PiperOrigin-RevId: 143588105 MOS_MIGRATED_REVID=143588105
Diffstat (limited to 'src/tools/singlejar/combiners.cc')
-rw-r--r--src/tools/singlejar/combiners.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/singlejar/combiners.cc b/src/tools/singlejar/combiners.cc
index b0a712a2a7..ca2e224c7e 100644
--- a/src/tools/singlejar/combiners.cc
+++ b/src/tools/singlejar/combiners.cc
@@ -53,7 +53,7 @@ void *Concatenator::OutputEntry(bool compress) {
// and compressed size values.
uint8_t
zip64_extension_buffer[sizeof(Zip64ExtraField) + 2 * sizeof(uint64_t)];
- bool huge_buffer = (buffer_->data_size() >= 0xFFFFFFFF);
+ bool huge_buffer = ziph::zfield_needs_ext64(buffer_->data_size());
if (huge_buffer) {
deflated_buffer_size += sizeof(zip64_extension_buffer);
}
@@ -97,8 +97,9 @@ void *Concatenator::OutputEntry(bool compress) {
lh->crc32(checksum);
lh->compression_method(method);
if (huge_buffer) {
- lh->compressed_file_size32(compressed_size < 0xFFFFFFFF ? compressed_size
- : 0xFFFFFFFF);
+ lh->compressed_file_size32(ziph::zfield_needs_ext64(compressed_size)
+ ? 0xFFFFFFFF
+ : compressed_size);
// Not sure if this has to be written in the small case, but it shouldn't
// hurt.
const_cast<Zip64ExtraField *>(lh->zip64_extra_field())