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

Unified Diff: net/dns/dns_hosts.cc

Issue 899433008: DNS: Don't use forbidden non-const reference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mapped_ip too 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_hosts.cc
diff --git a/net/dns/dns_hosts.cc b/net/dns/dns_hosts.cc
index b4d213b80c451fa24935473b53a720732f8ede7e..697ea148e007f111c368b4b53d12d09daab1d780 100644
--- a/net/dns/dns_hosts.cc
+++ b/net/dns/dns_hosts.cc
@@ -131,7 +131,6 @@ void ParseHostsWithCommaMode(const std::string& contents,
DnsHosts* dns_hosts,
ParseHostsCommaMode comma_mode) {
CHECK(dns_hosts);
- DnsHosts& hosts = *dns_hosts;
StringPiece ip_text;
IPAddressNumber ip;
@@ -156,9 +155,9 @@ void ParseHostsWithCommaMode(const std::string& contents,
} else {
DnsHostsKey key(parser.token().as_string(), family);
base::StringToLowerASCII(&key.first);
- IPAddressNumber& mapped_ip = hosts[key];
- if (mapped_ip.empty())
- mapped_ip = ip;
+ IPAddressNumber* mapped_ip = &(*dns_hosts)[key];
+ if (mapped_ip->empty())
+ *mapped_ip = ip;
// else ignore this entry (first hit counts)
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698