BIND 10 trac3016, updated. 1ed6c5843426b22dffaad30ed5403e034896a5ac Merge branch 'trac3015' into trac3016
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Aug 8 02:49:11 UTC 2013
The branch, trac3016 has been updated
via 1ed6c5843426b22dffaad30ed5403e034896a5ac (commit)
via e5b3471d579937f19e446f8a380464e0fc059567 (commit)
via 1176cc4839f9813cd49733a077715b5b2a767f8a (commit)
from b3d42b39d85fbd34e67c00c35ae87f823a311373 (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 1ed6c5843426b22dffaad30ed5403e034896a5ac
Merge: b3d42b3 e5b3471
Author: Kazunori Fujiwara <fujiwara at wide.ad.jp>
Date: Thu Aug 8 11:47:23 2013 +0900
Merge branch 'trac3015' into trac3016
-----------------------------------------------------------------------
Summary of changes:
src/lib/cc/data.cc | 5 -----
src/lib/cc/data.h | 15 +++++++++++++++
src/lib/cc/tests/data_unittests.cc | 20 +++++++++++++++-----
3 files changed, 30 insertions(+), 10 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc
index a48e1ce..3518939 100644
--- a/src/lib/cc/data.cc
+++ b/src/lib/cc/data.cc
@@ -393,11 +393,6 @@ numberFromStringstream(std::istream& in, int& pos) {
// that can also hold an e value? (and have specific getters if the
// value is larger than an int can handle)
//
-// Type of IntElement is changed from long int to int64_t.
-// However, strtoint64_t function does not exist.
-// It is assumed that "long long" and int64_t are the same sizes.
-// strtoll is used to convert string to integer.
-//
ElementPtr
fromStringstreamNumber(std::istream& in, int& pos) {
std::string number = numberFromStringstream(in, pos);
diff --git a/src/lib/cc/data.h b/src/lib/cc/data.h
index ca1c5ef..8050607 100644
--- a/src/lib/cc/data.h
+++ b/src/lib/cc/data.h
@@ -166,6 +166,8 @@ public:
/// the right type. Set the value and return true if the Elements
/// is of the correct type
///
+ /// Notes: Read notes of IntElement definition about the use of
+ /// long long int, long int and int.
//@{
virtual bool setValue(const long long int v);
bool setValue(const long int i) { return (setValue(static_cast<long long int>(i))); };
@@ -273,6 +275,9 @@ public:
/// underlying system).
/// (Note that that is different from an NullElement, which
/// represents an empty value, and is created with Element::create())
+ ///
+ /// Notes: Read notes of IntElement definition about the use of
+ /// long long int, long int and int.
//@{
static ElementPtr create();
static ElementPtr create(const long long int i);
@@ -373,6 +378,16 @@ public:
//@}
};
+/// Notes: IntElement type is changed to int64_t.
+/// Due to C++ problems on overloading and automatic type conversion,
+/// (C++ tries to convert integer type values and reference/pointer
+/// if value types do not match exactly)
+/// We decided the storage as int64_t,
+/// three (long long, long, int) override function defintions
+/// and cast int/long/long long to int64_t via long long.
+/// Therefore, call by value methods (create, setValue) have three
+/// (int,long,long long) definitions. Others use int64_t.
+///
class IntElement : public Element {
int64_t i;
private:
diff --git a/src/lib/cc/tests/data_unittests.cc b/src/lib/cc/tests/data_unittests.cc
index c8e76be..a60c994 100644
--- a/src/lib/cc/tests/data_unittests.cc
+++ b/src/lib/cc/tests/data_unittests.cc
@@ -205,7 +205,9 @@ testGetValueInt() {
std::map<std::string, ConstElementPtr> m;
el = Element::create(1);
- EXPECT_NO_THROW(el->intValue());
+ EXPECT_NO_THROW({
+ EXPECT_EQ(1, el->intValue());
+ });
EXPECT_THROW(el->doubleValue(), TypeError);
EXPECT_THROW(el->boolValue(), TypeError);
EXPECT_THROW(el->stringValue(), TypeError);
@@ -220,25 +222,33 @@ testGetValueInt() {
EXPECT_EQ(1, i);
el = Element::create(9223372036854775807LL);
- EXPECT_NO_THROW(el->intValue());
+ EXPECT_NO_THROW({
+ EXPECT_EQ(9223372036854775807LL, el->intValue());
+ });
EXPECT_TRUE(el->getValue(i));
EXPECT_EQ(9223372036854775807LL, i);
ll = 9223372036854775807LL;
el = Element::create(ll);
- EXPECT_NO_THROW(el->intValue());
+ EXPECT_NO_THROW({
+ EXPECT_EQ(ll, el->intValue());
+ });
EXPECT_TRUE(el->getValue(i));
EXPECT_EQ(ll, i);
i32 = 2147483647L;
el = Element::create(i32);
- EXPECT_NO_THROW(el->intValue());
+ EXPECT_NO_THROW({
+ EXPECT_EQ(i32, el->intValue());
+ });
EXPECT_TRUE(el->getValue(i));
EXPECT_EQ(i32, i);
l = 2147483647L;
el = Element::create(l);
- EXPECT_NO_THROW(el->intValue());
+ EXPECT_NO_THROW({
+ EXPECT_EQ(l, el->intValue());
+ });
EXPECT_TRUE(el->getValue(i));
EXPECT_EQ(l, i);
}
More information about the bind10-changes
mailing list