OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/gzip_filter.h" | 5 #include "net/base/gzip_filter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/base/gzip_header.h" | 8 #include "net/base/gzip_header.h" |
9 #include "third_party/zlib/zlib.h" | 9 #include "third_party/zlib/zlib.h" |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 switch (filter_type) { | 39 switch (filter_type) { |
40 case Filter::FILTER_TYPE_DEFLATE: { | 40 case Filter::FILTER_TYPE_DEFLATE: { |
41 if (inflateInit(zlib_stream_.get()) != Z_OK) | 41 if (inflateInit(zlib_stream_.get()) != Z_OK) |
42 return false; | 42 return false; |
43 decoding_mode_ = DECODE_MODE_DEFLATE; | 43 decoding_mode_ = DECODE_MODE_DEFLATE; |
44 break; | 44 break; |
45 } | 45 } |
46 case Filter::FILTER_TYPE_GZIP_HELPING_SDCH: | 46 case Filter::FILTER_TYPE_GZIP_HELPING_SDCH: |
47 possible_sdch_pass_through_ = true; // Needed to optionally help sdch. | 47 possible_sdch_pass_through_ = true; // Needed to optionally help sdch. |
48 // Fall through to GZIP case. | 48 // Fall through to GZIP case. |
| 49 FALLTHROUGH_INTENDED; |
49 case Filter::FILTER_TYPE_GZIP: { | 50 case Filter::FILTER_TYPE_GZIP: { |
50 gzip_header_.reset(new GZipHeader()); | 51 gzip_header_.reset(new GZipHeader()); |
51 if (!gzip_header_.get()) | 52 if (!gzip_header_.get()) |
52 return false; | 53 return false; |
53 if (inflateInit2(zlib_stream_.get(), -MAX_WBITS) != Z_OK) | 54 if (inflateInit2(zlib_stream_.get(), -MAX_WBITS) != Z_OK) |
54 return false; | 55 return false; |
55 decoding_mode_ = DECODE_MODE_GZIP; | 56 decoding_mode_ = DECODE_MODE_GZIP; |
56 break; | 57 break; |
57 } | 58 } |
58 default: { | 59 default: { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 stream_data_len_ -= footer_byte_avail; | 290 stream_data_len_ -= footer_byte_avail; |
290 next_stream_data_ += footer_byte_avail; | 291 next_stream_data_ += footer_byte_avail; |
291 gzip_footer_bytes_ += footer_byte_avail; | 292 gzip_footer_bytes_ += footer_byte_avail; |
292 | 293 |
293 if (stream_data_len_ == 0) | 294 if (stream_data_len_ == 0) |
294 next_stream_data_ = NULL; | 295 next_stream_data_ = NULL; |
295 } | 296 } |
296 } | 297 } |
297 | 298 |
298 } // namespace net | 299 } // namespace net |
OLD | NEW |