diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-26 18:21:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-26 18:25:15 +0400 |
commit | e73d0f57a32f309433c005c06d6da2048f274c04 (patch) | |
tree | eaa2542b29b5198590b79e1610d511cf0f57275d /source/blender/python/generic | |
parent | 483d8da9bcfa1eeef950ba45633c5fb49fb7f93b (diff) |
Code cleanup: use 'const' for arrays (python)
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r-- | source/blender/python/generic/bgl.c | 2 | ||||
-rw-r--r-- | source/blender/python/generic/blf_py_api.c | 8 | ||||
-rw-r--r-- | source/blender/python/generic/bpy_internal_import.c | 4 | ||||
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 14 | ||||
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 6 |
5 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index d1d0ec96315..292d3317a2e 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -1905,7 +1905,7 @@ PyObject *BPyInit_bgl(void) static PyObject *Method_ShaderSource(PyObject *UNUSED(self), PyObject *args) { unsigned int shader; - char *source; + const char *source; if (!PyArg_ParseTuple(args, "Is", &shader, &source)) return NULL; diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 768c5506b8c..655542e320a 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -146,7 +146,7 @@ PyDoc_STRVAR(py_blf_draw_doc, ); static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args) { - char *text; + const char *text; int text_length; int fontid; @@ -172,7 +172,7 @@ PyDoc_STRVAR(py_blf_dimensions_doc, ); static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args) { - char *text; + const char *text; float r_width, r_height; PyObject *ret; int fontid; @@ -356,7 +356,7 @@ PyDoc_STRVAR(py_blf_load_doc, ); static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args) { - char *filename; + const char *filename; if (!PyArg_ParseTuple(args, "s:blf.load", &filename)) return NULL; @@ -374,7 +374,7 @@ PyDoc_STRVAR(py_blf_unload_doc, ); static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args) { - char *filename; + const char *filename; if (!PyArg_ParseTuple(args, "s:blf.unload", &filename)) return NULL; diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index af41c3b426b..a0e6204b34c 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -226,7 +226,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found) { Text *text; const char *name; - char *filepath; + const char *filepath; //XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main; Main *maggie = bpy_import_main; @@ -265,7 +265,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found) static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { PyObject *exception, *err, *tb; - char *name; + const char *name; int found = 0; PyObject *globals = NULL, *locals = NULL, *fromlist = NULL; int level = 0; /* relative imports */ diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index 5821d48b994..54fed9e11ef 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -599,7 +599,7 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) switch (prop->subtype) { case IDP_FLOAT: { - float *array = (float *)IDP_Array(prop); + const float *array = (float *)IDP_Array(prop); for (i = 0; i < prop->len; i++) { PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i])); } @@ -607,7 +607,7 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) } case IDP_DOUBLE: { - double *array = (double *)IDP_Array(prop); + const double *array = (double *)IDP_Array(prop); for (i = 0; i < prop->len; i++) { PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i])); } @@ -615,7 +615,7 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) } case IDP_INT: { - int *array = (int *)IDP_Array(prop); + const int *array = (int *)IDP_Array(prop); for (i = 0; i < prop->len; i++) { PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i])); } @@ -881,7 +881,7 @@ static PyObject *BPy_IDGroup_clear(BPy_IDProperty *self) static PyObject *BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args) { IDProperty *idprop; - char *key; + const char *key; PyObject *def = Py_None; if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) @@ -1158,7 +1158,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) switch (prop->subtype) { case IDP_FLOAT: { - float *array = (float *)IDP_Array(prop); + const float *array = (float *)IDP_Array(prop); for (count = begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count])); } @@ -1166,7 +1166,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) } case IDP_DOUBLE: { - double *array = (double *)IDP_Array(prop); + const double *array = (double *)IDP_Array(prop); for (count = begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count])); } @@ -1174,7 +1174,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) } case IDP_INT: { - int *array = (int *)IDP_Array(prop); + const int *array = (int *)IDP_Array(prop); for (count = begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyLong_FromLong(array[count])); } diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index a37933d027e..6f72a291a36 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -284,7 +284,7 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...) { Py_ssize_t i; PyObject *item = o; - char *attr; + const char *attr; va_list vargs; @@ -647,7 +647,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...) va_start(vargs, n); for (i = 0; i * 2 < n; i++) { - char *format = va_arg(vargs, char *); + const char *format = va_arg(vargs, char *); void *ptr = va_arg(vargs, void *); ret = PyObject_CallFunction(calcsize, (char *)"s", format); @@ -704,7 +704,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...) /* now get the values back */ va_start(vargs, n); for (i = 0; i * 2 < n; i++) { - char *format = va_arg(vargs, char *); + const char *format = va_arg(vargs, char *); void *ptr = va_arg(vargs, void *); PyObject *item; |