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

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

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 years, 7 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/common_cert_set.h ('k') | net/quic/crypto/common_cert_set_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/common_cert_set.cc
diff --git a/net/quic/crypto/common_cert_set.cc b/net/quic/crypto/common_cert_set.cc
index 78aa9276197b303f54e427f7ca31b2ac37f62945..ee1ac67dcf7b8dfef7c60e3ba4b8578ebbeff213 100644
--- a/net/quic/crypto/common_cert_set.cc
+++ b/net/quic/crypto/common_cert_set.cc
@@ -53,17 +53,17 @@ StringPiece CommonCertSetsQUIC::GetCommonHashes() const {
}
StringPiece CommonCertSetsQUIC::GetCert(uint64 hash, uint32 index) const {
+ StringPiece cert;
for (size_t i = 0; i < arraysize(kSets); i++) {
if (kSets[i].hash == hash) {
- if (index >= kSets[i].num_certs) {
- return StringPiece();
+ if (index < kSets[i].num_certs) {
+ cert.set(kSets[i].certs[index], kSets[i].lens[index]);
}
- return StringPiece(reinterpret_cast<const char*>(kSets[i].certs[index]),
- kSets[i].lens[index]);
+ break;
}
}
- return StringPiece();
+ return cert;
}
// Compare returns a value less than, equal to or greater than zero if |a| is
@@ -110,11 +110,7 @@ bool CommonCertSetsQUIC::MatchCert(StringPiece cert,
// Binary search for a matching certificate.
size_t min = 0;
size_t max = kSets[j].num_certs - 1;
- for (;;) {
- if (max < min) {
- break;
- }
-
+ while (max >= min) {
size_t mid = min + ((max - min) / 2);
int n = Compare(cert, kSets[j].certs[mid], kSets[j].lens[mid]);
if (n < 0) {
« no previous file with comments | « net/quic/crypto/common_cert_set.h ('k') | net/quic/crypto/common_cert_set_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698