Use uint64_t for varint. gfe-relnote: Change two types from uint32_t to uint64_t. Not flag protected. Motivation: https://crbug.com/916990. HpackVarintDecoder::value() has a return type of uint64_t. This was returned by HpackEntryTypeDecoder::varint() as a uint32_t, this CL changes that to uint64_t. Outside tests HpackEntryTypeDecoder::varint() is called in HpackEntryDecoder::Start(), where it is immediately passed to HpackEntryDecoderListener::OnIndexedHeader(), which takes a size_t. The other HpackEntryTypeDecoder::varint() production call site is HpackEntryDecoder::DispatchOnType(), where a local variable |varint| is assigned to its return value. This CL changes |varint| type from uint32_t to uint64_t. It is then passed to three methods: HpackEntryDecoderListener::OnIndexedHeader(), HpackEntryDecoderListener::OnStartLiteralHeader(), and HpackEntryDecoderListener::OnDynamicTableSizeUpdate(). These all take size_t. Every platform that GFE cares about has a 64 bit wide size_t. So all this CL does is remove a 64 bit to 32 bit to 64 bit integer conversion along a small number of paths. PiperOrigin-RevId: 226346424 Change-Id: I71f50f71e6d1702845b3e76a7427428c28aa6984
diff --git a/http2/hpack/decoder/hpack_entry_decoder.cc b/http2/hpack/decoder/hpack_entry_decoder.cc index 89562a9..b227b18 100644 --- a/http2/hpack/decoder/hpack_entry_decoder.cc +++ b/http2/hpack/decoder/hpack_entry_decoder.cc
@@ -192,7 +192,7 @@ bool HpackEntryDecoder::DispatchOnType(HpackEntryDecoderListener* listener) { const HpackEntryType entry_type = entry_type_decoder_.entry_type(); - const uint32_t varint = entry_type_decoder_.varint(); + const uint64_t varint = entry_type_decoder_.varint(); switch (entry_type) { case HpackEntryType::kIndexedHeader: // The entry consists solely of the entry type and varint. See:
diff --git a/http2/hpack/decoder/hpack_entry_type_decoder.h b/http2/hpack/decoder/hpack_entry_type_decoder.h index 1c0f2ac..79898be 100644 --- a/http2/hpack/decoder/hpack_entry_type_decoder.h +++ b/http2/hpack/decoder/hpack_entry_type_decoder.h
@@ -38,7 +38,7 @@ // Returns the decoded variable length integer. Only call if the // preceding call to Start or Resume returned kDecodeDone. - uint32_t varint() const { return varint_decoder_.value(); } + uint64_t varint() const { return varint_decoder_.value(); } Http2String DebugString() const;