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

Side by Side Diff: net/dns/record_rdata.h

Issue 2118383006: Fix "conversion of size_t to unsigned int" warning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-inline NsecRecordRdata::bitmap_length() and remove DCHECK Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef NET_DNS_RECORD_RDATA_H_ 5 #ifndef NET_DNS_RECORD_RDATA_H_
6 #define NET_DNS_RECORD_RDATA_H_ 6 #define NET_DNS_RECORD_RDATA_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 public: 191 public:
192 static const uint16_t kType = dns_protocol::kTypeNSEC; 192 static const uint16_t kType = dns_protocol::kTypeNSEC;
193 193
194 ~NsecRecordRdata() override; 194 ~NsecRecordRdata() override;
195 static std::unique_ptr<NsecRecordRdata> Create(const base::StringPiece& data, 195 static std::unique_ptr<NsecRecordRdata> Create(const base::StringPiece& data,
196 const DnsRecordParser& parser); 196 const DnsRecordParser& parser);
197 bool IsEqual(const RecordRdata* other) const override; 197 bool IsEqual(const RecordRdata* other) const override;
198 uint16_t Type() const override; 198 uint16_t Type() const override;
199 199
200 // Length of the bitmap in bits. 200 // Length of the bitmap in bits.
201 unsigned bitmap_length() const { return bitmap_.size() * 8; } 201 // This will be between 8-256, as the bitmap is required to be between 1-32
202 // bytes long (this is verified by Create()).
Ryan Sleevi 2016/07/06 16:29:03 This is the sort of comment that makes me uneasy i
Rob Percival 2016/07/06 17:14:44 I had the same feeling when I wrote it. I wasn't c
203 uint16_t bitmap_length() const {
204 return static_cast<uint16_t>(bitmap_.size() * 8);
205 }
202 206
203 // Returns bit i-th bit in the bitmap, where bits withing a byte are organized 207 // Returns bit i-th bit in the bitmap, where bits withing a byte are organized
204 // most to least significant. If it is set, a record with rrtype i exists for 208 // most to least significant. If it is set, a record with rrtype i exists for
205 // the domain name of this nsec record. 209 // the domain name of this nsec record.
206 bool GetBit(unsigned i) const; 210 bool GetBit(unsigned i) const;
207 211
208 private: 212 private:
209 NsecRecordRdata(); 213 NsecRecordRdata();
210 214
211 std::vector<uint8_t> bitmap_; 215 std::vector<uint8_t> bitmap_;
212 216
213 DISALLOW_COPY_AND_ASSIGN(NsecRecordRdata); 217 DISALLOW_COPY_AND_ASSIGN(NsecRecordRdata);
214 }; 218 };
215 219
216 220
217 } // namespace net 221 } // namespace net
218 222
219 #endif // NET_DNS_RECORD_RDATA_H_ 223 #endif // NET_DNS_RECORD_RDATA_H_
OLDNEW
« 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