OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium 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 "components/compression/compression_utils.h" | 5 #include "components/compression/compression_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
| 13 #include "base/bit_cast.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/sys_byteorder.h" | 15 #include "base/sys_byteorder.h" |
15 #include "third_party/zlib/zlib.h" | 16 #include "third_party/zlib/zlib.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 // The difference in bytes between a zlib header and a gzip header. | 20 // The difference in bytes between a zlib header and a gzip header. |
20 const size_t kGzipZlibHeaderDifferenceBytes = 16; | 21 const size_t kGzipZlibHeaderDifferenceBytes = 16; |
21 | 22 |
22 // Pass an integer greater than the following get a gzip header instead of a | 23 // Pass an integer greater than the following get a gzip header instead of a |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 &uncompressed_size, | 156 &uncompressed_size, |
156 bit_cast<const Bytef*>(input.data()), | 157 bit_cast<const Bytef*>(input.data()), |
157 static_cast<uLongf>(input.length())) == Z_OK) { | 158 static_cast<uLongf>(input.length())) == Z_OK) { |
158 output->swap(uncompressed_output); | 159 output->swap(uncompressed_output); |
159 return true; | 160 return true; |
160 } | 161 } |
161 return false; | 162 return false; |
162 } | 163 } |
163 | 164 |
164 } // namespace compression | 165 } // namespace compression |
OLD | NEW |