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

Unified Diff: net/dns/dns_response.cc

Issue 9716020: Add base::HostToNetXX() & NetToHostXX(), and use them to replace htonX() & ntohX() in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/dns_query.cc ('k') | net/dns/dns_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_response.cc
diff --git a/net/dns/dns_response.cc b/net/dns/dns_response.cc
index 725629bf847244dc9140079f09c05df31a83f70c..4ad6465fbfd8ce8ffc51fa9a312783b0cd23b252 100644
--- a/net/dns/dns_response.cc
+++ b/net/dns/dns_response.cc
@@ -149,11 +149,11 @@ bool DnsResponse::InitParse(int nbytes, const DnsQuery& query) {
return false;
// Match the query id.
- if (ntohs(header()->id) != query.id())
+ if (base::NetToHost16(header()->id) != query.id())
return false;
// Match question count.
- if (ntohs(header()->qdcount) != 1)
+ if (base::NetToHost16(header()->qdcount) != 1)
return false;
// Match the question section.
@@ -177,17 +177,17 @@ bool DnsResponse::IsValid() const {
uint16 DnsResponse::flags() const {
DCHECK(parser_.IsValid());
- return ntohs(header()->flags) & ~(dns_protocol::kRcodeMask);
+ return base::NetToHost16(header()->flags) & ~(dns_protocol::kRcodeMask);
}
uint8 DnsResponse::rcode() const {
DCHECK(parser_.IsValid());
- return ntohs(header()->flags) & dns_protocol::kRcodeMask;
+ return base::NetToHost16(header()->flags) & dns_protocol::kRcodeMask;
}
unsigned DnsResponse::answer_count() const {
DCHECK(parser_.IsValid());
- return ntohs(header()->ancount);
+ return base::NetToHost16(header()->ancount);
}
base::StringPiece DnsResponse::qname() const {
« no previous file with comments | « net/dns/dns_query.cc ('k') | net/dns/dns_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698