BIND 10 trac2986test, updated. 554a52af838c0d11b93a4debba3a52f80e08ec72 [2986test] changed "long long int" to int64_t, "unsigned long long int" to uint64_t and added new Element type uint64.

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Jun 17 07:40:34 UTC 2013


The branch, trac2986test has been updated
       via  554a52af838c0d11b93a4debba3a52f80e08ec72 (commit)
      from  c345b2cf5d12ddfcf50724e4fdf3600291e2db2c (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 554a52af838c0d11b93a4debba3a52f80e08ec72
Author: Kazunori Fujiwara <fujiwara at wide.ad.jp>
Date:   Mon Jun 17 16:38:45 2013 +0900

    [2986test] changed "long long int" to int64_t, "unsigned long long int" to uint64_t and added new Element type uint64.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/cc/data.cc                             |   28 ++++++++-------
 src/lib/cc/data.h                              |   46 ++++++++++++------------
 src/lib/cc/tests/data_unittests.cc             |   14 ++++----
 src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc |    6 ++--
 src/lib/python/isc/cc/tests/data_test.py       |    4 +++
 src/lib/statistics/counter.h                   |    3 +-
 6 files changed, 54 insertions(+), 47 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc
index 4490e26..f405689 100644
--- a/src/lib/cc/data.cc
+++ b/src/lib/cc/data.cc
@@ -26,12 +26,10 @@
 #include <sstream>
 #include <cerrno>
 #include <climits>
-
-#include <boost/algorithm/string.hpp> // for iequals
-
 #include <cmath>
 #include <cerrno>
-// #include <cstdint>
+
+#include <boost/algorithm/string.hpp> // for iequals
 
 using namespace std;
 
@@ -62,12 +60,12 @@ Element::toWire(std::ostream& ss) const {
 }
 
 bool
-Element::getValue(long long int&) const {
+Element::getValue(int64_t&) const {
     return (false);
 }
 
 bool
-Element::getValue(unsigned long long int&) const {
+Element::getValue(uint64_t&) const {
     return (false);
 }
 
@@ -97,12 +95,12 @@ Element::getValue(std::map<std::string, ConstElementPtr>&) const {
 }
 
 bool
-Element::setValue(const long long int) {
+Element::setValue(const int64_t) {
     return (false);
 }
 
 bool
-Element::setValue(const unsigned long long int) {
+Element::setValue(const uint64_t) {
     return (false);
 }
 
@@ -220,12 +218,12 @@ Element::create() {
 }
 
 ElementPtr
-Element::create(const long long int i) {
+Element::create(const int64_t i) {
     return (ElementPtr(new IntElement(i)));
 }
 
 ElementPtr
-Element::create(const unsigned long long int u) {
+Element::create(const uint64_t u) {
     return (ElementPtr(new Uint64Element(u)));
 }
 
@@ -410,8 +408,8 @@ numberFromStringstream(std::istream& in, int& pos) {
 // value is larger than an int can handle)
 ElementPtr
 fromStringstreamNumber(std::istream& in, int& pos) {
-    long long int i;
-    unsigned long long int u;
+    int64_t i;
+    uint64_t u;
     double d = 0.0;
     char* endptr;
 
@@ -536,6 +534,8 @@ Element::typeToName(Element::types type) {
     switch (type) {
     case Element::integer:
         return (std::string("integer"));
+    case Element::uint64:
+        return (std::string("uint64"));
     case Element::real:
         return (std::string("real"));
     case Element::boolean:
@@ -559,6 +559,8 @@ Element::types
 Element::nameToType(const std::string& type_name) {
     if (type_name == "integer") {
         return (Element::integer);
+    } else if (type_name == "uint64") {
+        return (Element::uint64);
     } else if (type_name == "real") {
         return (Element::real);
     } else if (type_name == "boolean") {
@@ -858,7 +860,7 @@ IntElement::equals(const Element& other) const {
 
 bool
 Uint64Element::equals(const Element& other) const {
-    return (other.getType() == Element::integer) &&
+    return (other.getType() == Element::uint64) &&
            (i == other.intValue());
 }
 
diff --git a/src/lib/cc/data.h b/src/lib/cc/data.h
index 393f26c..eab0301 100644
--- a/src/lib/cc/data.h
+++ b/src/lib/cc/data.h
@@ -21,7 +21,7 @@
 #include <boost/shared_ptr.hpp>
 #include <stdexcept>
 #include <exceptions/exceptions.h>
-// #include <cstdint>
+#include <stdint.h>
 
 namespace isc { namespace data {
 
@@ -85,7 +85,7 @@ protected:
 public:
     // any is a special type used in list specifications, specifying
     // that the elements can be of any type
-    enum types { integer, real, boolean, null, string, list, map, any };
+    enum types { integer, uint64, real, boolean, null, string, list, map, any };
     // base class; make dtor virtual
     virtual ~Element() {};
 
@@ -125,10 +125,10 @@ public:
     /// If you want an exception-safe getter method, use
     /// getValue() below
     //@{
-    virtual long long int intValue() const
+    virtual int64_t intValue() const
     { isc_throw(TypeError, "intValue() called on non-integer Element"); };
-    virtual unsigned long long int uint64Value() const
-    { isc_throw(TypeError, "uint64Value() called on non-integer Element"); };
+    virtual uint64_t uint64Value() const
+    { isc_throw(TypeError, "uint64Value() called on non-uint64 Element"); };
     virtual double doubleValue() const
     { isc_throw(TypeError, "doubleValue() called on non-double Element"); };
     virtual bool boolValue() const
@@ -154,8 +154,8 @@ public:
     /// data to the given reference and returning true
     ///
     //@{
-    virtual bool getValue(long long int& t) const;
-    virtual bool getValue(unsigned long long int& t) const;
+    virtual bool getValue(int64_t& t) const;
+    virtual bool getValue(uint64_t& t) const;
     virtual bool getValue(double& t) const;
     virtual bool getValue(bool& t) const;
     virtual bool getValue(std::string& t) const;
@@ -171,8 +171,8 @@ public:
     /// is of the correct type
     ///
     //@{
-    virtual bool setValue(const long long int v);
-    virtual bool setValue(const unsigned long long int v);
+    virtual bool setValue(const int64_t v);
+    virtual bool setValue(const uint64_t v);
     virtual bool setValue(const double v);
     virtual bool setValue(const bool t);
     virtual bool setValue(const std::string& v);
@@ -278,10 +278,10 @@ public:
     /// represents an empty value, and is created with Element::create())
     //@{
     static ElementPtr create();
-    static ElementPtr create(const long long int i);
-    static ElementPtr create(const unsigned long long int u);
-    static ElementPtr create(const long int i) { return (create(static_cast<long long int>(i))); };
-    static ElementPtr create(const int i) { return (create(static_cast<long long int>(i))); };
+    static ElementPtr create(const int64_t i);
+    static ElementPtr create(const uint64_t u);
+    static ElementPtr create(const long int i) { return (create(static_cast<int64_t>(i))); };
+    static ElementPtr create(const int i) { return (create(static_cast<int64_t>(i))); };
     static ElementPtr create(const double d);
     static ElementPtr create(const bool b);
     static ElementPtr create(const std::string& s);
@@ -378,29 +378,29 @@ public:
 };
 
 class IntElement : public Element {
-    long long int i;
+    int64_t i;
 
 public:
-    IntElement(long long int v) : Element(integer), i(v) { }
-    long long int intValue() const { return (i); }
+    IntElement(int64_t v) : Element(integer), i(v) { }
+    int64_t intValue() const { return (i); }
     using Element::getValue;
-    bool getValue(long long int& t) const { t = i; return (true); }
+    bool getValue(int64_t& t) const { t = i; return (true); }
     using Element::setValue;
-    bool setValue(const long long int v) { i = v; return (true); }
+    bool setValue(const int64_t v) { i = v; return (true); }
     void toJSON(std::ostream& ss) const;
     bool equals(const Element& other) const;
 };
 
 class Uint64Element : public Element {
-    unsigned long long int i;
+    uint64_t i;
 
 public:
-    Uint64Element(unsigned long long int v) : Element(integer), i(v) { }
-    unsigned long long int uint64Value() const { return (i); }
+    Uint64Element(uint64_t v) : Element(uint64), i(v) { }
+    uint64_t uint64Value() const { return (i); }
     using Element::getValue;
-    bool getValue(unsigned long long int& t) const { t = i; return (true); }
+    bool getValue(uint64_t& t) const { t = i; return (true); }
     using Element::setValue;
-    bool setValue(const unsigned long long int v) { i = v; return (true); }
+    bool setValue(const uint64_t v) { i = v; return (true); }
     void toJSON(std::ostream& ss) const;
     bool equals(const Element& other) const;
 };
diff --git a/src/lib/cc/tests/data_unittests.cc b/src/lib/cc/tests/data_unittests.cc
index 4a8d894..3f9d5d4 100644
--- a/src/lib/cc/tests/data_unittests.cc
+++ b/src/lib/cc/tests/data_unittests.cc
@@ -192,7 +192,7 @@ template <typename T>
 void
 testGetValueInt() {
     T el;
-    long long int i;
+    int64_t i;
     double d;
     bool b;
     std::string s;
@@ -219,7 +219,7 @@ template <typename T>
 void
 testGetValueDouble() {
     T el;
-    long long int i;
+    int64_t i;
     double d;
     bool b;
     std::string s;
@@ -246,7 +246,7 @@ template <typename T>
 void
 testGetValueBool() {
     T el;
-    long long int i;
+    int64_t i;
     double d;
     bool b;
     std::string s;
@@ -273,7 +273,7 @@ template <typename T>
 void
 testGetValueString() {
     T el;
-    long long int i;
+    int64_t i;
     double d;
     bool b;
     std::string s;
@@ -300,7 +300,7 @@ template <typename T>
 void
 testGetValueList() {
     T el;
-    long long int i;
+    int64_t i;
     double d;
     bool b;
     std::string s;
@@ -327,7 +327,7 @@ template <typename T>
 void
 testGetValueMap() {
     T el;
-    long long int i;
+    int64_t i;
     double d;
     bool b;
     std::string s;
@@ -355,7 +355,7 @@ TEST(Element, create_and_value_throws) {
     // incorrect type is requested
     ElementPtr el;
     ConstElementPtr cel;
-    long long int i = 0;
+    int64_t i = 0;
     double d = 0.0;
     bool b = false;
     std::string s("asdf");
diff --git a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
index 687ef92..f76aeb6 100644
--- a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
+++ b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
@@ -167,13 +167,13 @@ TEST_F(DhcpParserTest, uint32ParserTest) {
     // 64-bit platform. 
     if (sizeof(long) > sizeof(uint32_t)) {
         long max = (long)(std::numeric_limits<uint32_t>::max()) + 1;
-        int_element->setValue(max);
+        int_element->setValue((int64_t)max);
         EXPECT_THROW(parser.build(int_element), isc::BadValue);
     }
 
     // Verify that parser will build with value of zero.
     int test_value = 0;
-    int_element->setValue((long)test_value);
+    int_element->setValue((int64_t)test_value);
     ASSERT_NO_THROW(parser.build(int_element));
 
     // Verify that commit updates storage.
@@ -184,7 +184,7 @@ TEST_F(DhcpParserTest, uint32ParserTest) {
 
     // Verify that parser will build with a valid positive value.
     test_value = 77;
-    int_element->setValue((long)test_value);
+    int_element->setValue((int64_t)test_value);
     ASSERT_NO_THROW(parser.build(int_element));
 
     // Verify that commit updates storage.
diff --git a/src/lib/python/isc/cc/tests/data_test.py b/src/lib/python/isc/cc/tests/data_test.py
index b8dc222..9794963 100644
--- a/src/lib/python/isc/cc/tests/data_test.py
+++ b/src/lib/python/isc/cc/tests/data_test.py
@@ -223,6 +223,10 @@ class TestData(unittest.TestCase):
         
     def test_parse_value_str(self):
         self.assertEqual(data.parse_value_str("1"), 1)
+        self.assertEqual(data.parse_value_str("9223372036854775807"), 9223372036854775807)
+        self.assertEqual(data.parse_value_str("-9223372036854775807"), -9223372036854775807)
+        self.assertEqual(data.parse_value_str("-9223372036854775808"), -9223372036854775808)
+        self.assertEqual(data.parse_value_str("18446744073709551615"), 18446744073709551615)
         self.assertEqual(data.parse_value_str("true"), True)
         self.assertEqual(data.parse_value_str("null"), None)
         self.assertEqual(data.parse_value_str("1.1"), 1.1)
diff --git a/src/lib/statistics/counter.h b/src/lib/statistics/counter.h
index 341a0ae..aceeded 100644
--- a/src/lib/statistics/counter.h
+++ b/src/lib/statistics/counter.h
@@ -21,6 +21,7 @@
 #include <boost/scoped_ptr.hpp>
 
 #include <vector>
+#include <stdint.h>
 
 namespace isc {
 namespace statistics {
@@ -28,7 +29,7 @@ namespace statistics {
 class Counter : boost::noncopyable {
 public:
     typedef unsigned int Type;
-    typedef unsigned long long int Value;
+    typedef uint64_t Value;
 
 private:
     std::vector<Counter::Value> counters_;



More information about the bind10-changes mailing list