BIND 10 trac1470, updated. 3f83fac07d34fc709aebe528028f041fc3637bab [1470] Correct bug concerning status return check
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Dec 13 17:00:13 UTC 2011
The branch, trac1470 has been updated
via 3f83fac07d34fc709aebe528028f041fc3637bab (commit)
via f1104654a25beae9f1b6fcd7e09c5128346a150a (commit)
via f1f4ce3e3014366d4916f924655c27761327c681 (commit)
from 0fd58479c441c0ce5584df6ab898594345e69ef5 (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 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.
-----------------------------------------------------------------------
Summary of changes:
src/bin/resolver/resolver.cc | 12 ++--
.../resolver/tests/response_scrubber_unittest.cc | 4 +-
src/lib/acl/dns.cc | 18 +++---
src/lib/acl/tests/loader_test.cc | 51 +++++++-------
src/lib/acl/tests/logic_check_test.cc | 21 +++---
src/lib/asiodns/dns_service.cc | 4 +-
src/lib/asiolink/io_service.cc | 4 +-
src/lib/datasrc/database.cc | 17 ++---
src/lib/datasrc/tests/database_unittest.cc | 72 ++++++++++----------
src/lib/datasrc/tests/sqlite3_accessor_unittest.cc | 5 +-
src/lib/dns/rrparamregistry-placeholder.cc | 6 +-
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/resolve/recursive_query.cc | 4 +-
src/lib/util/io/fd.cc | 71 ++++++++++++-------
16 files changed, 157 insertions(+), 146 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/resolver/resolver.cc b/src/bin/resolver/resolver.cc
index 473a9c2..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_;
@@ -603,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_;
@@ -771,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/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_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/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/datasrc/database.cc b/src/lib/datasrc/database.cc
index 6e0b02b..4af6aea 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/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index ca8df93..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) {
@@ -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_;
@@ -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_);
}
@@ -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)
@@ -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);
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/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/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/resolve/recursive_query.cc b/src/lib/resolve/recursive_query.cc
index 55f473e..5446974 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>
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));
}
}
More information about the bind10-changes
mailing list