diff options
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 32 | ||||
-rw-r--r-- | source/blender/python/generic/py_capi_utils.h | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 68 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_array.c | 12 |
4 files changed, 58 insertions, 58 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 35fff8699d1..9c84a4bb824 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -360,15 +360,15 @@ void PyC_StackSpit(void) } } -void PyC_FileAndNum(const char **filename, int *lineno) +void PyC_FileAndNum(const char **r_filename, int *r_lineno) { PyFrameObject *frame; - if (filename) { - *filename = NULL; + if (r_filename) { + *r_filename = NULL; } - if (lineno) { - *lineno = -1; + if (r_lineno) { + *r_lineno = -1; } if (!(frame = PyThreadState_GET()->frame)) { @@ -376,13 +376,13 @@ void PyC_FileAndNum(const char **filename, int *lineno) } /* when executing a script */ - if (filename) { - *filename = _PyUnicode_AsString(frame->f_code->co_filename); + if (r_filename) { + *r_filename = _PyUnicode_AsString(frame->f_code->co_filename); } /* when executing a module */ - if (filename && *filename == NULL) { - /* try an alternative method to get the filename - module based + if (r_filename && *r_filename == NULL) { + /* try an alternative method to get the r_filename - module based * references below are all borrowed (double checked) */ PyObject *mod_name = PyDict_GetItemString(PyEval_GetGlobals(), "__name__"); if (mod_name) { @@ -390,7 +390,7 @@ void PyC_FileAndNum(const char **filename, int *lineno) if (mod) { PyObject *mod_file = PyModule_GetFilenameObject(mod); if (mod_file) { - *filename = _PyUnicode_AsString(mod_name); + *r_filename = _PyUnicode_AsString(mod_name); Py_DECREF(mod_file); } else { @@ -399,24 +399,24 @@ void PyC_FileAndNum(const char **filename, int *lineno) } /* unlikely, fallback */ - if (*filename == NULL) { - *filename = _PyUnicode_AsString(mod_name); + if (*r_filename == NULL) { + *r_filename = _PyUnicode_AsString(mod_name); } } } - if (lineno) { - *lineno = PyFrame_GetLineNumber(frame); + if (r_lineno) { + *r_lineno = PyFrame_GetLineNumber(frame); } } -void PyC_FileAndNum_Safe(const char **filename, int *lineno) +void PyC_FileAndNum_Safe(const char **r_filename, int *r_lineno) { if (!PyC_IsInterpreterActive()) { return; } - PyC_FileAndNum(filename, lineno); + PyC_FileAndNum(r_filename, r_lineno); } /* Would be nice if python had this built in */ diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index 5fb5737e1f9..e8b2e8ff502 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -38,8 +38,8 @@ PyObject *PyC_Err_SetString_Prefix(PyObject *exception_type_prefix, const char * void PyC_Err_PrintWithFunc(PyObject *py_func); -void PyC_FileAndNum(const char **filename, int *lineno); -void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */ +void PyC_FileAndNum(const char **r_filename, int *r_lineno); +void PyC_FileAndNum_Safe(const char **r_filename, int *r_lineno); /* checks python is running */ int PyC_AsArray_FAST(void *array, PyObject *value_fast, const Py_ssize_t length, diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index e80c972e8bc..9579f78be30 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -5092,23 +5092,23 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key static bool foreach_attr_type(BPy_PropertyRNA *self, const char *attr, /* Values to assign. */ - RawPropertyType *raw_type, - int *attr_tot, - bool *attr_signed) + RawPropertyType *r_raw_type, + int *r_attr_tot, + bool *r_attr_signed) { PropertyRNA *prop; bool attr_ok = true; - *raw_type = PROP_RAW_UNSET; - *attr_tot = 0; - *attr_signed = false; + *r_raw_type = PROP_RAW_UNSET; + *r_attr_tot = 0; + *r_attr_signed = false; /* Note: this is fail with zero length lists, so don't let this get caled in that case. */ RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) { prop = RNA_struct_find_property(&itemptr, attr); if (prop) { - *raw_type = RNA_property_raw_type(prop); - *attr_tot = RNA_property_array_length(&itemptr, prop); - *attr_signed = (RNA_property_subtype(prop) != PROP_UNSIGNED); + *r_raw_type = RNA_property_raw_type(prop); + *r_attr_tot = RNA_property_array_length(&itemptr, prop); + *r_attr_signed = (RNA_property_subtype(prop) != PROP_UNSIGNED); } else { attr_ok = false; @@ -5125,53 +5125,53 @@ static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args, /* Values to assign. */ - const char **attr, - PyObject **seq, - int *tot, - int *size, - RawPropertyType *raw_type, - int *attr_tot, - bool *attr_signed) + const char **r_attr, + PyObject **r_seq, + int *r_tot, + int *r_size, + RawPropertyType *r_raw_type, + int *r_attr_tot, + bool *r_attr_signed) { #if 0 int array_tot; int target_tot; #endif - *size = *attr_tot = 0; - *attr_signed = false; - *raw_type = PROP_RAW_UNSET; + *r_size = *r_attr_tot = 0; + *r_attr_signed = false; + *r_raw_type = PROP_RAW_UNSET; - if (!PyArg_ParseTuple(args, "sO:foreach_get/set", attr, seq)) { + if (!PyArg_ParseTuple(args, "sO:foreach_get/set", r_attr, r_seq)) { return -1; } - if (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq)) { + if (!PySequence_Check(*r_seq) && PyObject_CheckBuffer(*r_seq)) { PyErr_Format( PyExc_TypeError, "foreach_get/set expected second argument to be a sequence or buffer, not a %.200s", - Py_TYPE(*seq)->tp_name); + Py_TYPE(*r_seq)->tp_name); return -1; } /* TODO - buffer may not be a sequence! array.array() is though. */ - *tot = PySequence_Size(*seq); + *r_tot = PySequence_Size(*r_seq); - if (*tot > 0) { - if (!foreach_attr_type(self, *attr, raw_type, attr_tot, attr_signed)) { + if (*r_tot > 0) { + if (!foreach_attr_type(self, *r_attr, r_raw_type, r_attr_tot, r_attr_signed)) { PyErr_Format(PyExc_AttributeError, "foreach_get/set '%.200s.%200s[...]' elements have no attribute '%.200s'", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), - *attr); + *r_attr); return -1; } - *size = RNA_raw_type_sizeof(*raw_type); + *r_size = RNA_raw_type_sizeof(*r_raw_type); #if 0 /* Works fine, but not strictly needed. \ * we could allow RNA_property_collection_raw_* to do the checks */ - if ((*attr_tot) < 1) { - *attr_tot = 1; + if ((*r_attr_tot) < 1) { + *r_attr_tot = 1; } if (RNA_property_type(self->prop) == PROP_COLLECTION) { @@ -5181,23 +5181,23 @@ static int foreach_parse_args(BPy_PropertyRNA *self, array_tot = RNA_property_array_length(&self->ptr, self->prop); } - target_tot = array_tot * (*attr_tot); + target_tot = array_tot * (*r_attr_tot); /* rna_access.c - rna_raw_access(...) uses this same method. */ - if (target_tot != (*tot)) { + if (target_tot != (*r_tot)) { PyErr_Format(PyExc_TypeError, "foreach_get(attr, sequence) sequence length mismatch given %d, needed %d", - *tot, + *r_tot, target_tot); return -1; } #endif } - /* Check 'attr_tot' otherwise we don't know if any values were set. + /* Check 'r_attr_tot' otherwise we don't know if any values were set. * This isn't ideal because it means running on an empty list may * fail silently when it's not compatible. */ - if (*size == 0 && *attr_tot != 0) { + if (*r_size == 0 && *r_attr_tot != 0) { PyErr_SetString(PyExc_AttributeError, "attribute does not support foreach method"); return -1; } diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index 29e3a07625a..1e5b53b819e 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -262,7 +262,7 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, - int *totitem, + int *r_totitem, const char *error_prefix) { int dimsize[MAX_ARRAY_DIMENSION]; @@ -296,7 +296,7 @@ static int validate_array_length(PyObject *rvalue, return -1; } #else - *totitem = tot; + *r_totitem = tot; return 0; #endif @@ -346,7 +346,7 @@ static int validate_array_length(PyObject *rvalue, } } - *totitem = len; + *r_totitem = len; return 0; } @@ -357,7 +357,7 @@ static int validate_array(PyObject *rvalue, int lvalue_dim, ItemTypeCheckFunc check_item_type, const char *item_type_str, - int *totitem, + int *r_totitem, const char *error_prefix) { int dimsize[MAX_ARRAY_DIMENSION]; @@ -405,7 +405,7 @@ static int validate_array(PyObject *rvalue, return -1; } else { - *totitem = dimsize[0] * dimsize[1]; + *r_totitem = dimsize[0] * dimsize[1]; return 0; } } @@ -425,7 +425,7 @@ static int validate_array(PyObject *rvalue, return -1; } - return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix); + return validate_array_length(rvalue, ptr, prop, lvalue_dim, r_totitem, error_prefix); } } |