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

Side by Side Diff: net/spdy/hpack/hpack_decoder.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 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/spdy/hpack/hpack_decoder.h ('k') | net/spdy/hpack/hpack_decoder_test.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/spdy/hpack/hpack_decoder.h" 5 #include "net/spdy/hpack/hpack_decoder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h"
10 #include "base/logging.h" 9 #include "base/logging.h"
11 #include "net/spdy/hpack/hpack_constants.h" 10 #include "net/spdy/hpack/hpack_constants.h"
12 #include "net/spdy/hpack/hpack_output_stream.h" 11 #include "net/spdy/hpack/hpack_output_stream.h"
13 12
14 namespace net { 13 namespace net {
15 14
16 using base::StringPiece; 15 using base::StringPiece;
17 using std::string; 16 using std::string;
18 17
19 namespace { 18 namespace {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Implements 7.3: Header Table Size Update. 123 // Implements 7.3: Header Table Size Update.
125 if (input_stream->MatchPrefixAndConsume(kHeaderTableSizeUpdateOpcode)) { 124 if (input_stream->MatchPrefixAndConsume(kHeaderTableSizeUpdateOpcode)) {
126 return DecodeNextHeaderTableSizeUpdate(input_stream); 125 return DecodeNextHeaderTableSizeUpdate(input_stream);
127 } 126 }
128 // Unrecognized opcode. 127 // Unrecognized opcode.
129 return false; 128 return false;
130 } 129 }
131 130
132 bool HpackDecoder::DecodeNextHeaderTableSizeUpdate( 131 bool HpackDecoder::DecodeNextHeaderTableSizeUpdate(
133 HpackInputStream* input_stream) { 132 HpackInputStream* input_stream) {
134 uint32 size = 0; 133 uint32_t size = 0;
135 if (!input_stream->DecodeNextUint32(&size)) { 134 if (!input_stream->DecodeNextUint32(&size)) {
136 return false; 135 return false;
137 } 136 }
138 if (size > header_table_.settings_size_bound()) { 137 if (size > header_table_.settings_size_bound()) {
139 return false; 138 return false;
140 } 139 }
141 header_table_.SetMaxSize(size); 140 header_table_.SetMaxSize(size);
142 return true; 141 return true;
143 } 142 }
144 143
145 bool HpackDecoder::DecodeNextIndexedHeader(HpackInputStream* input_stream) { 144 bool HpackDecoder::DecodeNextIndexedHeader(HpackInputStream* input_stream) {
146 uint32 index = 0; 145 uint32_t index = 0;
147 if (!input_stream->DecodeNextUint32(&index)) { 146 if (!input_stream->DecodeNextUint32(&index)) {
148 return false; 147 return false;
149 } 148 }
150 149
151 const HpackEntry* entry = header_table_.GetByIndex(index); 150 const HpackEntry* entry = header_table_.GetByIndex(index);
152 if (entry == NULL) { 151 if (entry == NULL) {
153 return false; 152 return false;
154 } 153 }
155 154
156 return HandleHeaderRepresentation(entry->name(), entry->value()); 155 return HandleHeaderRepresentation(entry->name(), entry->value());
(...skipping 18 matching lines...) Expand all
175 if (!should_index) { 174 if (!should_index) {
176 return true; 175 return true;
177 } 176 }
178 177
179 ignore_result(header_table_.TryAddEntry(name, value)); 178 ignore_result(header_table_.TryAddEntry(name, value));
180 return true; 179 return true;
181 } 180 }
182 181
183 bool HpackDecoder::DecodeNextName(HpackInputStream* input_stream, 182 bool HpackDecoder::DecodeNextName(HpackInputStream* input_stream,
184 StringPiece* next_name) { 183 StringPiece* next_name) {
185 uint32 index_or_zero = 0; 184 uint32_t index_or_zero = 0;
186 if (!input_stream->DecodeNextUint32(&index_or_zero)) { 185 if (!input_stream->DecodeNextUint32(&index_or_zero)) {
187 return false; 186 return false;
188 } 187 }
189 188
190 if (index_or_zero == 0) { 189 if (index_or_zero == 0) {
191 return DecodeNextStringLiteral(input_stream, true, next_name); 190 return DecodeNextStringLiteral(input_stream, true, next_name);
192 } 191 }
193 192
194 const HpackEntry* entry = header_table_.GetByIndex(index_or_zero); 193 const HpackEntry* entry = header_table_.GetByIndex(index_or_zero);
195 if (entry == NULL) { 194 if (entry == NULL) {
(...skipping 18 matching lines...) Expand all
214 *output = StringPiece(*buffer); 213 *output = StringPiece(*buffer);
215 return result; 214 return result;
216 } 215 }
217 if (input_stream->MatchPrefixAndConsume(kStringLiteralIdentityEncoded)) { 216 if (input_stream->MatchPrefixAndConsume(kStringLiteralIdentityEncoded)) {
218 return input_stream->DecodeNextIdentityString(output); 217 return input_stream->DecodeNextIdentityString(output);
219 } 218 }
220 return false; 219 return false;
221 } 220 }
222 221
223 } // namespace net 222 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack/hpack_decoder.h ('k') | net/spdy/hpack/hpack_decoder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698