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

Side by Side Diff: net/base/x509_certificate_win.cc

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/x509_certificate_mac.cc ('k') | net/http/http_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/x509_certificate.h" 5 #include "net/base/x509_certificate.h"
6 6
7 #include "base/crypto/rsa_private_key.h" 7 #include "base/crypto/rsa_private_key.h"
8 #include "base/crypto/scoped_capi_types.h" 8 #include "base/crypto/scoped_capi_types.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 // We don't expect to have more than one CN, L, S, and C. 399 // We don't expect to have more than one CN, L, S, and C.
400 std::vector<std::string>* single_value_lists[4] = { 400 std::vector<std::string>* single_value_lists[4] = {
401 &common_names, &locality_names, &state_names, &country_names }; 401 &common_names, &locality_names, &state_names, &country_names };
402 std::string* single_values[4] = { 402 std::string* single_values[4] = {
403 &principal->common_name, &principal->locality_name, 403 &principal->common_name, &principal->locality_name,
404 &principal->state_or_province_name, &principal->country_name }; 404 &principal->state_or_province_name, &principal->country_name };
405 for (int i = 0; i < arraysize(single_value_lists); ++i) { 405 for (int i = 0; i < arraysize(single_value_lists); ++i) {
406 int length = static_cast<int>(single_value_lists[i]->size()); 406 int length = static_cast<int>(single_value_lists[i]->size());
407 DCHECK(single_value_lists[i]->size() <= 1); 407 DCHECK(single_value_lists[i]->size() <= 1);
408 if (single_value_lists[i]->size() > 0) 408 if (!single_value_lists[i]->empty())
409 *(single_values[i]) = (*(single_value_lists[i]))[0]; 409 *(single_values[i]) = (*(single_value_lists[i]))[0];
410 } 410 }
411 } 411 }
412 412
413 void AddCertsFromStore(HCERTSTORE store, 413 void AddCertsFromStore(HCERTSTORE store,
414 X509Certificate::OSCertHandles* results) { 414 X509Certificate::OSCertHandles* results) {
415 PCCERT_CONTEXT cert = NULL; 415 PCCERT_CONTEXT cert = NULL;
416 416
417 while ((cert = CertEnumCertificatesInStore(store, cert)) != NULL) { 417 while ((cert = CertEnumCertificatesInStore(store, cert)) != NULL) {
418 PCCERT_CONTEXT to_add = NULL; 418 PCCERT_CONTEXT to_add = NULL;
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 DWORD sha1_size = sizeof(sha1.data); 971 DWORD sha1_size = sizeof(sha1.data);
972 rv = CryptHashCertificate(NULL, CALG_SHA1, 0, cert->pbCertEncoded, 972 rv = CryptHashCertificate(NULL, CALG_SHA1, 0, cert->pbCertEncoded,
973 cert->cbCertEncoded, sha1.data, &sha1_size); 973 cert->cbCertEncoded, sha1.data, &sha1_size);
974 DCHECK(rv && sha1_size == sizeof(sha1.data)); 974 DCHECK(rv && sha1_size == sizeof(sha1.data));
975 if (!rv) 975 if (!rv)
976 memset(sha1.data, 0, sizeof(sha1.data)); 976 memset(sha1.data, 0, sizeof(sha1.data));
977 return sha1; 977 return sha1;
978 } 978 }
979 979
980 } // namespace net 980 } // namespace net
OLDNEW
« no previous file with comments | « net/base/x509_certificate_mac.cc ('k') | net/http/http_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698