BIND 10 trac1313, updated. d8ac168592885baab953cbe6e416afc6b72d9e7d [1313] Comments corrected, fixed tests for readUint32, writeUint32
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Oct 20 13:06:45 UTC 2011
The branch, trac1313 has been updated
via d8ac168592885baab953cbe6e416afc6b72d9e7d (commit)
from a0cf3955fceb4d810997dfefed7abbf57e4ee1cf (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 d8ac168592885baab953cbe6e416afc6b72d9e7d
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Thu Oct 20 15:06:15 2011 +0200
[1313] Comments corrected, fixed tests for readUint32, writeUint32
-----------------------------------------------------------------------
Summary of changes:
src/lib/util/io_utilities.h | 4 ++--
src/lib/util/tests/io_utilities_unittest.cc | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/util/io_utilities.h b/src/lib/util/io_utilities.h
index 273917e..61d4c9c 100644
--- a/src/lib/util/io_utilities.h
+++ b/src/lib/util/io_utilities.h
@@ -62,7 +62,7 @@ writeUint16(uint16_t value, void* buffer) {
/// \brief Read Unsigned 32-Bit Integer from Buffer
///
-/// \param buffer Data buffer at least two bytes long of which the first two
+/// \param buffer Data buffer at least four bytes long of which the first four
/// bytes are assumed to represent a 32-bit integer in network-byte
/// order.
///
@@ -82,7 +82,7 @@ readUint32(const uint8_t* buffer) {
/// \brief Write Unisgned 32-Bit Integer to Buffer
///
/// \param value 32-bit value to convert
-/// \param buffer Data buffer at least two bytes long into which the 16-bit
+/// \param buffer Data buffer at least four bytes long into which the 32-bit
/// value is written in network-byte order.
///
/// \return pointer to the next byte after stored value
diff --git a/src/lib/util/tests/io_utilities_unittest.cc b/src/lib/util/tests/io_utilities_unittest.cc
index dbbfe2f..3d161c0 100644
--- a/src/lib/util/tests/io_utilities_unittest.cc
+++ b/src/lib/util/tests/io_utilities_unittest.cc
@@ -88,12 +88,12 @@ TEST(asioutil, readUint32) {
// make sure that we can read data, regardless of
// the memory alignment. That' why we need to repeat
// it 4 times.
- for (int offset=0; offset<4; offset++) {
- for (int i=0; i< sizeof(test32); i++) {
+ for (int offset=0; offset < 4; offset++) {
+ for (int i=0; i< sizeof(test32)/sizeof(uint32_t); i++) {
uint32_t tmp = htonl(test32[i]);
- memcpy(&data[offset], &tmp, sizeof(uint32_t) );
+ memcpy(&data[offset], &tmp, sizeof(uint32_t));
- EXPECT_EQ( test32[i], readUint32(&data[offset]) );
+ EXPECT_EQ(test32[i], readUint32(&data[offset]));
}
}
}
@@ -105,15 +105,15 @@ TEST(asioutil, writeUint32) {
// make sure that we can write data, regardless of
// the memory alignment. That's why we need to repeat
// it 4 times.
- for (int offset=0; offset<4; offset++) {
- for (int i=0; i< sizeof(test32); i++) {
+ for (int offset=0; offset < 4; offset++) {
+ for (int i=0; i< sizeof(test32)/sizeof(uint32_t); i++) {
uint8_t* ptr = writeUint32(test32[i], &data[offset]);
- EXPECT_EQ( &data[offset]+sizeof(uint32_t), ptr );
+ EXPECT_EQ(&data[offset]+sizeof(uint32_t), ptr);
uint32_t tmp = htonl(test32[i]);
- EXPECT_FALSE( memcmp(&tmp, &data[offset], sizeof(uint32_t) ) );
+ EXPECT_EQ(0, memcmp(&tmp, &data[offset], sizeof(uint32_t)));
}
}
}
More information about the bind10-changes
mailing list