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

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

Issue 761863002: Clean up type usage and fix MSVC "truncated value" warnings in net/quic/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More work Created 6 years, 1 month 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
Index: net/quic/crypto/p256_key_exchange_nss.cc
diff --git a/net/quic/crypto/p256_key_exchange_nss.cc b/net/quic/crypto/p256_key_exchange_nss.cc
index 73aa03d238116cfecbadf7703f9efe93079c6a45..3296a6f566b8b34005a993b2c77ee44c7c624f17 100644
--- a/net/quic/crypto/p256_key_exchange_nss.cc
+++ b/net/quic/crypto/p256_key_exchange_nss.cc
@@ -5,6 +5,7 @@
#include "net/quic/crypto/p256_key_exchange.h"
#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
#include "base/sys_byteorder.h"
using base::StringPiece;
@@ -131,7 +132,7 @@ string P256KeyExchange::NewPrivateKey() {
}
// TODO(thaidn): determine how large encrypted private key can be
- uint16 private_key_size = private_key.size();
+ uint16 private_key_size = base::checked_cast<uint16>(private_key.size());
Peter Kasting 2014/11/27 01:58:37 The old code sized |result| according to the caste
const size_t result_size = sizeof(private_key_size) +
private_key_size +
public_key.size();

Powered by Google App Engine
This is Rietveld 408576698