Cleanup: use function style casts
This commit is contained in:
@@ -426,7 +426,7 @@ struct BufferOrOffset {
|
||||
#define ret_def_GLuint uint ret_uint
|
||||
#define ret_set_GLuint ret_uint =
|
||||
#define ret_default_GLuint 0
|
||||
#define ret_ret_GLuint return PyLong_FromLong((long)ret_uint)
|
||||
#define ret_ret_GLuint return PyLong_FromLong(long(ret_uint))
|
||||
|
||||
#if 0
|
||||
# define ret_def_GLsizei size_t ret_size_t
|
||||
@@ -437,18 +437,18 @@ struct BufferOrOffset {
|
||||
#if 0
|
||||
# define ret_def_GLsync uint ret_sync
|
||||
# define ret_set_GLsync ret_sync =
|
||||
# define ret_ret_GLsync return PyLong_FromLong((long)ret_sync)
|
||||
# define ret_ret_GLsync return PyLong_FromLong(long(ret_sync))
|
||||
#endif
|
||||
|
||||
#define ret_def_GLenum uint ret_uint
|
||||
#define ret_set_GLenum ret_uint =
|
||||
#define ret_default_GLenum 0
|
||||
#define ret_ret_GLenum return PyLong_FromLong((long)ret_uint)
|
||||
#define ret_ret_GLenum return PyLong_FromLong(long(ret_uint))
|
||||
|
||||
#define ret_def_GLboolean uchar ret_bool
|
||||
#define ret_set_GLboolean ret_bool =
|
||||
#define ret_default_GLboolean GL_FALSE
|
||||
#define ret_ret_GLboolean return PyLong_FromLong((long)ret_bool)
|
||||
#define ret_ret_GLboolean return PyLong_FromLong(long(ret_bool))
|
||||
|
||||
#define ret_def_GLstring \
|
||||
const char *default_GLstring = ""; \
|
||||
|
||||
@@ -222,7 +222,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
|
||||
break;
|
||||
}
|
||||
case IDP_FLOAT: {
|
||||
float fvalue = (float)PyFloat_AsDouble(value);
|
||||
float fvalue = float(PyFloat_AsDouble(value));
|
||||
if (fvalue == -1 && PyErr_Occurred()) {
|
||||
PyErr_SetString(PyExc_TypeError, "expected a float");
|
||||
return -1;
|
||||
@@ -1807,9 +1807,9 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, Py_ssize_t index)
|
||||
case IDP_DOUBLE:
|
||||
return PyFloat_FromDouble(((double *)IDP_Array(self->prop))[index]);
|
||||
case IDP_INT:
|
||||
return PyLong_FromLong((long)((int *)IDP_Array(self->prop))[index]);
|
||||
return PyLong_FromLong(long(((int *)IDP_Array(self->prop))[index]));
|
||||
case IDP_BOOLEAN:
|
||||
return PyBool_FromLong((long)((int8_t *)IDP_Array(self->prop))[index]);
|
||||
return PyBool_FromLong(long(((int8_t *)IDP_Array(self->prop))[index]));
|
||||
}
|
||||
|
||||
PyErr_Format(
|
||||
|
||||
@@ -5530,22 +5530,22 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
|
||||
|
||||
switch (raw_type) {
|
||||
case PROP_RAW_CHAR:
|
||||
item = PyLong_FromLong((long)((char *)array)[i]);
|
||||
item = PyLong_FromLong(long(((char *)array)[i]));
|
||||
break;
|
||||
case PROP_RAW_SHORT:
|
||||
item = PyLong_FromLong((long)((short *)array)[i]);
|
||||
item = PyLong_FromLong(long(((short *)array)[i]));
|
||||
break;
|
||||
case PROP_RAW_INT:
|
||||
item = PyLong_FromLong((long)((int *)array)[i]);
|
||||
item = PyLong_FromLong(long(((int *)array)[i]));
|
||||
break;
|
||||
case PROP_RAW_FLOAT:
|
||||
item = PyFloat_FromDouble((double)((float *)array)[i]);
|
||||
item = PyFloat_FromDouble(double(((float *)array)[i]));
|
||||
break;
|
||||
case PROP_RAW_DOUBLE:
|
||||
item = PyFloat_FromDouble((double)((double *)array)[i]);
|
||||
item = PyFloat_FromDouble(double(((double *)array)[i]));
|
||||
break;
|
||||
case PROP_RAW_BOOLEAN:
|
||||
item = PyBool_FromLong((long)((bool *)array)[i]);
|
||||
item = PyBool_FromLong(long(((bool *)array)[i]));
|
||||
break;
|
||||
default: /* PROP_RAW_UNSET */
|
||||
/* Should never happen. */
|
||||
@@ -5658,7 +5658,7 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self,
|
||||
RNA_property_int_get_array(&self->ptr, self->prop, static_cast<int *>(array));
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
item = PyLong_FromLong((long)((int *)array)[i]);
|
||||
item = PyLong_FromLong(long(((int *)array)[i]));
|
||||
PySequence_SetItem(seq, i, item);
|
||||
Py_DECREF(item);
|
||||
}
|
||||
@@ -5680,7 +5680,7 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self,
|
||||
RNA_property_float_get_array(&self->ptr, self->prop, static_cast<float *>(array));
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
item = PyFloat_FromDouble((double)((float *)array)[i]);
|
||||
item = PyFloat_FromDouble(double(((float *)array)[i]));
|
||||
PySequence_SetItem(seq, i, item);
|
||||
Py_DECREF(item);
|
||||
}
|
||||
@@ -6588,7 +6588,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
|
||||
#ifdef DEBUG_STRING_FREE
|
||||
# if 0
|
||||
if (PyList_GET_SIZE(string_free_ls)) {
|
||||
printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls));
|
||||
printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), int(PyList_GET_SIZE(string_free_ls)));
|
||||
}
|
||||
# endif
|
||||
Py_DECREF(string_free_ls);
|
||||
|
||||
@@ -2693,8 +2693,8 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
|
||||
size_from = axis_from;
|
||||
}
|
||||
else if ((void)PyErr_Clear(), /* run but ignore the result */
|
||||
(size_from = (size_t)mathutils_array_parse(
|
||||
vec_assign, 2, 4, value, "Vector.**** = swizzle assignment")) == size_t(-1))
|
||||
(size_from = size_t(mathutils_array_parse(
|
||||
vec_assign, 2, 4, value, "Vector.**** = swizzle assignment"))) == size_t(-1))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user