Code cleanup: use booleans where appropriate

This commit is contained in:
2014-01-28 03:52:21 +11:00
parent 60287e23b5
commit a5c35fb27f
66 changed files with 248 additions and 233 deletions

View File

@@ -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;