Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: net/quic/crypto/quic_crypto_server_config.cc

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/crypto/quic_crypto_server_config.h ('k') | net/quic/port_suggester.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/quic_crypto_server_config.cc
diff --git a/net/quic/crypto/quic_crypto_server_config.cc b/net/quic/crypto/quic_crypto_server_config.cc
index 4a5dc8a75806da293e0f8948080064d720228354..d4bf9112a4a2c2332b5a8e703d18f4b6d3ed580e 100644
--- a/net/quic/crypto/quic_crypto_server_config.cc
+++ b/net/quic/crypto/quic_crypto_server_config.cc
@@ -1175,8 +1175,8 @@ void QuicCryptoServerConfig::BuildRejection(
// token.
const size_t max_unverified_size =
client_hello.size() * kMultiplier - kREJOverheadBytes;
- COMPILE_ASSERT(kClientHelloMinimumSize * kMultiplier >= kREJOverheadBytes,
- overhead_calculation_may_underflow);
+ static_assert(kClientHelloMinimumSize * kMultiplier >= kREJOverheadBytes,
+ "overhead calculation may overflow");
if (info.valid_source_address_token ||
signature.size() + compressed.size() < max_unverified_size) {
out->SetStringPiece(kCertificateTag, compressed);
@@ -1251,7 +1251,8 @@ QuicCryptoServerConfig::ParseConfigProtobuf(
" Got " << orbit.size() << " want " << kOrbitSize;
return nullptr;
}
- COMPILE_ASSERT(sizeof(config->orbit) == kOrbitSize, orbit_incorrect_size);
+ static_assert(sizeof(config->orbit) == kOrbitSize,
+ "orbit has incorrect size");
memcpy(config->orbit, orbit.data(), sizeof(config->orbit));
{
@@ -1615,7 +1616,7 @@ string QuicCryptoServerConfig::NewServerNonce(QuicRandom* rand,
const uint32 timestamp = static_cast<uint32>(now.ToUNIXSeconds());
uint8 server_nonce[kServerNoncePlaintextSize];
- COMPILE_ASSERT(sizeof(server_nonce) > sizeof(timestamp), nonce_too_small);
+ static_assert(sizeof(server_nonce) > sizeof(timestamp), "nonce too small");
server_nonce[0] = static_cast<uint8>(timestamp >> 24);
server_nonce[1] = static_cast<uint8>(timestamp >> 16);
server_nonce[2] = static_cast<uint8>(timestamp >> 8);
@@ -1652,8 +1653,8 @@ HandshakeFailureReason QuicCryptoServerConfig::ValidateServerNonce(
memcpy(server_nonce + 4, server_nonce_orbit_, sizeof(server_nonce_orbit_));
memcpy(server_nonce + 4 + sizeof(server_nonce_orbit_), plaintext.data() + 4,
20);
- COMPILE_ASSERT(4 + sizeof(server_nonce_orbit_) + 20 == sizeof(server_nonce),
- bad_nonce_buffer_length);
+ static_assert(4 + sizeof(server_nonce_orbit_) + 20 == sizeof(server_nonce),
+ "bad nonce buffer length");
InsertStatus nonce_error;
{
« no previous file with comments | « net/quic/crypto/quic_crypto_server_config.h ('k') | net/quic/port_suggester.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698