Python: remove redundant casts

This commit is contained in:
2014-07-01 13:39:36 +10:00
parent c92c3ef611
commit 9f05588b68
6 changed files with 38 additions and 34 deletions

View File

@@ -419,7 +419,7 @@ PyObject *PyC_ExceptionBuffer(void)
if (!(string_io_mod = PyImport_ImportModule("io"))) {
goto error_cleanup;
}
else if (!(string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
else if (!(string_io = PyObject_CallMethod(string_io_mod, "StringIO", NULL))) {
goto error_cleanup;
}
else if (!(string_io_getvalue = PyObject_GetAttrString(string_io, "getvalue"))) {
@@ -651,12 +651,12 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
const char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *);
ret = PyObject_CallFunction(calcsize, (char *)"s", format);
ret = PyObject_CallFunction(calcsize, "s", format);
if (ret) {
sizes[i] = PyLong_AsLong(ret);
Py_DECREF(ret);
ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]);
ret = PyObject_CallFunction(unpack, "sy#", format, (char *)ptr, sizes[i]);
}
if (ret == NULL) {

View File

@@ -212,25 +212,29 @@ static PyObject *CCL_initPython(void)
#endif
static struct _inittab bpy_internal_modules[] = {
{(char *)"mathutils", PyInit_mathutils},
// {(char *)"mathutils.geometry", PyInit_mathutils_geometry},
// {(char *)"mathutils.noise", PyInit_mathutils_noise},
// {(char *)"mathutils.kdtree", PyInit_mathutils_kdtree},
{(char *)"_bpy_path", BPyInit__bpy_path},
{(char *)"bgl", BPyInit_bgl},
{(char *)"blf", BPyInit_blf},
{(char *)"bmesh", BPyInit_bmesh},
// {(char *)"bmesh.types", BPyInit_bmesh_types},
// {(char *)"bmesh.utils", BPyInit_bmesh_utils},
// {(char *)"bmesh.utils", BPyInit_bmesh_geometry},
{"mathutils", PyInit_mathutils},
#if 0
{"mathutils.geometry", PyInit_mathutils_geometry},
{"mathutils.noise", PyInit_mathutils_noise},
{"mathutils.kdtree", PyInit_mathutils_kdtree},
#endif
{"_bpy_path", BPyInit__bpy_path},
{"bgl", BPyInit_bgl},
{"blf", BPyInit_blf},
{"bmesh", BPyInit_bmesh},
#if 0
{"bmesh.types", BPyInit_bmesh_types},
{"bmesh.utils", BPyInit_bmesh_utils},
{"bmesh.utils", BPyInit_bmesh_geometry},
#endif
#ifdef WITH_AUDASPACE
{(char *)"aud", AUD_initPython},
{"aud", AUD_initPython},
#endif
#ifdef WITH_CYCLES
{(char *)"_cycles", CCL_initPython},
{"_cycles", CCL_initPython},
#endif
{(char *)"gpu", GPU_initPython},
{(char *)"idprop", BPyInit_idprop},
{"gpu", GPU_initPython},
{"idprop", BPyInit_idprop},
{NULL, NULL}
};

View File

@@ -6255,7 +6255,7 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna)
/* always use O not N when calling, N causes refcount errors */
#if 0
newclass = PyObject_CallFunction(metaclass, (char *)"s(O) {sss()}",
newclass = PyObject_CallFunction(metaclass, "s(O) {sss()}",
idname, py_base, "__module__", "bpy.types", "__slots__");
#else
{

View File

@@ -102,7 +102,7 @@ static int PyKDTree__tp_init(PyKDTree *self, PyObject *args, PyObject *kwargs)
unsigned int maxsize;
const char *keywords[] = {"size", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *)"I:KDTree", (char **)keywords, &maxsize)) {
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "I:KDTree", (char **)keywords, &maxsize)) {
return -1;
}
@@ -425,7 +425,7 @@ PyMODINIT_FUNC PyInit_mathutils_kdtree(void)
if (PyType_Ready(&PyKDTree_Type)) {
return NULL;
}
PyModule_AddObject(m, (char *)"KDTree", (PyObject *) &PyKDTree_Type);
PyModule_AddObject(m, "KDTree", (PyObject *) &PyKDTree_Type);
return m;
}