Replace QuicheStrCat() with absl::StrCat() PiperOrigin-RevId: 345525523 Change-Id: Ib107d0864bf24741cf9a6c4c4aa870db18141625
diff --git a/http2/hpack/hpack_string.cc b/http2/hpack/hpack_string.cc index a68bd8b..52da992 100644 --- a/http2/hpack/hpack_string.cc +++ b/http2/hpack/hpack_string.cc
@@ -6,8 +6,8 @@ #include <utility> +#include "absl/strings/str_cat.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" namespace http2 { @@ -61,8 +61,8 @@ } std::string HpackStringPair::DebugString() const { - return quiche::QuicheStrCat("HpackStringPair(name=", name.ToString(), - ", value=", value.ToString(), ")"); + return absl::StrCat("HpackStringPair(name=", name.ToString(), + ", value=", value.ToString(), ")"); } std::ostream& operator<<(std::ostream& os, const HpackStringPair& p) {
diff --git a/http2/hpack/http2_hpack_constants.cc b/http2/hpack/http2_hpack_constants.cc index 4b121ac..520aaea 100644 --- a/http2/hpack/http2_hpack_constants.cc +++ b/http2/hpack/http2_hpack_constants.cc
@@ -4,7 +4,7 @@ #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" +#include "absl/strings/str_cat.h" namespace http2 { @@ -21,8 +21,7 @@ case HpackEntryType::kNeverIndexedLiteralHeader: return "kNeverIndexedLiteralHeader"; } - return quiche::QuicheStrCat("UnknownHpackEntryType(", static_cast<int>(v), - ")"); + return absl::StrCat("UnknownHpackEntryType(", static_cast<int>(v), ")"); } std::ostream& operator<<(std::ostream& out, HpackEntryType v) {
diff --git a/http2/hpack/tools/hpack_example.cc b/http2/hpack/tools/hpack_example.cc index 1087875..db62c41 100644 --- a/http2/hpack/tools/hpack_example.cc +++ b/http2/hpack/tools/hpack_example.cc
@@ -6,10 +6,10 @@ #include <ctype.h> +#include "absl/strings/str_cat.h" #include "net/third_party/quiche/src/http2/platform/api/http2_bug_tracker.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" namespace http2 { namespace test { @@ -41,7 +41,7 @@ continue; } HTTP2_BUG << "Can't parse byte " << static_cast<int>(c0) - << quiche::QuicheStrCat(" (0x", Http2Hex(c0), ")") + << absl::StrCat(" (0x", Http2Hex(c0), ")") << "\nExample: " << example; } CHECK_LT(0u, output->size()) << "Example is empty.";
diff --git a/http2/hpack/varint/hpack_varint_decoder.cc b/http2/hpack/varint/hpack_varint_decoder.cc index e3fe745..bbd272d 100644 --- a/http2/hpack/varint/hpack_varint_decoder.cc +++ b/http2/hpack/varint/hpack_varint_decoder.cc
@@ -4,8 +4,8 @@ #include "net/third_party/quiche/src/http2/hpack/varint/hpack_varint_decoder.h" +#include "absl/strings/str_cat.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" namespace http2 { @@ -122,8 +122,8 @@ } std::string HpackVarintDecoder::DebugString() const { - return quiche::QuicheStrCat("HpackVarintDecoder(value=", value_, - ", offset=", offset_, ")"); + return absl::StrCat("HpackVarintDecoder(value=", value_, ", offset=", offset_, + ")"); } DecodeStatus HpackVarintDecoder::StartForTest(uint8_t prefix_value,
diff --git a/http2/hpack/varint/hpack_varint_round_trip_test.cc b/http2/hpack/varint/hpack_varint_round_trip_test.cc index 957683f..b71564b 100644 --- a/http2/hpack/varint/hpack_varint_round_trip_test.cc +++ b/http2/hpack/varint/hpack_varint_round_trip_test.cc
@@ -13,12 +13,12 @@ #include <set> #include <vector> +#include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/tools/hpack_block_builder.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h" #include "net/third_party/quiche/src/http2/tools/random_decoder_test.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" #include "net/third_party/quiche/src/common/platform/api/quiche_test.h" using ::testing::AssertionFailure; @@ -162,10 +162,10 @@ for (const uint64_t value : values) { Encode(value, prefix_length); // Sets buffer_. - std::string msg = quiche::QuicheStrCat( - "value=", value, " (0x", Http2Hex(value), - "), prefix_length=", prefix_length, - ", expected_bytes=", expected_bytes, "\n", Http2HexDump(buffer_)); + std::string msg = absl::StrCat("value=", value, " (0x", Http2Hex(value), + "), prefix_length=", prefix_length, + ", expected_bytes=", expected_bytes, "\n", + Http2HexDump(buffer_)); if (value == minimum) { HTTP2_LOG(INFO) << "Checking minimum; " << msg;
diff --git a/quic/core/congestion_control/bbr2_simulator_test.cc b/quic/core/congestion_control/bbr2_simulator_test.cc index fa0f31c..b7fef49 100644 --- a/quic/core/congestion_control/bbr2_simulator_test.cc +++ b/quic/core/congestion_control/bbr2_simulator_test.cc
@@ -6,6 +6,7 @@ #include <sstream> #include <utility> +#include "absl/strings/str_cat.h" #include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/congestion_control/bbr2_misc.h" #include "net/third_party/quiche/src/quic/core/congestion_control/bbr2_sender.h" @@ -28,7 +29,6 @@ #include "net/third_party/quiche/src/quic/test_tools/simulator/simulator.h" #include "net/third_party/quiche/src/quic/test_tools/simulator/switch.h" #include "net/third_party/quiche/src/quic/test_tools/simulator/traffic_policer.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" using testing::AllOf; using testing::Ge; @@ -1232,8 +1232,8 @@ uint64_t first_connection_id = 42; std::vector<simulator::QuicEndpointBase*> receiver_endpoint_pointers; for (size_t i = 0; i < MultiSenderTopologyParams::kNumLocalLinks; ++i) { - std::string sender_name = quiche::QuicheStrCat("Sender", i + 1); - std::string receiver_name = quiche::QuicheStrCat("Receiver", i + 1); + std::string sender_name = absl::StrCat("Sender", i + 1); + std::string receiver_name = absl::StrCat("Receiver", i + 1); sender_endpoints_.push_back(std::make_unique<simulator::QuicEndpoint>( &simulator_, sender_name, receiver_name, Perspective::IS_CLIENT, TestConnectionId(first_connection_id + i)));
diff --git a/quic/core/congestion_control/send_algorithm_test.cc b/quic/core/congestion_control/send_algorithm_test.cc index 9937cf8..66877f8 100644 --- a/quic/core/congestion_control/send_algorithm_test.cc +++ b/quic/core/congestion_control/send_algorithm_test.cc
@@ -8,6 +8,7 @@ #include <string> #include <utility> +#include "absl/strings/str_cat.h" #include "net/third_party/quiche/src/quic/core/congestion_control/rtt_stats.h" #include "net/third_party/quiche/src/quic/core/congestion_control/send_algorithm_interface.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" @@ -22,7 +23,6 @@ #include "net/third_party/quiche/src/quic/test_tools/simulator/quic_endpoint.h" #include "net/third_party/quiche/src/quic/test_tools/simulator/simulator.h" #include "net/third_party/quiche/src/quic/test_tools/simulator/switch.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" namespace quic { namespace test { @@ -134,7 +134,7 @@ std::string TestParamToString( const testing::TestParamInfo<TestParams>& params) { - return quiche::QuicheStrCat( + return absl::StrCat( CongestionControlTypeToString(params.param.congestion_control_type), "_"); }
diff --git a/quic/platform/api/quic_socket_address.cc b/quic/platform/api/quic_socket_address.cc index ee3c3be..708c646 100644 --- a/quic/platform/api/quic_socket_address.cc +++ b/quic/platform/api/quic_socket_address.cc
@@ -8,10 +8,10 @@ #include <limits> #include <string> +#include "absl/strings/str_cat.h" #include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h" #include "net/third_party/quiche/src/quic/platform/api/quic_ip_address.h" #include "net/third_party/quiche/src/quic/platform/api/quic_ip_address_family.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" namespace quic { @@ -70,9 +70,9 @@ std::string QuicSocketAddress::ToString() const { switch (host_.address_family()) { case IpAddressFamily::IP_V4: - return quiche::QuicheStrCat(host_.ToString(), ":", port_); + return absl::StrCat(host_.ToString(), ":", port_); case IpAddressFamily::IP_V6: - return quiche::QuicheStrCat("[", host_.ToString(), "]:", port_); + return absl::StrCat("[", host_.ToString(), "]:", port_); default: return ""; }
diff --git a/quic/platform/api/quic_string_utils_test.cc b/quic/platform/api/quic_string_utils_test.cc index e23b6ff..fa323c5 100644 --- a/quic/platform/api/quic_string_utils_test.cc +++ b/quic/platform/api/quic_string_utils_test.cc
@@ -6,6 +6,7 @@ #include <cstdint> +#include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" @@ -16,60 +17,59 @@ TEST(QuicStringUtilsTest, QuicheStrCat) { // No arguments. - EXPECT_EQ("", quiche::QuicheStrCat()); + EXPECT_EQ("", absl::StrCat()); // Single string-like argument. const char kFoo[] = "foo"; const std::string string_foo(kFoo); const absl::string_view stringpiece_foo(string_foo); - EXPECT_EQ("foo", quiche::QuicheStrCat(kFoo)); - EXPECT_EQ("foo", quiche::QuicheStrCat(string_foo)); - EXPECT_EQ("foo", quiche::QuicheStrCat(stringpiece_foo)); + EXPECT_EQ("foo", absl::StrCat(kFoo)); + EXPECT_EQ("foo", absl::StrCat(string_foo)); + EXPECT_EQ("foo", absl::StrCat(stringpiece_foo)); // Two string-like arguments. const char kBar[] = "bar"; const absl::string_view stringpiece_bar(kBar); const std::string string_bar(kBar); - EXPECT_EQ("foobar", quiche::QuicheStrCat(kFoo, kBar)); - EXPECT_EQ("foobar", quiche::QuicheStrCat(kFoo, string_bar)); - EXPECT_EQ("foobar", quiche::QuicheStrCat(kFoo, stringpiece_bar)); - EXPECT_EQ("foobar", quiche::QuicheStrCat(string_foo, kBar)); - EXPECT_EQ("foobar", quiche::QuicheStrCat(string_foo, string_bar)); - EXPECT_EQ("foobar", quiche::QuicheStrCat(string_foo, stringpiece_bar)); - EXPECT_EQ("foobar", quiche::QuicheStrCat(stringpiece_foo, kBar)); - EXPECT_EQ("foobar", quiche::QuicheStrCat(stringpiece_foo, string_bar)); - EXPECT_EQ("foobar", quiche::QuicheStrCat(stringpiece_foo, stringpiece_bar)); + EXPECT_EQ("foobar", absl::StrCat(kFoo, kBar)); + EXPECT_EQ("foobar", absl::StrCat(kFoo, string_bar)); + EXPECT_EQ("foobar", absl::StrCat(kFoo, stringpiece_bar)); + EXPECT_EQ("foobar", absl::StrCat(string_foo, kBar)); + EXPECT_EQ("foobar", absl::StrCat(string_foo, string_bar)); + EXPECT_EQ("foobar", absl::StrCat(string_foo, stringpiece_bar)); + EXPECT_EQ("foobar", absl::StrCat(stringpiece_foo, kBar)); + EXPECT_EQ("foobar", absl::StrCat(stringpiece_foo, string_bar)); + EXPECT_EQ("foobar", absl::StrCat(stringpiece_foo, stringpiece_bar)); // Many-many arguments. EXPECT_EQ("foobarbazquxquuxquuzcorgegraultgarplywaldofredplughxyzzythud", - quiche::QuicheStrCat("foo", "bar", "baz", "qux", "quux", "quuz", - "corge", "grault", "garply", "waldo", "fred", - "plugh", "xyzzy", "thud")); + absl::StrCat("foo", "bar", "baz", "qux", "quux", "quuz", "corge", + "grault", "garply", "waldo", "fred", "plugh", "xyzzy", + "thud")); // Numerical arguments. const int16_t i = 1; const uint64_t u = 8; const double d = 3.1415; - EXPECT_EQ("1 8", quiche::QuicheStrCat(i, " ", u)); - EXPECT_EQ("3.14151181", quiche::QuicheStrCat(d, i, i, u, i)); + EXPECT_EQ("1 8", absl::StrCat(i, " ", u)); + EXPECT_EQ("3.14151181", absl::StrCat(d, i, i, u, i)); EXPECT_EQ("i: 1, u: 8, d: 3.1415", - quiche::QuicheStrCat("i: ", i, ", u: ", u, ", d: ", d)); + absl::StrCat("i: ", i, ", u: ", u, ", d: ", d)); // Boolean arguments. const bool t = true; const bool f = false; - EXPECT_EQ("1", quiche::QuicheStrCat(t)); - EXPECT_EQ("0", quiche::QuicheStrCat(f)); - EXPECT_EQ("0110", quiche::QuicheStrCat(f, t, t, f)); + EXPECT_EQ("1", absl::StrCat(t)); + EXPECT_EQ("0", absl::StrCat(f)); + EXPECT_EQ("0110", absl::StrCat(f, t, t, f)); // Mixed string-like, numerical, and Boolean arguments. EXPECT_EQ("foo1foo081bar3.14151", - quiche::QuicheStrCat(kFoo, i, string_foo, f, u, t, stringpiece_bar, - d, t)); + absl::StrCat(kFoo, i, string_foo, f, u, t, stringpiece_bar, d, t)); EXPECT_EQ("3.141511bar18bar13.14150", - quiche::QuicheStrCat(d, t, t, string_bar, i, u, kBar, t, d, f)); + absl::StrCat(d, t, t, string_bar, i, u, kBar, t, d, f)); } TEST(QuicStringUtilsTest, QuicStrAppend) {
diff --git a/spdy/core/hpack/hpack_entry.cc b/spdy/core/hpack/hpack_entry.cc index 7f251e6..c37af2b 100644 --- a/spdy/core/hpack/hpack_entry.cc +++ b/spdy/core/hpack/hpack_entry.cc
@@ -4,7 +4,7 @@ #include "net/third_party/quiche/src/spdy/core/hpack/hpack_entry.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" +#include "absl/strings/str_cat.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_estimate_memory_usage.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h" @@ -76,7 +76,7 @@ } std::string HpackEntry::GetDebugString() const { - return quiche::QuicheStrCat( + return absl::StrCat( "{ name: \"", name_ref_, "\", value: \"", value_ref_, "\", index: ", insertion_index_, " ", (IsStatic() ? " static" : (IsLookup() ? " lookup" : " dynamic")), " }");