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

Unified Diff: chromeos/network/onc/onc_utils.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix various builds. Created 4 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
Index: chromeos/network/onc/onc_utils.cc
diff --git a/chromeos/network/onc/onc_utils.cc b/chromeos/network/onc/onc_utils.cc
index 4eed8d7df78de2930132c222f70055a7ff0957a5..a13cc6fd2f881360776146a7c162e7096484c501 100644
--- a/chromeos/network/onc/onc_utils.cc
+++ b/chromeos/network/onc/onc_utils.cc
@@ -238,7 +238,7 @@ void ExpandStringsInOncObject(
void ExpandStringsInNetworks(const StringSubstitution& substitution,
base::ListValue* network_configs) {
- for (base::Value* entry : *network_configs) {
+ for (const auto& entry : *network_configs) {
base::DictionaryValue* network = nullptr;
entry->GetAsDictionary(&network);
DCHECK(network);
@@ -362,9 +362,10 @@ std::string DecodePEM(const std::string& pem_encoded) {
CertPEMsByGUIDMap GetServerAndCACertsByGUID(
const base::ListValue& certificates) {
CertPEMsByGUIDMap certs_by_guid;
- for (const base::Value* entry : certificates) {
+ for (const auto& entry : certificates) {
const base::DictionaryValue* cert = nullptr;
entry->GetAsDictionary(&cert);
+ DCHECK(cert);
danakj 2016/05/24 20:08:35 how about DCHECK the return of GetAsDictionary ins
dcheng 2016/05/24 20:39:02 Done.
std::string guid;
cert->GetStringWithoutPathExpansion(certificate::kGUID, &guid);
@@ -391,7 +392,7 @@ CertPEMsByGUIDMap GetServerAndCACertsByGUID(
}
void FillInHexSSIDFieldsInNetworks(base::ListValue* network_configs) {
- for (base::Value* entry : *network_configs) {
+ for (const auto& entry : *network_configs) {
base::DictionaryValue* network = nullptr;
entry->GetAsDictionary(&network);
DCHECK(network);
@@ -557,9 +558,10 @@ bool ResolveCertRefList(const CertPEMsByGUIDMap& certs_by_guid,
}
std::unique_ptr<base::ListValue> pem_list(new base::ListValue);
- for (const base::Value* entry : *guid_ref_list) {
+ for (const auto& entry : *guid_ref_list) {
std::string guid_ref;
- entry->GetAsString(&guid_ref);
+ if (!entry->GetAsString(&guid_ref))
danakj 2016/05/24 20:08:35 nitto
dcheng 2016/05/24 20:39:02 Done.
+ NOTREACHED();
std::string pem_encoded;
if (!GUIDRefToPEMEncoding(certs_by_guid, guid_ref, &pem_encoded))

Powered by Google App Engine
This is Rietveld 408576698