Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: net/filter/gzip_header.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/dns/single_request_host_resolver.cc ('k') | net/http/disk_based_cert_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/filter/gzip_header.h" 5 #include "net/filter/gzip_header.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "third_party/zlib/zlib.h" 10 #include "third_party/zlib/zlib.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 extra_length_ += *pos << 8; 98 extra_length_ += *pos << 8;
99 pos++; 99 pos++;
100 state_++; 100 state_++;
101 // We intentionally fall through, because if we have a 101 // We intentionally fall through, because if we have a
102 // zero-length FEXTRA, we want to check to notice that we're 102 // zero-length FEXTRA, we want to check to notice that we're
103 // done reading the FEXTRA before we exit this loop... 103 // done reading the FEXTRA before we exit this loop...
104 104
105 case IN_FEXTRA: { 105 case IN_FEXTRA: {
106 // Grab the rest of the bytes in the extra field, or as many 106 // Grab the rest of the bytes in the extra field, or as many
107 // of them as are actually present so far. 107 // of them as are actually present so far.
108 const int num_extra_bytes = static_cast<const int>(std::min( 108 const uint16 num_extra_bytes = static_cast<uint16>(std::min(
109 static_cast<ptrdiff_t>(extra_length_), 109 static_cast<ptrdiff_t>(extra_length_),
110 (end - pos))); 110 (end - pos)));
111 pos += num_extra_bytes; 111 pos += num_extra_bytes;
112 extra_length_ -= num_extra_bytes; 112 extra_length_ -= num_extra_bytes;
113 if ( extra_length_ == 0 ) { 113 if ( extra_length_ == 0 ) {
114 state_ = IN_FNAME; // advance when we've seen extra_length_ bytes 114 state_ = IN_FNAME; // advance when we've seen extra_length_ bytes
115 flags_ &= ~FLAG_FEXTRA; // we're done with the FEXTRA stuff 115 flags_ &= ~FLAG_FEXTRA; // we're done with the FEXTRA stuff
116 } 116 }
117 break; 117 break;
118 } 118 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 if ( (state_ > IN_HEADER_OS) && (flags_ == 0) ) { 173 if ( (state_ > IN_HEADER_OS) && (flags_ == 0) ) {
174 *header_end = reinterpret_cast<const char*>(pos); 174 *header_end = reinterpret_cast<const char*>(pos);
175 return COMPLETE_HEADER; 175 return COMPLETE_HEADER;
176 } else { 176 } else {
177 return INCOMPLETE_HEADER; 177 return INCOMPLETE_HEADER;
178 } 178 }
179 } 179 }
180 180
181 } // namespace net 181 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/single_request_host_resolver.cc ('k') | net/http/disk_based_cert_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698