BIND 10 master, updated. e304c3e5e99d52252921370306d05c64d3a19a86 [master] Merge branch 'master' of ssh://git.bind10.isc.org/var/bind10/git/bind10
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri May 11 19:27:22 UTC 2012
The branch, master has been updated
via e304c3e5e99d52252921370306d05c64d3a19a86 (commit)
via ae3f3a68590912bb21304c9cdc5f55833984e7a6 (commit)
from 6d4b7f727228d8966a6700b920e0d1ae71c0aa92 (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 e304c3e5e99d52252921370306d05c64d3a19a86
Merge: ae3f3a6 6d4b7f7
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri May 11 12:27:19 2012 -0700
[master] Merge branch 'master' of ssh://git.bind10.isc.org/var/bind10/git/bind10
commit ae3f3a68590912bb21304c9cdc5f55833984e7a6
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri May 11 12:25:24 2012 -0700
[master] removed the "from-iterator" ctor of InputBuffer and its test.
It's not used anywhere else, and caused build failure on Solaris/SunStudio.
okayed on jabber.
I also made a few minor cleanups: unify string.c/ctring to the latter
and qualify memcpy() with std::
-----------------------------------------------------------------------
Summary of changes:
src/lib/util/buffer.h | 21 ++++-----------------
src/lib/util/tests/buffer_unittest.cc | 15 ---------------
2 files changed, 4 insertions(+), 32 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/util/buffer.h b/src/lib/util/buffer.h
index 5cd216a..1263636 100644
--- a/src/lib/util/buffer.h
+++ b/src/lib/util/buffer.h
@@ -18,8 +18,6 @@
#include <stdlib.h>
#include <cstring>
#include <vector>
-#include <iterator>
-#include <string.h>
#include <stdint.h>
@@ -101,17 +99,6 @@ public:
/// \param len The length of the data in bytes.
InputBuffer(const void* data, size_t len) :
position_(0), data_(static_cast<const uint8_t*>(data)), len_(len) {}
-
- /// @brief Constructor from vector<uint8_t>
- ///
- /// It is caller's responsibility to ensure that the data is valid as long
- /// as the buffer exists.
- ///
- /// @param begin iterator to beginning of the vector
- /// @param end iterator to end of the vector
- InputBuffer(std::vector<uint8_t>::const_iterator begin,
- std::vector<uint8_t>::const_iterator end) :
- position_(0), data_(&(*begin)), len_(std::distance(begin, end)) {}
//@}
///
@@ -209,7 +196,7 @@ public:
throwError("read beyond end of buffer");
}
- memcpy(data, &data_[position_], len);
+ std::memcpy(data, &data_[position_], len);
position_ += len;
}
//@}
@@ -344,7 +331,7 @@ public:
if (buffer_ == NULL && allocated_ != 0) {
throw std::bad_alloc();
}
- memcpy(buffer_, other.buffer_, size_);
+ std::memcpy(buffer_, other.buffer_, size_);
}
/// \brief Destructor
@@ -363,7 +350,7 @@ public:
buffer_ = newbuff;
size_ = other.size_;
allocated_ = other.allocated_;
- memcpy(buffer_, other.buffer_, size_);
+ std::memcpy(buffer_, other.buffer_, size_);
return (*this);
}
@@ -504,7 +491,7 @@ public:
void writeData(const void *data, size_t len)
{
ensureAllocated(size_ + len);
- memcpy(buffer_ + size_, data, len);
+ std::memcpy(buffer_ + size_, data, len);
size_ += len;
}
//@}
diff --git a/src/lib/util/tests/buffer_unittest.cc b/src/lib/util/tests/buffer_unittest.cc
index 9d924b3..9af3d57 100644
--- a/src/lib/util/tests/buffer_unittest.cc
+++ b/src/lib/util/tests/buffer_unittest.cc
@@ -287,19 +287,4 @@ TEST_F(BufferTest, inputBufferReadVectorChunks) {
EXPECT_EQ(0, memcmp(&vec[0], testdata+3, 2));
}
-TEST_F(BufferTest, inputBufferConstructorVector) {
- std::vector<uint8_t> vec(17);
- for (int i = 0; i < vec.size(); i++) {
- vec[i] = i;
- }
-
- InputBuffer buf(vec.begin(), vec.end());
-
- EXPECT_EQ(buf.getLength(), 17);
-
- std::vector<uint8_t> vec2;
- EXPECT_NO_THROW(buf.readVector(vec2, 17));
- EXPECT_TRUE(vec == vec2);
-}
-
}
More information about the bind10-changes
mailing list