diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-07-01 07:39:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-07-01 08:10:59 +0400 |
commit | 9f05588b680b71d64fb560ebf6e597216f3e5d14 (patch) | |
tree | fea7c6d9a5ad7d42599a041a9aa724ef6d96e94b | |
parent | c92c3ef61132b7116b55a883cbcfd08f7225aaa0 (diff) |
Python: remove redundant casts
-rw-r--r-- | source/blender/freestyle/intern/python/Director.cpp | 18 | ||||
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 6 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 34 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_kdtree.c | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 8 |
6 files changed, 38 insertions, 34 deletions
diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp index db287fd054d..653fd0b1d29 100644 --- a/source/blender/freestyle/intern/python/Director.cpp +++ b/source/blender/freestyle/intern/python/Director.cpp @@ -74,7 +74,7 @@ int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D, Interface0D Py_XDECREF(arg2); return -1; } - PyObject *result = PyObject_CallMethod((PyObject *)bp0D->py_bp0D, (char *)"__call__", (char *)"OO", arg1, arg2); + PyObject *result = PyObject_CallMethod((PyObject *)bp0D->py_bp0D, "__call__", "OO", arg1, arg2); Py_DECREF(arg1); Py_DECREF(arg2); if (!result) @@ -101,7 +101,7 @@ int Director_BPy_BinaryPredicate1D___call__(BinaryPredicate1D *bp1D, Interface1D Py_XDECREF(arg2); return -1; } - PyObject *result = PyObject_CallMethod((PyObject *)bp1D->py_bp1D, (char *)"__call__", (char *)"OO", arg1, arg2); + PyObject *result = PyObject_CallMethod((PyObject *)bp1D->py_bp1D, "__call__", "OO", arg1, arg2); Py_DECREF(arg1); Py_DECREF(arg2); if (!result) @@ -124,7 +124,7 @@ int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIt PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false); if (!arg) return -1; - PyObject *result = PyObject_CallMethod((PyObject *)up0D->py_up0D, (char *)"__call__", (char *)"O", arg); + PyObject *result = PyObject_CallMethod((PyObject *)up0D->py_up0D, "__call__", "O", arg); Py_DECREF(arg); if (!result) return -1; @@ -146,7 +146,7 @@ int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D& PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D); if (!arg) return -1; - PyObject *result = PyObject_CallMethod((PyObject *)up1D->py_up1D, (char *)"__call__", (char *)"O", arg); + PyObject *result = PyObject_CallMethod((PyObject *)up1D->py_up1D, "__call__", "O", arg); Py_DECREF(arg); if (!result) return -1; @@ -168,7 +168,7 @@ int Director_BPy_StrokeShader_shade(StrokeShader *ss, Stroke& s) PyObject *arg = BPy_Stroke_from_Stroke(s); if (!arg) return -1; - PyObject *result = PyObject_CallMethod((PyObject *)ss->py_ss, (char *)"shade", (char *)"O", arg); + PyObject *result = PyObject_CallMethod((PyObject *)ss->py_ss, "shade", "O", arg); Py_DECREF(arg); if (!result) return -1; @@ -183,7 +183,7 @@ int Director_BPy_ChainingIterator_init(ChainingIterator *c_it) PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_c_it) not initialized"); return -1; } - PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, (char *)"init", NULL); + PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "init", NULL); if (!result) return -1; Py_DECREF(result); @@ -199,7 +199,7 @@ int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIter PyObject *arg = BPy_AdjacencyIterator_from_AdjacencyIterator(a_it); if (!arg) return -1; - PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, (char *)"traverse", (char *)"O", arg); + PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "traverse", "O", arg); Py_DECREF(arg); if (!result) return -1; @@ -229,7 +229,7 @@ int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0D PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false); if (!arg) return -1; - PyObject *result = PyObject_CallMethod(obj, (char *)"__call__", (char *)"O", arg); + PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg); Py_DECREF(arg); if (!result) return -1; @@ -288,7 +288,7 @@ int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D); if (!arg) return -1; - PyObject *result = PyObject_CallMethod(obj, (char *)"__call__", (char *)"O", arg); + PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg); Py_DECREF(arg); if (!result) return -1; diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 96b5707ec27..36ae30ada22 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -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) { diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index b7752b39900..ddfbfecc46e 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -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} }; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 38a0f74f009..440af035bcd 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -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 { diff --git a/source/blender/python/mathutils/mathutils_kdtree.c b/source/blender/python/mathutils/mathutils_kdtree.c index 0833d522a60..519778aea7d 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.c +++ b/source/blender/python/mathutils/mathutils_kdtree.c @@ -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; } diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 5af4ab2a9b9..56b7631e7f1 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1958,10 +1958,10 @@ void removeImportMain(struct Main *maggie) // Copied from bpy_interface.c static struct _inittab bge_internal_modules[] = { - {(char *)"mathutils", PyInit_mathutils}, - {(char *)"bgl", BPyInit_bgl}, - {(char *)"blf", BPyInit_blf}, - {(char *)"aud", AUD_initPython}, + {"mathutils", PyInit_mathutils}, + {"bgl", BPyInit_bgl}, + {"blf", BPyInit_blf}, + {"aud", AUD_initPython}, {NULL, NULL} }; |