BIND 10 trac1278, updated. eb6053d466fcea08fa66205d598d316e550863c8 [1278] whitespace fix
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Nov 28 14:14:56 UTC 2011
The branch, trac1278 has been updated
via eb6053d466fcea08fa66205d598d316e550863c8 (commit)
via 42d4a37a121ea7df3440268fe15995267fb66b12 (commit)
from 1b186f0a6fc242fa6dff08944ef43b60010d3631 (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 eb6053d466fcea08fa66205d598d316e550863c8
Author: Jelte Jansen <jelte at isc.org>
Date: Mon Nov 28 15:14:38 2011 +0100
[1278] whitespace fix
commit 42d4a37a121ea7df3440268fe15995267fb66b12
Author: Jelte Jansen <jelte at isc.org>
Date: Mon Nov 28 15:12:57 2011 +0100
[1278] some doc updates and final touches
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/python/serial_python.cc | 38 ++++++++++++++-------------------
src/lib/dns/python/serial_python.h | 2 +-
src/lib/dns/serial.cc | 2 +-
src/lib/dns/tests/serial_unittest.cc | 4 +-
4 files changed, 20 insertions(+), 26 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/python/serial_python.cc b/src/lib/dns/python/serial_python.cc
index fd79997..2f9501c 100644
--- a/src/lib/dns/python/serial_python.cc
+++ b/src/lib/dns/python/serial_python.cc
@@ -13,11 +13,8 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <Python.h>
-#include <vector>
#include <dns/serial.h>
-#include <dns/messagerenderer.h>
-#include <util/buffer.h>
#include <util/python/pycppwrapper_util.h>
#include "serial_python.h"
@@ -52,10 +49,12 @@ PyObject* Serial_add(PyObject *right, PyObject *left);
// 4. Documentation
PyMethodDef Serial_methods[] = {
{ "get_value", reinterpret_cast<PyCFunction>(Serial_getValue), METH_NOARGS,
- "Returns the Serial as an integer" },
+ "Returns the Serial value as an integer" },
{ NULL, NULL, 0, NULL }
};
+// For overriding the + operator. We do not define any other operators for
+// this type.
PyNumberMethods Serial_NumberMethods = {
Serial_add, //nb_add;
NULL, //nb_subtract;
@@ -162,15 +161,16 @@ Serial_richcmp(s_Serial* self, s_Serial* other, int op) {
*self->cppobj == *other->cppobj;
break;
}
- if (c)
+ if (c) {
Py_RETURN_TRUE;
- else
+ } else {
Py_RETURN_FALSE;
+ }
}
PyObject *
Serial_add(PyObject *left, PyObject *right) {
- // Either can be either a serial or a number, as long as one of them is a
+ // Either can be either a serial or a long, as long as one of them is a
// serial
if (PySerial_Check(left) && PySerial_Check(right)) {
return (createSerialObject(PySerial_ToSerial(left) +
@@ -192,15 +192,6 @@ Serial_add(PyObject *left, PyObject *right) {
namespace isc {
namespace dns {
namespace python {
-
-//
-// Declaration of the custom exceptions
-// Initialization and addition of these go in the initModulePart
-// function in pydnspp.cc
-//
-PyObject* po_InvalidSerial;
-PyObject* po_IncompleteSerial;
-
// This defines the complete type for reflection in python and
// parsing of PyObject* to s_Serial
// Most of the functions are not actually implemented and NULL here.
@@ -225,12 +216,14 @@ PyTypeObject serial_type = {
NULL, // tp_setattro
NULL, // tp_as_buffer
Py_TPFLAGS_DEFAULT, // tp_flags
- "The Serial class encapsulates Serials used in DNS resource records.\n\n"
+ "The Serial class encapsulates Serials used in DNS SOA records.\n\n"
"This is a straightforward class; an Serial object simply maintains a "
- "32-bit unsigned integer corresponding to the Serial value. The main purpose "
- "of this class is to provide convenient interfaces to convert a textual "
- "representation into the integer Serial value and vice versa, and to handle "
- "wire-format representations.",
+ "32-bit unsigned integer corresponding to the SOA SERIAL value. The "
+ "main purpose of this class is to provide serial number arithmetic, as "
+ "described in RFC 1892. Objects of this type can be compared and added "
+ "to each other, as described in RFC 1892. Apart from str(), get_value(), "
+ "comparison operators, and the + operand, no other operations are "
+ "defined for this type.",
NULL, // tp_traverse
NULL, // tp_clear
(richcmpfunc)Serial_richcmp, // tp_richcompare
@@ -269,7 +262,8 @@ createSerialObject(const Serial& source) {
bool
PySerial_Check(PyObject* obj) {
if (obj == NULL) {
- isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+ isc_throw(PyCPPWrapperException,
+ "obj argument NULL in Serial typecheck");
}
return (PyObject_TypeCheck(obj, &serial_type));
}
diff --git a/src/lib/dns/python/serial_python.h b/src/lib/dns/python/serial_python.h
index 0dd65d7..48b5199 100644
--- a/src/lib/dns/python/serial_python.h
+++ b/src/lib/dns/python/serial_python.h
@@ -12,7 +12,7 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-#ifndef __PYTHON_Serial_H
+#ifndef __PYTHON_SERIAL_H
#define __PYTHON_SERIAL_H 1
#include <Python.h>
diff --git a/src/lib/dns/serial.cc b/src/lib/dns/serial.cc
index aa588aa..3623f67 100644
--- a/src/lib/dns/serial.cc
+++ b/src/lib/dns/serial.cc
@@ -67,7 +67,7 @@ Serial::operator+(uint32_t other_val) const {
if (value_ - MAX_INCREMENT + other_val <= MAX_INCREMENT + 1) {
return (Serial(value_ + other_val));
} else {
- return (Serial(value_ - MAX_INCREMENT +
+ return (Serial(value_ - MAX_INCREMENT +
other_val - MAX_INCREMENT - 2));
}
}
diff --git a/src/lib/dns/tests/serial_unittest.cc b/src/lib/dns/tests/serial_unittest.cc
index 3933400..da2d753 100644
--- a/src/lib/dns/tests/serial_unittest.cc
+++ b/src/lib/dns/tests/serial_unittest.cc
@@ -68,7 +68,7 @@ TEST_F(SerialTest, comparison) {
EXPECT_LT(one, number_low);
EXPECT_LT(number_low, number_medium);
EXPECT_LT(number_medium, number_high);
-
+
// now let's try some that 'wrap', as it were
EXPECT_GT(min, max);
EXPECT_LT(max, min);
@@ -85,7 +85,7 @@ TEST_F(SerialTest, addition) {
EXPECT_EQ(min, max + one);
EXPECT_EQ(one, max + two);
EXPECT_EQ(one, max + one + one);
-
+
EXPECT_EQ(one + 100, max + 102);
EXPECT_EQ(min + 2147483645, max + 2147483646);
EXPECT_EQ(min + 2147483646, max + MAX_INCREMENT);
More information about the bind10-changes
mailing list