aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmin Hassani <ahassani@google.com>2018-02-23 18:18:01 +0000
committerandroid-build-merger <android-build-merger@google.com>2018-02-23 18:18:01 +0000
commit52ab9662607ec56d7396cbc2e2ff01fb40530ffc (patch)
tree6eae1775b7c95cad0f042f62d1baf067bf2dd8ce
parent1bf91cf60121d54388d459b0efc5667eea7d214c (diff)
parent7aaa6229a730e59ccbada0c35ff66effe4e7a63b (diff)
downloadpuffin-52ab9662607ec56d7396cbc2e2ff01fb40530ffc.tar.gz
Fix a bug in PuffinStream am: 06c3d5304f am: d87fbb6ae3
am: 7aaa6229a7 Change-Id: I996e3f3ec2bc0420f7a29b4960115b515c98b9d0
-rw-r--r--src/puffin_stream.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/puffin_stream.cc b/src/puffin_stream.cc
index e26e2c9..3fb54a1 100644
--- a/src/puffin_stream.cc
+++ b/src/puffin_stream.cc
@@ -334,7 +334,7 @@ bool PuffinStream::Write(const void* buffer, size_t length) {
auto bytes = static_cast<const uint8_t*>(buffer);
size_t bytes_wrote = 0;
while (bytes_wrote < length) {
- if (deflate_bit_pos_ < (cur_deflate_->offset & ~7u)) {
+ if (deflate_bit_pos_ < (cur_deflate_->offset & ~7ull)) {
// Between two puffs or before the first puff. We know that we are
// starting from the byte boundary because we have already processed the
// non-deflate bits of the last byte of the last deflate. Here we don't
@@ -397,7 +397,7 @@ bool PuffinStream::Write(const void* buffer, size_t length) {
if (extra_byte_ == 1) {
deflate_buffer_->data()[bytes_to_write - 1] |=
puff_buffer_->data()[cur_puff_->length] << (deflate_bit_pos_ & 7);
- deflate_bit_pos_ = (deflate_bit_pos_ + 7) & ~7u;
+ deflate_bit_pos_ = (deflate_bit_pos_ + 7) & ~7ull;
} else if ((deflate_bit_pos_ & 7) != 0) {
// This happens if current and next deflate finish and end on the same
// byte, then we cannot write into output until we have huffed the
@@ -436,7 +436,7 @@ bool PuffinStream::SetExtraByte() {
return true;
}
size_t end_bit = cur_deflate_->offset + cur_deflate_->length;
- if ((end_bit & 7) && ((end_bit + 7) & ~7u) <= (cur_deflate_ + 1)->offset) {
+ if ((end_bit & 7) && ((end_bit + 7) & ~7ull) <= (cur_deflate_ + 1)->offset) {
extra_byte_ = 1;
} else {
extra_byte_ = 0;