BIND 10 master, updated. ee21a81dbcfc6dc3587a9ca8ae95175c3b52bfea Merge branch 'master' into trac1470
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Dec 19 14:05:33 UTC 2011
The branch, master has been updated
via ee21a81dbcfc6dc3587a9ca8ae95175c3b52bfea (commit)
via ad1fd67bc72d8a050b58496fab79c4aeeeec1f44 (commit)
via 502cc85e6d101d89210cf8a1a41f06ea8b2412dd (commit)
via 3f83fac07d34fc709aebe528028f041fc3637bab (commit)
via f1104654a25beae9f1b6fcd7e09c5128346a150a (commit)
via f1f4ce3e3014366d4916f924655c27761327c681 (commit)
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 4feacbc10b4f22b6d8b82230ce88c95a391b82da (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 ee21a81dbcfc6dc3587a9ca8ae95175c3b52bfea
Merge: ad1fd67bc72d8a050b58496fab79c4aeeeec1f44 4feacbc10b4f22b6d8b82230ce88c95a391b82da
Author: Stephen Morris <stephen at isc.org>
Date: Mon Dec 19 13:58:05 2011 +0000
Merge branch 'master' into trac1470
commit ad1fd67bc72d8a050b58496fab79c4aeeeec1f44
Author: Stephen Morris <stephen at isc.org>
Date: Fri Dec 16 15:07:34 2011 +0000
[1470] Update test for the const removeIdentical() method
A previous change updated the test for removeIdentical(). This
change was omitted from the test for the const version.
commit 502cc85e6d101d89210cf8a1a41f06ea8b2412dd
Author: Jelte Jansen <jelte at isc.org>
Date: Wed Dec 14 12:03:51 2011 +0100
[1470] fix a few more shared_ptr namespaces
commit 3f83fac07d34fc709aebe528028f041fc3637bab
Author: Stephen Morris <stephen at isc.org>
Date: Tue Dec 13 16:57:48 2011 +0000
[1470] Correct bug concerning status return check
Original code checked the wrong variable when doing a status check
on read(2)/write(2).
commit f1104654a25beae9f1b6fcd7e09c5128346a150a
Author: Stephen Morris <stephen at isc.org>
Date: Tue Dec 13 11:46:06 2011 +0000
[1470] Move include of config.h before all other includes
commit f1f4ce3e3014366d4916f924655c27761327c681
Author: Stephen Morris <stephen at isc.org>
Date: Tue Dec 13 11:33:57 2011 +0000
[1470] replaced shared_ptr by boost::shared_ptr
shared_ptr is a candidates for the next STL version and Windows has
already adopted it. This change removes ambiguity between the Boost
and Windows versions of the class.
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_config.cc | 14 ++--
src/bin/auth/auth_srv.cc | 18 ++--
src/bin/auth/command.cc | 5 +-
src/bin/auth/tests/auth_srv_unittest.cc | 9 +-
src/bin/resolver/resolver.cc | 24 +++--
.../resolver/tests/response_scrubber_unittest.cc | 4 +-
src/lib/acl/dns.cc | 18 ++--
src/lib/acl/tests/acl_test.cc | 5 +-
src/lib/acl/tests/ip_check_unittest.cc | 8 +-
src/lib/acl/tests/loader_test.cc | 51 ++++++------
src/lib/acl/tests/logic_check_test.cc | 21 +++--
src/lib/asiodns/dns_lookup.h | 4 +-
src/lib/asiodns/dns_server.h | 4 +-
src/lib/asiodns/dns_service.cc | 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/io_service.cc | 4 +-
src/lib/asiolink/simple_callback.h | 4 +-
src/lib/asiolink/tcp_socket.h | 2 +-
src/lib/asiolink/tests/io_endpoint_unittest.cc | 3 +-
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 | 11 +++
src/lib/cryptolink/tests/crypto_unittests.cc | 3 +-
src/lib/datasrc/database.cc | 17 ++--
src/lib/datasrc/rbtree.h | 13 ++-
src/lib/datasrc/tests/database_unittest.cc | 90 ++++++++++----------
src/lib/datasrc/tests/memory_datasrc_unittest.cc | 8 +-
src/lib/datasrc/tests/sqlite3_accessor_unittest.cc | 5 +-
src/lib/dhcp/libdhcp++.cc | 2 +-
src/lib/dhcp/tests/pkt4_unittest.cc | 14 ++--
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/rrparamregistry-placeholder.cc | 6 +-
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/nsas/tests/hash_table_unittest.cc | 7 +-
.../tests/nameserver_address_store_unittest.cc | 4 +-
src/lib/python/isc/acl/dns_requestloader_python.cc | 3 +-
src/lib/python/isc/log/log.cc | 4 +-
src/lib/resolve/recursive_query.cc | 9 ++-
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/io/fd.cc | 71 ++++++++++------
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 +-
70 files changed, 340 insertions(+), 273 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/auth_config.cc b/src/bin/auth/auth_config.cc
index d684c68..2ae520c 100644
--- a/src/bin/auth/auth_config.cc
+++ b/src/bin/auth/auth_config.cc
@@ -35,7 +35,6 @@
#include <server_common/portconfig.h>
using namespace std;
-using boost::shared_ptr;
using namespace isc::dns;
using namespace isc::data;
using namespace isc::datasrc;
@@ -56,7 +55,7 @@ public:
virtual void commit();
private:
AuthSrv& server_;
- vector<shared_ptr<AuthConfigParser> > datasources_;
+ vector<boost::shared_ptr<AuthConfigParser> > datasources_;
set<string> configured_sources_;
};
@@ -86,8 +85,8 @@ DatasourcesConfig::build(ConstElementPtr config_value) {
datasrc_type->stringValue() << "' already configured");
}
- shared_ptr<AuthConfigParser> datasrc_config =
- shared_ptr<AuthConfigParser>(
+ boost::shared_ptr<AuthConfigParser> datasrc_config =
+ boost::shared_ptr<AuthConfigParser>(
createAuthConfigParser(server_, string("datasources/") +
datasrc_type->stringValue(),
true));
@@ -109,7 +108,8 @@ DatasourcesConfig::commit() {
// Currently memory data source for class IN is the only possibility.
server_.setInMemoryClient(RRClass::IN(), AuthSrv::InMemoryClientPtr());
- BOOST_FOREACH(shared_ptr<AuthConfigParser> datasrc_config, datasources_) {
+ BOOST_FOREACH(boost::shared_ptr<AuthConfigParser> datasrc_config,
+ datasources_) {
datasrc_config->commit();
}
}
@@ -163,7 +163,7 @@ MemoryDatasourceConfig::build(ConstElementPtr config_value) {
isc_throw(AuthConfigError, "Missing zone file for zone: "
<< origin->str());
}
- shared_ptr<InMemoryZoneFinder> zone_finder(new
+ boost::shared_ptr<InMemoryZoneFinder> zone_finder(new
InMemoryZoneFinder(rrclass_,
Name(origin->stringValue())));
const result::Result result = memory_client_->addZone(zone_finder);
@@ -327,7 +327,7 @@ configureAuthServer(AuthSrv& server, ConstElementPtr config_set) {
"Null pointer is passed to configuration parser");
}
- typedef shared_ptr<AuthConfigParser> ParserPtr;
+ typedef boost::shared_ptr<AuthConfigParser> ParserPtr;
vector<ParserPtr> parsers;
typedef pair<string, ConstElementPtr> ConfigPair;
try {
diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc
index da05e48..9c5e594 100644
--- a/src/bin/auth/auth_srv.cc
+++ b/src/bin/auth/auth_srv.cc
@@ -76,7 +76,6 @@ using namespace isc::xfr;
using namespace isc::asiolink;
using namespace isc::asiodns;
using namespace isc::server_common::portconfig;
-using boost::shared_ptr;
class AuthSrvImpl {
private:
@@ -124,7 +123,7 @@ public:
AddressList listen_addresses_;
/// The TSIG keyring
- const shared_ptr<TSIGKeyRing>* keyring_;
+ const boost::shared_ptr<TSIGKeyRing>* keyring_;
/// Bind the ModuleSpec object in config_session_ with
/// isc:config::ModuleSpec::validateStatistics.
@@ -228,12 +227,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() {
@@ -786,6 +786,6 @@ AuthSrv::setDNSService(isc::asiodns::DNSService& dnss) {
}
void
-AuthSrv::setTSIGKeyRing(const shared_ptr<TSIGKeyRing>* keyring) {
+AuthSrv::setTSIGKeyRing(const boost::shared_ptr<TSIGKeyRing>* keyring) {
impl_->keyring_ = keyring;
}
diff --git a/src/bin/auth/command.cc b/src/bin/auth/command.cc
index 940d57b..280558d 100644
--- a/src/bin/auth/command.cc
+++ b/src/bin/auth/command.cc
@@ -32,7 +32,6 @@
#include <auth/command.h>
using boost::scoped_ptr;
-using boost::shared_ptr;
using namespace isc::auth;
using namespace isc::config;
using namespace isc::data;
@@ -136,7 +135,7 @@ public:
// that doesn't block other server operations.
// TODO: we may (should?) want to check the "last load time" and
// the timestamp of the file and skip loading if the file isn't newer.
- shared_ptr<InMemoryZoneFinder> zone_finder(
+ boost::shared_ptr<InMemoryZoneFinder> zone_finder(
new InMemoryZoneFinder(old_zone_finder->getClass(),
old_zone_finder->getOrigin()));
zone_finder->load(old_zone_finder->getFileName());
@@ -147,7 +146,7 @@ public:
private:
// zone finder to be updated with the new file.
- shared_ptr<InMemoryZoneFinder> old_zone_finder;
+ boost::shared_ptr<InMemoryZoneFinder> old_zone_finder;
// A helper private method to parse and validate command parameters.
// On success, it sets 'old_zone_finder' to the zone to be updated.
diff --git a/src/bin/auth/tests/auth_srv_unittest.cc b/src/bin/auth/tests/auth_srv_unittest.cc
index d90006a..329a2dc 100644
--- a/src/bin/auth/tests/auth_srv_unittest.cc
+++ b/src/bin/auth/tests/auth_srv_unittest.cc
@@ -54,7 +54,6 @@ using namespace isc::asiolink;
using namespace isc::testutils;
using namespace isc::server_common::portconfig;
using isc::UnitTestUtil;
-using boost::shared_ptr;
namespace {
const char* const CONFIG_TESTDB =
@@ -251,7 +250,7 @@ TEST_F(AuthSrvTest, TSIGSigned) {
createRequestPacket(request_message, IPPROTO_UDP, &context);
// Run the message through the server
- shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
+ boost::shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
keyring->add(key);
server.setTSIGKeyRing(&keyring);
server.processMessage(*io_message, parse_message, response_obuffer,
@@ -285,7 +284,7 @@ TEST_F(AuthSrvTest, TSIGSignedBadKey) {
createRequestPacket(request_message, IPPROTO_UDP, &context);
// Process the message, but use a different key there
- shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
+ boost::shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
server.setTSIGKeyRing(&keyring);
server.processMessage(*io_message, parse_message, response_obuffer,
&dnsserv);
@@ -317,7 +316,7 @@ TEST_F(AuthSrvTest, TSIGBadSig) {
createRequestPacket(request_message, IPPROTO_UDP, &context);
// Process the message, but use a different key there
- shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
+ boost::shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
keyring->add(TSIGKey("key:QkFECg==:hmac-sha1"));
server.setTSIGKeyRing(&keyring);
server.processMessage(*io_message, parse_message, response_obuffer,
@@ -353,7 +352,7 @@ TEST_F(AuthSrvTest, TSIGCheckFirst) {
createRequestPacket(request_message, IPPROTO_UDP, &context);
// Process the message, but use a different key there
- shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
+ boost::shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
keyring->add(TSIGKey("key:QkFECg==:hmac-sha1"));
server.setTSIGKeyRing(&keyring);
server.processMessage(*io_message, parse_message, response_obuffer,
diff --git a/src/bin/resolver/resolver.cc b/src/bin/resolver/resolver.cc
index bb1eb3b..be70f1b 100644
--- a/src/bin/resolver/resolver.cc
+++ b/src/bin/resolver/resolver.cc
@@ -57,8 +57,6 @@
#include "resolver_log.h"
using namespace std;
-using boost::shared_ptr;
-
using namespace isc;
using namespace isc::util;
using namespace isc::acl;
@@ -167,7 +165,7 @@ public:
return (*query_acl_);
}
- void setQueryACL(shared_ptr<const RequestACL> new_acl) {
+ void setQueryACL(boost::shared_ptr<const RequestACL> new_acl) {
query_acl_ = new_acl;
}
@@ -195,7 +193,7 @@ public:
private:
/// ACL on incoming queries
- shared_ptr<const RequestACL> query_acl_;
+ boost::shared_ptr<const RequestACL> query_acl_;
/// Object to handle upstream queries
RecursiveQuery* rec_query_;
@@ -354,13 +352,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_;
@@ -597,9 +601,9 @@ Resolver::updateConfig(ConstElementPtr config) {
AddressList listenAddresses(parseAddresses(listenAddressesE,
"listen_on"));
const ConstElementPtr query_acl_cfg(config->get("query_acl"));
- const shared_ptr<const RequestACL> query_acl =
+ const boost::shared_ptr<const RequestACL> query_acl =
query_acl_cfg ? acl::dns::getRequestLoader().load(query_acl_cfg) :
- shared_ptr<RequestACL>();
+ boost::shared_ptr<RequestACL>();
bool set_timeouts(false);
int qtimeout = impl_->query_timeout_;
int ctimeout = impl_->client_timeout_;
@@ -765,7 +769,7 @@ Resolver::getQueryACL() const {
}
void
-Resolver::setQueryACL(shared_ptr<const RequestACL> new_acl) {
+Resolver::setQueryACL(boost::shared_ptr<const RequestACL> new_acl) {
if (!new_acl) {
isc_throw(InvalidParameter, "NULL pointer is passed to setQueryACL");
}
diff --git a/src/bin/resolver/tests/response_scrubber_unittest.cc b/src/bin/resolver/tests/response_scrubber_unittest.cc
index 1570def..37e2553 100644
--- a/src/bin/resolver/tests/response_scrubber_unittest.cc
+++ b/src/bin/resolver/tests/response_scrubber_unittest.cc
@@ -12,15 +12,13 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-// $Id$
+#include <config.h>
#include <string>
#include <iostream>
#include <gtest/gtest.h>
-#include <config.h>
-
#include <asiolink/io_endpoint.h>
#include <asiolink/io_address.h>
#include <netinet/in.h>
diff --git a/src/lib/acl/dns.cc b/src/lib/acl/dns.cc
index b9cf91f..d16ec65 100644
--- a/src/lib/acl/dns.cc
+++ b/src/lib/acl/dns.cc
@@ -32,7 +32,6 @@
#include <acl/logic_check.h>
using namespace std;
-using boost::shared_ptr;
using namespace isc::dns;
using namespace isc::data;
@@ -78,7 +77,7 @@ internal::RequestCheckCreator::names() const {
return (supported_names);
}
-shared_ptr<RequestCheck>
+boost::shared_ptr<RequestCheck>
internal::RequestCheckCreator::create(const string& name,
ConstElementPtr definition,
// unused:
@@ -90,10 +89,10 @@ internal::RequestCheckCreator::create(const string& name,
}
if (name == "from") {
- return (shared_ptr<internal::RequestIPCheck>(
+ return (boost::shared_ptr<internal::RequestIPCheck>(
new internal::RequestIPCheck(definition->stringValue())));
} else if (name == "key") {
- return (shared_ptr<internal::RequestKeyCheck>(
+ return (boost::shared_ptr<internal::RequestKeyCheck>(
new internal::RequestKeyCheck(
Name(definition->stringValue()))));
} else {
@@ -116,16 +115,17 @@ getRequestLoader() {
auto_ptr<RequestLoader>(new RequestLoader(REJECT));
// Register default check creator(s)
- loader_ptr->registerCreator(shared_ptr<internal::RequestCheckCreator>(
- new internal::RequestCheckCreator()));
loader_ptr->registerCreator(
- shared_ptr<NotCreator<RequestContext> >(
+ boost::shared_ptr<internal::RequestCheckCreator>(
+ new internal::RequestCheckCreator()));
+ loader_ptr->registerCreator(
+ boost::shared_ptr<NotCreator<RequestContext> >(
new NotCreator<RequestContext>("NOT")));
loader_ptr->registerCreator(
- shared_ptr<LogicCreator<AnyOfSpec, RequestContext> >(
+ boost::shared_ptr<LogicCreator<AnyOfSpec, RequestContext> >(
new LogicCreator<AnyOfSpec, RequestContext>("ANY")));
loader_ptr->registerCreator(
- shared_ptr<LogicCreator<AllOfSpec, RequestContext> >(
+ boost::shared_ptr<LogicCreator<AllOfSpec, RequestContext> >(
new LogicCreator<AllOfSpec, RequestContext>("ALL")));
// From this point there shouldn't be any exception thrown
diff --git a/src/lib/acl/tests/acl_test.cc b/src/lib/acl/tests/acl_test.cc
index 15ffef6..485a5a3 100644
--- a/src/lib/acl/tests/acl_test.cc
+++ b/src/lib/acl/tests/acl_test.cc
@@ -18,7 +18,6 @@
using namespace isc::acl;
using namespace isc::acl::tests;
-using boost::shared_ptr;
namespace {
@@ -46,8 +45,8 @@ public:
Log log_;
size_t next_check_;
boost::shared_ptr<Check<Log> > getCheck(bool accepts) {
- return (shared_ptr<Check<Log> >(new ConstCheck(accepts,
- next_check_++)));
+ return (boost::shared_ptr<Check<Log> >(new ConstCheck(accepts,
+ next_check_++)));
}
};
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/acl/tests/loader_test.cc b/src/lib/acl/tests/loader_test.cc
index 1705c0a..451f195 100644
--- a/src/lib/acl/tests/loader_test.cc
+++ b/src/lib/acl/tests/loader_test.cc
@@ -70,31 +70,30 @@ public:
// Some convenience functions to set up
// Create a NamedCreator, convert to shared pointer
- shared_ptr<NamedCreator> namedCreator(const string& name,
+ boost::shared_ptr<NamedCreator> namedCreator(const string& name,
bool abbreviatedList = true)
{
- return (shared_ptr<NamedCreator>(new NamedCreator(name,
- abbreviatedList)));
+ return (boost::shared_ptr<NamedCreator>(new NamedCreator(name,
+ abbreviatedList)));
}
// Create and add a NamedCreator
void addNamed(const string& name, bool abbreviatedList = true) {
EXPECT_NO_THROW(loader_.registerCreator(
namedCreator(name, abbreviatedList)));
}
- template<class Result> shared_ptr<Result> loadCheckAny(const string&
- definition)
+ template<class Result> boost::shared_ptr<Result> loadCheckAny(
+ const string& definition)
{
SCOPED_TRACE("Loading check " + definition);
- shared_ptr<Check<Log> > loaded;
+ boost::shared_ptr<Check<Log> > loaded;
EXPECT_NO_THROW(loaded = loader_.loadCheck(
Element::fromJSON(definition)));
- shared_ptr<Result> result(dynamic_pointer_cast<Result>(
- loaded));
+ boost::shared_ptr<Result> result(dynamic_pointer_cast<Result>(loaded));
EXPECT_TRUE(result);
return (result);
}
// Load a check and convert it to named check to examine it
- shared_ptr<NamedCheck> loadCheck(const string& definition) {
+ boost::shared_ptr<NamedCheck> loadCheck(const string& definition) {
return (loadCheckAny<NamedCheck>(definition));
}
// The loadCheck throws an exception
@@ -114,11 +113,12 @@ public:
// Insert the throw, throwcheck and logcheck checks into the loader
void aclSetup() {
try {
- loader_.registerCreator(shared_ptr<ThrowCreator>(new
- ThrowCreator()));
- loader_.registerCreator(shared_ptr<ThrowCheckCreator>(
+ loader_.registerCreator(boost::shared_ptr<ThrowCreator>(
+ new ThrowCreator()));
+ loader_.registerCreator(boost::shared_ptr<ThrowCheckCreator>(
new ThrowCheckCreator()));
- loader_.registerCreator(shared_ptr<LogCreator>(new LogCreator()));
+ loader_.registerCreator(boost::shared_ptr<LogCreator>(
+ new LogCreator()));
}
// We ignore this exception here, because it happens when we try to
// insert the creators multiple times. This is harmless.
@@ -133,7 +133,7 @@ public:
{
SCOPED_TRACE("Running ACL for " + JSON);
aclSetup();
- shared_ptr<ACL<Log> > acl;
+ boost::shared_ptr<ACL<Log> > acl;
EXPECT_NO_THROW(acl = loader_.load(Element::fromJSON(JSON)));
EXPECT_EQ(expectedResult, acl->execute(log_));
log_.checkFirst(logged);
@@ -174,7 +174,7 @@ TEST_F(LoaderTest, CreatorDuplicateUnchanged) {
names.push_back("name1");
names.push_back("name3");
EXPECT_THROW(loader_.registerCreator(
- shared_ptr<NamedCreator>(new NamedCreator(names))), LoaderError);
+ boost::shared_ptr<NamedCreator>(new NamedCreator(names))), LoaderError);
// It should now reject both name2 and name3 as not known
checkException("{\"name2\": null}");
checkException("{\"name3\": null}");
@@ -183,7 +183,7 @@ TEST_F(LoaderTest, CreatorDuplicateUnchanged) {
// Test that we can register a creator and load a check with the name
TEST_F(LoaderTest, SimpleCheckLoad) {
addNamed("name");
- shared_ptr<NamedCheck> check(loadCheck("{\"name\": 42}"));
+ boost::shared_ptr<NamedCheck> check(loadCheck("{\"name\": 42}"));
EXPECT_EQ("name", check->name_);
EXPECT_TRUE(check->data_->equals(*Element::fromJSON("42")));
}
@@ -192,7 +192,7 @@ TEST_F(LoaderTest, SimpleCheckLoad) {
TEST_F(LoaderTest, MultiCreatorCheckLoad) {
addNamed("name1");
addNamed("name2");
- shared_ptr<NamedCheck> check(loadCheck("{\"name2\": 42}"));
+ boost::shared_ptr<NamedCheck> check(loadCheck("{\"name2\": 42}"));
EXPECT_EQ("name2", check->name_);
EXPECT_TRUE(check->data_->equals(*Element::fromJSON("42")));
}
@@ -203,9 +203,9 @@ TEST_F(LoaderTest, MultiNameCheckLoad) {
vector<string> names;
names.push_back("name2");
names.push_back("name3");
- EXPECT_NO_THROW(loader_.registerCreator(shared_ptr<NamedCreator>(
+ EXPECT_NO_THROW(loader_.registerCreator(boost::shared_ptr<NamedCreator>(
new NamedCreator(names))));
- shared_ptr<NamedCheck> check(loadCheck("{\"name3\": 42}"));
+ boost::shared_ptr<NamedCheck> check(loadCheck("{\"name3\": 42}"));
EXPECT_EQ("name3", check->name_);
EXPECT_TRUE(check->data_->equals(*Element::fromJSON("42")));
}
@@ -230,7 +230,8 @@ TEST_F(LoaderTest, UnkownName) {
// Exception from the creator is propagated
TEST_F(LoaderTest, CheckPropagate) {
- loader_.registerCreator(shared_ptr<ThrowCreator>(new ThrowCreator()));
+ loader_.registerCreator(boost::shared_ptr<ThrowCreator>(
+ new ThrowCreator()));
EXPECT_THROW(loader_.loadCheck(Element::fromJSON("{\"throw\": null}")),
TestCreatorError);
}
@@ -239,7 +240,7 @@ TEST_F(LoaderTest, CheckPropagate) {
TEST_F(LoaderTest, AndAbbrev) {
addNamed("name1");
addNamed("name2");
- shared_ptr<LogicOperator<AllOfSpec, Log> > oper(
+ boost::shared_ptr<LogicOperator<AllOfSpec, Log> > oper(
loadCheckAny<LogicOperator<AllOfSpec, Log> >("{\"name1\": 1, \"name2\": 2}"));
// If we don't have anything loaded, the rest would crash. It is already
// reported from within loadCheckAny if it isn't loaded.
@@ -258,7 +259,7 @@ TEST_F(LoaderTest, AndAbbrev) {
// The abbreviated form of parameters
TEST_F(LoaderTest, OrAbbrev) {
addNamed("name1");
- shared_ptr<LogicOperator<AnyOfSpec, Log> > oper(
+ boost::shared_ptr<LogicOperator<AnyOfSpec, Log> > oper(
loadCheckAny<LogicOperator<AnyOfSpec, Log> >("{\"name1\": [1, 2]}"));
// If we don't have anything loaded, the rest would crash. It is already
// reported from within loadCheckAny if it isn't loaded.
@@ -276,7 +277,7 @@ TEST_F(LoaderTest, OrAbbrev) {
TEST_F(LoaderTest, BothAbbrev) {
addNamed("name1");
addNamed("name2");
- shared_ptr<LogicOperator<AllOfSpec, Log> > oper(
+ boost::shared_ptr<LogicOperator<AllOfSpec, Log> > oper(
loadCheckAny<LogicOperator<AllOfSpec, Log> >("{\"name1\": 1, \"name2\": [3, 4]}"));
// If we don't have anything loaded, the rest would crash. It is already
// reported from within loadCheckAny if it isn't loaded.
@@ -302,7 +303,7 @@ TEST_F(LoaderTest, BothAbbrev) {
// creator
TEST_F(LoaderTest, ListCheck) {
addNamed("name1", false);
- shared_ptr<NamedCheck> check(loadCheck("{\"name1\": [1, 2]}"));
+ boost::shared_ptr<NamedCheck> check(loadCheck("{\"name1\": [1, 2]}"));
EXPECT_EQ("name1", check->name_);
EXPECT_TRUE(check->data_->equals(*Element::fromJSON("[1, 2]")));
}
@@ -310,7 +311,7 @@ TEST_F(LoaderTest, ListCheck) {
// Check the action key is ignored as it should be
TEST_F(LoaderTest, CheckNoAction) {
addNamed("name1");
- shared_ptr<NamedCheck> check(loadCheck("{\"name1\": 1, \"action\": 2}"));
+ boost::shared_ptr<NamedCheck> check(loadCheck("{\"name1\": 1, \"action\": 2}"));
EXPECT_EQ("name1", check->name_);
EXPECT_TRUE(check->data_->equals(*Element::fromJSON("1")));
}
diff --git a/src/lib/acl/tests/logic_check_test.cc b/src/lib/acl/tests/logic_check_test.cc
index 1c80277..0ecd2cc 100644
--- a/src/lib/acl/tests/logic_check_test.cc
+++ b/src/lib/acl/tests/logic_check_test.cc
@@ -52,7 +52,7 @@ testCheck(bool emptyResult) {
EXPECT_EQ(emptyResult, oper.matches(log));
log.checkFirst(0);
// Fill it with some subexpressions
- typedef shared_ptr<ConstCheck> CheckPtr;
+ typedef boost::shared_ptr<ConstCheck> CheckPtr;
oper.addSubexpression(CheckPtr(new ConstCheck(emptyResult, 0)));
oper.addSubexpression(CheckPtr(new ConstCheck(emptyResult, 1)));
// Check what happens when only the default-valued are there
@@ -80,7 +80,7 @@ TEST(LogicOperators, AnyOf) {
// Fixture for the tests of the creators
class LogicCreatorTest : public ::testing::Test {
private:
- typedef shared_ptr<Loader<Log>::CheckCreator> CreatorPtr;
+ typedef boost::shared_ptr<Loader<Log>::CheckCreator> CreatorPtr;
public:
// Register some creators, both tested ones and some auxiliary ones for
// help
@@ -102,12 +102,12 @@ public:
// Some convenience shortcut names
typedef LogicOperator<AnyOfSpec, Log> AnyOf;
typedef LogicOperator<AllOfSpec, Log> AllOf;
- typedef shared_ptr<AnyOf> AnyOfPtr;
- typedef shared_ptr<AllOf> AllOfPtr;
+ typedef boost::shared_ptr<AnyOf> AnyOfPtr;
+ typedef boost::shared_ptr<AllOf> AllOfPtr;
// Loads the JSON as a check and tries to convert it to the given check
// subclass
- template<typename Result> shared_ptr<Result> load(const string& JSON) {
- shared_ptr<Check<Log> > result;
+ template<typename Result> boost::shared_ptr<Result> load(const string& JSON) {
+ boost::shared_ptr<Check<Log> > result;
EXPECT_NO_THROW(result = loader_.loadCheck(Element::fromJSON(JSON)));
/*
* Optimally, we would use a dynamic_pointer_cast here to both
@@ -122,9 +122,9 @@ public:
* multiple inheritance.
*/
EXPECT_STREQ(typeid(Result).name(), typeid(*result.get()).name());
- shared_ptr<Result>
+ boost::shared_ptr<Result>
resultConverted(static_pointer_cast<Result>(result));
- EXPECT_NE(shared_ptr<Result>(), resultConverted);
+ EXPECT_NE(boost::shared_ptr<Result>(), resultConverted);
return (resultConverted);
}
};
@@ -244,7 +244,8 @@ TEST_F(LogicCreatorTest, nested) {
}
void notTest(bool value) {
- NotOperator<Log> notOp(shared_ptr<Check<Log> >(new ConstCheck(value, 0)));
+ NotOperator<Log> notOp(boost::shared_ptr<Check<Log> >(
+ new ConstCheck(value, 0)));
Log log;
// It returns negated value
EXPECT_EQ(!value, notOp.matches(log));
@@ -281,7 +282,7 @@ TEST_F(LogicCreatorTest, notInvalid) {
}
TEST_F(LogicCreatorTest, notValid) {
- shared_ptr<NotOperator<Log> > notOp(load<NotOperator<Log> >("{\"NOT\":"
+ boost::shared_ptr<NotOperator<Log> > notOp(load<NotOperator<Log> >("{\"NOT\":"
" {\"logcheck\":"
" [0, true]}}"));
EXPECT_FALSE(notOp->matches(log_));
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/dns_service.cc b/src/lib/asiodns/dns_service.cc
index 94510fe..ed7d717 100644
--- a/src/lib/asiodns/dns_service.cc
+++ b/src/lib/asiodns/dns_service.cc
@@ -12,14 +12,14 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
+#include <config.h>
+
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h> // for some IPC/network system calls
#include <boost/lexical_cast.hpp>
-#include <config.h>
-
#include <log/dummylog.h>
#include <asio.hpp>
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/io_service.cc b/src/lib/asiolink/io_service.cc
index 70cc18b..76d5ee1 100644
--- a/src/lib/asiolink/io_service.cc
+++ b/src/lib/asiolink/io_service.cc
@@ -12,12 +12,12 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
+#include <config.h>
+
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h> // for some IPC/network system calls
-#include <config.h>
-
#include <asio.hpp>
#include <asiolink/io_service.h>
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/asiolink/tests/io_endpoint_unittest.cc b/src/lib/asiolink/tests/io_endpoint_unittest.cc
index c7283ec..948e708 100644
--- a/src/lib/asiolink/tests/io_endpoint_unittest.cc
+++ b/src/lib/asiolink/tests/io_endpoint_unittest.cc
@@ -25,11 +25,10 @@
#include <asiolink/io_endpoint.h>
#include <asiolink/io_error.h>
-using boost::shared_ptr;
using namespace isc::asiolink;
namespace {
-typedef shared_ptr<const IOEndpoint> ConstIOEndpointPtr;
+typedef boost::shared_ptr<const IOEndpoint> ConstIOEndpointPtr;
TEST(IOEndpointTest, createUDPv4) {
ConstIOEndpointPtr ep(IOEndpoint::create(IPPROTO_UDP,
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..d8624cb 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);
}
@@ -567,6 +573,11 @@ TEST(Element, constRemoveIdentical) {
c = Element::fromJSON("{ \"a\": { \"b\": \"c\" } }");
EXPECT_EQ(*removeIdentical(a, b), *c);
+ a = Element::fromJSON("{ \"a\": 1, \"b\": 2, \"c\": 3 }");
+ b = Element::fromJSON("{ \"c\": 3, \"b\": 2 }");
+ c = Element::fromJSON("{ \"a\": 1 }");
+ EXPECT_EQ(*removeIdentical(a, b), *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/database.cc b/src/lib/datasrc/database.cc
index bf7f6ae..6620c85 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -35,7 +35,6 @@
using namespace isc::dns;
using namespace std;
-using boost::shared_ptr;
using namespace isc::dns::rdata;
namespace isc {
@@ -874,7 +873,7 @@ namespace {
/// for next time.
class DatabaseIterator : public ZoneIterator {
public:
- DatabaseIterator(shared_ptr<DatabaseAccessor> accessor,
+ DatabaseIterator(boost::shared_ptr<DatabaseAccessor> accessor,
const Name& zone_name,
const RRClass& rrclass,
bool separate_rrs) :
@@ -970,7 +969,7 @@ private:
}
// The dedicated accessor
- shared_ptr<DatabaseAccessor> accessor_;
+ boost::shared_ptr<DatabaseAccessor> accessor_;
// The context
DatabaseAccessor::IteratorContextPtr context_;
// Class of the zone
@@ -1006,7 +1005,7 @@ DatabaseClient::getIterator(const isc::dns::Name& name,
//
class DatabaseUpdater : public ZoneUpdater {
public:
- DatabaseUpdater(shared_ptr<DatabaseAccessor> accessor, int zone_id,
+ DatabaseUpdater(boost::shared_ptr<DatabaseAccessor> accessor, int zone_id,
const Name& zone_name, const RRClass& zone_class,
bool journaling) :
committed_(false), accessor_(accessor), zone_id_(zone_id),
@@ -1052,7 +1051,7 @@ private:
typedef DatabaseAccessor Accessor;
bool committed_;
- shared_ptr<DatabaseAccessor> accessor_;
+ boost::shared_ptr<DatabaseAccessor> accessor_;
const int zone_id_;
const string db_name_;
const string zone_name_;
@@ -1229,7 +1228,7 @@ DatabaseClient::getUpdater(const isc::dns::Name& name, bool replace,
isc_throw(isc::BadValue, "Can't store journal and replace the whole "
"zone at the same time");
}
- shared_ptr<DatabaseAccessor> update_accessor(accessor_->clone());
+ boost::shared_ptr<DatabaseAccessor> update_accessor(accessor_->clone());
const std::pair<bool, int> zone(update_accessor->startUpdateZone(
name.toText(), replace));
if (!zone.first) {
@@ -1249,7 +1248,7 @@ private:
// A shortcut typedef to keep the code concise.
typedef DatabaseAccessor Accessor;
public:
- DatabaseJournalReader(shared_ptr<Accessor> accessor, const Name& zone,
+ DatabaseJournalReader(boost::shared_ptr<Accessor> accessor, const Name& zone,
int zone_id, const RRClass& rrclass, uint32_t begin,
uint32_t end) :
accessor_(accessor), zone_(zone), rrclass_(rrclass),
@@ -1297,7 +1296,7 @@ public:
}
private:
- shared_ptr<Accessor> accessor_;
+ boost::shared_ptr<Accessor> accessor_;
const Name zone_;
const RRClass rrclass_;
Accessor::IteratorContextPtr context_;
@@ -1312,7 +1311,7 @@ DatabaseClient::getJournalReader(const isc::dns::Name& zone,
uint32_t begin_serial,
uint32_t end_serial) const
{
- shared_ptr<DatabaseAccessor> jnl_accessor(accessor_->clone());
+ boost::shared_ptr<DatabaseAccessor> jnl_accessor(accessor_->clone());
const pair<bool, int> zoneinfo(jnl_accessor->getZone(zone.toText()));
if (!zoneinfo.first) {
return (pair<ZoneJournalReader::Result, ZoneJournalReaderPtr>(
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..01c16f3 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -41,7 +41,6 @@ using namespace isc::datasrc;
using namespace std;
// don't import the entire boost namespace. It will unexpectedly hide uint32_t
// for some systems.
-using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::lexical_cast;
using namespace isc::dns;
@@ -229,9 +228,9 @@ public:
}
}
- virtual shared_ptr<DatabaseAccessor> clone() {
+ virtual boost::shared_ptr<DatabaseAccessor> clone() {
// This accessor is stateless, so we can simply return a new instance.
- return (shared_ptr<DatabaseAccessor>(new NopAccessor));
+ return (boost::shared_ptr<DatabaseAccessor>(new NopAccessor));
}
virtual std::pair<bool, int> startUpdateZone(const std::string&, bool) {
@@ -311,7 +310,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;
}
@@ -350,8 +349,8 @@ public:
fillData();
}
- virtual shared_ptr<DatabaseAccessor> clone() {
- shared_ptr<MockAccessor> cloned_accessor(new MockAccessor());
+ virtual boost::shared_ptr<DatabaseAccessor> clone() {
+ boost::shared_ptr<MockAccessor> cloned_accessor(new MockAccessor());
cloned_accessor->readonly_records_ = &readonly_records_master_;
cloned_accessor->update_records_ = &update_records_master_;
cloned_accessor->empty_records_ = &empty_records_master_;
@@ -406,7 +405,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 +441,7 @@ private:
private:
const std::string searched_name_;
- int cur_record_;
+ size_t cur_record_;
std::vector< std::vector<std::string> > cur_name;
};
@@ -706,7 +705,7 @@ public:
}
// This allows the test code to get the accessor used in an update context
- shared_ptr<const MockAccessor> getLatestClone() const {
+ boost::shared_ptr<const MockAccessor> getLatestClone() const {
return (latest_clone_);
}
@@ -807,7 +806,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 +882,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_;
@@ -992,7 +991,7 @@ public:
current_accessor_ = new ACCESSOR_TYPE();
is_mock_ = (dynamic_cast<MockAccessor*>(current_accessor_) != NULL);
client_.reset(new DatabaseClient(qclass_,
- shared_ptr<ACCESSOR_TYPE>(
+ boost::shared_ptr<ACCESSOR_TYPE>(
current_accessor_)));
}
@@ -1002,9 +1001,9 @@ public:
*/
void checkZoneFinder(const DataSourceClient::FindResult& zone) {
ASSERT_NE(ZoneFinderPtr(), zone.zone_finder) << "No zone finder";
- shared_ptr<DatabaseClient::Finder> finder(
+ boost::shared_ptr<DatabaseClient::Finder> finder(
dynamic_pointer_cast<DatabaseClient::Finder>(zone.zone_finder));
- ASSERT_NE(shared_ptr<DatabaseClient::Finder>(), finder) <<
+ ASSERT_NE(boost::shared_ptr<DatabaseClient::Finder>(), finder) <<
"Wrong type of finder";
if (is_mock_) {
EXPECT_EQ(READONLY_ZONE_ID, finder->zone_id());
@@ -1012,10 +1011,10 @@ public:
EXPECT_EQ(current_accessor_, &finder->getAccessor());
}
- shared_ptr<DatabaseClient::Finder> getFinder() {
+ boost::shared_ptr<DatabaseClient::Finder> getFinder() {
DataSourceClient::FindResult zone(client_->findZone(zname_));
EXPECT_EQ(result::SUCCESS, zone.code);
- shared_ptr<DatabaseClient::Finder> finder(
+ boost::shared_ptr<DatabaseClient::Finder> finder(
dynamic_pointer_cast<DatabaseClient::Finder>(zone.zone_finder));
if (is_mock_) {
EXPECT_EQ(READONLY_ZONE_ID, finder->zone_id());
@@ -1102,11 +1101,11 @@ public:
// Will be deleted by client_, just keep the current value for comparison.
ACCESSOR_TYPE* current_accessor_;
- shared_ptr<DatabaseClient> client_;
+ boost::shared_ptr<DatabaseClient> client_;
const std::string database_name_;
// The zone finder of the test zone commonly used in various tests.
- shared_ptr<DatabaseClient::Finder> finder_;
+ boost::shared_ptr<DatabaseClient::Finder> finder_;
// Some shortcut variables for commonly used test parameters
const Name zname_; // the zone name stored in the test data source
@@ -1120,7 +1119,7 @@ public:
// update related objects to be tested
ZoneUpdaterPtr updater_;
- shared_ptr<const DatabaseAccessor> update_accessor_;
+ boost::shared_ptr<const DatabaseAccessor> update_accessor_;
// placeholders
const std::vector<std::string> empty_rdatas_; // for NXRRSET/NXDOMAIN
@@ -1194,7 +1193,7 @@ TEST(GenericDatabaseClientTest, noAccessorException) {
// We need a dummy variable here; some compiler would regard it a mere
// declaration instead of an instantiation and make the test fail.
EXPECT_THROW(DatabaseClient dummy(RRClass::IN(),
- shared_ptr<DatabaseAccessor>()),
+ boost::shared_ptr<DatabaseAccessor>()),
isc::InvalidParameter);
}
@@ -1215,8 +1214,9 @@ TEST(GenericDatabaseClientTest, noZoneNotImplementedIterator) {
}
TEST(GenericDatabaseClientTest, notImplementedIterator) {
- EXPECT_THROW(DatabaseClient(RRClass::IN(), shared_ptr<DatabaseAccessor>(
- new NopAccessor())).getIterator(Name("example.org")),
+ EXPECT_THROW(DatabaseClient(RRClass::IN(),
+ boost::shared_ptr<DatabaseAccessor>(
+ new NopAccessor())).getIterator(Name("example.org")),
isc::NotImplemented);
}
@@ -1499,7 +1499,7 @@ TEST_F(MockDatabaseClientTest, ttldiff_separate_rrs) {
}
TYPED_TEST(DatabaseClientTest, find) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->expected_rdatas_.clear();
this->expected_sig_rdatas_.clear();
@@ -1738,7 +1738,7 @@ TYPED_TEST(DatabaseClientTest, find) {
}
TYPED_TEST(DatabaseClientTest, findDelegation) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
// The apex should not be considered delegation point and we can access
// data
@@ -1856,7 +1856,7 @@ TYPED_TEST(DatabaseClientTest, findDelegation) {
}
TYPED_TEST(DatabaseClientTest, emptyDomain) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
// This domain doesn't exist, but a subdomain of it does.
// Therefore we should pretend the domain is there, but contains no RRsets
@@ -1868,7 +1868,7 @@ TYPED_TEST(DatabaseClientTest, emptyDomain) {
// Glue-OK mode. Just go through NS delegations down (but not through
// DNAME) and pretend it is not there.
TYPED_TEST(DatabaseClientTest, glueOK) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->expected_rdatas_.clear();
this->expected_sig_rdatas_.clear();
@@ -1925,7 +1925,7 @@ TYPED_TEST(DatabaseClientTest, glueOK) {
}
TYPED_TEST(DatabaseClientTest, wildcard) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
// First, simple wildcard match
// Check also that the RRSIG is added from the wildcard (not modified)
@@ -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_,
@@ -2098,7 +2098,7 @@ TYPED_TEST(DatabaseClientTest, wildcard) {
TYPED_TEST(DatabaseClientTest, noWildcard) {
// Tests with the NO_WILDCARD flag.
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
// This would match *.wild.example.org, but with NO_WILDCARD should
// result in NXDOMAIN.
@@ -2159,7 +2159,7 @@ TYPED_TEST(DatabaseClientTest, noWildcard) {
TYPED_TEST(DatabaseClientTest, NXRRSET_NSEC) {
// The domain exists, but doesn't have this RRType
// So we should get its NSEC
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->expected_rdatas_.push_back("www2.example.org. A AAAA NSEC RRSIG");
this->expected_sig_rdatas_.push_back("NSEC 5 3 3600 20000101000000 "
@@ -2178,7 +2178,7 @@ TYPED_TEST(DatabaseClientTest, wildcardNXRRSET_NSEC) {
//
// The user will have to query us again to get the correct
// answer (eg. prove there's not an exact match)
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->expected_rdatas_.push_back("cancel.here.wild.example.org. A NSEC "
"RRSIG");
@@ -2195,7 +2195,7 @@ TYPED_TEST(DatabaseClientTest, wildcardNXRRSET_NSEC) {
TYPED_TEST(DatabaseClientTest, NXDOMAIN_NSEC) {
// The domain doesn't exist, so we must get the right NSEC
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->expected_rdatas_.push_back("www2.example.org. A AAAA NSEC RRSIG");
this->expected_sig_rdatas_.push_back("NSEC 5 3 3600 20000101000000 "
@@ -2232,7 +2232,7 @@ TYPED_TEST(DatabaseClientTest, NXDOMAIN_NSEC) {
TYPED_TEST(DatabaseClientTest, emptyNonterminalNSEC) {
// Same as NXDOMAIN_NSEC, but with empty non-terminal
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->expected_rdatas_.push_back("empty.nonterminal.example.org. NSEC");
doFindTest(*finder, isc::dns::Name("nonterminal.example.org."),
@@ -2259,7 +2259,7 @@ TYPED_TEST(DatabaseClientTest, getOrigin) {
DataSourceClient::FindResult
zone(this->client_->findZone(Name("example.org")));
ASSERT_EQ(result::SUCCESS, zone.code);
- shared_ptr<DatabaseClient::Finder> finder(
+ boost::shared_ptr<DatabaseClient::Finder> finder(
dynamic_pointer_cast<DatabaseClient::Finder>(zone.zone_finder));
if (this->is_mock_) {
EXPECT_EQ(READONLY_ZONE_ID, finder->zone_id());
@@ -2301,7 +2301,7 @@ TYPED_TEST(DatabaseClientTest, updaterFinder) {
TYPED_TEST(DatabaseClientTest, flushZone) {
// A simple update case: flush the entire zone
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
// Before update, the name exists.
EXPECT_EQ(ZoneFinder::SUCCESS, finder->find(this->qname_,
@@ -2420,7 +2420,7 @@ TYPED_TEST(DatabaseClientTest, addRRsetToNewZone) {
TYPED_TEST(DatabaseClientTest, addRRsetToCurrentZone) {
// Similar to the previous test, but not replacing the existing data.
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->updater_->addRRset(*this->rrset_);
@@ -2577,7 +2577,7 @@ TYPED_TEST(DatabaseClientTest, addRRsetWithRRSIG) {
}
TYPED_TEST(DatabaseClientTest, deleteRRset) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->rrset_.reset(new RRset(this->qname_, this->qclass_, this->qtype_,
this->rrttl_));
@@ -2849,7 +2849,7 @@ TYPED_TEST(DatabaseClientTest, compoundUpdate) {
// Commit the changes, confirm the entire changes applied.
this->updater_->commit();
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("192.0.2.2");
this->expected_rdatas_.push_back("192.0.2.1");
@@ -2865,7 +2865,7 @@ TYPED_TEST(DatabaseClientTest, compoundUpdate) {
}
TYPED_TEST(DatabaseClientTest, previous) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
EXPECT_EQ(Name("www.example.org."),
finder->findPreviousName(Name("www2.example.org.")));
@@ -2892,7 +2892,7 @@ TYPED_TEST(DatabaseClientTest, previous) {
}
TYPED_TEST(DatabaseClientTest, invalidRdata) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
EXPECT_THROW(finder->find(Name("invalidrdata.example.org."), RRType::A()),
DataSourceError);
@@ -2901,7 +2901,7 @@ TYPED_TEST(DatabaseClientTest, invalidRdata) {
}
TEST_F(MockDatabaseClientTest, missingNSEC) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
/*
* FIXME: For now, we can't really distinguish this bogus input
@@ -2919,7 +2919,7 @@ TEST_F(MockDatabaseClientTest, missingNSEC) {
}
TEST_F(MockDatabaseClientTest, badName) {
- shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
+ boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
EXPECT_THROW(finder->findPreviousName(Name("brokenname.example.org.")),
DataSourceError);
@@ -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/datasrc/tests/sqlite3_accessor_unittest.cc b/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc
index 61341f6..5122136 100644
--- a/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc
+++ b/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc
@@ -29,7 +29,6 @@
using namespace std;
using namespace isc::datasrc;
-using boost::shared_ptr;
using boost::lexical_cast;
using isc::data::ConstElementPtr;
using isc::data::Element;
@@ -527,7 +526,7 @@ TEST_F(SQLite3Create, lockedtest) {
}
TEST_F(SQLite3AccessorTest, clone) {
- shared_ptr<DatabaseAccessor> cloned = accessor->clone();
+ boost::shared_ptr<DatabaseAccessor> cloned = accessor->clone();
EXPECT_EQ(accessor->getDBName(), cloned->getDBName());
// The cloned accessor should have a separate connection and search
@@ -604,7 +603,7 @@ protected:
vector<const char* const*> empty_stored; // indicate no corresponding data
// Another accessor, emulating one running on a different process/thread
- shared_ptr<SQLite3Accessor> another_accessor;
+ boost::shared_ptr<SQLite3Accessor> another_accessor;
DatabaseAccessor::IteratorContextPtr iterator;
};
diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc
index 78e91c9..c727be2 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/dhcp/tests/pkt4_unittest.cc b/src/lib/dhcp/tests/pkt4_unittest.cc
index fd28c5d..c5965d1 100644
--- a/src/lib/dhcp/tests/pkt4_unittest.cc
+++ b/src/lib/dhcp/tests/pkt4_unittest.cc
@@ -197,7 +197,7 @@ generateTestPacket2() {
TEST(Pkt4Test, fixedFields) {
- shared_ptr<Pkt4> pkt = generateTestPacket1();
+ boost::shared_ptr<Pkt4> pkt = generateTestPacket1();
// ok, let's check packet values
EXPECT_EQ(dummyOp, pkt->getOp());
@@ -224,7 +224,7 @@ TEST(Pkt4Test, fixedFields) {
}
TEST(Pkt4Test, fixedFieldsPack) {
- shared_ptr<Pkt4> pkt = generateTestPacket1();
+ boost::shared_ptr<Pkt4> pkt = generateTestPacket1();
vector<uint8_t> expectedFormat = generateTestPacket2();
EXPECT_NO_THROW(
@@ -244,8 +244,8 @@ TEST(Pkt4Test, fixedFieldsPack) {
TEST(Pkt4Test, fixedFieldsUnpack) {
vector<uint8_t> expectedFormat = generateTestPacket2();
- shared_ptr<Pkt4> pkt(new Pkt4(&expectedFormat[0],
- Pkt4::DHCPV4_PKT_HDR_LEN));
+ boost::shared_ptr<Pkt4> pkt(new Pkt4(&expectedFormat[0],
+ Pkt4::DHCPV4_PKT_HDR_LEN));
EXPECT_NO_THROW(
pkt->unpack()
@@ -512,8 +512,8 @@ TEST(Pkt4Test, unpackOptions) {
// now expectedFormat contains fixed format and 5 options
- shared_ptr<Pkt4> pkt(new Pkt4(&expectedFormat[0],
- expectedFormat.size()));
+ boost::shared_ptr<Pkt4> pkt(new Pkt4(&expectedFormat[0],
+ expectedFormat.size()));
EXPECT_NO_THROW(
pkt->unpack()
@@ -525,7 +525,7 @@ TEST(Pkt4Test, unpackOptions) {
EXPECT_TRUE(pkt->getOption(128));
EXPECT_TRUE(pkt->getOption(254));
- shared_ptr<Option> x = pkt->getOption(12);
+ boost::shared_ptr<Option> x = pkt->getOption(12);
ASSERT_TRUE(x); // option 1 should exist
EXPECT_EQ(12, x->getType()); // this should be option 12
ASSERT_EQ(3, x->getData().size()); // it should be of length 3
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/rrparamregistry-placeholder.cc b/src/lib/dns/rrparamregistry-placeholder.cc
index 5058ca3..62a9e34 100644
--- a/src/lib/dns/rrparamregistry-placeholder.cc
+++ b/src/lib/dns/rrparamregistry-placeholder.cc
@@ -77,7 +77,7 @@ struct RRTypeParam {
static size_t UNKNOWN_MAXLEN();
};
-typedef shared_ptr<RRTypeParam> RRTypeParamPtr;
+typedef boost::shared_ptr<RRTypeParam> RRTypeParamPtr;
typedef map<string, RRTypeParamPtr, CIStringLess> StrRRTypeMap;
typedef map<uint16_t, RRTypeParamPtr> CodeRRTypeMap;
@@ -119,7 +119,7 @@ struct RRClassParam {
static size_t UNKNOWN_MAXLEN();
};
-typedef shared_ptr<RRClassParam> RRClassParamPtr;
+typedef boost::shared_ptr<RRClassParam> RRClassParamPtr;
typedef map<string, RRClassParamPtr, CIStringLess> StrRRClassMap;
typedef map<uint16_t, RRClassParamPtr> CodeRRClassMap;
@@ -342,7 +342,7 @@ addParam(const string& code_string, uint16_t code, MC& codemap, MS& stringmap)
return (false);
}
- typedef shared_ptr<PT> ParamPtr;
+ typedef boost::shared_ptr<PT> ParamPtr;
typedef pair<string, ParamPtr> StrParamPair;
typedef pair<uint16_t, ParamPtr> CodeParamPair;
ParamPtr param = ParamPtr(new PT(code_string, code));
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/nsas/tests/hash_table_unittest.cc b/src/lib/nsas/tests/hash_table_unittest.cc
index 7ba25b5..f4c28fd 100644
--- a/src/lib/nsas/tests/hash_table_unittest.cc
+++ b/src/lib/nsas/tests/hash_table_unittest.cc
@@ -30,7 +30,6 @@
#include "nsas_test.h"
using namespace std;
-using boost::shared_ptr;
using namespace isc::dns;
namespace isc {
@@ -180,8 +179,8 @@ TEST_F(HashTableTest, GetTest) {
EXPECT_TRUE(value.get() == NULL);
}
-shared_ptr<TestEntry>
-pass(shared_ptr<TestEntry> value) {
+boost::shared_ptr<TestEntry>
+pass(boost::shared_ptr<TestEntry> value) {
return (value);
}
@@ -190,7 +189,7 @@ TEST_F(HashTableTest, GetOrAddTest) {
EXPECT_TRUE(table_.add(dummy1_, dummy1_->hashKey()));
// Check it looks it up
- std::pair<bool, shared_ptr<TestEntry> > result = table_.getOrAdd(
+ std::pair<bool, boost::shared_ptr<TestEntry> > result = table_.getOrAdd(
dummy1_->hashKey(), boost::bind(pass, dummy3_));
EXPECT_FALSE(result.first);
EXPECT_EQ(dummy1_.get(), result.second.get());
diff --git a/src/lib/nsas/tests/nameserver_address_store_unittest.cc b/src/lib/nsas/tests/nameserver_address_store_unittest.cc
index abbac1d..4785627 100644
--- a/src/lib/nsas/tests/nameserver_address_store_unittest.cc
+++ b/src/lib/nsas/tests/nameserver_address_store_unittest.cc
@@ -16,6 +16,8 @@
///
/// This file contains tests for the nameserver address store as a whole.
+#include <config.h>
+
#include <algorithm>
#include <cassert>
#include <string.h>
@@ -26,8 +28,6 @@
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
-#include <config.h>
-
#include <dns/rdataclass.h>
#include <dns/rrclass.h>
#include <dns/rrset.h>
diff --git a/src/lib/python/isc/acl/dns_requestloader_python.cc b/src/lib/python/isc/acl/dns_requestloader_python.cc
index ab421c5..24ae599 100644
--- a/src/lib/python/isc/acl/dns_requestloader_python.cc
+++ b/src/lib/python/isc/acl/dns_requestloader_python.cc
@@ -36,7 +36,6 @@
#include "dns_requestloader_python.h"
using namespace std;
-using boost::shared_ptr;
using namespace isc::util::python;
using namespace isc::data;
using namespace isc::acl::dns;
@@ -121,7 +120,7 @@ RequestLoader_load(PyObject* po_self, PyObject* args) {
}
}
if (py_result) {
- shared_ptr<RequestACL> acl(
+ boost::shared_ptr<RequestACL> acl(
self->cppobj->load(Element::fromJSON(acl_config)));
s_RequestACL* py_acl = static_cast<s_RequestACL*>(
requestacl_type.tp_alloc(&requestacl_type, 0));
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 930b593..c6ef331 100644
--- a/src/lib/resolve/recursive_query.cc
+++ b/src/lib/resolve/recursive_query.cc
@@ -12,6 +12,8 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
+#include <config.h>
+
#include <netinet/in.h>
#include <stdlib.h>
#include <sys/socket.h>
@@ -21,8 +23,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/bind.hpp>
-#include <config.h>
-
#include <dns/question.h>
#include <dns/message.h>
#include <dns/opcode.h>
@@ -679,11 +679,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/io/fd.cc b/src/lib/util/io/fd.cc
index 04e64dc..f9b17a7 100644
--- a/src/lib/util/io/fd.cc
+++ b/src/lib/util/io/fd.cc
@@ -23,46 +23,63 @@ namespace io {
bool
write_data(const int fd, const void *buffer_v, const size_t length) {
- const unsigned char *buffer(static_cast<const unsigned char *>(buffer_v));
- size_t rest(length);
- // Just keep writing until all is written
- while (rest) {
- ssize_t written(write(fd, buffer, rest));
- if (rest == -1) {
- if (errno == EINTR) { // Just keep going
- continue;
- } else {
+
+ const unsigned char* buffer(static_cast<const unsigned char*>(buffer_v));
+ size_t remaining = length; // Amount remaining to be written
+
+ while (remaining > 0) {
+ ssize_t amount = write(fd, buffer, remaining);
+ if (amount == -1) {
+ // Some error. Ignore interrupted system calls otherwise return
+ // an error indication.
+ if (errno != EINTR) {
return false;
}
- } else { // Wrote something
- rest -= written;
- buffer += written;
+
+ } else if (amount > 0) {
+ // Wrote "amount" bytes from the buffer
+ remaining -= amount;
+ buffer += amount;
+
+ } else {
+ // Wrote zero bytes from the buffer. We should not get here as any
+ // error that causes zero bytes to be written should have returned
+ // -1. However, write(2) can return 0, and in this case we
+ // interpret it as an error.
+ return (false);
}
}
- return true;
+ return (true);
}
ssize_t
read_data(const int fd, void *buffer_v, const size_t length) {
- unsigned char *buffer(static_cast<unsigned char *>(buffer_v));
- size_t rest(length), already(0);
- while (rest) { // Stil something to read
- ssize_t amount(read(fd, buffer, rest));
- if (rest == -1) {
- if (errno == EINTR) { // Continue on interrupted call
- continue;
- } else {
+
+ unsigned char* buffer(static_cast<unsigned char*>(buffer_v));
+ size_t remaining = length; // Amount remaining to be read
+
+ while (remaining > 0) {
+ ssize_t amount = read(fd, buffer, remaining);
+ if (amount == -1) {
+ // Some error. Ignore interrupted system calls otherwise return
+ // an error indication.
+ if (errno != EINTR) {
return -1;
}
- } else if (amount) {
- already += amount;
- rest -= amount;
+
+ } else if (amount > 0) {
+ // Read "amount" bytes into the buffer
+ remaining -= amount;
buffer += amount;
- } else { // EOF
- return already;
+
+ } else {
+ // EOF - end the read
+ break;
}
}
- return already;
+
+ // Return total number of bytes read
+ return (static_cast<ssize_t>(length - remaining));
}
}
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