Commit 38d7d64c authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2112] Fix initialization in for loops (for Microsoft C++)

parent 90460192
......@@ -103,7 +103,7 @@ DatabaseClient::findZone(const Name& name) const {
}
// Then super domains
// Start from 1, as 0 is covered above
for (size_t i(1); i < name.getLabelCount(); ++i) {
for (size_t i = 1; i < name.getLabelCount(); ++i) {
isc::dns::Name superdomain(name.split(i));
zone = accessor_->getZone(superdomain.toText());
if (zone.first) {
......@@ -344,7 +344,7 @@ DatabaseClient::Finder::getRRsets(const string& name, const WantedTypes& types,
}
if (!sig_store.empty()) {
// Add signatures to all found RRsets
for (std::map<RRType, RRsetPtr>::iterator i(result.begin());
for (std::map<RRType, RRsetPtr>::iterator i = result.begin();
i != result.end(); ++ i) {
sig_store.appendSignatures(i->second);
}
......@@ -760,7 +760,7 @@ DatabaseClient::Finder::FindDNSSECContext::probe() {
const string origin = finder_.getOrigin().toText();
const FoundRRsets nsec3_found =
finder_.getRRsets(origin, NSEC3PARAM_TYPES(), true);
const FoundIterator nfi=
const FoundIterator nfi =
nsec3_found.second.find(RRType::NSEC3PARAM());
is_nsec3_ = (nfi != nsec3_found.second.end());
......@@ -908,7 +908,7 @@ DatabaseClient::Finder::findOnNameResult(const Name& name,
if (any) {
// An ANY query, copy everything to the target instead of returning
// directly.
for (FoundIterator it(found.second.begin());
for (FoundIterator it = found.second.begin();
it != found.second.end(); ++it) {
if (it->second) {
// Skip over the empty ANY
......@@ -1110,7 +1110,7 @@ DatabaseClient::Finder::findNSEC3(const Name& name, bool recursive) {
// We keep stripping the leftmost label until we find something.
// In case it is recursive, we'll exit the loop at the first iteration.
for (unsigned labels(qlabels); labels >= olabels; -- labels) {
for (unsigned labels = qlabels; labels >= olabels; --labels) {
const string hash(calculator->calculate(labels == qlabels ? name :
name.split(qlabels - labels,
labels)));
......
......@@ -142,7 +142,7 @@ public:
" \"noiter.org\", \"null.org\"]"
"}]"))
{
for (size_t i(0); i < ds_count; ++ i) {
for (size_t i = 0; i < ds_count; ++ i) {
boost::shared_ptr<MockDataSourceClient>
ds(new MockDataSourceClient(ds_zones[i]));
ds_.push_back(ds);
......@@ -155,12 +155,12 @@ public:
~ListTest() {
ds_info_.clear();
for (size_t i(0); i < ds_count; ++ i) {
for (size_t i = 0; i < ds_count; ++ i) {
ds_[i].reset();
}
ds_.clear();
for (size_t i(0); i < ds_count; ++ i) {
for (size_t i = 0; i < ds_count; ++ i) {
boost::interprocess::file_mapping::remove(
getMappedFilename(i).c_str());
}
......@@ -465,7 +465,7 @@ const char* const test_names[] = {
TEST_P(ListTest, multiExactMatch) {
// Run through all the multi-configurations
for (size_t i(0); i < sizeof(test_names) / sizeof(*test_names); ++i) {
for (size_t i = 0; i < sizeof(test_names) / sizeof(*test_names); ++i) {
SCOPED_TRACE(test_names[i]);
multiConfiguration(i);
// Something that is nowhere there
......@@ -484,7 +484,7 @@ TEST_P(ListTest, multiExactMatch) {
TEST_P(ListTest, multiBestMatch) {
// Run through all the multi-configurations
for (size_t i(0); i < 4; ++ i) {
for (size_t i = 0; i < 4; ++ i) {
SCOPED_TRACE(test_names[i]);
multiConfiguration(i);
// Something that is nowhere there
......@@ -545,7 +545,7 @@ TEST_P(ListTest, configureParams) {
"{}",
NULL
};
for (const char** param(params); *param; ++param) {
for (const char** param = params; *param; ++param) {
SCOPED_TRACE(*param);
ConstElementPtr elem(Element::fromJSON(string("["
"{"
......@@ -672,7 +672,7 @@ TEST_P(ListTest, wrongConfig) {
// Put something inside to see it survives the exception
list_->configure(config_elem_, true);
checkDS(0, "test_type", "{}", false);
for (const char** config(configs); *config; ++config) {
for (const char** config = configs; *config; ++config) {
SCOPED_TRACE(*config);
ConstElementPtr elem(Element::fromJSON(*config));
EXPECT_THROW(list_->configure(elem, true),
......
......@@ -293,7 +293,7 @@ private:
if (position_ == domain_.end()) {
return (false);
} else {
for (size_t i(0); i < COLUMN_COUNT; ++ i) {
for (size_t i = 0; i < COLUMN_COUNT; ++i) {
columns[i] = (*position_)[i];
}
++ position_;
......@@ -1814,7 +1814,7 @@ doFindAllTestResult(ZoneFinder& finder, const isc::dns::Name& name,
std::sort(rdata.begin(), rdata.end());
std::sort(expected_rdata.begin(), expected_rdata.end());
ASSERT_EQ(expected_rdata.size(), rdata.size());
for (size_t i(0); i < expected_rdata.size(); ++ i) {
for (size_t i = 0; i < expected_rdata.size(); ++i) {
EXPECT_EQ(expected_rdata[i], rdata[i]);
}
EXPECT_TRUE(expected_rdata == rdata);
......@@ -3023,7 +3023,7 @@ TEST_P(DatabaseClientTest, findRRSIGsWithoutDNSSEC) {
std::sort(rdata.begin(), rdata.end());
std::sort(expected_rdata.begin(), expected_rdata.end());
ASSERT_EQ(expected_rdata.size(), rdata.size());
for (size_t i(0); i < expected_rdata.size(); ++ i) {
for (size_t i = 0; i < expected_rdata.size(); ++i) {
EXPECT_EQ(expected_rdata[i], rdata[i]);
}
}
......@@ -3065,7 +3065,7 @@ TEST_P(DatabaseClientTest, getAll) {
EXPECT_EQ(RRType::A(), target[a_idx]->getType());
std::string previous;
size_t count(0);
for (RdataIteratorPtr it(target[a_idx]->getRdataIterator());
for (RdataIteratorPtr it = target[a_idx]->getRdataIterator();
!it->isLast(); it->next()) {
++count;
EXPECT_NE(previous, it->getCurrent().toText());
......
......@@ -52,7 +52,7 @@ public:
rrset.getTTL()));
EXPECT_FALSE(rrset.getRRsig()) << "Unexpected RRSIG on rrset, not "
"copying. Following check will likely fail as a result.";
for (isc::dns::RdataIteratorPtr it(rrset.getRdataIterator());
for (isc::dns::RdataIteratorPtr it = rrset.getRdataIterator();
!it->isLast(); it->next()) {
copy->addRdata(it->getCurrent());
}
......
......@@ -1253,7 +1253,7 @@ previousWalk(TestDomainTree& dtree, const TestDomainTreeNode* node,
EXPECT_EQ(static_cast<void*>(NULL), node);
node = dtree.previousNode(node_path);
}
for (size_t i(chain_length); i > 0; --i) {
for (size_t i = chain_length; i > 0; --i) {
EXPECT_NE(static_cast<void*>(NULL), node);
EXPECT_EQ(Name(ordered_names[i - 1]), node_path.getAbsoluteName());
// Find the node at the path and check the value is the same
......
......@@ -128,7 +128,7 @@ private:
MockDataSourceClient::MockDataSourceClient(const char* zone_names[]) :
have_a_(true), use_baditerator_(true)
{
for (const char** zone(zone_names); *zone; ++zone) {
for (const char** zone = zone_names; *zone; ++zone) {
zones.insert(Name(*zone));
}
}
......@@ -145,7 +145,7 @@ MockDataSourceClient::MockDataSourceClient(
EXPECT_NE("MasterFiles", type) << "MasterFiles is a special case "
"and it never should be created as a data source client";
if (configuration_->getType() == data::Element::list) {
for (size_t i(0); i < configuration_->size(); ++i) {
for (size_t i = 0; i < configuration_->size(); ++i) {
zones.insert(Name(configuration_->get(i)->stringValue()));
}
}
......
......@@ -130,7 +130,7 @@ ZoneFinder::stripRRsigs(isc::dns::ConstRRsetPtr rp,
rp->getClass(),
rp->getType(),
rp->getTTL()));
for (isc::dns::RdataIteratorPtr i(rp->getRdataIterator());
for (isc::dns::RdataIteratorPtr i = rp->getRdataIterator();
!i->isLast();
i->next()) {
result_base->addRdata(i->getCurrent());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment