BIND 10 trac1470, updated. 0fd58479c441c0ce5584df6ab898594345e69ef5 [1470] Corrected data type of index into vector
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Dec 12 20:35:13 UTC 2011
The branch, trac1470 has been updated
via 0fd58479c441c0ce5584df6ab898594345e69ef5 (commit)
via c066e58bd521a107d027818f47268c5183ec5b18 (commit)
via ae4e8ba0c81e273b515147e916e28924c2804c14 (commit)
via b5f53a509974185553f40022b947c9c515992493 (commit)
via f15d8831381af8a56c62e5e8a762166fcd053422 (commit)
via 0a5f810dd86794befad38590f68d3725828379eb (commit)
via cd4c9eb0868200fbd53beef6eebc35ba6982a798 (commit)
via 5dbdcfa0a3fdeab7b8757a8a22ff6d5b9cf87cbb (commit)
via c4ca960f3139817c9d3baf35c2b975a240c8acd2 (commit)
via 5cdcda0439416cbe1610a5990d30441c20e571eb (commit)
via f18114000f75a0615ae97e36c54881754cc84be9 (commit)
via 0213d987ac8b4fb30bc1aa1ee6bd67cdfde02ce0 (commit)
via 62463d1d0236e7fb6c3bfc94b3b66e46c875ca93 (commit)
via bf2e60ca2a5bd14d057c5ad292b752e980d9637b (commit)
via 29003e06a65e9cbd18f83d44e197e70542a2a6a2 (commit)
via 0daa6e10d2b7446069b3e43b8cbf80691270431f (commit)
via 0910b0f180332e46fd0bac7867c646f76e040615 (commit)
via c254f7fcb4fac6b47cc880221aa5d28a0772b641 (commit)
from 1615a521d61a0f47a627f92cc4f95d982a04f8d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0fd58479c441c0ce5584df6ab898594345e69ef5
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 19:54:10 2011 +0000
[1470] Corrected data type of index into vector
commit c066e58bd521a107d027818f47268c5183ec5b18
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 19:51:38 2011 +0000
[1470] Correct declaration of getAdditive()
commit ae4e8ba0c81e273b515147e916e28924c2804c14
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 19:42:06 2011 +0000
[1470] Forward declare OutputOption as a struct.
commit b5f53a509974185553f40022b947c9c515992493
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 19:40:01 2011 +0000
[1470] Correct data type of variable
commit f15d8831381af8a56c62e5e8a762166fcd053422
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 19:37:13 2011 +0000
[1470] Added checks for zero length data
commit 0a5f810dd86794befad38590f68d3725828379eb
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 19:16:59 2011 +0000
[1470] Remove redundant include file
commit cd4c9eb0868200fbd53beef6eebc35ba6982a798
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 19:13:05 2011 +0000
[1470] Correct data type of counter
commit 5dbdcfa0a3fdeab7b8757a8a22ff6d5b9cf87cbb
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 18:48:22 2011 +0000
[1470] Check for null filename before attempting to open master file
commit c4ca960f3139817c9d3baf35c2b975a240c8acd2
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 18:37:57 2011 +0000
[1470] Change "for" loop initialization to more standard style
commit 5cdcda0439416cbe1610a5990d30441c20e571eb
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 18:20:46 2011 +0000
[1470] Correct data type of member variable in MockAccess::MockIteratorNameContext
commit f18114000f75a0615ae97e36c54881754cc84be9
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 18:12:39 2011 +0000
[1470] Iterate over unchanging map when removing identical elements
A method iterates over a std::map and removes from it elements that
match those in another map. This can lead to a problem on some
operating systems if the element removal affects the iterator.
The fix here is to iterate over the (unchanging) reference map.
commit 0213d987ac8b4fb30bc1aa1ee6bd67cdfde02ce0
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 17:34:26 2011 +0000
[1470] Removed declared but unused exception variable
This leads to a warning on some compiler.
commit 62463d1d0236e7fb6c3bfc94b3b66e46c875ca93
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 17:14:03 2011 +0000
[1470] Reconcile declaration of Data
The .cc has it defined as "struct" and the .h file referenced a
"class". This has now been harmonised as "struct".
commit bf2e60ca2a5bd14d057c5ad292b752e980d9637b
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 17:09:00 2011 +0000
[1470] Change some loop indexes to unsigned values
Some loops changed to use unsigned loop indexes to avoid warning
messages from some compilers.
commit 29003e06a65e9cbd18f83d44e197e70542a2a6a2
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 15:39:41 2011 +0000
[1470] Qualify "error_code"
One compiler had a problem with the unqualifier data type
"error_code". This has been changed to "asio::error_code".
commit 0daa6e10d2b7446069b3e43b8cbf80691270431f
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 14:45:25 2011 +0000
[1470] Make io_fetch.cc and .h consistent about type of IOFetchData
Was declared as "class" in one and "struct" in another - now declared
as "struct" in both.
commit 0910b0f180332e46fd0bac7867c646f76e040615
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 14:40:31 2011 +0000
[1470] Replace char by uint8_t for initialized numeric data
commit c254f7fcb4fac6b47cc880221aa5d28a0772b641
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 12 14:29:12 2011 +0000
[1470] Remove "this" from initializer lists
Some compilers warn if "this" is referred to in a constructor
initialization list. This change replaces such initializations
with an assignment within the constructor body.
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/auth_srv.cc | 13 ++++++-----
src/bin/resolver/resolver.cc | 12 ++++++++--
src/lib/acl/tests/ip_check_unittest.cc | 8 +++---
src/lib/asiodns/dns_lookup.h | 4 ++-
src/lib/asiodns/dns_server.h | 4 ++-
src/lib/asiodns/io_fetch.h | 2 +-
src/lib/asiodns/tcp_server.cc | 2 +-
src/lib/asiodns/tests/dns_server_unittest.cc | 2 +-
src/lib/asiodns/tests/io_fetch_unittest.cc | 15 +++++++++----
src/lib/asiodns/udp_server.cc | 2 +-
src/lib/asiodns/udp_server.h | 2 +-
src/lib/asiolink/io_address.cc | 2 +-
src/lib/asiolink/simple_callback.h | 4 ++-
src/lib/asiolink/tcp_socket.h | 2 +-
src/lib/bench/benchmark.h | 2 +-
src/lib/bench/benchmark_util.cc | 2 +-
src/lib/cache/resolver_cache.cc | 9 +++++--
src/lib/cc/data.cc | 14 ++++++++----
src/lib/cc/session.cc | 2 +-
src/lib/cc/tests/data_unittests.cc | 6 +++++
src/lib/cryptolink/tests/crypto_unittests.cc | 3 +-
src/lib/datasrc/rbtree.h | 13 ++++++++---
src/lib/datasrc/tests/database_unittest.cc | 18 ++++++++--------
src/lib/datasrc/tests/memory_datasrc_unittest.cc | 8 +++---
src/lib/dhcp/libdhcp.cc | 2 +-
src/lib/dns/masterload.cc | 5 +++-
src/lib/dns/messagerenderer.cc | 2 +-
src/lib/dns/python/pydnspp_common.cc | 1 -
src/lib/dns/rdata.cc | 10 ++++++--
src/lib/dns/rdata/generic/dnskey_48.cc | 2 +-
src/lib/dns/rdata/generic/nsec3_50.cc | 2 +-
src/lib/dns/rdata/generic/nsec_47.cc | 2 +-
src/lib/dns/rdatafields.cc | 4 +-
src/lib/dns/tests/message_unittest.cc | 2 +-
src/lib/dns/tests/unittest_util.cc | 4 +-
src/lib/log/compiler/message.cc | 2 +-
src/lib/log/logger_manager.cc | 2 +-
src/lib/log/logger_manager_impl.h | 2 +-
src/lib/log/logger_specification.h | 2 +-
src/lib/log/tests/logger_manager_unittest.cc | 2 +-
src/lib/nsas/hash_key.cc | 2 +-
src/lib/python/isc/log/log.cc | 4 +-
src/lib/resolve/recursive_query.cc | 5 +++-
src/lib/resolve/response_classifier.cc | 9 ++++---
.../resolve/tests/recursive_query_unittest_2.cc | 21 ++++++++++++++-----
src/lib/server_common/portconfig.cc | 2 +-
src/lib/util/strutil.cc | 2 +-
src/lib/util/strutil.h | 2 +-
src/lib/util/tests/base32hex_unittest.cc | 2 +-
src/lib/util/tests/hex_unittest.cc | 2 +-
src/lib/util/time_utilities.cc | 2 +-
51 files changed, 153 insertions(+), 97 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc
index caf69b9..92eec6f 100644
--- a/src/bin/auth/auth_srv.cc
+++ b/src/bin/auth/auth_srv.cc
@@ -228,12 +228,13 @@ private:
AuthSrv* server_;
};
-AuthSrv::AuthSrv(const bool use_cache, AbstractXfroutClient& xfrout_client) :
- impl_(new AuthSrvImpl(use_cache, xfrout_client)),
- checkin_(new ConfigChecker(this)),
- dns_lookup_(new MessageLookup(this)),
- dns_answer_(new MessageAnswer(this))
-{}
+AuthSrv::AuthSrv(const bool use_cache, AbstractXfroutClient& xfrout_client)
+{
+ impl_ = new AuthSrvImpl(use_cache, xfrout_client);
+ checkin_ = new ConfigChecker(this);
+ dns_lookup_ = new MessageLookup(this);
+ dns_answer_ = new MessageAnswer(this);
+}
void
AuthSrv::stop() {
diff --git a/src/bin/resolver/resolver.cc b/src/bin/resolver/resolver.cc
index bb1eb3b..473a9c2 100644
--- a/src/bin/resolver/resolver.cc
+++ b/src/bin/resolver/resolver.cc
@@ -354,13 +354,19 @@ private:
Resolver::Resolver() :
impl_(new ResolverImpl()),
dnss_(NULL),
- checkin_(new ConfigCheck(this)),
- dns_lookup_(new MessageLookup(this)),
+ checkin_(NULL),
+ dns_lookup_(NULL),
dns_answer_(new MessageAnswer),
nsas_(NULL),
cache_(NULL),
configured_(false)
-{}
+{
+ // Operations referring to "this" must be done in the constructor body
+ // (some compilers will issue warnings if "this" is referred to in the
+ // initialization list).
+ checkin_ = new ConfigCheck(this);
+ dns_lookup_ = new MessageLookup(this);
+}
Resolver::~Resolver() {
delete impl_;
diff --git a/src/lib/acl/tests/ip_check_unittest.cc b/src/lib/acl/tests/ip_check_unittest.cc
index 8b8c498..5f40baa 100644
--- a/src/lib/acl/tests/ip_check_unittest.cc
+++ b/src/lib/acl/tests/ip_check_unittest.cc
@@ -162,7 +162,7 @@ TEST(IPFunctionCheck, SplitIPAddress) {
TEST(IPAddress, constructIPv4) {
IPAddress ipaddr(tests::getSockAddr("192.0.2.1"));
- const char expected_data[4] = { 192, 0, 2, 1 };
+ const uint8_t expected_data[4] = { 192, 0, 2, 1 };
EXPECT_EQ(AF_INET, ipaddr.getFamily());
EXPECT_EQ(4, ipaddr.getLength());
EXPECT_EQ(0, memcmp(expected_data, ipaddr.getData(), 4));
@@ -170,9 +170,9 @@ TEST(IPAddress, constructIPv4) {
TEST(IPAddress, constructIPv6) {
IPAddress ipaddr(tests::getSockAddr("2001:db8:1234:abcd::53"));
- const char expected_data[16] = { 0x20, 0x01, 0x0d, 0xb8, 0x12, 0x34, 0xab,
- 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x53 };
+ const uint8_t expected_data[16] = { 0x20, 0x01, 0x0d, 0xb8, 0x12, 0x34, 0xab,
+ 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x53 };
EXPECT_EQ(AF_INET6, ipaddr.getFamily());
EXPECT_EQ(16, ipaddr.getLength());
EXPECT_EQ(0, memcmp(expected_data, ipaddr.getData(), 16));
diff --git a/src/lib/asiodns/dns_lookup.h b/src/lib/asiodns/dns_lookup.h
index 40290e4..5dc84ac 100644
--- a/src/lib/asiodns/dns_lookup.h
+++ b/src/lib/asiodns/dns_lookup.h
@@ -51,7 +51,9 @@ protected:
///
/// This is intentionally defined as \c protected as this base class
/// should never be instantiated (except as part of a derived class).
- DNSLookup() : self_(this) {}
+ DNSLookup() {
+ self_ = this;
+ }
public:
/// \brief The destructor
virtual ~DNSLookup() {}
diff --git a/src/lib/asiodns/dns_server.h b/src/lib/asiodns/dns_server.h
index f235860..d3a8528 100644
--- a/src/lib/asiodns/dns_server.h
+++ b/src/lib/asiodns/dns_server.h
@@ -53,7 +53,9 @@ protected:
/// This is intentionally defined as \c protected, as this base class
/// should never be instantiated except as part of a derived class.
//@{
- DNSServer() : self_(this) {}
+ DNSServer() {
+ self_ = this;
+ }
public:
/// \brief The destructor
virtual ~DNSServer() {}
diff --git a/src/lib/asiodns/io_fetch.h b/src/lib/asiodns/io_fetch.h
index 9626ffe..ee0aacd 100644
--- a/src/lib/asiodns/io_fetch.h
+++ b/src/lib/asiodns/io_fetch.h
@@ -35,7 +35,7 @@ namespace isc {
namespace asiodns {
// Forward declarations
-class IOFetchData;
+struct IOFetchData;
/// \brief Upstream Fetch Processing
///
diff --git a/src/lib/asiodns/tcp_server.cc b/src/lib/asiodns/tcp_server.cc
index f91eb32..2606a21 100644
--- a/src/lib/asiodns/tcp_server.cc
+++ b/src/lib/asiodns/tcp_server.cc
@@ -70,7 +70,7 @@ TCPServer::TCPServer(io_service& io_service,
}
void
-TCPServer::operator()(error_code ec, size_t length) {
+TCPServer::operator()(asio::error_code ec, size_t length) {
/// Because the coroutine reentry block is implemented as
/// a switch statement, inline variable declarations are not
/// permitted. Certain variables used below can be declared here.
diff --git a/src/lib/asiodns/tests/dns_server_unittest.cc b/src/lib/asiodns/tests/dns_server_unittest.cc
index 1ef3192..c79ee7f 100644
--- a/src/lib/asiodns/tests/dns_server_unittest.cc
+++ b/src/lib/asiodns/tests/dns_server_unittest.cc
@@ -430,7 +430,7 @@ TEST_F(DNSServerTest, stopUDPServerDuringPrepareAnswer) {
}
static void stopServerManyTimes(DNSServer *server, unsigned int times) {
- for (int i = 0; i < times; ++i) {
+ for (unsigned int i = 0; i < times; ++i) {
server->stop();
}
}
diff --git a/src/lib/asiodns/tests/io_fetch_unittest.cc b/src/lib/asiodns/tests/io_fetch_unittest.cc
index 52a51a1..936c6c7 100644
--- a/src/lib/asiodns/tests/io_fetch_unittest.cc
+++ b/src/lib/asiodns/tests/io_fetch_unittest.cc
@@ -169,8 +169,10 @@ public:
/// sent with the correct QID.
/// \param length Amount of data received.
void udpReceiveHandler(udp::endpoint* remote, udp::socket* socket,
- error_code ec = error_code(), size_t length = 0,
- bool bad_qid = false, bool second_send = false) {
+ asio::error_code ec = asio::error_code(),
+ size_t length = 0, bool bad_qid = false,
+ bool second_send = false)
+ {
if (debug_) {
cout << "udpReceiveHandler(): error = " << ec.value() <<
", length = " << length << endl;
@@ -218,7 +220,8 @@ public:
///
/// \param socket Socket on which data will be received
/// \param ec Boost error code, value should be zero.
- void tcpAcceptHandler(tcp::socket* socket, error_code ec = error_code())
+ void tcpAcceptHandler(tcp::socket* socket,
+ asio::error_code ec = asio::error_code())
{
if (debug_) {
cout << "tcpAcceptHandler(): error = " << ec.value() << endl;
@@ -257,7 +260,8 @@ public:
/// \param ec ASIO error code, completion code of asynchronous I/O issued
/// by the "server" to receive data.
/// \param length Amount of data received.
- void tcpReceiveHandler(tcp::socket* socket, error_code ec = error_code(),
+ void tcpReceiveHandler(tcp::socket* socket,
+ asio::error_code ec = asio::error_code(),
size_t length = 0)
{
if (debug_) {
@@ -386,7 +390,8 @@ public:
/// \param ec Boost error code, value should be zero.
/// \param length Number of bytes sent.
void tcpSendHandler(size_t expected, tcp::socket* socket,
- error_code ec = error_code(), size_t length = 0)
+ asio::error_code ec = asio::error_code(),
+ size_t length = 0)
{
if (debug_) {
cout << "tcpSendHandler(): error = " << ec.value() <<
diff --git a/src/lib/asiodns/udp_server.cc b/src/lib/asiodns/udp_server.cc
index f103e5a..72db2bf 100644
--- a/src/lib/asiodns/udp_server.cc
+++ b/src/lib/asiodns/udp_server.cc
@@ -170,7 +170,7 @@ UDPServer::UDPServer(io_service& io_service, const ip::address& addr,
/// The function operator is implemented with the "stackless coroutine"
/// pattern; see internal/coroutine.h for details.
void
-UDPServer::operator()(error_code ec, size_t length) {
+UDPServer::operator()(asio::error_code ec, size_t length) {
/// Because the coroutine reentry block is implemented as
/// a switch statement, inline variable declarations are not
/// permitted. Certain variables used below can be declared here.
diff --git a/src/lib/asiodns/udp_server.h b/src/lib/asiodns/udp_server.h
index 4c19544..90fcc6f 100644
--- a/src/lib/asiodns/udp_server.h
+++ b/src/lib/asiodns/udp_server.h
@@ -99,7 +99,7 @@ private:
* This way the overhead of copying is lower, we copy only one shared
* pointer instead of about 10 of them.
*/
- class Data;
+ struct Data;
boost::shared_ptr<Data> data_;
};
diff --git a/src/lib/asiolink/io_address.cc b/src/lib/asiolink/io_address.cc
index 0fe1db4..370e8f5 100644
--- a/src/lib/asiolink/io_address.cc
+++ b/src/lib/asiolink/io_address.cc
@@ -38,7 +38,7 @@ namespace asiolink {
// XXX: we cannot simply construct the address in the initialization list,
// because we'd like to throw our own exception on failure.
IOAddress::IOAddress(const string& address_str) {
- error_code err;
+ asio::error_code err;
asio_address_ = ip::address::from_string(address_str, err);
if (err) {
isc_throw(IOError, "Failed to convert string to address '"
diff --git a/src/lib/asiolink/simple_callback.h b/src/lib/asiolink/simple_callback.h
index 92093ec..a297a1d 100644
--- a/src/lib/asiolink/simple_callback.h
+++ b/src/lib/asiolink/simple_callback.h
@@ -49,7 +49,9 @@ protected:
///
/// This is intentionally defined as \c protected as this base class
/// should never be instantiated (except as part of a derived class).
- SimpleCallback() : self_(this) {}
+ SimpleCallback() {
+ self_ = this;
+ }
public:
/// \brief The destructor
virtual ~SimpleCallback() {}
diff --git a/src/lib/asiolink/tcp_socket.h b/src/lib/asiolink/tcp_socket.h
index c8876c8..2505d7b 100644
--- a/src/lib/asiolink/tcp_socket.h
+++ b/src/lib/asiolink/tcp_socket.h
@@ -276,7 +276,7 @@ TCPSocket<C>::asyncSend(const void* data, size_t length,
// ... and send it
socket_.async_send(asio::buffer(send_buffer_->getData(),
send_buffer_->getLength()), callback);
- } catch (boost::numeric::bad_numeric_cast& e) {
+ } catch (boost::numeric::bad_numeric_cast&) {
isc_throw(BufferTooLarge,
"attempt to send buffer larger than 64kB");
}
diff --git a/src/lib/bench/benchmark.h b/src/lib/bench/benchmark.h
index 5eab1b7..7f77aa1 100644
--- a/src/lib/bench/benchmark.h
+++ b/src/lib/bench/benchmark.h
@@ -261,7 +261,7 @@ public:
struct timeval beg, end;
gettimeofday(&beg, NULL);
- for (int i = 0; i < iterations_; ++i) {
+ for (unsigned int i = 0; i < iterations_; ++i) {
sub_iterations_ += target_.run();
}
gettimeofday(&end, NULL);
diff --git a/src/lib/bench/benchmark_util.cc b/src/lib/bench/benchmark_util.cc
index c67a851..9cf3b26 100644
--- a/src/lib/bench/benchmark_util.cc
+++ b/src/lib/bench/benchmark_util.cc
@@ -103,7 +103,7 @@ loadQueryData(istream& input, BenchQueries& queries, const RRClass& qclass,
static_cast<const unsigned char*>(buffer.getData()) +
buffer.getLength());
queries.push_back(query_data);
- } catch (const Exception& error) {
+ } catch (const Exception&) {
if (strict) {
isc_throw(BenchMarkError,
"failed to parse/create query around line " <<
diff --git a/src/lib/cache/resolver_cache.cc b/src/lib/cache/resolver_cache.cc
index 57935c0..20f470e 100644
--- a/src/lib/cache/resolver_cache.cc
+++ b/src/lib/cache/resolver_cache.cc
@@ -164,14 +164,16 @@ ResolverCache::ResolverCache()
ResolverCache::ResolverCache(std::vector<CacheSizeInfo> caches_info)
{
- for (int i = 0; i < caches_info.size(); ++i) {
+ for (std::vector<CacheSizeInfo>::size_type i = 0;
+ i < caches_info.size(); ++i) {
class_caches_.push_back(new ResolverClassCache(caches_info[i]));
}
}
ResolverCache::~ResolverCache()
{
- for (int i = 0; i < class_caches_.size(); ++i) {
+ for (std::vector<ResolverClassCache*>::size_type i = 0;
+ i < class_caches_.size(); ++i) {
delete class_caches_[i];
}
}
@@ -261,7 +263,8 @@ ResolverCache::update(const isc::dns::ConstRRsetPtr& rrset_ptr) {
ResolverClassCache*
ResolverCache::getClassCache(const isc::dns::RRClass& cache_class) const {
- for (int i = 0; i < class_caches_.size(); ++i) {
+ for (std::vector<ResolverClassCache*>::size_type i = 0;
+ i < class_caches_.size(); ++i) {
if (class_caches_[i]->getClass() == cache_class) {
return (class_caches_[i]);
}
diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc
index ffa5346..77f948a 100644
--- a/src/lib/cc/data.cc
+++ b/src/lib/cc/data.cc
@@ -742,7 +742,7 @@ MapElement::find(const std::string& id, ConstElementPtr t) const {
t = p;
return (true);
}
- } catch (const TypeError& e) {
+ } catch (const TypeError&) {
// ignore
}
return (false);
@@ -780,11 +780,11 @@ StringElement::equals(const Element& other) const {
bool
ListElement::equals(const Element& other) const {
if (other.getType() == Element::list) {
- const int s = size();
+ const size_t s = size();
if (s != other.size()) {
return (false);
}
- for (int i = 0; i < s; ++i) {
+ for (size_t i = 0; i < s; ++i) {
if (!get(i)->equals(*other.get(i))) {
return (false);
}
@@ -843,10 +843,14 @@ removeIdentical(ElementPtr a, ConstElementPtr b) {
isc_throw(TypeError, "Non-map Elements passed to removeIdentical");
}
- const std::map<std::string, ConstElementPtr>& m = a->mapValue();
+ // As maps do not allow entries with multiple keys, we can either iterate
+ // over a checking for identical entries in b or vice-versa. As elements
+ // are removed from a if a match is found, we choose to iterate over b to
+ // avoid problems with element removal affecting the iterator.
+ const std::map<std::string, ConstElementPtr>& m = b->mapValue();
for (std::map<std::string, ConstElementPtr>::const_iterator it = m.begin();
it != m.end() ; ++it) {
- if (b->contains((*it).first)) {
+ if (a->contains((*it).first)) {
if (a->get((*it).first)->equals(*b->get((*it).first))) {
a->remove((*it).first);
}
diff --git a/src/lib/cc/session.cc b/src/lib/cc/session.cc
index 0052aca..1b21d21 100644
--- a/src/lib/cc/session.cc
+++ b/src/lib/cc/session.cc
@@ -367,7 +367,7 @@ Session::recvmsg(ConstElementPtr& env, ConstElementPtr& msg,
size_t length = impl_->readDataLength();
if (hasQueuedMsgs()) {
ConstElementPtr q_el;
- for (int i = 0; i < impl_->queue_->size(); i++) {
+ for (size_t i = 0; i < impl_->queue_->size(); i++) {
q_el = impl_->queue_->get(i);
if (( seq == -1 &&
!q_el->get(0)->contains("reply")
diff --git a/src/lib/cc/tests/data_unittests.cc b/src/lib/cc/tests/data_unittests.cc
index 53d5ab8..8ae77b1 100644
--- a/src/lib/cc/tests/data_unittests.cc
+++ b/src/lib/cc/tests/data_unittests.cc
@@ -523,6 +523,12 @@ TEST(Element, removeIdentical) {
removeIdentical(a, b);
EXPECT_EQ(*a, *c);
+ a = Element::fromJSON("{ \"a\": 1, \"b\": 2, \"c\": 3 }");
+ b = Element::fromJSON("{ \"c\": 3, \"b\": 2 }");
+ c = Element::fromJSON("{ \"a\": 1 }");
+ removeIdentical(a, b);
+ EXPECT_EQ(*a, *c);
+
EXPECT_THROW(removeIdentical(Element::create(1), Element::create(2)), TypeError);
}
diff --git a/src/lib/cryptolink/tests/crypto_unittests.cc b/src/lib/cryptolink/tests/crypto_unittests.cc
index 4abeb87..df94c12 100644
--- a/src/lib/cryptolink/tests/crypto_unittests.cc
+++ b/src/lib/cryptolink/tests/crypto_unittests.cc
@@ -392,7 +392,8 @@ doRFC4231Tests(HashAlgorithm hash_algorithm,
ASSERT_EQ(secret_list.size(), data_list.size());
ASSERT_EQ(secret_list.size(), hmac_list.size());
- for (int i = 0; i < data_list.size(); ++i) {
+ for (std::vector<std::string>::size_type i = 0;
+ i < data_list.size(); ++i) {
SCOPED_TRACE("RFC4231 HMAC test for algorithm ID: " +
lexical_cast<std::string>(hash_algorithm) +
", data ID: " + lexical_cast<std::string>(i));
diff --git a/src/lib/datasrc/rbtree.h b/src/lib/datasrc/rbtree.h
index b6c098a..4757a45 100644
--- a/src/lib/datasrc/rbtree.h
+++ b/src/lib/datasrc/rbtree.h
@@ -295,15 +295,20 @@ private:
// This is only to support NULL nodes.
template <typename T>
RBNode<T>::RBNode() :
- parent_(this),
- left_(this),
- right_(this),
+ parent_(NULL),
+ left_(NULL),
+ right_(NULL),
color_(BLACK),
// dummy name, the value doesn't matter:
name_(isc::dns::Name::ROOT_NAME()),
- down_(this),
+ down_(NULL),
flags_(0)
{
+ // Some compilers object to use of "this" in initializer lists.
+ parent_ = this;
+ left_ = this;
+ right_ = this;
+ down_ = this;
}
template <typename T>
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index 920c9a2..ca8df93 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -311,7 +311,7 @@ struct JournalEntry {
DatabaseAccessor::DiffOperation operation_;
std::string data_[DatabaseAccessor::DIFF_PARAM_COUNT];
bool operator==(const JournalEntry& other) const {
- for (size_t i(0); i < DatabaseAccessor::DIFF_PARAM_COUNT; ++ i) {
+ for (size_t i = 0; i < DatabaseAccessor::DIFF_PARAM_COUNT; ++ i) {
if (data_[i] != other.data_[i]) {
return false;
}
@@ -406,7 +406,7 @@ private:
cur_name.clear();
// Just walk everything and check if it is a subdomain.
// If it is, just copy all data from there.
- for (Domains::const_iterator i(cur_records.begin());
+ for (Domains::const_iterator i = cur_records.begin();
i != cur_records.end(); ++i) {
const Name local(i->first);
if (local.compare(Name(name)).getRelation() ==
@@ -442,7 +442,7 @@ private:
private:
const std::string searched_name_;
- int cur_record_;
+ size_t cur_record_;
std::vector< std::vector<std::string> > cur_name;
};
@@ -807,7 +807,7 @@ public:
// Clean the journal, but keep local copy to check
journal.swap(*journal_entries_);
ASSERT_EQ(expected.size(), journal.size());
- for (size_t i(0); i < expected.size(); ++ i) {
+ for (size_t i = 0; i < expected.size(); ++ i) {
EXPECT_TRUE(expected[i] == journal[i]);
}
}
@@ -883,7 +883,7 @@ private:
ASSERT_EQ(0, readonly_records_->count(name));
// Append the name to all of them
for (std::vector<std::vector<std::string> >::iterator
- i(cur_name_.begin()); i != cur_name_.end(); ++ i) {
+ i = cur_name_.begin(); i != cur_name_.end(); ++ i) {
i->push_back(name);
}
(*readonly_records_)[name] = cur_name_;
@@ -2018,7 +2018,7 @@ TYPED_TEST(DatabaseClientTest, wildcard) {
"wild.*.foo.*.bar.example.org.",
NULL
};
- for (const char** name(positive_names); *name != NULL; ++ name) {
+ for (const char** name = positive_names; *name != NULL; ++ name) {
doFindTest(*finder, isc::dns::Name(*name), this->qtype_,
this->qtype_, this->rrttl_, ZoneFinder::SUCCESS,
this->expected_rdatas_,
@@ -2043,7 +2043,7 @@ TYPED_TEST(DatabaseClientTest, wildcard) {
};
// Unless FIND_DNSSEC is specified, this is no different from other
// NXRRSET case.
- for (const char** name(negative_names); *name != NULL; ++ name) {
+ for (const char** name = negative_names; *name != NULL; ++ name) {
doFindTest(*finder, isc::dns::Name(*name), this->qtype_,
this->qtype_, this->rrttl_, ZoneFinder::NXRRSET,
this->expected_rdatas_, this->expected_sig_rdatas_);
@@ -2059,7 +2059,7 @@ TYPED_TEST(DatabaseClientTest, wildcard) {
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("wild.*.foo.*.bar.example.org. NSEC");
this->expected_sig_rdatas_.clear();
- for (const char** name(negative_dnssec_names); *name != NULL; ++ name) {
+ for (const char** name = negative_dnssec_names; *name != NULL; ++ name) {
doFindTest(*finder, isc::dns::Name(*name), this->qtype_,
RRType::NSEC(), this->rrttl_, ZoneFinder::WILDCARD_NXRRSET,
this->expected_rdatas_, this->expected_sig_rdatas_,
@@ -2973,7 +2973,7 @@ TYPED_TEST(DatabaseClientTest, journalMultiple) {
this->updater_ = this->client_->getUpdater(this->zname_, false, true);
std::string soa_rdata = "ns1.example.org. admin.example.org. "
"1234 3600 1800 2419200 7200";
- for (size_t i(1); i < 100; ++ i) {
+ for (size_t i = 1; i < 100; ++ i) {
// Remove the old SOA
this->updater_->deleteRRset(*this->soa_);
expected.push_back(JournalEntry(WRITABLE_ZONE_ID, 1234 + i - 1,
diff --git a/src/lib/datasrc/tests/memory_datasrc_unittest.cc b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
index a1bd94e..01d3230 100644
--- a/src/lib/datasrc/tests/memory_datasrc_unittest.cc
+++ b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
@@ -981,7 +981,7 @@ TEST_F(InMemoryZoneFinderTest, nestedEmptyWildcard) {
NULL
};
- for (const char** name(names); *name != NULL; ++ name) {
+ for (const char** name = names; *name != NULL; ++ name) {
SCOPED_TRACE(string("Node ") + *name);
findTest(Name(*name), RRType::A(), ZoneFinder::NXRRSET);
}
@@ -999,7 +999,7 @@ TEST_F(InMemoryZoneFinderTest, nestedEmptyWildcard) {
{
SCOPED_TRACE("Asking directly for A on parent nodes");
- for (const char** name(names); *name != NULL; ++ name) {
+ for (const char** name = names; *name != NULL; ++ name) {
SCOPED_TRACE(string("Node ") + *name);
findTest(Name(*name), RRType::A(), ZoneFinder::NXRRSET);
}
@@ -1008,7 +1008,7 @@ TEST_F(InMemoryZoneFinderTest, nestedEmptyWildcard) {
{
SCOPED_TRACE("Asking for ANY on parent nodes");
- for (const char** name(names); *name != NULL; ++ name) {
+ for (const char** name = names; *name != NULL; ++ name) {
SCOPED_TRACE(string("Node ") + *name);
RRsetList target;
@@ -1050,7 +1050,7 @@ InMemoryZoneFinderTest::doCancelWildcardTest() {
NULL
};
- for (const char** name(names); *name != NULL; ++ name) {
+ for (const char** name = names; *name != NULL; ++ name) {
SCOPED_TRACE(string("Node ") + *name);
findTest(Name(*name), RRType::A(), ZoneFinder::SUCCESS, false,
diff --git a/src/lib/dhcp/libdhcp.cc b/src/lib/dhcp/libdhcp.cc
index f84e495..dd86de9 100644
--- a/src/lib/dhcp/libdhcp.cc
+++ b/src/lib/dhcp/libdhcp.cc
@@ -139,7 +139,7 @@ LibDHCP::packOptions6(boost::shared_array<uint8_t> data,
offset = it->second->pack(data, data_len, offset);
}
}
- catch (const Exception& e) {
+ catch (const Exception&) {
cout << "Packet build failed (Option build failed)." << endl;
throw;
}
diff --git a/src/lib/dns/masterload.cc b/src/lib/dns/masterload.cc
index 5f7d5a0..a32d4b7 100644
--- a/src/lib/dns/masterload.cc
+++ b/src/lib/dns/masterload.cc
@@ -40,8 +40,11 @@ void
masterLoad(const char* const filename, const Name& origin,
const RRClass& zone_class, MasterLoadCallback callback)
{
- ifstream ifs;
+ if ((filename == NULL) || (*filename == '\0')) {
+ isc_throw(MasterLoadError, "Name of master file must not be null");
+ }
+ ifstream ifs;
ifs.open(filename, ios_base::in);
if (ifs.fail()) {
isc_throw(MasterLoadError, "Failed to open master file: " << filename);
diff --git a/src/lib/dns/messagerenderer.cc b/src/lib/dns/messagerenderer.cc
index 02f5519..1378ba9 100644
--- a/src/lib/dns/messagerenderer.cc
+++ b/src/lib/dns/messagerenderer.cc
@@ -117,7 +117,7 @@ private:
uint16_t pos, uint16_t& llen) const
{
if (llen == 0) {
- int i = 0;
+ size_t i = 0;
while ((buffer[pos] & Name::COMPRESS_POINTER_MARK8) ==
Name::COMPRESS_POINTER_MARK8) {
diff --git a/src/lib/dns/python/pydnspp_common.cc b/src/lib/dns/python/pydnspp_common.cc
index 0f0f873..8e623c5 100644
--- a/src/lib/dns/python/pydnspp_common.cc
+++ b/src/lib/dns/python/pydnspp_common.cc
@@ -13,7 +13,6 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <Python.h>
-#include <pydnspp_common.h>
#include <exceptions/exceptions.h>
diff --git a/src/lib/dns/rdata.cc b/src/lib/dns/rdata.cc
index 27496a2..c1ece52 100644
--- a/src/lib/dns/rdata.cc
+++ b/src/lib/dns/rdata.cc
@@ -112,7 +112,9 @@ Generic::Generic(isc::util::InputBuffer& buffer, size_t rdata_len) {
}
vector<uint8_t> data(rdata_len);
- buffer.readData(&data[0], rdata_len);
+ if (rdata_len > 0) {
+ buffer.readData(&data[0], rdata_len);
+ }
impl_ = new GenericImpl(data);
}
@@ -242,8 +244,10 @@ compare_internal(const GenericImpl& lhs, const GenericImpl& rhs) {
size_t len = (this_len < other_len) ? this_len : other_len;
int cmp;
- if ((cmp = memcmp(&lhs.data_[0], &rhs.data_[0], len))
- != 0) {
+ // TODO: is there a need to check len - should we just assert?
+ // (Depends if it is possible for rdata to have zero length)
+ if ((len != 0) &&
+ ((cmp = memcmp(&lhs.data_[0], &rhs.data_[0], len)) != 0)) {
return (cmp);
} else {
return ((this_len == other_len) ? 0 :
diff --git a/src/lib/dns/rdata/generic/dnskey_48.cc b/src/lib/dns/rdata/generic/dnskey_48.cc
index e0f5461..7bdbd05 100644
--- a/src/lib/dns/rdata/generic/dnskey_48.cc
+++ b/src/lib/dns/rdata/generic/dnskey_48.cc
@@ -181,7 +181,7 @@ DNSKEY::getTag() const {
ac += impl_->algorithm_;
size_t size = impl_->keydata_.size();
- for (int i = 0; i < size; i ++) {
+ for (size_t i = 0; i < size; i ++) {
ac += (i & 1) ? impl_->keydata_[i] : (impl_->keydata_[i] << 8);
}
ac += (ac >> 16) & 0xffff;
diff --git a/src/lib/dns/rdata/generic/nsec3_50.cc b/src/lib/dns/rdata/generic/nsec3_50.cc
index 3bd0bb2..092695c 100644
--- a/src/lib/dns/rdata/generic/nsec3_50.cc
+++ b/src/lib/dns/rdata/generic/nsec3_50.cc
@@ -221,7 +221,7 @@ string
NSEC3::toText() const {
ostringstream s;
int len = 0;
- for (int i = 0; i < impl_->typebits_.size(); i += len) {
+ for (size_t i = 0; i < impl_->typebits_.size(); i += len) {
assert(i + 2 <= impl_->typebits_.size());
int window = impl_->typebits_[i];
len = impl_->typebits_[i + 1];
diff --git a/src/lib/dns/rdata/generic/nsec_47.cc b/src/lib/dns/rdata/generic/nsec_47.cc
index 4723c23..a9a9f75 100644
--- a/src/lib/dns/rdata/generic/nsec_47.cc
+++ b/src/lib/dns/rdata/generic/nsec_47.cc
@@ -143,7 +143,7 @@ NSEC::toText() const {
// and easier to find a bug (if any). Note that this conversion method
// is generally not expected to be very efficient, so the slight overhead
// of at() should be acceptable.
- for (int i = 0; i < impl_->typebits_.size(); i += len) {
+ for (size_t i = 0; i < impl_->typebits_.size(); i += len) {
assert(i + 2 <= impl_->typebits_.size());
const int block = impl_->typebits_.at(i);
len = impl_->typebits_.at(i + 1);
diff --git a/src/lib/dns/rdatafields.cc b/src/lib/dns/rdatafields.cc
index d3f282b..af9ba2e 100644
--- a/src/lib/dns/rdatafields.cc
+++ b/src/lib/dns/rdatafields.cc
@@ -171,7 +171,7 @@ RdataFields::RdataFields(const void* fields, const unsigned int fields_length,
}
size_t total_length = 0;
- for (int i = 0; i < nfields_; ++i) {
+ for (unsigned int i = 0; i < nfields_; ++i) {
total_length += fields_[i].len;
}
if (total_length != data_length_) {
@@ -198,7 +198,7 @@ void
RdataFields::toWire(AbstractMessageRenderer& renderer) const {
size_t offset = 0;
- for (int i = 0; i < nfields_; ++i) {
+ for (unsigned int i = 0; i < nfields_; ++i) {
if (fields_[i].type == DATA) {
renderer.writeData(data_ + offset, fields_[i].len);
} else {
diff --git a/src/lib/dns/tests/message_unittest.cc b/src/lib/dns/tests/message_unittest.cc
index f068791..c4d4984 100644
--- a/src/lib/dns/tests/message_unittest.cc
+++ b/src/lib/dns/tests/message_unittest.cc
@@ -207,7 +207,7 @@ TEST_F(MessageTest, fromWireWithTSIG) {
EXPECT_THROW(message_render.getTSIGRecord(), InvalidMessageOperation);
factoryFromFile(message_parse, "message_toWire2.wire");
- const char expected_mac[] = {
+ const uint8_t expected_mac[] = {
0x22, 0x70, 0x26, 0xad, 0x29, 0x7b, 0xee, 0xe7,
0x21, 0xce, 0x6c, 0x6f, 0xff, 0x1e, 0x9e, 0xf3
};
diff --git a/src/lib/dns/tests/unittest_util.cc b/src/lib/dns/tests/unittest_util.cc
index c9c0982..ca9d347 100644
--- a/src/lib/dns/tests/unittest_util.cc
+++ b/src/lib/dns/tests/unittest_util.cc
@@ -116,7 +116,7 @@ UnitTestUtil::readWireData(const string& datastr,
throw runtime_error(err_oss.str());
}
- for (int pos = 0; pos < bytes.size(); pos += 2) {
+ for (string::size_type pos = 0; pos < bytes.size(); pos += 2) {
istringstream iss_byte(bytes.substr(pos, 2));
unsigned int ch;
@@ -139,7 +139,7 @@ UnitTestUtil::matchWireData(const char*, const char*, const char*, const char*,
::testing::Message msg;
size_t cmplen = min(len1, len2);
- for (int i = 0; i < cmplen; i++) {
+ for (size_t i = 0; i < cmplen; i++) {
int ch1 = static_cast<const uint8_t*>(data1)[i];
int ch2 = static_cast<const uint8_t*>(data2)[i];
if (ch1 != ch2) {
diff --git a/src/lib/log/compiler/message.cc b/src/lib/log/compiler/message.cc
index f74020a..3c8a3f2 100644
--- a/src/lib/log/compiler/message.cc
+++ b/src/lib/log/compiler/message.cc
@@ -224,7 +224,7 @@ writeOpeningNamespace(ostream& output, const vector<string>& ns) {
if (!ns.empty()) {
// Output namespaces in correct order
- for (int i = 0; i < ns.size(); ++i) {
+ for (vector<string>::size_type i = 0; i < ns.size(); ++i) {
output << "namespace " << ns[i] << " {\n";
}
output << "\n";
diff --git a/src/lib/log/logger_manager.cc b/src/lib/log/logger_manager.cc
index 70e0d6f..a04fffb 100644
--- a/src/lib/log/logger_manager.cc
+++ b/src/lib/log/logger_manager.cc
@@ -167,7 +167,7 @@ LoggerManager::readLocalMessageFile(const char* file) {
// Log the variable number of arguments. The actual message will be
// logged when the error_message variable is destroyed.
Formatter<isc::log::Logger> error_message = logger.error(ident);
- for (int i = 0; i < args.size(); ++i) {
+ for (vector<string>::size_type i = 0; i < args.size(); ++i) {
error_message = error_message.arg(args[i]);
}
}
diff --git a/src/lib/log/logger_manager_impl.h b/src/lib/log/logger_manager_impl.h
index f99f832..42a98f1 100644
--- a/src/lib/log/logger_manager_impl.h
+++ b/src/lib/log/logger_manager_impl.h
@@ -31,7 +31,7 @@ namespace log {
// Forward declarations
class LoggerSpecification;
-class OutputOption;
+struct OutputOption;
/// \brief Logger Manager Implementation
///
diff --git a/src/lib/log/logger_specification.h b/src/lib/log/logger_specification.h
index 6805fdd..78df054 100644
--- a/src/lib/log/logger_specification.h
+++ b/src/lib/log/logger_specification.h
@@ -97,7 +97,7 @@ public:
}
/// \return Return additive flag.
- int getAdditive() const {
+ bool getAdditive() const {
return additive_;
}
diff --git a/src/lib/log/tests/logger_manager_unittest.cc b/src/lib/log/tests/logger_manager_unittest.cc
index 0bdfc74..9eb85ad 100644
--- a/src/lib/log/tests/logger_manager_unittest.cc
+++ b/src/lib/log/tests/logger_manager_unittest.cc
@@ -315,7 +315,7 @@ TEST_F(LoggerManagerTest, FileSizeRollover) {
EXPECT_FALSE(file3.good());
// Tidy up
- for (int i = 0; i < prev_name.size(); ++i) {
+ for (vector<string>::size_type i = 0; i < prev_name.size(); ++i) {
(void) unlink(prev_name[i].c_str());
}
}
diff --git a/src/lib/nsas/hash_key.cc b/src/lib/nsas/hash_key.cc
index bf4676b..782e3d8 100644
--- a/src/lib/nsas/hash_key.cc
+++ b/src/lib/nsas/hash_key.cc
@@ -35,7 +35,7 @@ bool HashKey::operator==(const isc::nsas::HashKey& other) {
// variation (stops on the first null byte).
//
// TODO: Use a lookup table to map upper to lower case (for speed)
- for (int i = 0; i < other.keylen; ++i) {
+ for (uint32_t i = 0; i < other.keylen; ++i) {
if (tolower(static_cast<unsigned char>(other.key[i])) !=
tolower(static_cast<unsigned char>(key[i]))) {
return false; // Mismatch
diff --git a/src/lib/python/isc/log/log.cc b/src/lib/python/isc/log/log.cc
index 2e4a28f..ed05398 100644
--- a/src/lib/python/isc/log/log.cc
+++ b/src/lib/python/isc/log/log.cc
@@ -237,10 +237,10 @@ logConfigUpdate(PyObject*, PyObject* args) {
} catch (const isc::data::JSONError& je) {
std::string error_msg = std::string("JSON format error: ") + je.what();
PyErr_SetString(PyExc_TypeError, error_msg.c_str());
- } catch (const isc::data::TypeError& de) {
+ } catch (const isc::data::TypeError&) {
PyErr_SetString(PyExc_TypeError, "argument 1 of log_config_update "
"is not a map of config data");
- } catch (const isc::config::ModuleSpecError& mse) {
+ } catch (const isc::config::ModuleSpecError&) {
PyErr_SetString(PyExc_TypeError, "argument 2 of log_config_update "
"is not a correct module specification");
} catch (const std::exception& e) {
diff --git a/src/lib/resolve/recursive_query.cc b/src/lib/resolve/recursive_query.cc
index 1855f7a..55f473e 100644
--- a/src/lib/resolve/recursive_query.cc
+++ b/src/lib/resolve/recursive_query.cc
@@ -676,11 +676,14 @@ public:
nsas_(nsas),
cache_(cache),
cur_zone_("."),
- nsas_callback_(new ResolverNSASCallback(this)),
+ nsas_callback_(),
nsas_callback_out_(false),
outstanding_events_(0),
rtt_recorder_(recorder)
{
+ // Set here to avoid using "this" in initializer list.
+ nsas_callback_.reset(new ResolverNSASCallback(this));
+
// Setup the timer to stop trying (lookup_timeout)
if (lookup_timeout >= 0) {
lookup_timer.expires_from_now(
diff --git a/src/lib/resolve/response_classifier.cc b/src/lib/resolve/response_classifier.cc
index 02808e4..27c5cfc 100644
--- a/src/lib/resolve/response_classifier.cc
+++ b/src/lib/resolve/response_classifier.cc
@@ -119,7 +119,7 @@ ResponseClassifier::Category ResponseClassifier::classify(
if (authority.empty()) {
return (EMPTY);
}
- for (int i = 0; i < authority.size(); ++i) {
+ for (vector<RRsetPtr>::size_type i = 0; i < authority.size(); ++i) {
if (authority[i]->getType() == RRType::NS()) {
return (REFERRAL);
}
@@ -161,7 +161,7 @@ ResponseClassifier::Category ResponseClassifier::classify(
// There are multiple RRsets in the answer. They should all have the same
// QCLASS, else there is some error in the response.
- for (int i = 1; i < answer.size(); ++i) {
+ for (vector<RRsetPtr>::size_type i = 1; i < answer.size(); ++i) {
if (answer[0]->getClass() != answer[i]->getClass()) {
return (MULTICLASS);
}
@@ -173,7 +173,8 @@ ResponseClassifier::Category ResponseClassifier::classify(
// CNAME - in which case there should no other record types at that QNAME.
if (question.getType() == RRType::ANY()) {
bool all_same = true;
- for (int i = 1; (i < answer.size()) && all_same; ++i) {
+ for (vector<RRsetPtr>::size_type i = 1; (i < answer.size()) && all_same;
+ ++i) {
all_same = (answer[0]->getName() == answer[i]->getName());
}
if (all_same) {
@@ -211,7 +212,7 @@ ResponseClassifier::Category ResponseClassifier::cnameChase(
{
// Search through the vector of RRset pointers until we find one with the
// right QNAME.
- for (int i = 0; i < ansrrset.size(); ++i) {
+ for (vector<RRsetPtr>::size_type i = 0; i < ansrrset.size(); ++i) {
if (present[i]) {
// This entry has not been logically removed, so look at it.
diff --git a/src/lib/resolve/tests/recursive_query_unittest_2.cc b/src/lib/resolve/tests/recursive_query_unittest_2.cc
index 3e62336..a222240 100644
--- a/src/lib/resolve/tests/recursive_query_unittest_2.cc
+++ b/src/lib/resolve/tests/recursive_query_unittest_2.cc
@@ -275,7 +275,9 @@ public:
/// \param ec ASIO error code, completion code of asynchronous I/O issued
/// by the "server" to receive data.
/// \param length Amount of data received.
- void udpReceiveHandler(error_code ec = error_code(), size_t length = 0) {
+ void udpReceiveHandler(asio::error_code ec = asio::error_code(),
+ size_t length = 0)
+ {
if (debug_) {
cout << "udpReceiveHandler(): error = " << ec.value() <<
", length = " << length << ", last state = " << last_ <<
@@ -368,7 +370,9 @@ public:
///
/// \param ec Completion error code of the send.
/// \param length Actual number of bytes sent.
- void udpSendHandler(error_code ec = error_code(), size_t length = 0) {
+ void udpSendHandler(asio::error_code ec = asio::error_code(),
+ size_t length = 0)
+ {
if (debug_) {
cout << "udpSendHandler(): error = " << ec.value() <<
", length = " << length << endl;
@@ -392,7 +396,9 @@ public:
///
/// \param socket Socket on which data will be received
/// \param ec Boost error code, value should be zero.
- void tcpAcceptHandler(error_code ec = error_code(), size_t length = 0) {
+ void tcpAcceptHandler(asio::error_code ec = asio::error_code(),
+ size_t length = 0)
+ {
if (debug_) {
cout << "tcpAcceptHandler(): error = " << ec.value() <<
", length = " << length << endl;
@@ -419,7 +425,9 @@ public:
/// \param ec ASIO error code, completion code of asynchronous I/O issued
/// by the "server" to receive data.
/// \param length Amount of data received.
- void tcpReceiveHandler(error_code ec = error_code(), size_t length = 0) {
+ void tcpReceiveHandler(asio::error_code ec = asio::error_code(),
+ size_t length = 0)
+ {
if (debug_) {
cout << "tcpReceiveHandler(): error = " << ec.value() <<
", length = " << length <<
@@ -506,7 +514,8 @@ public:
/// \param expected_length Number of bytes that were expected to have been sent.
/// \param ec Boost error code, value should be zero.
/// \param length Number of bytes sent.
- void tcpSendHandler(size_t expected_length = 0, error_code ec = error_code(),
+ void tcpSendHandler(size_t expected_length = 0,
+ asio::error_code ec = asio::error_code(),
size_t length = 0)
{
if (debug_) {
@@ -689,7 +698,7 @@ TEST_F(RecursiveQueryTest2, Resolve) {
// weren't, we would expect some absurdly high answers.
vector<uint32_t> rtt = recorder->getRtt();
EXPECT_GT(rtt.size(), 0);
- for (int i = 0; i < rtt.size(); ++i) {
+ for (vector<uint32_t>::size_type i = 0; i < rtt.size(); ++i) {
EXPECT_LT(rtt[i], 2000);
}
}
diff --git a/src/lib/server_common/portconfig.cc b/src/lib/server_common/portconfig.cc
index 379a0a1..fba8e1a 100644
--- a/src/lib/server_common/portconfig.cc
+++ b/src/lib/server_common/portconfig.cc
@@ -59,7 +59,7 @@ parseAddresses(isc::data::ConstElementPtr addresses,
result.push_back(AddressPair(addr->stringValue(),
port->intValue()));
}
- catch (const TypeError &e) { // Better error message
+ catch (const TypeError&) { // Better error message
LOG_ERROR(logger, SRVCOMM_ADDRESS_TYPE).
arg(addrPair->str());
isc_throw(TypeError,
diff --git a/src/lib/util/strutil.cc b/src/lib/util/strutil.cc
index ed7fc9b..89edcc9 100644
--- a/src/lib/util/strutil.cc
+++ b/src/lib/util/strutil.cc
@@ -120,7 +120,7 @@ format(const std::string& format, const std::vector<std::string>& args) {
// Iterate through replacing all tokens
result = format;
size_t tokenpos = 0; // Position of last token replaced
- int i = 0; // Index into argument array
+ std::vector<std::string>::size_type i = 0; // Index into argument array
while ((i < args.size()) && (tokenpos != string::npos)) {
tokenpos = result.find(flag, tokenpos);
diff --git a/src/lib/util/strutil.h b/src/lib/util/strutil.h
index 021c236..0dbbe96 100644
--- a/src/lib/util/strutil.h
+++ b/src/lib/util/strutil.h
@@ -191,7 +191,7 @@ tokenToNum(const std::string& num_token) {
NumType num;
try {
num = boost::lexical_cast<NumType>(num_token);
- } catch (const boost::bad_lexical_cast& ex) {
+ } catch (const boost::bad_lexical_cast&) {
isc_throw(StringTokenError, "Invalid SRV numeric parameter: " <<
num_token);
}
diff --git a/src/lib/util/tests/base32hex_unittest.cc b/src/lib/util/tests/base32hex_unittest.cc
index fa4a290..89d441e 100644
--- a/src/lib/util/tests/base32hex_unittest.cc
+++ b/src/lib/util/tests/base32hex_unittest.cc
@@ -154,7 +154,7 @@ TEST_F(Base32HexTest, decodeMap) {
}
TEST_F(Base32HexTest, encodeMap) {
- for (int i = 0; i < 32; ++i) {
+ for (uint8_t i = 0; i < 32; ++i) {
decoded_data.assign(4, 0);
decoded_data.push_back(i);
EXPECT_EQ(encoding_chars[i], encodeBase32Hex(decoded_data)[7]);
diff --git a/src/lib/util/tests/hex_unittest.cc b/src/lib/util/tests/hex_unittest.cc
index 52bccea..efb842f 100644
--- a/src/lib/util/tests/hex_unittest.cc
+++ b/src/lib/util/tests/hex_unittest.cc
@@ -110,7 +110,7 @@ TEST_F(HexTest, decodeMap) {
}
TEST_F(HexTest, encodeMap) {
- for (int i = 0; i < 16; ++i) {
+ for (uint8_t i = 0; i < 16; ++i) {
decoded_data.clear();
decoded_data.push_back(i);
EXPECT_EQ(encoding_chars[i], encodeHex(decoded_data)[1]);
diff --git a/src/lib/util/time_utilities.cc b/src/lib/util/time_utilities.cc
index 9303ab5..c756382 100644
--- a/src/lib/util/time_utilities.cc
+++ b/src/lib/util/time_utilities.cc
@@ -158,7 +158,7 @@ uint64_t
timeFromText64(const string& time_txt) {
// Confirm the source only consists digits. sscanf() allows some
// minor exceptions.
- for (int i = 0; i < time_txt.length(); ++i) {
+ for (string::size_type i = 0; i < time_txt.length(); ++i) {
if (!isdigit(time_txt.at(i))) {
isc_throw(InvalidTime, "Couldn't convert non-numeric time value: "
<< time_txt);
More information about the bind10-changes
mailing list