From 858bce569808509666898b29d411efbb655b2b3f Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 28 Sep 2024 10:10:32 -0700 Subject: [PATCH] src: make minor tweaks to quic c++ for c++20 PR-URL: https://github.com/nodejs/node/pull/53256 Reviewed-By: Stephen Belanger Reviewed-By: Yagiz Nizipli --- src/quic/application.h | 6 ++---- src/quic/bindingdata.h | 6 ++---- src/quic/cid.cc | 6 ++---- src/quic/cid.h | 6 ++---- src/quic/data.h | 6 ++---- src/quic/defs.h | 6 ++---- src/quic/endpoint.h | 6 ++---- src/quic/http3.cc | 6 ++---- src/quic/http3.h | 7 ++----- src/quic/logstream.h | 6 ++---- src/quic/packet.h | 6 ++---- src/quic/preferredaddress.h | 6 ++---- src/quic/session.h | 6 ++---- src/quic/sessionticket.h | 6 ++---- src/quic/streams.h | 6 ++---- src/quic/tlscontext.h | 6 ++---- src/quic/tokens.cc | 6 ++---- src/quic/tokens.h | 6 ++---- src/quic/transportparams.h | 6 ++---- 19 files changed, 38 insertions(+), 77 deletions(-) diff --git a/src/quic/application.h b/src/quic/application.h index fc228fafe35..79b9941f62b 100644 --- a/src/quic/application.h +++ b/src/quic/application.h @@ -10,8 +10,7 @@ #include "sessionticket.h" #include "streams.h" -namespace node { -namespace quic { +namespace node::quic { // An Application implements the ALPN-protocol specific semantics on behalf // of a QUIC Session. @@ -154,8 +153,7 @@ struct Session::Application::StreamData final { std::string ToString() const; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/bindingdata.h b/src/quic/bindingdata.h index f5c19d1fbb8..cbc8c9436de 100644 --- a/src/quic/bindingdata.h +++ b/src/quic/bindingdata.h @@ -16,8 +16,7 @@ #include #include "defs.h" -namespace node { -namespace quic { +namespace node::quic { class Endpoint; class Packet; @@ -267,8 +266,7 @@ struct CallbackScope final : public CallbackScopeBase { explicit CallbackScope(T* ptr) : CallbackScopeBase(ptr->env()), ref(ptr) {} }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/cid.cc b/src/quic/cid.cc index f6eb9301a92..fdc63614521 100644 --- a/src/quic/cid.cc +++ b/src/quic/cid.cc @@ -8,8 +8,7 @@ #include "ncrypto.h" #include "quic/defs.h" -namespace node { -namespace quic { +namespace node::quic { // ============================================================================ // CID @@ -150,6 +149,5 @@ const CID::Factory& CID::Factory::random() { return instance; } -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC diff --git a/src/quic/cid.h b/src/quic/cid.h index 89d8fd2f2a0..15aa6d90748 100644 --- a/src/quic/cid.h +++ b/src/quic/cid.h @@ -7,8 +7,7 @@ #include #include "defs.h" -namespace node { -namespace quic { +namespace node::quic { // CIDS are used to identify endpoints participating in a QUIC session. // Once created, CID instances are immutable. @@ -122,8 +121,7 @@ class CID::Factory { // of CID::Factory that implement the QUIC Load Balancers spec. }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/data.h b/src/quic/data.h index ef36e248bbf..7f97403d61f 100644 --- a/src/quic/data.h +++ b/src/quic/data.h @@ -13,8 +13,7 @@ #include #include "defs.h" -namespace node { -namespace quic { +namespace node::quic { struct Path final : public ngtcp2_path { Path(const SocketAddress& local, const SocketAddress& remote); @@ -143,8 +142,7 @@ class QuicError final : public MemoryRetainer { const ngtcp2_ccerr* ptr_ = nullptr; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/defs.h b/src/quic/defs.h index 0e2e3095ad8..5491d407390 100644 --- a/src/quic/defs.h +++ b/src/quic/defs.h @@ -9,8 +9,7 @@ #include #include -namespace node { -namespace quic { +namespace node::quic { #define NGTCP2_SUCCESS 0 #define NGTCP2_ERR(V) (V != NGTCP2_SUCCESS) @@ -243,5 +242,4 @@ class DebugIndentScope { static int indent_; }; -} // namespace quic -} // namespace node +} // namespace node::quic diff --git a/src/quic/endpoint.h b/src/quic/endpoint.h index 132ebae18d4..194f7c3d84c 100644 --- a/src/quic/endpoint.h +++ b/src/quic/endpoint.h @@ -17,8 +17,7 @@ #include "sessionticket.h" #include "tokens.h" -namespace node { -namespace quic { +namespace node::quic { #define ENDPOINT_CC(V) \ V(RENO, reno) \ @@ -453,8 +452,7 @@ class Endpoint final : public AsyncWrap, public Packet::Listener { friend class Session; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/http3.cc b/src/quic/http3.cc index 11196a5f6ca..2fd2b704d07 100644 --- a/src/quic/http3.cc +++ b/src/quic/http3.cc @@ -17,8 +17,7 @@ #include "session.h" #include "sessionticket.h" -namespace node { -namespace quic { +namespace node::quic { namespace { struct Http3HeadersTraits { @@ -831,7 +830,6 @@ std::unique_ptr createHttp3Application( return std::make_unique(session, options); } -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC diff --git a/src/quic/http3.h b/src/quic/http3.h index b56d28b0dd2..94860c9b771 100644 --- a/src/quic/http3.h +++ b/src/quic/http3.h @@ -5,14 +5,11 @@ #include "session.h" -namespace node { -namespace quic { - +namespace node::quic { std::unique_ptr createHttp3Application( Session* session, const Session::Application_Options& options); -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/logstream.h b/src/quic/logstream.h index b9d3f8df974..b5f2b59e3aa 100644 --- a/src/quic/logstream.h +++ b/src/quic/logstream.h @@ -9,8 +9,7 @@ #include #include -namespace node { -namespace quic { +namespace node::quic { // The LogStream is a utility that the QUIC impl uses to publish both QLog // and Keylog diagnostic data (one instance for each). @@ -76,8 +75,7 @@ class LogStream : public AsyncWrap, public StreamBase { void ensure_space(size_t amt); }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/packet.h b/src/quic/packet.h index 761fb3af4e6..58ab6f46fa8 100644 --- a/src/quic/packet.h +++ b/src/quic/packet.h @@ -18,8 +18,7 @@ #include "defs.h" #include "tokens.h" -namespace node { -namespace quic { +namespace node::quic { struct PathDescriptor { uint32_t version; @@ -147,8 +146,7 @@ class Packet final : public ReqWrap { std::shared_ptr data_; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/preferredaddress.h b/src/quic/preferredaddress.h index 37003e2eb70..369c09c8463 100644 --- a/src/quic/preferredaddress.h +++ b/src/quic/preferredaddress.h @@ -10,8 +10,7 @@ #include #include "defs.h" -namespace node { -namespace quic { +namespace node::quic { // PreferredAddress is a helper class used only when a client Session receives // an advertised preferred address from a server. The helper provides @@ -67,8 +66,7 @@ class PreferredAddress final { const ngtcp2_preferred_addr* paddr_; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/session.h b/src/quic/session.h index 41a797dad68..f980af9611c 100644 --- a/src/quic/session.h +++ b/src/quic/session.h @@ -25,8 +25,7 @@ #include "tlscontext.h" #include "transportparams.h" -namespace node { -namespace quic { +namespace node::quic { class Endpoint; @@ -438,8 +437,7 @@ class Session final : public AsyncWrap, private SessionTicket::AppData::Source { friend class TransportParams; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/sessionticket.h b/src/quic/sessionticket.h index d7ec639baef..a2e6e3758f6 100644 --- a/src/quic/sessionticket.h +++ b/src/quic/sessionticket.h @@ -11,8 +11,7 @@ #include "data.h" #include "defs.h" -namespace node { -namespace quic { +namespace node::quic { // A TLS 1.3 Session resumption ticket. Encapsulates both the TLS // ticket and the encoded QUIC transport parameters. The encoded @@ -103,8 +102,7 @@ class SessionTicket::AppData final { SSL* ssl_; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/streams.h b/src/quic/streams.h index 15f86cda0e3..0bacb37faf5 100644 --- a/src/quic/streams.h +++ b/src/quic/streams.h @@ -15,8 +15,7 @@ #include "bindingdata.h" #include "data.h" -namespace node { -namespace quic { +namespace node::quic { class Session; @@ -227,8 +226,7 @@ class Stream : public AsyncWrap, void Unschedule(); }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/tlscontext.h b/src/quic/tlscontext.h index c7ee7f8ef72..3f2f8aff42a 100644 --- a/src/quic/tlscontext.h +++ b/src/quic/tlscontext.h @@ -13,8 +13,7 @@ #include "defs.h" #include "sessionticket.h" -namespace node { -namespace quic { +namespace node::quic { class Session; class TLSContext; @@ -221,8 +220,7 @@ class TLSContext final : public MemoryRetainer, friend class TLSSession; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/tokens.cc b/src/quic/tokens.cc index fcb2a24ca3b..d3ebde6225d 100644 --- a/src/quic/tokens.cc +++ b/src/quic/tokens.cc @@ -10,8 +10,7 @@ #include "nbytes.h" #include "ncrypto.h" -namespace node { -namespace quic { +namespace node::quic { // ============================================================================ // TokenSecret @@ -300,7 +299,6 @@ RegularToken::operator const char*() const { return reinterpret_cast(ptr_.base); } -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC diff --git a/src/quic/tokens.h b/src/quic/tokens.h index bd62faee9ea..4f9f25dd123 100644 --- a/src/quic/tokens.h +++ b/src/quic/tokens.h @@ -10,8 +10,7 @@ #include "cid.h" #include "defs.h" -namespace node { -namespace quic { +namespace node::quic { // TokenSecrets are used to generate things like stateless reset tokens, // retry tokens, and token packets. They are always QUIC_TOKENSECRET_LEN @@ -251,8 +250,7 @@ class RegularToken final : public MemoryRetainer { const ngtcp2_vec ptr_; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/quic/transportparams.h b/src/quic/transportparams.h index 349ddd5c948..af6af3fc026 100644 --- a/src/quic/transportparams.h +++ b/src/quic/transportparams.h @@ -13,8 +13,7 @@ #include "data.h" #include "tokens.h" -namespace node { -namespace quic { +namespace node::quic { class Endpoint; class Session; @@ -160,8 +159,7 @@ class TransportParams final { QuicError error_ = QuicError::TRANSPORT_NO_ERROR; }; -} // namespace quic -} // namespace node +} // namespace node::quic #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS