NameComparisonResult
LabelSequence::compare(const LabelSequence& other,
- bool case_sensitive) const {
+ bool case_sensitive) const
+{
if (isAbsolute() ^ other.isAbsolute()) {
return (NameComparisonResult(0, 0, NameComparisonResult::NONE));
}
unsigned int nlabels = 0;
int l1 = last_label_ - first_label_;
int l2 = other.last_label_ - other.first_label_;
- int ldiff = (int)l1 - (int)l2;
+ const int ldiff = static_cast<int>(l1) - static_cast<int>(l2);
unsigned int l = (ldiff < 0) ? l1 : l2;
while (l > 0) {
// bitstring labels.
assert(count1 <= Name::MAX_LABELLEN && count2 <= Name::MAX_LABELLEN);
- int cdiff = (int)count1 - (int)count2;
+ const int cdiff = static_cast<int>(count1) - static_cast<int>(count2);
unsigned int count = (cdiff < 0) ? count1 : count2;
while (count > 0) {
- uint8_t label1 = data_[pos1];
- uint8_t label2 = other.data_[pos2];
+ const uint8_t label1 = data_[pos1];
+ const uint8_t label2 = other.data_[pos2];
int chdiff;
if (case_sensitive) {
- chdiff = (int)label1 - (int)label2;
+ chdiff = static_cast<int>(label1) - static_cast<int>(label2);
} else {
- chdiff = (int)isc::dns::name::internal::maptolower[label1] -
- (int)isc::dns::name::internal::maptolower[label2];
+ chdiff = static_cast<int>(
+ isc::dns::name::internal::maptolower[label1]) -
+ static_cast<int>(
+ isc::dns::name::internal::maptolower[label2]);
}
if (chdiff != 0) {
/// LabelSequences can be compared to other LabelSequences, and their
/// data can be requested (which then points to part of the original
/// data of the original Name object).
-///
class LabelSequence {
// Name calls the private toText(bool) method of LabelSequence.
friend std::string Name::toText(bool) const;
} // end namespace isc
#endif
+
+// Local Variables:
+// mode: c++
+// End: