diff options
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 16 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 36 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 17 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_anim.c | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Vector.c | 4 |
5 files changed, 38 insertions, 37 deletions
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index c3cbe7ddbf9..938a4cc8049 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -1002,22 +1002,22 @@ PyTypeObject BPy_IDGroup_Type = { /********Array Wrapper********/ -static PyTypeObject *idp_array_py_type(BPy_IDArray *self, short *is_double) +static PyTypeObject *idp_array_py_type(BPy_IDArray *self, bool *r_is_double) { switch (self->prop->subtype) { case IDP_FLOAT: - *is_double = 0; + *r_is_double = false; return &PyFloat_Type; case IDP_DOUBLE: - *is_double = 1; + *r_is_double = true; return &PyFloat_Type; case IDP_INT: - *is_double = 0; + *r_is_double = false; return &PyLong_Type; + default: + *r_is_double = false; + return NULL; } - - *is_double = 0; - return NULL; } static PyObject *BPy_IDArray_repr(BPy_IDArray *self) @@ -1188,7 +1188,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject *seq) { IDProperty *prop = self->prop; - short is_double = 0; + bool is_double; const PyTypeObject *py_type = idp_array_py_type(self, &is_double); const size_t elem_size = is_double ? sizeof(double) : sizeof(float); size_t alloc_len; diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 796f6388eb3..7eee0d4a42a 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -197,7 +197,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc PyObject *args; PyObject *self; PyObject *ret; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -248,7 +248,7 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int value; BLI_assert(py_data != NULL); @@ -306,7 +306,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA * PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -360,7 +360,7 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int i, len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -422,7 +422,7 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert PyObject *py_values; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -482,7 +482,7 @@ static int bpy_prop_int_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop) PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int value; BLI_assert(py_data != NULL); @@ -540,7 +540,7 @@ static void bpy_prop_int_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -594,7 +594,7 @@ static void bpy_prop_int_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int i, len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -656,7 +656,7 @@ static void bpy_prop_int_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA PyObject *py_values; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -716,7 +716,7 @@ static float bpy_prop_float_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); float value; BLI_assert(py_data != NULL); @@ -774,7 +774,7 @@ static void bpy_prop_float_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pr PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -828,7 +828,7 @@ static void bpy_prop_float_array_get_cb(struct PointerRNA *ptr, struct PropertyR PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int i, len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -890,7 +890,7 @@ static void bpy_prop_float_array_set_cb(struct PointerRNA *ptr, struct PropertyR PyObject *py_values; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int len = RNA_property_array_length(ptr, prop); BLI_assert(py_data != NULL); @@ -950,7 +950,7 @@ static void bpy_prop_string_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); @@ -1009,7 +1009,7 @@ static int bpy_prop_string_length_cb(struct PointerRNA *ptr, struct PropertyRNA PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int length; BLI_assert(py_data != NULL); @@ -1071,7 +1071,7 @@ static void bpy_prop_string_set_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); PyObject *py_value; BLI_assert(py_data != NULL); @@ -1132,7 +1132,7 @@ static int bpy_prop_enum_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); int value; BLI_assert(py_data != NULL); @@ -1190,7 +1190,7 @@ static void bpy_prop_enum_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pro PyObject *ret; PyGILState_STATE gilstate; bool use_gil; - const int is_write_ok = pyrna_write_check(); + const bool is_write_ok = pyrna_write_check(); BLI_assert(py_data != NULL); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index b8640f7208b..23308bf997d 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -606,7 +606,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) #ifdef USE_MATHUTILS int subtype, totdim; int len; - int is_thick; + bool is_thick; const int flag = RNA_property_flag(prop); /* disallow dynamic sized arrays to be wrapped since the size could change @@ -617,7 +617,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) len = RNA_property_array_length(ptr, prop); subtype = RNA_property_subtype(prop); totdim = RNA_property_array_dimension(ptr, prop, NULL); - is_thick = (flag & PROP_THICK_WRAP); + is_thick = (flag & PROP_THICK_WRAP) != 0; if (totdim == 1 || (totdim == 2 && subtype == PROP_MATRIX)) { if (!is_thick) @@ -3640,7 +3640,7 @@ static int pyrna_struct_pydict_contains(PyObject *self, PyObject *pyname) #endif /* --------------- setattr------------------------------------------- */ -static int pyrna_is_deferred_prop(const PyObject *value) +static bool pyrna_is_deferred_prop(const PyObject *value) { return PyTuple_CheckExact(value) && PyTuple_GET_SIZE(value) == 2 && @@ -3682,7 +3682,7 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyObject *value) { StructRNA *srna = srna_from_self(cls, "StructRNA.__setattr__"); - const int is_deferred_prop = (value && pyrna_is_deferred_prop(value)); + const bool is_deferred_prop = (value && pyrna_is_deferred_prop(value)); const char *attr_str = _PyUnicode_AsString(attr); if (srna && !pyrna_write_check() && (is_deferred_prop || RNA_struct_type_find_property(srna, attr_str))) { @@ -6901,7 +6901,7 @@ static int rna_function_arg_count(FunctionRNA *func, int *min_count) PropertyRNA *parm; Link *link; int flag = RNA_function_flag(func); - int is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE); + const bool is_staticmethod = (flag & FUNC_NO_SELF) && !(flag & FUNC_USE_SELF_TYPE); int count = is_staticmethod ? 0 : 1; bool done_min_count = false; @@ -6934,7 +6934,8 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v PyObject *py_class = (PyObject *)py_data; PyObject *base_class = RNA_struct_py_type_get(srna); PyObject *item; - int i, flag, is_staticmethod, arg_count, func_arg_count, func_arg_min_count = 0; + int i, flag, arg_count, func_arg_count, func_arg_min_count = 0; + bool is_staticmethod; const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; /* __name__ */ if (srna_base) { @@ -7119,10 +7120,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param PyGILState_STATE gilstate; #ifdef USE_PEDANTIC_WRITE - const int is_operator = RNA_struct_is_a(ptr->type, &RNA_Operator); + const bool is_operator = RNA_struct_is_a(ptr->type, &RNA_Operator); // const char *func_id = RNA_function_identifier(func); /* UNUSED */ /* testing, for correctness, not operator and not draw function */ - const short is_readonly = !(RNA_function_flag(func) & FUNC_ALLOW_WRITE); + const bool is_readonly = !(RNA_function_flag(func) & FUNC_ALLOW_WRITE); #endif py_class = RNA_struct_py_type_get(ptr->type); diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index e473af9fac8..3320043aeb5 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -58,7 +58,7 @@ static int pyrna_struct_anim_args_parse( PointerRNA *ptr, const char *error_prefix, const char *path, const char **path_full, int *index) { - const int is_idbase = RNA_struct_is_ID(ptr->type); + const bool is_idbase = RNA_struct_is_ID(ptr->type); PropertyRNA *prop; PointerRNA r_ptr; diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 91055a55bfa..0e6864047a2 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -1261,7 +1261,7 @@ static int Vector_len(VectorObject *self) return self->size; } /* sequence accessor (get): vector[index] */ -static PyObject *vector_item_internal(VectorObject *self, int i, const int is_attr) +static PyObject *vector_item_internal(VectorObject *self, int i, const bool is_attr) { if (i < 0) i = self->size - i; @@ -1289,7 +1289,7 @@ static PyObject *Vector_item(VectorObject *self, int i) return vector_item_internal(self, i, false); } /* sequence accessor (set): vector[index] = value */ -static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, const int is_attr) +static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, const bool is_attr) { float scalar; if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ |