Skip to content

Commit 858bce5

Browse files
committed
src: make minor tweaks to quic c++ for c++20
PR-URL: #53256 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent cdae315 commit 858bce5

19 files changed

+38
-77
lines changed

src/quic/application.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#include "sessionticket.h"
1111
#include "streams.h"
1212

13-
namespace node {
14-
namespace quic {
13+
namespace node::quic {
1514

1615
// An Application implements the ALPN-protocol specific semantics on behalf
1716
// of a QUIC Session.
@@ -154,8 +153,7 @@ struct Session::Application::StreamData final {
154153
std::string ToString() const;
155154
};
156155

157-
} // namespace quic
158-
} // namespace node
156+
} // namespace node::quic
159157

160158
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
161159
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/bindingdata.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
#include <vector>
1717
#include "defs.h"
1818

19-
namespace node {
20-
namespace quic {
19+
namespace node::quic {
2120

2221
class Endpoint;
2322
class Packet;
@@ -267,8 +266,7 @@ struct CallbackScope final : public CallbackScopeBase {
267266
explicit CallbackScope(T* ptr) : CallbackScopeBase(ptr->env()), ref(ptr) {}
268267
};
269268

270-
} // namespace quic
271-
} // namespace node
269+
} // namespace node::quic
272270

273271
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
274272
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/cid.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
#include "ncrypto.h"
99
#include "quic/defs.h"
1010

11-
namespace node {
12-
namespace quic {
11+
namespace node::quic {
1312

1413
// ============================================================================
1514
// CID
@@ -150,6 +149,5 @@ const CID::Factory& CID::Factory::random() {
150149
return instance;
151150
}
152151

153-
} // namespace quic
154-
} // namespace node
152+
} // namespace node::quic
155153
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC

src/quic/cid.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#include <string>
88
#include "defs.h"
99

10-
namespace node {
11-
namespace quic {
10+
namespace node::quic {
1211

1312
// CIDS are used to identify endpoints participating in a QUIC session.
1413
// Once created, CID instances are immutable.
@@ -122,8 +121,7 @@ class CID::Factory {
122121
// of CID::Factory that implement the QUIC Load Balancers spec.
123122
};
124123

125-
} // namespace quic
126-
} // namespace node
124+
} // namespace node::quic
127125

128126
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
129127
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/data.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#include <string>
1414
#include "defs.h"
1515

