Commit a2ce4084 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

use c++ style casts. Most of them are reinterpret_casts because of the way we...

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


git-svn-id: svn://bind10.isc.org/svn/bind10/experiments/python-binding@2238 e5f2f494-b856-4b98-b285-d166d9295462
parent 024bea20
......@@ -33,7 +33,7 @@ readDataFromSequence(uint8_t *data, size_t len, PyObject* sequence) {
"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,
......
This diff is collapsed.
......@@ -45,17 +45,17 @@ static PyObject* MessageRenderer_setLengthLimit(s_MessageRenderer* self, PyObjec
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 @@ initModulePart_MessageRenderer(PyObject* mod) {
}
Py_INCREF(&messagerenderer_type);
PyModule_AddObject(mod, "MessageRenderer",
(PyObject*) &messagerenderer_type);
reinterpret_cast<PyObject*>(&messagerenderer_type));
return true;
}
......
......@@ -61,11 +61,11 @@ static PyObject* NameComparisonResult_getCommonLabels(s_NameComparisonResult* se
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 @@ NameComparisonResult_getRelation(s_NameComparisonResult* self) {
// end of NameComparisonResult
// Name
typedef struct {
PyObject_HEAD
isc::dns::Name* name;
......@@ -190,38 +191,38 @@ static PyObject* Name_downcase(s_Name* self);
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 @@ Name_toText(s_Name* self) {
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 @@ Name_compare(s_Name* self, PyObject* args) {
return NULL;
}
}
return (PyObject*) ret;
return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
......@@ -499,7 +502,7 @@ Name_split(s_Name* self, PyObject* args) {
}
}
}
return (PyObject*) ret;
return reinterpret_cast<PyObject*>(ret);
}
#include <iostream>
......@@ -510,7 +513,8 @@ Name_richcmp(s_Name* n1, s_Name* n2, int op) {
// 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 @@ Name_reverse(s_Name* self) {
return NULL;
}
}
return (PyObject*) ret;
return reinterpret_cast<PyObject*>(ret);
}
static PyObject*
......@@ -578,14 +582,14 @@ Name_concatenate(s_Name* self, PyObject* args) {
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 @@ initModulePart_Name(PyObject* mod) {
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 @@ initModulePart_Name(PyObject* mod) {
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 @@ initModulePart_Name(PyObject* mod) {
PyModule_AddObject(mod, "IscException", po_IscException);
PyModule_AddObject(mod, "Name",
(PyObject*) &name_type);
reinterpret_cast<PyObject*>(&name_type));
return true;
}
......@@ -53,15 +53,15 @@ static PyObject* Question_toWire(s_Question* self, PyObject* args);
// 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 @@ Question_getName(s_Question* self) {
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 @@ Question_getName(s_Question* self) {
}
}
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 @@ Question_getType(s_Question* self) {
}
}
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 @@ Question_getClass(s_Question* self) {
}
}
return (PyObject*)rrclass;
return reinterpret_cast<PyObject*>(rrclass);
}
......@@ -249,7 +249,9 @@ Question_toText(s_Question* self) {
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 @@ Question_toWire(s_Question* self, PyObject* args) {
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 @@ initModulePart_Question(PyObject* mod) {
}
Py_INCREF(&question_type);
PyModule_AddObject(mod, "Question",
(PyObject*) &question_type);
reinterpret_cast<PyObject*>(&question_type));
return true;
}
......@@ -68,9 +68,9 @@ static PyObject* Rdata_toWire(s_Rdata* self, PyObject* args);
// 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 @@ Rdata_toText(s_Rdata* self) {
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 @@ initModulePart_Rdata(PyObject* mod) {
}
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);
......
......@@ -76,22 +76,22 @@ static PyObject* RRClass_ANY(s_RRClass *self);
// 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 @@ RRClass_toText(s_RRClass* self) {
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 @@ RRClass_richcmp(s_RRClass* self, s_RRClass* other, int op) {
// 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 @@ static PyObject* RRClass_IN(s_RRClass *self UNUSED_PARAM) {
return NULL;
}
}
return (PyObject*) ret;
return reinterpret_cast<PyObject*>(ret);
}
static PyObject* RRClass_CH(s_RRClass *self UNUSED_PARAM) {
......@@ -317,7 +319,7 @@ static PyObject* RRClass_CH(s_RRClass *self UNUSED_PARAM) {
return NULL;
}
}
return (PyObject*) ret;
return reinterpret_cast<PyObject*>(ret);
}
static PyObject* RRClass_HS(s_RRClass *self UNUSED_PARAM) {
......@@ -329,7 +331,7 @@ static PyObject* RRClass_HS(s_RRClass *self UNUSED_PARAM) {
return NULL;
}
}
return (PyObject*) ret;
return reinterpret_cast<PyObject*>(ret);
}
static PyObject* RRClass_NONE(s_RRClass *self UNUSED_PARAM) {
......@@ -341,7 +343,7 @@ static PyObject* RRClass_NONE(s_RRClass *self UNUSED_PARAM) {
return NULL;
}
}
return (PyObject*) ret;
return reinterpret_cast<PyObject*>(ret);
}
static PyObject* RRClass_ANY(s_RRClass *self UNUSED_PARAM) {
......@@ -353,7 +355,7 @@ static PyObject* RRClass_ANY(s_RRClass *self UNUSED_PARAM) {
return NULL;
}
}
return (PyObject*) ret;
return reinterpret_cast<PyObject*>(ret);
}
// end of RRClass
......@@ -377,7 +379,7 @@ initModulePart_RRClass(PyObject* mod) {
}
Py_INCREF(&rrclass_type);
PyModule_AddObject(mod, "RRClass",
(PyObject*) &rrclass_type);
reinterpret_cast<PyObject*>(&rrclass_type));
return true;
}
......@@ -72,32 +72,32 @@ static PyObject* RRset_getRdata(s_RRset* self);
// 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 @@ RRset_getName(s_RRset* self) {
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 @@ RRset_getName(s_RRset* self) {
}
}
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 @@ RRset_getClass(s_RRset* self) {
}
}
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 @@ RRset_getType(s_RRset* self) {
}
}
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 @@ RRset_getTTL(s_RRset* self) {
}
}
return (PyObject*)rrttl;
return reinterpret_cast<PyObject*>(rrttl);
}
static PyObject*
......@@ -305,7 +305,9 @@ RRset_toText(s_RRset* self) {
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 @@ RRset_getRdata(s_RRset* self) {
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 @@ initModulePart_RRset(PyObject* mod) {
}
Py_INCREF(&rrset_type);
PyModule_AddObject(mod, "RRset",
(PyObject*) &rrset_type);
reinterpret_cast<PyObject*>(&rrset_type));
return true;
}
......
......@@ -68,16 +68,16 @@ static PyObject* RRTTL_richcmp(s_RRTTL* self, s_RRTTL* other, int op);
// 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" },