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

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

Issue 2663203002: Fix uninitialized fields in hpack code. (Closed)
Patch Set: Created 3 years, 10 months 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.cc ('k') | net/spdy/hpack/hpack_huffman_table.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_entry.h" 5 #include "net/spdy/hpack/hpack_entry.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 using base::StringPiece; 12 using base::StringPiece;
13 13
14 const size_t HpackEntry::kSizeOverhead = 32; 14 const size_t HpackEntry::kSizeOverhead = 32;
15 15
16 HpackEntry::HpackEntry(StringPiece name, 16 HpackEntry::HpackEntry(StringPiece name,
17 StringPiece value, 17 StringPiece value,
18 bool is_static, 18 bool is_static,
19 size_t insertion_index) 19 size_t insertion_index)
20 : name_(name.data(), name.size()), 20 : name_(name.data(), name.size()),
21 value_(value.data(), value.size()), 21 value_(value.data(), value.size()),
22 name_ref_(name_), 22 name_ref_(name_),
23 value_ref_(value_), 23 value_ref_(value_),
24 insertion_index_(insertion_index), 24 insertion_index_(insertion_index),
25 type_(is_static ? STATIC : DYNAMIC) {} 25 type_(is_static ? STATIC : DYNAMIC),
26 time_added_(0) {}
26 27
27 HpackEntry::HpackEntry(StringPiece name, StringPiece value) 28 HpackEntry::HpackEntry(StringPiece name, StringPiece value)
28 : name_ref_(name), value_ref_(value), insertion_index_(0), type_(LOOKUP) {} 29 : name_ref_(name), value_ref_(value), insertion_index_(0), type_(LOOKUP),
30 time_added_(0) {}
29 31
30 HpackEntry::HpackEntry() : insertion_index_(0), type_(LOOKUP) {} 32 HpackEntry::HpackEntry()
33 : insertion_index_(0), type_(LOOKUP), time_added_(0) {}
31 34
32 HpackEntry::HpackEntry(const HpackEntry& other) 35 HpackEntry::HpackEntry(const HpackEntry& other)
33 : insertion_index_(other.insertion_index_), type_(other.type_) { 36 : insertion_index_(other.insertion_index_), type_(other.type_),
37 time_added_(0) {
34 if (type_ == LOOKUP) { 38 if (type_ == LOOKUP) {
35 name_ref_ = other.name_ref_; 39 name_ref_ = other.name_ref_;
36 value_ref_ = other.value_ref_; 40 value_ref_ = other.value_ref_;
37 } else { 41 } else {
38 name_ = other.name_; 42 name_ = other.name_;
39 value_ = other.value_; 43 value_ = other.value_;
40 name_ref_ = StringPiece(name_.data(), name_.size()); 44 name_ref_ = StringPiece(name_.data(), name_.size());
41 value_ref_ = StringPiece(value_.data(), value_.size()); 45 value_ref_ = StringPiece(value_.data(), value_.size());
42 } 46 }
43 } 47 }
(...skipping 26 matching lines...) Expand all
70 74
71 std::string HpackEntry::GetDebugString() const { 75 std::string HpackEntry::GetDebugString() const {
72 return "{ name: \"" + name_ref_.as_string() + "\", value: \"" + 76 return "{ name: \"" + name_ref_.as_string() + "\", value: \"" +
73 value_ref_.as_string() + "\", index: " + 77 value_ref_.as_string() + "\", index: " +
74 base::SizeTToString(insertion_index_) + 78 base::SizeTToString(insertion_index_) +
75 (IsStatic() ? " static" : (IsLookup() ? " lookup" : " dynamic")) + 79 (IsStatic() ? " static" : (IsLookup() ? " lookup" : " dynamic")) +
76 " }"; 80 " }";
77 } 81 }
78 82
79 } // namespace net 83 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack/hpack_decoder.cc ('k') | net/spdy/hpack/hpack_huffman_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698