Commit 5f4eb187 authored by Jelte Jansen's avatar Jelte Jansen

[1193] updates to fix cppcheck-1.53 warnings

parent 6ab057e9
......@@ -4,8 +4,16 @@ debug
missingInclude
// This is a template, and should be excluded from the check
unreadVariable:src/lib/dns/rdata/template.cc:61
// Intentional self assignment tests. Suppress warning about them.
selfAssignment:src/lib/dns/tests/name_unittest.cc:293
selfAssignment:src/lib/dns/tests/rdata_unittest.cc:228
selfAssignment:src/lib/dns/tests/tsigkey_unittest.cc:137
selfAssignment:src/lib/dns/tests/rdata_txt_like_unittest.cc:222
// Intentional self-comparisons
duplicateExpression:src/lib/dns/tests/name_unittest.cc:569
duplicateExpression:src/lib/dns/tests/name_unittest.cc:580
duplicateExpression:src/lib/dns/tests/rrttl_unittest.cc:164
duplicateExpression:src/lib/dns/tests/rrttl_unittest.cc:175
// Intentional self-comparisons
uselessCallsCompare:src/lib/dns/tests/rdata_dhcid_unittest.cc:96
uselessCallsCompare:src/lib/dns/tests/rdata_in_a_unittest.cc:98
uselessCallsCompare:src/lib/dns/tests/rdata_in_aaaa_unittest.cc:94
uselessCallsCompare:src/lib/dns/tests/rdata_mx_unittest.cc:104
uselessCallsCompare:src/lib/dns/tests/rdata_unittest.cc:254
......@@ -466,7 +466,6 @@ ModuleSpec::validateSpecList(ConstElementPtr spec, ConstElementPtr data,
const bool full, ElementPtr errors) const
{
bool validated = true;
std::string cur_item_name;
BOOST_FOREACH(ConstElementPtr cur_spec_el, spec->listValue()) {
if (!validateSpec(cur_spec_el, data, full, errors)) {
validated = false;
......
......@@ -1311,7 +1311,6 @@ checkConfig(ConstElementPtr config, ElementPtr errors) {
}
return (result);
return true;
}
} // end anonymous namespace
......
......@@ -130,7 +130,7 @@ IfaceMgr::IfaceMgr()
// interface detection is implemented. Otherwise
// it is not possible to run tests in a portable
// way (see detectIfaces() method).
throw ex;
throw;
}
}
......@@ -191,7 +191,7 @@ IfaceMgr::stubDetectIfaces() {
// TODO Do LOG_FATAL here
std::cerr << "Interface detection failed." << std::endl;
throw ex;
throw;
}
}
......
......@@ -377,8 +377,9 @@ Message_getTSIGRecord(s_Message* self) {
if (tsig_record == NULL) {
Py_RETURN_NONE;
} else {
return (createTSIGRecordObject(*tsig_record));
}
return (createTSIGRecordObject(*tsig_record));
} catch (const InvalidMessageOperation& ex) {
PyErr_SetString(po_InvalidMessageOperation, ex.what());
} catch (const exception& ex) {
......
......@@ -543,7 +543,7 @@ TEST_F(NameTest, leq) {
// small <= small is true
EXPECT_TRUE(small_name.leq(small_name));
EXPECT_TRUE(small_name <= small_name);
EXPECT_LE(small_name, small_name);
// large <= small is false
EXPECT_FALSE(large_name.leq(small_name));
......@@ -555,7 +555,7 @@ TEST_F(NameTest, geq) {
EXPECT_TRUE(large_name >= small_name);
EXPECT_TRUE(large_name.geq(large_name));
EXPECT_TRUE(large_name >= large_name);
EXPECT_GE(large_name, large_name);
EXPECT_FALSE(small_name.geq(large_name));
EXPECT_FALSE(small_name >= large_name);
......
......@@ -138,7 +138,7 @@ TEST_F(RRTTLTest, leq) {
// small <= small is true
EXPECT_TRUE(ttl_small.leq(ttl_small));
EXPECT_TRUE(ttl_small <= ttl_small);
EXPECT_LE(ttl_small, ttl_small);
// large <= small is false
EXPECT_FALSE(ttl_large.leq(ttl_small));
......@@ -150,7 +150,7 @@ TEST_F(RRTTLTest, geq) {
EXPECT_TRUE(ttl_large >= ttl_small);
EXPECT_TRUE(ttl_large.geq(ttl_large));
EXPECT_TRUE(ttl_large >= ttl_large);
EXPECT_GE(ttl_large, ttl_large);
EXPECT_FALSE(ttl_small.geq(ttl_large));
EXPECT_FALSE(ttl_small >= ttl_large);
......
......@@ -86,8 +86,8 @@ GlueHints::GlueHints(const std::string& zone_name,
bool
GlueHints::hasGlue(AddressFamily family) const {
return ((addresses_v4.size() > 0 && (family == ANY_OK || family == V4_ONLY)) ||
(addresses_v6.size() > 0 && (family == ANY_OK || family == V6_ONLY)));
return ((!addresses_v4.empty() && (family == ANY_OK || family == V4_ONLY)) ||
(!addresses_v6.empty() && (family == ANY_OK || family == V6_ONLY)));
}
NameserverAddress
......
......@@ -59,7 +59,7 @@ struct HashTableSlot {
/// \brief Copy Constructor
///
/// ... which as noted in the class description does not copy.
HashTableSlot(const HashTableSlot<T>&)
HashTableSlot(const HashTableSlot<T>&) : mutex_(), list_()
{ }
public:
......
......@@ -139,7 +139,7 @@ TEST_F(NameserverEntryTest, SetRTT) {
NameserverEntry::AddressVector vec;
alpha->getAddresses(vec);
ASSERT_TRUE(vec.size() > 0);
ASSERT_FALSE(vec.empty());
// Take the first address and change the RTT.
IOAddress first_address = vec[0].getAddress();
......@@ -174,7 +174,7 @@ TEST_F(NameserverEntryTest, Unreachable) {
NameserverEntry::AddressVector vec;
alpha->getAddresses(vec);
ASSERT_TRUE(vec.size() > 0);
ASSERT_FALSE(vec.empty());
// Take the first address and mark as unreachable.
IOAddress first_address = vec[0].getAddress();
......
......@@ -329,7 +329,7 @@ updateAddressSelector(std::vector<NameserverAddress>& addresses,
it != probabilities.end(); ++it){
(*it) /= sum;
}
} else if(probabilities.size() > 0){
} else if(!probabilities.empty()){
// If all the nameservers are unreachable, the sum will be 0
// So give each server equal opportunity to be selected.
for(vector<double>::iterator it = probabilities.begin();
......
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