[svn] commit: r2238 - /experiments/python-binding/src/lib/dns/python/
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jun 23 11:15:08 UTC 2010
Author: jelte
Date: Wed Jun 23 11:15:08 2010
New Revision: 2238
Log:
use c++ style casts. Most of them are reinterpret_casts because of the way we used the strucutres in c-style as well, will change in next commit
Modified:
experiments/python-binding/src/lib/dns/python/libdns_python_common.cc
experiments/python-binding/src/lib/dns/python/message_python.cc
experiments/python-binding/src/lib/dns/python/messagerenderer_python.cc
experiments/python-binding/src/lib/dns/python/name_python.cc
experiments/python-binding/src/lib/dns/python/question_python.cc
experiments/python-binding/src/lib/dns/python/rdata_python.cc
experiments/python-binding/src/lib/dns/python/rrclass_python.cc
experiments/python-binding/src/lib/dns/python/rrset_python.cc
experiments/python-binding/src/lib/dns/python/rrttl_python.cc
experiments/python-binding/src/lib/dns/python/rrtype_python.cc
Modified: experiments/python-binding/src/lib/dns/python/libdns_python_common.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/libdns_python_common.cc (original)
+++ experiments/python-binding/src/lib/dns/python/libdns_python_common.cc Wed Jun 23 11:15:08 2010
@@ -33,7 +33,7 @@
"number in fromWire sequence not between 0 and 255");
return -1;
}
- data[i] = (uint8_t) PyLong_AsLong(el);
+ data[i] = static_cast<uint8_t>(PyLong_AsLong(el));
PySequence_DelItem(sequence, 0);
} else {
PyErr_SetString(PyExc_TypeError,
Modified: experiments/python-binding/src/lib/dns/python/message_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/message_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/message_python.cc Wed Jun 23 11:15:08 2010
@@ -58,14 +58,14 @@
static PyObject* MessageFlag_CD(s_MessageFlag* self);
static PyMethodDef MessageFlag_methods[] = {
- { "get_bit", (PyCFunction)MessageFlag_getBit, METH_NOARGS, "Returns the flag bit" },
- { "QR", (PyCFunction)MessageFlag_QR, METH_NOARGS | METH_STATIC, "Creates a QR MessageFlag" },
- { "AA", (PyCFunction)MessageFlag_AA, METH_NOARGS | METH_STATIC, "Creates a AA MessageFlag" },
- { "TC", (PyCFunction)MessageFlag_TC, METH_NOARGS | METH_STATIC, "Creates a TC MessageFlag" },
- { "RD", (PyCFunction)MessageFlag_RD, METH_NOARGS | METH_STATIC, "Creates a RD MessageFlag" },
- { "RA", (PyCFunction)MessageFlag_RA, METH_NOARGS | METH_STATIC, "Creates a RA MessageFlag" },
- { "AD", (PyCFunction)MessageFlag_AD, METH_NOARGS | METH_STATIC, "Creates a AD MessageFlag" },
- { "CD", (PyCFunction)MessageFlag_CD, METH_NOARGS | METH_STATIC, "Creates a CD MessageFlag" },
+ { "get_bit", reinterpret_cast<PyCFunction>(MessageFlag_getBit), METH_NOARGS, "Returns the flag bit" },
+ { "QR", reinterpret_cast<PyCFunction>(MessageFlag_QR), METH_NOARGS | METH_STATIC, "Creates a QR MessageFlag" },
+ { "AA", reinterpret_cast<PyCFunction>(MessageFlag_AA), METH_NOARGS | METH_STATIC, "Creates a AA MessageFlag" },
+ { "TC", reinterpret_cast<PyCFunction>(MessageFlag_TC), METH_NOARGS | METH_STATIC, "Creates a TC MessageFlag" },
+ { "RD", reinterpret_cast<PyCFunction>(MessageFlag_RD), METH_NOARGS | METH_STATIC, "Creates a RD MessageFlag" },
+ { "RA", reinterpret_cast<PyCFunction>(MessageFlag_RA), METH_NOARGS | METH_STATIC, "Creates a RA MessageFlag" },
+ { "AD", reinterpret_cast<PyCFunction>(MessageFlag_AD), METH_NOARGS | METH_STATIC, "Creates a AD MessageFlag" },
+ { "CD", reinterpret_cast<PyCFunction>(MessageFlag_CD), METH_NOARGS | METH_STATIC, "Creates a CD MessageFlag" },
{ NULL, NULL, 0, NULL }
};
@@ -156,7 +156,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -169,7 +169,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -182,7 +182,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -195,7 +195,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -208,7 +208,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -221,7 +221,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -234,7 +234,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
//
@@ -275,24 +275,24 @@
static PyObject* Opcode_richcmp(s_Opcode* self, s_Opcode* other, int op);
static PyMethodDef Opcode_methods[] = {
- { "get_code", (PyCFunction)Opcode_getCode, METH_NOARGS, "Returns the code value" },
- { "to_text", (PyCFunction)Opcode_toText, METH_NOARGS, "Returns the text representation" },
- { "QUERY", (PyCFunction)Opcode_QUERY, METH_NOARGS | METH_STATIC, "Creates a QUERY Opcode" },
- { "IQUERY", (PyCFunction)Opcode_IQUERY, METH_NOARGS | METH_STATIC, "Creates a IQUERY Opcode" },
- { "STATUS", (PyCFunction)Opcode_STATUS, METH_NOARGS | METH_STATIC, "Creates a STATUS Opcode" },
- { "RESERVED3", (PyCFunction)Opcode_RESERVED3, METH_NOARGS | METH_STATIC, "Creates a RESERVED3 Opcode" },
- { "NOTIFY", (PyCFunction)Opcode_NOTIFY, METH_NOARGS | METH_STATIC, "Creates a NOTIFY Opcode" },
- { "UPDATE", (PyCFunction)Opcode_UPDATE, METH_NOARGS | METH_STATIC, "Creates a UPDATE Opcode" },
- { "RESERVED6", (PyCFunction)Opcode_RESERVED6, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
- { "RESERVED7", (PyCFunction)Opcode_RESERVED7, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
- { "RESERVED8", (PyCFunction)Opcode_RESERVED8, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
- { "RESERVED9", (PyCFunction)Opcode_RESERVED9, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
- { "RESERVED10", (PyCFunction)Opcode_RESERVED10, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
- { "RESERVED11", (PyCFunction)Opcode_RESERVED11, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
- { "RESERVED12", (PyCFunction)Opcode_RESERVED12, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
- { "RESERVED13", (PyCFunction)Opcode_RESERVED13, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
- { "RESERVED14", (PyCFunction)Opcode_RESERVED14, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
- { "RESERVED15", (PyCFunction)Opcode_RESERVED15, METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "get_code", reinterpret_cast<PyCFunction>(Opcode_getCode), METH_NOARGS, "Returns the code value" },
+ { "to_text", reinterpret_cast<PyCFunction>(Opcode_toText), METH_NOARGS, "Returns the text representation" },
+ { "QUERY", reinterpret_cast<PyCFunction>(Opcode_QUERY), METH_NOARGS | METH_STATIC, "Creates a QUERY Opcode" },
+ { "IQUERY", reinterpret_cast<PyCFunction>(Opcode_IQUERY), METH_NOARGS | METH_STATIC, "Creates a IQUERY Opcode" },
+ { "STATUS", reinterpret_cast<PyCFunction>(Opcode_STATUS), METH_NOARGS | METH_STATIC, "Creates a STATUS Opcode" },
+ { "RESERVED3", reinterpret_cast<PyCFunction>(Opcode_RESERVED3), METH_NOARGS | METH_STATIC, "Creates a RESERVED3 Opcode" },
+ { "NOTIFY", reinterpret_cast<PyCFunction>(Opcode_NOTIFY), METH_NOARGS | METH_STATIC, "Creates a NOTIFY Opcode" },
+ { "UPDATE", reinterpret_cast<PyCFunction>(Opcode_UPDATE), METH_NOARGS | METH_STATIC, "Creates a UPDATE Opcode" },
+ { "RESERVED6", reinterpret_cast<PyCFunction>(Opcode_RESERVED6), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "RESERVED7", reinterpret_cast<PyCFunction>(Opcode_RESERVED7), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "RESERVED8", reinterpret_cast<PyCFunction>(Opcode_RESERVED8), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "RESERVED9", reinterpret_cast<PyCFunction>(Opcode_RESERVED9), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "RESERVED10", reinterpret_cast<PyCFunction>(Opcode_RESERVED10), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "RESERVED11", reinterpret_cast<PyCFunction>(Opcode_RESERVED11), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "RESERVED12", reinterpret_cast<PyCFunction>(Opcode_RESERVED12), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "RESERVED13", reinterpret_cast<PyCFunction>(Opcode_RESERVED13), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "RESERVED14", reinterpret_cast<PyCFunction>(Opcode_RESERVED14), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
+ { "RESERVED15", reinterpret_cast<PyCFunction>(Opcode_RESERVED15), METH_NOARGS | METH_STATIC, "Creates a RESERVED Opcode" },
{ NULL, NULL, 0, NULL }
};
@@ -379,7 +379,9 @@
static PyObject*
Opcode_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self,
+ const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -392,7 +394,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -405,7 +407,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -418,7 +420,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -431,7 +433,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -444,7 +446,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -457,7 +459,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -470,7 +472,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -483,7 +485,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -496,7 +498,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -509,7 +511,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -522,7 +524,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -535,7 +537,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -548,7 +550,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -561,7 +563,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -574,7 +576,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -587,7 +589,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -597,7 +599,7 @@
// Check for null and if the types match. If different type,
// simply return False
if (!other ||
- ((PyObject*)self)->ob_type != ((PyObject*)other)->ob_type
+ (reinterpret_cast<PyObject*>(self))->ob_type != (reinterpret_cast<PyObject*>(other))->ob_type
) {
Py_RETURN_FALSE;
}
@@ -680,25 +682,25 @@
static PyObject* Rcode_richcmp(s_Rcode* self, s_Rcode* other, int op);
static PyMethodDef Rcode_methods[] = {
- { "get_code", (PyCFunction)Rcode_getCode, METH_NOARGS, "Returns the code value" },
- { "to_text", (PyCFunction)Rcode_toText, METH_NOARGS, "Returns the text representation" },
- { "NOERROR", (PyCFunction)Rcode_NOERROR, METH_NOARGS | METH_STATIC, "Creates a NOERROR Rcode" },
- { "FORMERR", (PyCFunction)Rcode_FORMERR, METH_NOARGS | METH_STATIC, "Creates a FORMERR Rcode" },
- { "SERVFAIL", (PyCFunction)Rcode_SERVFAIL, METH_NOARGS | METH_STATIC, "Creates a SERVFAIL Rcode" },
- { "NXDOMAIN", (PyCFunction)Rcode_NXDOMAIN, METH_NOARGS | METH_STATIC, "Creates a NXDOMAIN Rcode" },
- { "NOTIMP", (PyCFunction)Rcode_NOTIMP, METH_NOARGS | METH_STATIC, "Creates a NOTIMP Rcode" },
- { "REFUSED", (PyCFunction)Rcode_REFUSED, METH_NOARGS | METH_STATIC, "Creates a REFUSED Rcode" },
- { "YXDOMAIN", (PyCFunction)Rcode_YXDOMAIN, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "YXRRSET", (PyCFunction)Rcode_YXRRSET, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "NXRRSET", (PyCFunction)Rcode_NXRRSET, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "NOTAUTH", (PyCFunction)Rcode_NOTAUTH, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "NOTZONE", (PyCFunction)Rcode_NOTZONE, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "RESERVED11", (PyCFunction)Rcode_RESERVED11, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "RESERVED12", (PyCFunction)Rcode_RESERVED12, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "RESERVED13", (PyCFunction)Rcode_RESERVED13, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "RESERVED14", (PyCFunction)Rcode_RESERVED14, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "RESERVED15", (PyCFunction)Rcode_RESERVED15, METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
- { "BADVERS", (PyCFunction)Rcode_BADVERS, METH_NOARGS | METH_STATIC, "Creates a BADVERS Rcode" },
+ { "get_code", reinterpret_cast<PyCFunction>(Rcode_getCode), METH_NOARGS, "Returns the code value" },
+ { "to_text", reinterpret_cast<PyCFunction>(Rcode_toText), METH_NOARGS, "Returns the text representation" },
+ { "NOERROR", reinterpret_cast<PyCFunction>(Rcode_NOERROR), METH_NOARGS | METH_STATIC, "Creates a NOERROR Rcode" },
+ { "FORMERR", reinterpret_cast<PyCFunction>(Rcode_FORMERR), METH_NOARGS | METH_STATIC, "Creates a FORMERR Rcode" },
+ { "SERVFAIL", reinterpret_cast<PyCFunction>(Rcode_SERVFAIL), METH_NOARGS | METH_STATIC, "Creates a SERVFAIL Rcode" },
+ { "NXDOMAIN", reinterpret_cast<PyCFunction>(Rcode_NXDOMAIN), METH_NOARGS | METH_STATIC, "Creates a NXDOMAIN Rcode" },
+ { "NOTIMP", reinterpret_cast<PyCFunction>(Rcode_NOTIMP), METH_NOARGS | METH_STATIC, "Creates a NOTIMP Rcode" },
+ { "REFUSED", reinterpret_cast<PyCFunction>(Rcode_REFUSED), METH_NOARGS | METH_STATIC, "Creates a REFUSED Rcode" },
+ { "YXDOMAIN", reinterpret_cast<PyCFunction>(Rcode_YXDOMAIN), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "YXRRSET", reinterpret_cast<PyCFunction>(Rcode_YXRRSET), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "NXRRSET", reinterpret_cast<PyCFunction>(Rcode_NXRRSET), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "NOTAUTH", reinterpret_cast<PyCFunction>(Rcode_NOTAUTH), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "NOTZONE", reinterpret_cast<PyCFunction>(Rcode_NOTZONE), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "RESERVED11", reinterpret_cast<PyCFunction>(Rcode_RESERVED11), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "RESERVED12", reinterpret_cast<PyCFunction>(Rcode_RESERVED12), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "RESERVED13", reinterpret_cast<PyCFunction>(Rcode_RESERVED13), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "RESERVED14", reinterpret_cast<PyCFunction>(Rcode_RESERVED14), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "RESERVED15", reinterpret_cast<PyCFunction>(Rcode_RESERVED15), METH_NOARGS | METH_STATIC, "Creates a RESERVED Rcode" },
+ { "BADVERS", reinterpret_cast<PyCFunction>(Rcode_BADVERS), METH_NOARGS | METH_STATIC, "Creates a BADVERS Rcode" },
{ NULL, NULL, 0, NULL }
};
@@ -799,7 +801,9 @@
static PyObject*
Rcode_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self,
+ const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -813,7 +817,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -827,7 +831,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -841,7 +845,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -855,7 +859,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -869,7 +873,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -883,7 +887,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -897,7 +901,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -911,7 +915,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -925,7 +929,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -939,7 +943,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -953,7 +957,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -967,7 +971,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -981,7 +985,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -995,7 +999,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -1009,7 +1013,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -1023,7 +1027,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -1037,7 +1041,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -1047,7 +1051,7 @@
// Check for null and if the types match. If different type,
// simply return False
if (!other ||
- ((PyObject*)self)->ob_type != ((PyObject*)other)->ob_type
+ (reinterpret_cast<PyObject*>(self))->ob_type != (reinterpret_cast<PyObject*>(other))->ob_type
) {
Py_RETURN_FALSE;
}
@@ -1110,11 +1114,11 @@
static PyObject* Section_richcmp(s_Section* self, s_Section* other, int op);
static PyMethodDef Section_methods[] = {
- { "get_code", (PyCFunction)Section_getCode, METH_NOARGS, "Returns the code value" },
- { "QUESTION", (PyCFunction)Section_QUESTION, METH_NOARGS | METH_STATIC, "Creates a QUESTION Section" },
- { "ANSWER", (PyCFunction)Section_ANSWER, METH_NOARGS | METH_STATIC, "Creates an ANSWER Section" },
- { "AUTHORITY", (PyCFunction)Section_AUTHORITY, METH_NOARGS | METH_STATIC, "Creates an AUTHORITY Section" },
- { "ADDITIONAL", (PyCFunction)Section_ADDITIONAL, METH_NOARGS | METH_STATIC, "Creates an ADDITIONAL Section" },
+ { "get_code", reinterpret_cast<PyCFunction>(Section_getCode), METH_NOARGS, "Returns the code value" },
+ { "QUESTION", reinterpret_cast<PyCFunction>(Section_QUESTION), METH_NOARGS | METH_STATIC, "Creates a QUESTION Section" },
+ { "ANSWER", reinterpret_cast<PyCFunction>(Section_ANSWER), METH_NOARGS | METH_STATIC, "Creates an ANSWER Section" },
+ { "AUTHORITY", reinterpret_cast<PyCFunction>(Section_AUTHORITY), METH_NOARGS | METH_STATIC, "Creates an AUTHORITY Section" },
+ { "ADDITIONAL", reinterpret_cast<PyCFunction>(Section_ADDITIONAL), METH_NOARGS | METH_STATIC, "Creates an ADDITIONAL Section" },
{ NULL, NULL, 0, NULL }
};
@@ -1205,7 +1209,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -1218,7 +1222,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -1231,7 +1235,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -1244,7 +1248,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -1254,7 +1258,7 @@
// Check for null and if the types match. If different type,
// simply return False
if (!other ||
- ((PyObject*)self)->ob_type != ((PyObject*)other)->ob_type
+ (reinterpret_cast<PyObject*>(self))->ob_type != (reinterpret_cast<PyObject*>(other))->ob_type
) {
Py_RETURN_FALSE;
}
@@ -1354,28 +1358,28 @@
// 3. Argument type
// 4. Documentation
static PyMethodDef Message_methods[] = {
- { "get_header_flag", (PyCFunction)Message_getHeaderFlag, METH_VARARGS,
+ { "get_header_flag", reinterpret_cast<PyCFunction>(Message_getHeaderFlag), METH_VARARGS,
"Return whether the specified header flag bit is set in the "
"header section. Takes a MessageFlag object as the only argument." },
- { "set_header_flag", (PyCFunction)Message_setHeaderFlag, METH_VARARGS,
+ { "set_header_flag", reinterpret_cast<PyCFunction>(Message_setHeaderFlag), METH_VARARGS,
"Sets the specified header flag bit to 1. The message must be in "
"RENDER mode. If not, an InvalidMessageOperation is raised. "
"Takes a MessageFlag object as the only argument." },
- { "clear_header_flag", (PyCFunction)Message_clearHeaderFlag, METH_VARARGS,
+ { "clear_header_flag", reinterpret_cast<PyCFunction>(Message_clearHeaderFlag), METH_VARARGS,
"Sets the specified header flag bit to 0. The message must be in "
"RENDER mode. If not, an InvalidMessageOperation is raised. "
"Takes a MessageFlag object as the only argument." },
- { "is_dnssec_supported", (PyCFunction)Message_isDNSSECSupported, METH_NOARGS,
+ { "is_dnssec_supported", reinterpret_cast<PyCFunction>(Message_isDNSSECSupported), METH_NOARGS,
"Returns True if the message sender indicates DNSSEC is supported. "
"If EDNS is included, this corresponds to the value of the DO bit. "
"Otherwise, DNSSEC is considered not supported." },
- { "set_dnssec_supported", (PyCFunction)Message_setDNSSECSupported, METH_VARARGS,
+ { "set_dnssec_supported", reinterpret_cast<PyCFunction>(Message_setDNSSECSupported), METH_VARARGS,
"Specify whether DNSSEC is supported in the message. "
"The message must be in RENDER mode. If not, an "
"InvalidMessageOperation is raised."
"If EDNS is included in the message, the DO bit is set or cleared "
"according to given argument (True or False) of this method."},
- { "get_udp_size", (PyCFunction)Message_getUDPSize, METH_NOARGS,
+ { "get_udp_size", reinterpret_cast<PyCFunction>(Message_getUDPSize), METH_NOARGS,
"Return the maximum buffer size of UDP messages for the sender "
"of the message.\n\n"
"The semantics of this value is different based on the mode:\n"
@@ -1383,7 +1387,7 @@
"in the RENDER mode, it means the buffer size of the local node.\n\n"
"In either case, its value is the value of the UDP payload size field "
"of EDNS (when it's included) or DEFAULT_MAX_UDPSIZE." },
- { "set_udp_size", (PyCFunction)Message_setUDPSize, METH_VARARGS,
+ { "set_udp_size", reinterpret_cast<PyCFunction>(Message_setUDPSize), METH_VARARGS,
"Specify the maximum buffer size of UDP messages of the local "
"node. If the message is not in RENDER mode, an "
"InvalidMessageOperation is raised.\n\n"
@@ -1394,60 +1398,60 @@
"included or not. This means if an application wants to send a message "
"with an EDNS OPT RR for specifying a larger UDP size, it must explicitly "
"specify the value using this method. "},
- { "get_qid", (PyCFunction)Message_getQid, METH_NOARGS,
+ { "get_qid", reinterpret_cast<PyCFunction>(Message_getQid), METH_NOARGS,
"Returns the query id" },
- { "set_qid", (PyCFunction)Message_setQid, METH_VARARGS,
+ { "set_qid", reinterpret_cast<PyCFunction>(Message_setQid), METH_VARARGS,
"Sets the query id. If the message is not in RENDER mode, an "
"InvalidMessageOperation is raised.\n"
"The argument must be an integer" },
- { "get_rcode", (PyCFunction)Message_getRcode, METH_NOARGS,
+ { "get_rcode", reinterpret_cast<PyCFunction>(Message_getRcode), METH_NOARGS,
"Returns the message Response code (an Rcode object)" },
- { "set_rcode", (PyCFunction)Message_setRcode, METH_VARARGS,
+ { "set_rcode", reinterpret_cast<PyCFunction>(Message_setRcode), METH_VARARGS,
"Sets the message Response code (an Rcode object).\n"
"If the message is not in RENDER mode, an "
"InvalidMessageOperation is raised."},
- { "get_opcode", (PyCFunction)Message_getOpcode, METH_NOARGS,
+ { "get_opcode", reinterpret_cast<PyCFunction>(Message_getOpcode), METH_NOARGS,
"Returns the message opcode (an Opcode object)" },
- { "set_opcode", (PyCFunction)Message_setOpcode, METH_VARARGS,
+ { "set_opcode", reinterpret_cast<PyCFunction>(Message_setOpcode), METH_VARARGS,
"Sets the message opcode (an Opcode object).\n"
"If the message is not in RENDER mode, an "
"InvalidMessageOperation is raised."},
- { "get_rr_count", (PyCFunction)Message_getRRCount, METH_VARARGS,
+ { "get_rr_count", reinterpret_cast<PyCFunction>(Message_getRRCount), METH_VARARGS,
"Returns the number of RRs contained in the given section." },
- { "get_question", (PyCFunction)Message_getQuestion, METH_NOARGS,
+ { "get_question", reinterpret_cast<PyCFunction>(Message_getQuestion), METH_NOARGS,
"Returns a list of all Question objects in the message "
"(should be either 0 or 1)" },
- { "get_section", (PyCFunction)Message_getSection, METH_VARARGS,
+ { "get_section", reinterpret_cast<PyCFunction>(Message_getSection), METH_VARARGS,
"Returns a list of all RRset objects in the given section of the message\n"
"The argument must be of type Section" },
- { "add_question", (PyCFunction)Message_addQuestion, METH_VARARGS,
+ { "add_question", reinterpret_cast<PyCFunction>(Message_addQuestion), METH_VARARGS,
"Add a Question to the message."
"If the message is not in RENDER mode, an "
"InvalidMessageOperation is raised."},
- { "add_rrset", (PyCFunction)Message_addRRset, METH_VARARGS,
+ { "add_rrset", reinterpret_cast<PyCFunction>(Message_addRRset), METH_VARARGS,
"Add an RRset to the given section of the message.\n"
"The first argument is of type Section\n"
"The second is of type RRset\n"
"The third argument is an optional Boolean specifying whether "
"the RRset is signed"},
- { "clear", (PyCFunction)Message_clear, METH_VARARGS,
+ { "clear", reinterpret_cast<PyCFunction>(Message_clear), METH_VARARGS,
"Clears the message content (if any) and reinitialize the "
"message in the given mode\n"
"The argument must be either Message.PARSE or Message.RENDER"},
- { "make_response", (PyCFunction)Message_makeResponse, METH_NOARGS,
+ { "make_response", reinterpret_cast<PyCFunction>(Message_makeResponse), METH_NOARGS,
"Prepare for making a response from a request.\n"
"This will clear the DNS header except those fields that should be kept "
"for the response, and clear answer and the following sections. "
"See also dns_message_reply() of BIND9."},
- { "to_text", (PyCFunction)Message_toText, METH_NOARGS,
+ { "to_text", reinterpret_cast<PyCFunction>(Message_toText), METH_NOARGS,
"Returns the string representation of the message" },
- { "to_wire", (PyCFunction)Message_toWire, METH_VARARGS,
+ { "to_wire", reinterpret_cast<PyCFunction>(Message_toWire), METH_VARARGS,
"Render the message in wire format.\n"
"The argument must be a MessageRenderer.\n"
"If the given message is not in RENDER mode, an "
"InvalidMessageOperation is raised.\n"
},
- { "from_wire", (PyCFunction)Message_fromWire, METH_VARARGS,
+ { "from_wire", reinterpret_cast<PyCFunction>(Message_fromWire), METH_VARARGS,
"Parses the given wire format to a Message object.\n"
"The first argument is a Message to parse the data into.\n"
"The second argument must implement the buffer interface.\n"
@@ -1671,7 +1675,7 @@
Message_getRcode(s_Message* self) {
s_Rcode* rcode;
- rcode = (s_Rcode*)rcode_type.tp_alloc(&rcode_type, 0);
+ rcode = reinterpret_cast<s_Rcode*>(rcode_type.tp_alloc(&rcode_type, 0));
if (rcode != NULL) {
rcode->rcode = new Rcode(self->message->getRcode());
if (rcode->rcode == NULL)
@@ -1681,7 +1685,7 @@
}
}
- return (PyObject*)rcode;
+ return reinterpret_cast<PyObject*>(rcode);
}
static PyObject*
@@ -1698,7 +1702,7 @@
Message_getOpcode(s_Message* self) {
s_Opcode* opcode;
- opcode = (s_Opcode*)opcode_type.tp_alloc(&opcode_type, 0);
+ opcode = reinterpret_cast<s_Opcode*>(opcode_type.tp_alloc(&opcode_type, 0));
if (opcode != NULL) {
// Note that we do not new and delete for opcodes.
// all rcodes point to the statics defined in
@@ -1711,7 +1715,7 @@
}
}
- return (PyObject*)opcode;
+ return reinterpret_cast<PyObject*>(opcode);
}
static PyObject*
@@ -1741,7 +1745,7 @@
for (QuestionIterator qi = self->message->beginQuestion();
qi != self->message->endQuestion();
++qi) {
- s_Question *question = (s_Question*)question_type.tp_alloc(&question_type, 0);
+ s_Question *question = reinterpret_cast<s_Question*>(question_type.tp_alloc(&question_type, 0));
if (question != NULL) {
question->question = *qi;
if (question->question == NULL)
@@ -1750,7 +1754,7 @@
return NULL;
}
}
- PyList_Append(list, (PyObject*) question);
+ PyList_Append(list, reinterpret_cast<PyObject*>(question));
}
return list;
}
@@ -1767,7 +1771,7 @@
rrsi != self->message->endSection(*section->section);
++rrsi) {
- s_RRset *rrset = (s_RRset*)rrset_type.tp_alloc(&rrset_type, 0);
+ s_RRset *rrset = reinterpret_cast<s_RRset*>(rrset_type.tp_alloc(&rrset_type, 0));
if (rrset != NULL) {
rrset->rrset = *rrsi;
if (rrset->rrset == NULL)
@@ -1777,7 +1781,7 @@
return NULL;
}
}
- PyList_Append(list, (PyObject*) rrset);
+ PyList_Append(list, reinterpret_cast<PyObject*>(rrset));
// PyList_Append increases refcount, so we remove ours since
// we don't need it anymore
Py_DECREF(rrset);
@@ -1861,7 +1865,9 @@
static PyObject*
Message_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self,
+ const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -1923,7 +1929,7 @@
}
Py_INCREF(&messageflag_type);
PyModule_AddObject(mod, "MessageFlag",
- (PyObject*) &messageflag_type);
+ reinterpret_cast<PyObject*>(&messageflag_type));
if (PyType_Ready(&opcode_type) < 0) {
@@ -1931,21 +1937,21 @@
}
Py_INCREF(&opcode_type);
PyModule_AddObject(mod, "Opcode",
- (PyObject*) &opcode_type);
+ reinterpret_cast<PyObject*>(&opcode_type));
if (PyType_Ready(&rcode_type) < 0) {
return false;
}
Py_INCREF(&rcode_type);
PyModule_AddObject(mod, "Rcode",
- (PyObject*) &rcode_type);
+ reinterpret_cast<PyObject*>(&rcode_type));
if (PyType_Ready(§ion_type) < 0) {
return false;
}
Py_INCREF(§ion_type);
PyModule_AddObject(mod, "Section",
- (PyObject*) §ion_type);
+ reinterpret_cast<PyObject*>(§ion_type));
if (PyType_Ready(&message_type) < 0) {
@@ -1973,7 +1979,7 @@
Py_INCREF(&message_type);
PyModule_AddObject(mod, "Message",
- (PyObject*) &message_type);
+ reinterpret_cast<PyObject*>(&message_type));
return true;
Modified: experiments/python-binding/src/lib/dns/python/messagerenderer_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/messagerenderer_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/messagerenderer_python.cc Wed Jun 23 11:15:08 2010
@@ -45,17 +45,17 @@
static PyMethodDef MessageRenderer_methods[] = {
- { "get_data", (PyCFunction)MessageRenderer_getData, METH_NOARGS,
+ { "get_data", reinterpret_cast<PyCFunction>(MessageRenderer_getData), METH_NOARGS,
"Returns the data as a bytes() object" },
- { "get_length", (PyCFunction)MessageRenderer_getLength, METH_NOARGS,
+ { "get_length", reinterpret_cast<PyCFunction>(MessageRenderer_getLength), METH_NOARGS,
"Returns the length of the data" },
- { "is_truncated", (PyCFunction)MessageRenderer_isTruncated, METH_NOARGS,
+ { "is_truncated", reinterpret_cast<PyCFunction>(MessageRenderer_isTruncated), METH_NOARGS,
"Returns True if the data is truncated" },
- { "get_length_limit", (PyCFunction)MessageRenderer_getLengthLimit, METH_NOARGS,
+ { "get_length_limit", reinterpret_cast<PyCFunction>(MessageRenderer_getLengthLimit), METH_NOARGS,
"Returns the length limit of the data" },
- { "set_truncated", (PyCFunction)MessageRenderer_setTruncated, METH_NOARGS,
+ { "set_truncated", reinterpret_cast<PyCFunction>(MessageRenderer_setTruncated), METH_NOARGS,
"Sets truncated to true" },
- { "set_length_limit", (PyCFunction)MessageRenderer_setLengthLimit, METH_VARARGS,
+ { "set_length_limit", reinterpret_cast<PyCFunction>(MessageRenderer_setLengthLimit), METH_VARARGS,
"Sets the length limit of the data to the given number" },
{ NULL, NULL, 0, NULL }
};
@@ -198,7 +198,7 @@
}
Py_INCREF(&messagerenderer_type);
PyModule_AddObject(mod, "MessageRenderer",
- (PyObject*) &messagerenderer_type);
+ reinterpret_cast<PyObject*>(&messagerenderer_type));
return true;
}
Modified: experiments/python-binding/src/lib/dns/python/name_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/name_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/name_python.cc Wed Jun 23 11:15:08 2010
@@ -61,11 +61,11 @@
static PyObject* NameComparisonResult_getRelation(s_NameComparisonResult* self);
static PyMethodDef NameComparisonResult_methods[] = {
- { "get_order", (PyCFunction)NameComparisonResult_getOrder, METH_NOARGS,
+ { "get_order", reinterpret_cast<PyCFunction>(NameComparisonResult_getOrder), METH_NOARGS,
"Returns the order" },
- { "get_common_labels", (PyCFunction)NameComparisonResult_getCommonLabels, METH_NOARGS,
+ { "get_common_labels", reinterpret_cast<PyCFunction>(NameComparisonResult_getCommonLabels), METH_NOARGS,
"Returns the number of common labels" },
- { "get_relation", (PyCFunction)NameComparisonResult_getRelation, METH_NOARGS,
+ { "get_relation", reinterpret_cast<PyCFunction>(NameComparisonResult_getRelation), METH_NOARGS,
"Returns the relation" },
{ NULL, NULL, 0, NULL }
};
@@ -163,6 +163,7 @@
// end of NameComparisonResult
// Name
+
typedef struct {
PyObject_HEAD
isc::dns::Name* name;
@@ -190,38 +191,38 @@
static PyObject* Name_isWildCard(s_Name* self);
static PyMethodDef Name_methods[] = {
- { "at", (PyCFunction)Name_at, METH_VARARGS,
+ { "at", reinterpret_cast<PyCFunction>(Name_at), METH_VARARGS,
"Returns the integer value of the name data at the specified position" },
- { "get_length", (PyCFunction)Name_getLength, METH_NOARGS,
+ { "get_length", reinterpret_cast<PyCFunction>(Name_getLength), METH_NOARGS,
"Returns the length" },
- { "get_labelcount", (PyCFunction)Name_getLabelCount, METH_NOARGS,
+ { "get_labelcount", reinterpret_cast<PyCFunction>(Name_getLabelCount), METH_NOARGS,
"Returns the number of labels" },
- { "to_text", (PyCFunction)Name_toText, METH_NOARGS,
+ { "to_text", reinterpret_cast<PyCFunction>(Name_toText), METH_NOARGS,
"Returns the string representation" },
- { "to_wire", (PyCFunction)Name_toWire, METH_VARARGS,
+ { "to_wire", reinterpret_cast<PyCFunction>(Name_toWire), METH_VARARGS,
"Converts the Name object to wire format.\n"
"The argument can be either a MessageRenderer or an object that "
"implements the sequence interface. If the object is mutable "
"(for instance a bytearray()), the wire data is added in-place.\n"
"If it is not (for instance a bytes() object), a new object is "
"returned" },
- { "compare", (PyCFunction)Name_compare, METH_VARARGS,
+ { "compare", reinterpret_cast<PyCFunction>(Name_compare), METH_VARARGS,
"Returns a NameComparisonResult object. The argument must be another Name object" },
- { "equals", (PyCFunction)Name_equals, METH_VARARGS,
+ { "equals", reinterpret_cast<PyCFunction>(Name_equals), METH_VARARGS,
"Returns true if the given Name object is equal to this one" },
- { "split", (PyCFunction)Name_split, METH_VARARGS,
+ { "split", reinterpret_cast<PyCFunction>(Name_split), METH_VARARGS,
"Splits the name, takes two arguments, the first is an integer "
"specifying the first label to place in the result. The second "
"is an integer specifying the number of labels to put in the "
"result. Returns a new Name object" },
- { "reverse", (PyCFunction)Name_reverse, METH_NOARGS,
+ { "reverse", reinterpret_cast<PyCFunction>(Name_reverse), METH_NOARGS,
"Returns a new Name object that is the reverse of this one" },
- { "concatenate", (PyCFunction)Name_concatenate, METH_VARARGS,
+ { "concatenate", reinterpret_cast<PyCFunction>(Name_concatenate), METH_VARARGS,
"Concatenates the given Name object to this one and returns the "
"result as a new Name object" },
- { "downcase", (PyCFunction)Name_downcase, METH_NOARGS,
+ { "downcase", reinterpret_cast<PyCFunction>(Name_downcase), METH_NOARGS,
"Downcases this name object (in-place). Returns a new reference to the Name." },
- { "is_wildcard", (PyCFunction)Name_isWildCard, METH_NOARGS,
+ { "is_wildcard", reinterpret_cast<PyCFunction>(Name_isWildCard), METH_NOARGS,
"Returns True if the Name object represents a wildcard name." },
{ NULL, NULL, 0, NULL }
};
@@ -400,7 +401,9 @@
static PyObject*
Name_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self,
+ const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -447,7 +450,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -499,7 +502,7 @@
}
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
#include <iostream>
@@ -510,7 +513,8 @@
// Check for null and if the types match. If different type,
// simply return False
if (!n2 ||
- ((PyObject*)n1)->ob_type != ((PyObject*)n2)->ob_type
+ (reinterpret_cast<PyObject*>(n1))->ob_type !=
+ (reinterpret_cast<PyObject*>(n2))->ob_type
) {
Py_RETURN_FALSE;
}
@@ -555,7 +559,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -578,14 +582,14 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
Name_downcase(s_Name* self) {
self->name->downcase();
Py_INCREF(self);
- return (PyObject*) self;
+ return reinterpret_cast<PyObject*>(self);
}
static PyObject*
@@ -621,7 +625,7 @@
addClassVariable(name_comparison_result_type, "NameRelation", po_NameRelation);
PyModule_AddObject(mod, "NameComparisonResult",
- (PyObject*) &name_comparison_result_type);
+ reinterpret_cast<PyObject*>(&name_comparison_result_type));
if (PyType_Ready(&name_type) < 0) {
return false;
@@ -638,7 +642,7 @@
s_Name* root_name = PyObject_New(s_Name, &name_type);
root_name->name = new Name(".");
- PyObject* po_ROOT_NAME = (PyObject*) root_name;
+ PyObject* po_ROOT_NAME = reinterpret_cast<PyObject*>(root_name);
Py_INCREF(po_ROOT_NAME);
addClassVariable(name_type, "ROOT_NAME", po_ROOT_NAME);
@@ -675,7 +679,7 @@
PyModule_AddObject(mod, "IscException", po_IscException);
PyModule_AddObject(mod, "Name",
- (PyObject*) &name_type);
+ reinterpret_cast<PyObject*>(&name_type));
return true;
}
Modified: experiments/python-binding/src/lib/dns/python/question_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/question_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/question_python.cc Wed Jun 23 11:15:08 2010
@@ -53,15 +53,15 @@
// 3. Argument type
// 4. Documentation
static PyMethodDef Question_methods[] = {
- { "get_name", (PyCFunction)Question_getName, METH_NOARGS,
+ { "get_name", reinterpret_cast<PyCFunction>(Question_getName), METH_NOARGS,
"Returns the Name" },
- { "get_type", (PyCFunction)Question_getType, METH_NOARGS,
+ { "get_type", reinterpret_cast<PyCFunction>(Question_getType), METH_NOARGS,
"Returns the RRType" },
- { "get_class", (PyCFunction)Question_getClass, METH_NOARGS,
+ { "get_class", reinterpret_cast<PyCFunction>(Question_getClass), METH_NOARGS,
"Returns the RRClass" },
- { "to_text", (PyCFunction)Question_toText, METH_NOARGS,
+ { "to_text", reinterpret_cast<PyCFunction>(Question_toText), METH_NOARGS,
"Returns the string representation" },
- { "to_wire", (PyCFunction)Question_toWire, METH_VARARGS,
+ { "to_wire", reinterpret_cast<PyCFunction>(Question_toWire), METH_VARARGS,
"Converts the Question object to wire format.\n"
"The argument can be either a MessageRenderer or an object that "
"implements the sequence interface. If the object is mutable "
@@ -192,7 +192,7 @@
s_Name* name;
// is this the best way to do this?
- name = (s_Name*)name_type.tp_alloc(&name_type, 0);
+ name = reinterpret_cast<s_Name*>(name_type.tp_alloc(&name_type, 0));
if (name != NULL) {
name->name = new Name(self->question->getName());
if (name->name == NULL)
@@ -202,14 +202,14 @@
}
}
- return (PyObject*)name;
+ return reinterpret_cast<PyObject*>(name);
}
static PyObject*
Question_getType(s_Question* self) {
s_RRType* rrtype;
- rrtype = (s_RRType*)rrtype_type.tp_alloc(&rrtype_type, 0);
+ rrtype = reinterpret_cast<s_RRType*>(rrtype_type.tp_alloc(&rrtype_type, 0));
if (rrtype != NULL) {
rrtype->rrtype = new RRType(self->question->getType());
if (rrtype->rrtype == NULL)
@@ -219,14 +219,14 @@
}
}
- return (PyObject*)rrtype;
+ return reinterpret_cast<PyObject*>(rrtype);
}
static PyObject*
Question_getClass(s_Question* self) {
s_RRClass* rrclass;
- rrclass = (s_RRClass*)rrclass_type.tp_alloc(&rrclass_type, 0);
+ rrclass = reinterpret_cast<s_RRClass*>(rrclass_type.tp_alloc(&rrclass_type, 0));
if (rrclass != NULL) {
rrclass->rrclass = new RRClass(self->question->getClass());
if (rrclass->rrclass == NULL)
@@ -236,7 +236,7 @@
}
}
- return (PyObject*)rrclass;
+ return reinterpret_cast<PyObject*>(rrclass);
}
@@ -249,7 +249,9 @@
static PyObject*
Question_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self,
+ const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -270,7 +272,7 @@
Py_DECREF(n);
return result;
} else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type,
- (PyObject**) &mr)) {
+ reinterpret_cast<PyObject**>(&mr))) {
self->question->toWire(*mr->messagerenderer);
// If we return NULL it is seen as an error, so use this for
// None returns
@@ -298,7 +300,7 @@
}
Py_INCREF(&question_type);
PyModule_AddObject(mod, "Question",
- (PyObject*) &question_type);
+ reinterpret_cast<PyObject*>(&question_type));
return true;
}
Modified: experiments/python-binding/src/lib/dns/python/rdata_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rdata_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rdata_python.cc Wed Jun 23 11:15:08 2010
@@ -68,9 +68,9 @@
// 3. Argument type
// 4. Documentation
static PyMethodDef Rdata_methods[] = {
- { "to_text", (PyCFunction)Rdata_toText, METH_NOARGS,
+ { "to_text", reinterpret_cast<PyCFunction>(Rdata_toText), METH_NOARGS,
"Returns the string representation" },
- { "to_wire", (PyCFunction)Rdata_toWire, METH_VARARGS,
+ { "to_wire", reinterpret_cast<PyCFunction>(Rdata_toWire), METH_VARARGS,
"Converts the Rdata object to wire format.\n"
"The argument can be either a MessageRenderer or an object that "
"implements the sequence interface. If the object is mutable "
@@ -171,7 +171,9 @@
static PyObject*
Rdata_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self,
+ const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -216,7 +218,7 @@
}
Py_INCREF(&rdata_type);
PyModule_AddObject(mod, "Rdata",
- (PyObject*) &rdata_type);
+ reinterpret_cast<PyObject*>(&rdata_type));
// Add the exceptions to the class
po_InvalidRdataLength = PyErr_NewException("libdns_python.InvalidRdataLength", NULL, NULL);
Modified: experiments/python-binding/src/lib/dns/python/rrclass_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rrclass_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rrclass_python.cc Wed Jun 23 11:15:08 2010
@@ -76,22 +76,22 @@
// 3. Argument type
// 4. Documentation
static PyMethodDef RRClass_methods[] = {
- { "to_text", (PyCFunction)RRClass_toText, METH_NOARGS,
+ { "to_text", reinterpret_cast<PyCFunction>(RRClass_toText), METH_NOARGS,
"Returns the string representation" },
- { "to_wire", (PyCFunction)RRClass_toWire, METH_VARARGS,
+ { "to_wire", reinterpret_cast<PyCFunction>(RRClass_toWire), METH_VARARGS,
"Converts the RRClass object to wire format.\n"
"The argument can be either a MessageRenderer or an object that "
"implements the sequence interface. If the object is mutable "
"(for instance a bytearray()), the wire data is added in-place.\n"
"If it is not (for instance a bytes() object), a new object is "
"returned" },
- { "get_code", (PyCFunction)RRClass_getCode, METH_NOARGS,
+ { "get_code", reinterpret_cast<PyCFunction>(RRClass_getCode), METH_NOARGS,
"Returns the class code as an integer" },
- { "IN", (PyCFunction)RRClass_IN, METH_NOARGS | METH_STATIC, "Creates an IN RRClass" },
- { "CH", (PyCFunction)RRClass_CH, METH_NOARGS | METH_STATIC, "Creates a CH RRClass" },
- { "HS", (PyCFunction)RRClass_HS, METH_NOARGS | METH_STATIC, "Creates an HS RRClass" },
- { "NONE", (PyCFunction)RRClass_NONE, METH_NOARGS | METH_STATIC, "Creates a NONE RRClass" },
- { "ANY", (PyCFunction)RRClass_ANY, METH_NOARGS | METH_STATIC, "Creates an ANY RRClass" },
+ { "IN", reinterpret_cast<PyCFunction>(RRClass_IN), METH_NOARGS | METH_STATIC, "Creates an IN RRClass" },
+ { "CH", reinterpret_cast<PyCFunction>(RRClass_CH), METH_NOARGS | METH_STATIC, "Creates a CH RRClass" },
+ { "HS", reinterpret_cast<PyCFunction>(RRClass_HS), METH_NOARGS | METH_STATIC, "Creates an HS RRClass" },
+ { "NONE", reinterpret_cast<PyCFunction>(RRClass_NONE), METH_NOARGS | METH_STATIC, "Creates a NONE RRClass" },
+ { "ANY", reinterpret_cast<PyCFunction>(RRClass_ANY), METH_NOARGS | METH_STATIC, "Creates an ANY RRClass" },
{ NULL, NULL, 0, NULL }
};
@@ -218,7 +218,9 @@
static PyObject*
RRClass_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self,
+ const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -261,7 +263,7 @@
// Check for null and if the types match. If different type,
// simply return False
if (!other ||
- ((PyObject*)self)->ob_type != ((PyObject*)other)->ob_type
+ (reinterpret_cast<PyObject*>(self))->ob_type != (reinterpret_cast<PyObject*>(other))->ob_type
) {
Py_RETURN_FALSE;
}
@@ -305,7 +307,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject* RRClass_CH(s_RRClass *self UNUSED_PARAM) {
@@ -317,7 +319,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject* RRClass_HS(s_RRClass *self UNUSED_PARAM) {
@@ -329,7 +331,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject* RRClass_NONE(s_RRClass *self UNUSED_PARAM) {
@@ -341,7 +343,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject* RRClass_ANY(s_RRClass *self UNUSED_PARAM) {
@@ -353,7 +355,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
// end of RRClass
@@ -377,7 +379,7 @@
}
Py_INCREF(&rrclass_type);
PyModule_AddObject(mod, "RRClass",
- (PyObject*) &rrclass_type);
+ reinterpret_cast<PyObject*>(&rrclass_type));
return true;
}
Modified: experiments/python-binding/src/lib/dns/python/rrset_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rrset_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rrset_python.cc Wed Jun 23 11:15:08 2010
@@ -72,32 +72,32 @@
// TODO: iterator?
static PyMethodDef RRset_methods[] = {
- { "get_rdata_count", (PyCFunction)RRset_getRdataCount, METH_NOARGS,
+ { "get_rdata_count", reinterpret_cast<PyCFunction>(RRset_getRdataCount), METH_NOARGS,
"Returns the number of rdata fields." },
- { "get_name", (PyCFunction)RRset_getName, METH_NOARGS,
+ { "get_name", reinterpret_cast<PyCFunction>(RRset_getName), METH_NOARGS,
"Returns the name of the RRset, as a Name object." },
- { "get_class", (PyCFunction)RRset_getClass, METH_NOARGS,
+ { "get_class", reinterpret_cast<PyCFunction>(RRset_getClass), METH_NOARGS,
"Returns the class of the RRset as an RRClass object." },
- { "get_type", (PyCFunction)RRset_getType, METH_NOARGS,
+ { "get_type", reinterpret_cast<PyCFunction>(RRset_getType), METH_NOARGS,
"Returns the type of the RRset as an RRType object." },
- { "get_ttl", (PyCFunction)RRset_getTTL, METH_NOARGS,
+ { "get_ttl", reinterpret_cast<PyCFunction>(RRset_getTTL), METH_NOARGS,
"Returns the TTL of the RRset as an RRTTL object." },
- { "set_name", (PyCFunction)RRset_setName, METH_VARARGS,
+ { "set_name", reinterpret_cast<PyCFunction>(RRset_setName), METH_VARARGS,
"Sets the name of the RRset.\nTakes a Name object as an argument." },
- { "set_ttl", (PyCFunction)RRset_setTTL, METH_VARARGS,
+ { "set_ttl", reinterpret_cast<PyCFunction>(RRset_setTTL), METH_VARARGS,
"Sets the TTL of the RRset.\nTakes an RRTTL object as an argument." },
- { "to_text", (PyCFunction)RRset_toText, METH_NOARGS,
+ { "to_text", reinterpret_cast<PyCFunction>(RRset_toText), METH_NOARGS,
"Returns the text representation of the RRset as a string" },
- { "to_wire", (PyCFunction)RRset_toWire, METH_VARARGS,
+ { "to_wire", reinterpret_cast<PyCFunction>(RRset_toWire), METH_VARARGS,
"Converts the RRset object to wire format.\n"
"The argument can be either a MessageRenderer or an object that "
"implements the sequence interface. If the object is mutable "
"(for instance a bytearray()), the wire data is added in-place.\n"
"If it is not (for instance a bytes() object), a new object is "
"returned" },
- { "add_rdata", (PyCFunction)RRset_addRdata, METH_VARARGS,
+ { "add_rdata", reinterpret_cast<PyCFunction>(RRset_addRdata), METH_VARARGS,
"Adds the rdata for one RR to the RRset.\nTakes an Rdata object as an argument" },
- { "get_rdata", (PyCFunction)RRset_getRdata, METH_NOARGS,
+ { "get_rdata", reinterpret_cast<PyCFunction>(RRset_getRdata), METH_NOARGS,
"Returns a List containing all Rdata elements" },
{ NULL, NULL, 0, NULL }
};
@@ -208,7 +208,7 @@
s_Name* name;
// is this the best way to do this?
- name = (s_Name*)name_type.tp_alloc(&name_type, 0);
+ name = reinterpret_cast<s_Name*>(name_type.tp_alloc(&name_type, 0));
if (name != NULL) {
name->name = new Name(self->rrset->getName());
if (name->name == NULL)
@@ -218,14 +218,14 @@
}
}
- return (PyObject*)name;
+ return reinterpret_cast<PyObject*>(name);
}
static PyObject*
RRset_getClass(s_RRset* self) {
s_RRClass* rrclass;
- rrclass = (s_RRClass*)rrclass_type.tp_alloc(&rrclass_type, 0);
+ rrclass = reinterpret_cast<s_RRClass*>(rrclass_type.tp_alloc(&rrclass_type, 0));
if (rrclass != NULL) {
rrclass->rrclass = new RRClass(self->rrset->getClass());
if (rrclass->rrclass == NULL)
@@ -235,14 +235,14 @@
}
}
- return (PyObject*)rrclass;
+ return reinterpret_cast<PyObject*>(rrclass);
}
static PyObject*
RRset_getType(s_RRset* self) {
s_RRType* rrtype;
- rrtype = (s_RRType*)rrtype_type.tp_alloc(&rrtype_type, 0);
+ rrtype = reinterpret_cast<s_RRType*>(rrtype_type.tp_alloc(&rrtype_type, 0));
if (rrtype != NULL) {
rrtype->rrtype = new RRType(self->rrset->getType());
if (rrtype->rrtype == NULL)
@@ -252,14 +252,14 @@
}
}
- return (PyObject*)rrtype;
+ return reinterpret_cast<PyObject*>(rrtype);
}
static PyObject*
RRset_getTTL(s_RRset* self) {
s_RRTTL* rrttl;
- rrttl = (s_RRTTL*)rrttl_type.tp_alloc(&rrttl_type, 0);
+ rrttl = reinterpret_cast<s_RRTTL*>(rrttl_type.tp_alloc(&rrttl_type, 0));
if (rrttl != NULL) {
rrttl->rrttl = new RRTTL(self->rrset->getTTL());
if (rrttl->rrttl == NULL)
@@ -269,7 +269,7 @@
}
}
- return (PyObject*)rrttl;
+ return reinterpret_cast<PyObject*>(rrttl);
}
static PyObject*
@@ -305,7 +305,9 @@
static PyObject*
RRset_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self,
+ const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -366,14 +368,14 @@
RdataIteratorPtr it = self->rrset->getRdataIterator();
for (it->first(); !it->isLast(); it->next()) {
- s_Rdata *rds = (s_Rdata*)rdata_type.tp_alloc(&rdata_type, 0);
+ s_Rdata *rds = reinterpret_cast<s_Rdata*>(rdata_type.tp_alloc(&rdata_type, 0));
if (rds != NULL) {
// hmz them iterators/shared_ptrs and private constructors
// make this a bit weird, so we create a new one with
// the data available
const Rdata *rd = &it->getCurrent();
rds->rdata = createRdata(self->rrset->getType(), self->rrset->getClass(), *rd);
- PyList_Append(list, (PyObject*) rds);
+ PyList_Append(list, reinterpret_cast<PyObject*>(rds));
} else {
return NULL;
}
@@ -406,7 +408,7 @@
}
Py_INCREF(&rrset_type);
PyModule_AddObject(mod, "RRset",
- (PyObject*) &rrset_type);
+ reinterpret_cast<PyObject*>(&rrset_type));
return true;
}
Modified: experiments/python-binding/src/lib/dns/python/rrttl_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rrttl_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rrttl_python.cc Wed Jun 23 11:15:08 2010
@@ -68,16 +68,16 @@
// 3. Argument type
// 4. Documentation
static PyMethodDef RRTTL_methods[] = {
- { "to_text", (PyCFunction)RRTTL_toText, METH_NOARGS,
+ { "to_text", reinterpret_cast<PyCFunction>(RRTTL_toText), METH_NOARGS,
"Returns the string representation" },
- { "to_wire", (PyCFunction)RRTTL_toWire, METH_VARARGS,
+ { "to_wire", reinterpret_cast<PyCFunction>(RRTTL_toWire), METH_VARARGS,
"Converts the RRTTL object to wire format.\n"
"The argument can be either a MessageRenderer or an object that "
"implements the sequence interface. If the object is mutable "
"(for instance a bytearray()), the wire data is added in-place.\n"
"If it is not (for instance a bytes() object), a new object is "
"returned" },
- { "get_value", (PyCFunction)RRTTL_getValue, METH_NOARGS,
+ { "get_value", reinterpret_cast<PyCFunction>(RRTTL_getValue), METH_NOARGS,
"Returns the TTL as an integer" },
{ NULL, NULL, 0, NULL }
};
@@ -211,7 +211,9 @@
static PyObject*
RRTTL_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self,
+ const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -254,7 +256,8 @@
// Check for null and if the types match. If different type,
// simply return False
if (!other ||
- ((PyObject*)self)->ob_type != ((PyObject*)other)->ob_type
+ (reinterpret_cast<PyObject*>(self))->ob_type !=
+ (reinterpret_cast<PyObject*>(other))->ob_type
) {
Py_RETURN_FALSE;
}
@@ -306,7 +309,7 @@
}
Py_INCREF(&rrttl_type);
PyModule_AddObject(mod, "RRTTL",
- (PyObject*) &rrttl_type);
+ reinterpret_cast<PyObject*>(&rrttl_type));
return true;
}
Modified: experiments/python-binding/src/lib/dns/python/rrtype_python.cc
==============================================================================
--- experiments/python-binding/src/lib/dns/python/rrtype_python.cc (original)
+++ experiments/python-binding/src/lib/dns/python/rrtype_python.cc Wed Jun 23 11:15:08 2010
@@ -113,36 +113,36 @@
// 3. Argument type
// 4. Documentation
static PyMethodDef RRType_methods[] = {
- { "to_text", (PyCFunction)RRType_toText, METH_NOARGS,
+ { "to_text", reinterpret_cast<PyCFunction>(RRType_toText), METH_NOARGS,
"Returns the string representation" },
- { "to_wire", (PyCFunction)RRType_toWire, METH_VARARGS,
+ { "to_wire", reinterpret_cast<PyCFunction>(RRType_toWire), METH_VARARGS,
"Converts the RRType object to wire format.\n"
"The argument can be either a MessageRenderer or an object that "
"implements the sequence interface. If the object is mutable "
"(for instance a bytearray()), the wire data is added in-place.\n"
"If it is not (for instance a bytes() object), a new object is "
"returned" },
- { "get_code", (PyCFunction)RRType_getCode, METH_NOARGS,
+ { "get_code", reinterpret_cast<PyCFunction>(RRType_getCode), METH_NOARGS,
"Returns the type code as an integer" },
- { "NSEC3PARAM", (PyCFunction)RRType_NSEC3PARAM, METH_NOARGS | METH_STATIC, "Creates an NSEC3PARAM RRType" },
- { "DNAME", (PyCFunction)RRType_DNAME, METH_NOARGS | METH_STATIC, "Creates a DNAME RRType" },
- { "PTR", (PyCFunction)RRType_PTR, METH_NOARGS | METH_STATIC, "Creates a PTR RRType" },
- { "MX", (PyCFunction)RRType_MX, METH_NOARGS | METH_STATIC, "Creates an MX RRType" },
- { "DNSKEY", (PyCFunction)RRType_DNSKEY, METH_NOARGS | METH_STATIC, "Creates a DNSKEY RRType" },
- { "TXT", (PyCFunction)RRType_TXT, METH_NOARGS | METH_STATIC, "Creates a TXT RRType" },
- { "RRSIG", (PyCFunction)RRType_RRSIG, METH_NOARGS | METH_STATIC, "Creates a RRSIG RRType" },
- { "NSEC", (PyCFunction)RRType_NSEC, METH_NOARGS | METH_STATIC, "Creates a NSEC RRType" },
- { "AAAA", (PyCFunction)RRType_AAAA, METH_NOARGS | METH_STATIC, "Creates an AAAA RRType" },
- { "DS", (PyCFunction)RRType_DS, METH_NOARGS | METH_STATIC, "Creates a DS RRType" },
- { "OPT", (PyCFunction)RRType_OPT, METH_NOARGS | METH_STATIC, "Creates an OPT RRType" },
- { "A", (PyCFunction)RRType_A, METH_NOARGS | METH_STATIC, "Creates an A RRType" },
- { "NS", (PyCFunction)RRType_NS, METH_NOARGS | METH_STATIC, "Creates an NS RRType" },
- { "CNAME", (PyCFunction)RRType_CNAME, METH_NOARGS | METH_STATIC, "Creates a CNAME RRType" },
- { "SOA", (PyCFunction)RRType_SOA, METH_NOARGS | METH_STATIC, "Creates a SOA RRType" },
- { "NSEC3", (PyCFunction)RRType_NSEC3, METH_NOARGS | METH_STATIC, "Creates an NSEC3 RRType" },
- { "IXFR", (PyCFunction)RRType_IXFR, METH_NOARGS | METH_STATIC, "Creates an IXFR RRType" },
- { "AXFR", (PyCFunction)RRType_AXFR, METH_NOARGS | METH_STATIC, "Creates an AXFR RRType" },
- { "ANY", (PyCFunction)RRType_ANY, METH_NOARGS | METH_STATIC, "Creates an ANY RRType" },
+ { "NSEC3PARAM", reinterpret_cast<PyCFunction>(RRType_NSEC3PARAM), METH_NOARGS | METH_STATIC, "Creates an NSEC3PARAM RRType" },
+ { "DNAME", reinterpret_cast<PyCFunction>(RRType_DNAME), METH_NOARGS | METH_STATIC, "Creates a DNAME RRType" },
+ { "PTR", reinterpret_cast<PyCFunction>(RRType_PTR), METH_NOARGS | METH_STATIC, "Creates a PTR RRType" },
+ { "MX", reinterpret_cast<PyCFunction>(RRType_MX), METH_NOARGS | METH_STATIC, "Creates an MX RRType" },
+ { "DNSKEY", reinterpret_cast<PyCFunction>(RRType_DNSKEY), METH_NOARGS | METH_STATIC, "Creates a DNSKEY RRType" },
+ { "TXT", reinterpret_cast<PyCFunction>(RRType_TXT), METH_NOARGS | METH_STATIC, "Creates a TXT RRType" },
+ { "RRSIG", reinterpret_cast<PyCFunction>(RRType_RRSIG), METH_NOARGS | METH_STATIC, "Creates a RRSIG RRType" },
+ { "NSEC", reinterpret_cast<PyCFunction>(RRType_NSEC), METH_NOARGS | METH_STATIC, "Creates a NSEC RRType" },
+ { "AAAA", reinterpret_cast<PyCFunction>(RRType_AAAA), METH_NOARGS | METH_STATIC, "Creates an AAAA RRType" },
+ { "DS", reinterpret_cast<PyCFunction>(RRType_DS), METH_NOARGS | METH_STATIC, "Creates a DS RRType" },
+ { "OPT", reinterpret_cast<PyCFunction>(RRType_OPT), METH_NOARGS | METH_STATIC, "Creates an OPT RRType" },
+ { "A", reinterpret_cast<PyCFunction>(RRType_A), METH_NOARGS | METH_STATIC, "Creates an A RRType" },
+ { "NS", reinterpret_cast<PyCFunction>(RRType_NS), METH_NOARGS | METH_STATIC, "Creates an NS RRType" },
+ { "CNAME", reinterpret_cast<PyCFunction>(RRType_CNAME), METH_NOARGS | METH_STATIC, "Creates a CNAME RRType" },
+ { "SOA", reinterpret_cast<PyCFunction>(RRType_SOA), METH_NOARGS | METH_STATIC, "Creates a SOA RRType" },
+ { "NSEC3", reinterpret_cast<PyCFunction>(RRType_NSEC3), METH_NOARGS | METH_STATIC, "Creates an NSEC3 RRType" },
+ { "IXFR", reinterpret_cast<PyCFunction>(RRType_IXFR), METH_NOARGS | METH_STATIC, "Creates an IXFR RRType" },
+ { "AXFR", reinterpret_cast<PyCFunction>(RRType_AXFR), METH_NOARGS | METH_STATIC, "Creates an AXFR RRType" },
+ { "ANY", reinterpret_cast<PyCFunction>(RRType_ANY), METH_NOARGS | METH_STATIC, "Creates an ANY RRType" },
{ NULL, NULL, 0, NULL }
};
@@ -277,7 +277,8 @@
static PyObject*
RRType_str(PyObject* self) {
// Simply call the to_text method we already defined
- return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+ return PyObject_CallMethod(self, const_cast<char*>("to_text"),
+ const_cast<char*>(""));
}
static PyObject*
@@ -320,7 +321,8 @@
// Check for null and if the types match. If different type,
// simply return False
if (!other ||
- ((PyObject*)self)->ob_type != ((PyObject*)other)->ob_type
+ (reinterpret_cast<PyObject*>(self))->ob_type !=
+ (reinterpret_cast<PyObject*>(other))->ob_type
) {
Py_RETURN_FALSE;
}
@@ -365,7 +367,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -378,7 +380,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -391,7 +393,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -404,7 +406,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -417,7 +419,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -430,7 +432,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -443,7 +445,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -456,7 +458,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -469,7 +471,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -482,7 +484,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -495,7 +497,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -508,7 +510,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -521,7 +523,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -534,7 +536,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -547,7 +549,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -560,7 +562,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -573,7 +575,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -586,7 +588,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
@@ -599,7 +601,7 @@
return NULL;
}
}
- return (PyObject*) ret;
+ return reinterpret_cast<PyObject*>(ret);
}
@@ -623,7 +625,7 @@
}
Py_INCREF(&rrtype_type);
PyModule_AddObject(mod, "RRType",
- (PyObject*) &rrtype_type);
+ reinterpret_cast<PyObject*>(&rrtype_type));
return true;
}
More information about the bind10-changes
mailing list