gfe-relnote: Remove use of QuicEndian from QuicFramer, not flag protected This replaces uses of ReadTag/WriteTag combined with QuicEndian::HostToNet32 to use ReadUInt32/WriteUInt32 instead, which handles endianness conversion. PiperOrigin-RevId: 250934036 Change-Id: I3740fd040d6a0c4cbffb41a5fa7f587b70f4f85e
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc index fa6dbd20..df019cf 100644 --- a/quic/core/quic_framer.cc +++ b/quic/core/quic_framer.cc
@@ -33,7 +33,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h" #include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h" #include "net/third_party/quiche/src/quic/platform/api/quic_client_stats.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_endian.h" #include "net/third_party/quiche/src/quic/platform/api/quic_fallthrough.h" #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h" #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h" @@ -1319,8 +1318,6 @@ size_t len = kPublicFlagsSize + packet.connection_id.length() + reset_serialized.length(); std::unique_ptr<char[]> buffer(new char[len]); - // Endianness is not a concern here, as writer is not going to write integers - // or floating numbers. QuicDataWriter writer(len, buffer.get()); uint8_t flags = static_cast<uint8_t>(PACKET_PUBLIC_FLAGS_RST | @@ -1394,8 +1391,6 @@ size_t len = kPublicFlagsSize + server_connection_id.length() + versions.size() * kQuicVersionSize; std::unique_ptr<char[]> buffer(new char[len]); - // Endianness is not a concern here, version negotiation packet does not have - // integers or floating numbers. QuicDataWriter writer(len, buffer.get()); uint8_t flags = static_cast<uint8_t>( @@ -1411,9 +1406,7 @@ } for (const ParsedQuicVersion& version : versions) { - // TODO(rch): Use WriteUInt32() once QUIC_VERSION_35 is removed. - if (!writer.WriteTag( - QuicEndian::HostToNet32(CreateQuicVersionLabel(version)))) { + if (!writer.WriteUInt32(CreateQuicVersionLabel(version))) { return nullptr; } } @@ -1458,9 +1451,7 @@ } for (const ParsedQuicVersion& version : versions) { - // TODO(rch): Use WriteUInt32() once QUIC_VERSION_35 is removed. - if (!writer.WriteTag( - QuicEndian::HostToNet32(CreateQuicVersionLabel(version)))) { + if (!writer.WriteUInt32(CreateQuicVersionLabel(version))) { return nullptr; } } @@ -2100,8 +2091,7 @@ if (header.version_flag) { DCHECK_EQ(Perspective::IS_CLIENT, perspective_); QuicVersionLabel version_label = CreateQuicVersionLabel(version_); - // TODO(rch): Use WriteUInt32() once QUIC_VERSION_35 is removed. - if (!writer->WriteTag(QuicEndian::NetToHost32(version_label))) { + if (!writer->WriteUInt32(version_label)) { return false; } @@ -2156,8 +2146,7 @@ if (header.version_flag) { // Append version for long header. QuicVersionLabel version_label = CreateQuicVersionLabel(version_); - // TODO(rch): Use WriteUInt32() once QUIC_VERSION_35 is removed. - if (!writer->WriteTag(QuicEndian::NetToHost32(version_label))) { + if (!writer->WriteUInt32(version_label)) { return false; } } @@ -2587,11 +2576,9 @@ // static bool QuicFramer::ProcessVersionLabel(QuicDataReader* reader, QuicVersionLabel* version_label) { - if (!reader->ReadTag(version_label)) { + if (!reader->ReadUInt32(version_label)) { return false; } - // TODO(rch): Use ReadUInt32() once QUIC_VERSION_35 is removed. - *version_label = QuicEndian::NetToHost32(*version_label); return true; }
diff --git a/quic/core/quic_framer.h b/quic/core/quic_framer.h index 992f370..57b1ed7 100644 --- a/quic/core/quic_framer.h +++ b/quic/core/quic_framer.h
@@ -15,7 +15,6 @@ #include "net/third_party/quiche/src/quic/core/crypto/quic_random.h" #include "net/third_party/quiche/src/quic/core/quic_connection_id.h" #include "net/third_party/quiche/src/quic/core/quic_packets.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_endian.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" #include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"