16-
namespace node {
17-
namespace quic {
16+
namespace node::quic {
1817

1918
struct Path final : public ngtcp2_path {
2019
Path(const SocketAddress& local, const SocketAddress& remote);
@@ -143,8 +142,7 @@ class QuicError final : public MemoryRetainer {
143142
const ngtcp2_ccerr* ptr_ = nullptr;
144143
};
145144

146-
} // namespace quic
147-
} // namespace node
145+
} // namespace node::quic
148146

149147
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
150148
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/defs.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
#include <v8.h>
1010
#include <limits>
1111

12-
namespace node {
13-
namespace quic {
12+
namespace node::quic {
1413

1514
#define NGTCP2_SUCCESS 0
1615
#define NGTCP2_ERR(V) (V != NGTCP2_SUCCESS)
@@ -243,5 +242,4 @@ class DebugIndentScope {
243242
static int indent_;
244243
};
245244

246-
} // namespace quic
247-
} // namespace node
245+
} // namespace node::quic

src/quic/endpoint.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
#include "sessionticket.h"
1818
#include "tokens.h"
1919

20-
namespace node {
21-
namespace quic {
20+
namespace node::quic {
2221

2322
#define ENDPOINT_CC(V) \
2423
V(RENO, reno) \
@@ -453,8 +452,7 @@ class Endpoint final : public AsyncWrap, public Packet::Listener {
453452
friend class Session;
454453
};
455454

456-
} // namespace quic
457-
} // namespace node
455+
} // namespace node::quic
458456

459457
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
460458
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/http3.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
#include "session.h"
1818
#include "sessionticket.h"
1919

20-
namespace node {
21-
namespace quic {
20+
namespace node::quic {
2221
namespace {
2322

2423
struct Http3HeadersTraits {
@@ -831,7 +830,6 @@ std::unique_ptr<Session::Application> createHttp3Application(
831830
return std::make_unique<Http3Application>(session, options);
832831
}
833832

834-
} // namespace quic
835-
} // namespace node
833+
} // namespace node::quic
836834

837835
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC

src/quic/http3.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55

66
#include "session.h"
77

8-
namespace node {
9-
namespace quic {
10-
8+
namespace node::quic {
119
std::unique_ptr<Session::Application> createHttp3Application(
1210
Session* session, const Session::Application_Options& options);
1311

14-
} // namespace quic
15-
} // namespace node
12+
} // namespace node::quic
1613

1714
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
1815
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/logstream.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
#include <stream_base.h>
1010
#include <deque>
1111

12-
namespace node {
13-
namespace quic {
12+
namespace node::quic {
1413

1514
// The LogStream is a utility that the QUIC impl uses to publish both QLog
1615
// and Keylog diagnostic data (one instance for each).
@@ -76,8 +75,7 @@ class LogStream : public AsyncWrap, public StreamBase {
7675
void ensure_space(size_t amt);
7776
};
7877

79-
} // namespace quic
80-
} // namespace node
78+
} // namespace node::quic
8179

8280
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
8381
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/packet.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
#include "defs.h"
1919
#include "tokens.h"
2020

21-
namespace node {
22-
namespace quic {
21+
namespace node::quic {
2322

2423
struct PathDescriptor {
2524
uint32_t version;
@@ -147,8 +146,7 @@ class Packet final : public ReqWrap<uv_udp_send_t> {
147146
std::shared_ptr<Data> data_;
148147
};
149148

150-
} // namespace quic
151-
} // namespace node
149+
} // namespace node::quic
152150

153151
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
154152
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/preferredaddress.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#include <string>
1111
#include "defs.h"
1212

13-
namespace node {
14-
namespace quic {
13+
namespace node::quic {
1514

1615
// PreferredAddress is a helper class used only when a client Session receives
1716
// an advertised preferred address from a server. The helper provides
@@ -67,8 +66,7 @@ class PreferredAddress final {
6766
const ngtcp2_preferred_addr* paddr_;
6867
};
6968

70-
} // namespace quic
71-
} // namespace node
69+
} // namespace node::quic
7270

7371
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
7472
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/session.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
#include "tlscontext.h"
2626
#include "transportparams.h"
2727

28-
namespace node {
29-
namespace quic {
28+
namespace node::quic {
3029

3130
class Endpoint;
3231

@@ -438,8 +437,7 @@ class Session final : public AsyncWrap, private SessionTicket::AppData::Source {
438437
friend class TransportParams;
439438
};
440439

441-
} // namespace quic
442-
} // namespace node
440+
} // namespace node::quic
443441

444442
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
445443
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/sessionticket.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include "data.h"
1212
#include "defs.h"
1313

14-
namespace node {
15-
namespace quic {
14+
namespace node::quic {
1615

1716
// A TLS 1.3 Session resumption ticket. Encapsulates both the TLS
1817
// ticket and the encoded QUIC transport parameters. The encoded
@@ -103,8 +102,7 @@ class SessionTicket::AppData final {
103102
SSL* ssl_;
104103
};
105104

106-
} // namespace quic
107-
} // namespace node
105+
} // namespace node::quic
108106

109107
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
110108
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/streams.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include "bindingdata.h"
1616
#include "data.h"
1717

18-
namespace node {
19-
namespace quic {
18+
namespace node::quic {
2019

2120
class Session;
2221

@@ -227,8 +226,7 @@ class Stream : public AsyncWrap,
227226
void Unschedule();
228227
};
229228

230-
} // namespace quic
231-
} // namespace node
229+
} // namespace node::quic
232230

233231
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
234232
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/tlscontext.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#include "defs.h"
1414
#include "sessionticket.h"
1515

16-
namespace node {
17-
namespace quic {
16+
namespace node::quic {
1817

1918
class Session;
2019
class TLSContext;
@@ -221,8 +220,7 @@ class TLSContext final : public MemoryRetainer,
221220
friend class TLSSession;
222221
};
223222

224-
} // namespace quic
225-
} // namespace node
223+
} // namespace node::quic
226224

227225
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
228226
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/tokens.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#include "nbytes.h"
1111
#include "ncrypto.h"
1212

13-
namespace node {
14-
namespace quic {
13+
namespace node::quic {
1514

1615
// ============================================================================
1716
// TokenSecret
@@ -300,7 +299,6 @@ RegularToken::operator const char*() const {
300299
return reinterpret_cast<const char*>(ptr_.base);
301300
}
302301

303-
} // namespace quic
304-
} // namespace node
302+
} // namespace node::quic
305303

306304
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC

src/quic/tokens.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#include "cid.h"
1111
#include "defs.h"
1212

13-
namespace node {
14-
namespace quic {
13+
namespace node::quic {
1514

1615
// TokenSecrets are used to generate things like stateless reset tokens,
1716
// retry tokens, and token packets. They are always QUIC_TOKENSECRET_LEN
@@ -251,8 +250,7 @@ class RegularToken final : public MemoryRetainer {
251250
const ngtcp2_vec ptr_;
252251
};
253252

254-
} // namespace quic
255-
} // namespace node
253+
} // namespace node::quic
256254

257255
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
258256
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/quic/transportparams.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#include "data.h"
1414
#include "tokens.h"
1515

16-
namespace node {
17-
namespace quic {
16+
namespace node::quic {
1817

1918
class Endpoint;
2019
class Session;
@@ -160,8 +159,7 @@ class TransportParams final {
160159
QuicError error_ = QuicError::TRANSPORT_NO_ERROR;
161160
};
162161

163-
} // namespace quic
164-
} // namespace node
162+
} // namespace node::quic
165163

166164
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
167165
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

0 commit comments

Comments
 (0)