Code cleanup: use 'const' for arrays (python)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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]));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user