OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "update_engine/bzip_extent_writer.h" | 5 #include "update_engine/bzip_extent_writer.h" |
6 | 6 |
7 using std::vector; | 7 using std::vector; |
8 | 8 |
9 namespace chromeos_update_engine { | 9 namespace chromeos_update_engine { |
10 | 10 |
11 namespace { | 11 namespace { |
12 const vector<char>::size_type kOutputBufferLength = 1024 * 1024; | 12 const vector<char>::size_type kOutputBufferLength = 1024 * 1024; |
13 } | 13 } |
14 | 14 |
15 bool BzipExtentWriter::Init(int fd, | 15 bool BzipExtentWriter::Init(int fd, |
16 const vector<Extent>& extents, | 16 const vector<Extent>& extents, |
17 uint32 block_size) { | 17 uint32_t block_size) { |
18 // Init bzip2 stream | 18 // Init bzip2 stream |
19 int rc = BZ2_bzDecompressInit(&stream_, | 19 int rc = BZ2_bzDecompressInit(&stream_, |
20 0, // verbosity. (0 == silent) | 20 0, // verbosity. (0 == silent) |
21 0 // 0 = faster algo, more memory | 21 0 // 0 = faster algo, more memory |
22 ); | 22 ); |
23 TEST_AND_RETURN_FALSE(rc == BZ_OK); | 23 TEST_AND_RETURN_FALSE(rc == BZ_OK); |
24 | 24 |
25 return next_->Init(fd, extents, block_size); | 25 return next_->Init(fd, extents, block_size); |
26 } | 26 } |
27 | 27 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return true; | 64 return true; |
65 } | 65 } |
66 | 66 |
67 bool BzipExtentWriter::EndImpl() { | 67 bool BzipExtentWriter::EndImpl() { |
68 TEST_AND_RETURN_FALSE(input_buffer_.empty()); | 68 TEST_AND_RETURN_FALSE(input_buffer_.empty()); |
69 TEST_AND_RETURN_FALSE(BZ2_bzDecompressEnd(&stream_) == BZ_OK); | 69 TEST_AND_RETURN_FALSE(BZ2_bzDecompressEnd(&stream_) == BZ_OK); |
70 return next_->End(); | 70 return next_->End(); |
71 } | 71 } |
72 | 72 |
73 } // namespace chromeos_update_engine | 73 } // namespace chromeos_update_engine |
OLD | NEW |