Make bool methods with unused return values void. gfe-relnote: n/a (no functional change) PiperOrigin-RevId: 293208554 Change-Id: I2f45a6e500ee0b167e88ff18106e6448363e377b
diff --git a/http2/hpack/decoder/hpack_decoder_tables.cc b/http2/hpack/decoder/hpack_decoder_tables.cc index 09a18a8..397c085 100644 --- a/http2/hpack/decoder/hpack_decoder_tables.cc +++ b/http2/hpack/decoder/hpack_decoder_tables.cc
@@ -69,7 +69,7 @@ // TODO(jamessynge): Check somewhere before here that names received from the // peer are valid (e.g. are lower-case, no whitespace, etc.). -bool HpackDecoderDynamicTable::Insert(const HpackString& name, +void HpackDecoderDynamicTable::Insert(const HpackString& name, const HpackString& value) { HpackDecoderTableEntry entry(name, value); size_t entry_size = entry.size(); @@ -81,7 +81,7 @@ << current_size_ << " bytes."; table_.clear(); current_size_ = 0; - return false; // Not inserted because too large. + return; } ++insert_count_; if (debug_listener_ != nullptr) { @@ -96,7 +96,6 @@ HTTP2_DVLOG(2) << "InsertEntry: current_size_=" << current_size_; DCHECK_GE(current_size_, entry_size); DCHECK_LE(current_size_, size_limit_); - return true; } const HpackStringPair* HpackDecoderDynamicTable::Lookup(size_t index) const {
diff --git a/http2/hpack/decoder/hpack_decoder_tables.h b/http2/hpack/decoder/hpack_decoder_tables.h index 28bab5b..8841bbf 100644 --- a/http2/hpack/decoder/hpack_decoder_tables.h +++ b/http2/hpack/decoder/hpack_decoder_tables.h
@@ -106,9 +106,9 @@ // exceed the acknowledged value of SETTINGS_HEADER_TABLE_SIZE. void DynamicTableSizeUpdate(size_t size_limit); - // Returns true if inserted, false if too large (at which point the - // dynamic table will be empty.) - bool Insert(const HpackString& name, const HpackString& value); + // Insert entry if possible. + // If entry is too large to insert, then dynamic table will be empty. + void Insert(const HpackString& name, const HpackString& value); // If index is valid, returns a pointer to the entry, otherwise returns // nullptr. @@ -165,12 +165,12 @@ dynamic_table_.DynamicTableSizeUpdate(size_limit); } - // Returns true if inserted, false if too large (at which point the - // dynamic table will be empty.) + // Insert entry if possible. + // If entry is too large to insert, then dynamic table will be empty. // TODO(jamessynge): Add methods for moving the string(s) into the table, // or for otherwise avoiding unnecessary copies. - bool Insert(const HpackString& name, const HpackString& value) { - return dynamic_table_.Insert(name, value); + void Insert(const HpackString& name, const HpackString& value) { + dynamic_table_.Insert(name, value); } // If index is valid, returns a pointer to the entry, otherwise returns
diff --git a/http2/hpack/decoder/hpack_decoder_tables_test.cc b/http2/hpack/decoder/hpack_decoder_tables_test.cc index db4ada1..5722c70 100644 --- a/http2/hpack/decoder/hpack_decoder_tables_test.cc +++ b/http2/hpack/decoder/hpack_decoder_tables_test.cc
@@ -206,13 +206,7 @@ // move up by 1 index. AssertionResult Insert(const std::string& name, const std::string& value) { size_t old_count = num_dynamic_entries(); - if (tables_.Insert(HpackString(name), HpackString(value))) { - VERIFY_GT(current_dynamic_size(), 0u); - VERIFY_GT(num_dynamic_entries(), 0u); - } else { - VERIFY_EQ(current_dynamic_size(), 0u); - VERIFY_EQ(num_dynamic_entries(), 0u); - } + tables_.Insert(HpackString(name), HpackString(value)); FakeInsert(name, value); VERIFY_EQ(old_count + 1, fake_dynamic_table_.size()); FakeTrim(dynamic_size_limit());