code cleanup: not all mathutils callback creation functions tool unsigned char for type & subtype args.

This commit is contained in:
Campbell Barton 2012-03-17 22:31:57 +00:00
parent 6075a24fc4
commit 05612c0419
9 changed files with 29 additions and 23 deletions

@ -885,14 +885,15 @@ PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type)
return (PyObject *)self; return (PyObject *)self;
} }
PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
unsigned char cb_type, unsigned char cb_subtype)
{ {
ColorObject *self = (ColorObject *)Color_CreatePyObject(NULL, Py_NEW, NULL); ColorObject *self = (ColorObject *)Color_CreatePyObject(NULL, Py_NEW, NULL);
if (self) { if (self) {
Py_INCREF(cb_user); Py_INCREF(cb_user);
self->cb_user = cb_user; self->cb_user = cb_user;
self->cb_type = (unsigned char)cb_type; self->cb_type = cb_type;
self->cb_subtype = (unsigned char)cb_subtype; self->cb_subtype = cb_subtype;
PyObject_GC_Track(self); PyObject_GC_Track(self);
} }

@ -49,6 +49,7 @@ typedef struct {
//prototypes //prototypes
PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type); PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type);
PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype); PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
unsigned char cb_type, unsigned char cb_subtype);
#endif /* __MATHUTILS_COLOR_H__ */ #endif /* __MATHUTILS_COLOR_H__ */

@ -732,14 +732,15 @@ PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *
return (PyObject *)self; return (PyObject *)self;
} }
PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype) PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
unsigned char cb_type, unsigned char cb_subtype)
{ {
EulerObject *self = (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL); EulerObject *self = (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL);
if (self) { if (self) {
Py_INCREF(cb_user); Py_INCREF(cb_user);
self->cb_user = cb_user; self->cb_user = cb_user;
self->cb_type = (unsigned char)cb_type; self->cb_type = cb_type;
self->cb_subtype = (unsigned char)cb_subtype; self->cb_subtype = cb_subtype;
PyObject_GC_Track(self); PyObject_GC_Track(self);
} }

@ -51,7 +51,8 @@ typedef struct {
//prototypes //prototypes
PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type); PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type);
PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype); PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
unsigned char cb_type, unsigned char cb_subtype);
short euler_order_from_string(const char *str, const char *error_prefix); short euler_order_from_string(const char *str, const char *error_prefix);

@ -1739,8 +1739,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
tuple = PyTuple_New(end - begin); tuple = PyTuple_New(end - begin);
for (count = begin; count < end; count++) { for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyTuple_SET_ITEM(tuple, count - begin,
Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_row_cb_index, count)); Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_row_cb_index, count));
} }
return tuple; return tuple;
@ -2399,14 +2398,14 @@ PyObject *Matrix_CreatePyObject(float *mat,
PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user, PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user,
const unsigned short num_col, const unsigned short num_row, const unsigned short num_col, const unsigned short num_row,
int cb_type, int cb_subtype) unsigned char cb_type, unsigned char cb_subtype)
{ {
MatrixObject *self = (MatrixObject *)Matrix_CreatePyObject(NULL, num_col, num_row, Py_NEW, NULL); MatrixObject *self = (MatrixObject *)Matrix_CreatePyObject(NULL, num_col, num_row, Py_NEW, NULL);
if (self) { if (self) {
Py_INCREF(cb_user); Py_INCREF(cb_user);
self->cb_user = cb_user; self->cb_user = cb_user;
self->cb_type = (unsigned char)cb_type; self->cb_type = cb_type;
self->cb_subtype = (unsigned char)cb_subtype; self->cb_subtype = cb_subtype;
PyObject_GC_Track(self); PyObject_GC_Track(self);
} }
return (PyObject *) self; return (PyObject *) self;

@ -71,7 +71,7 @@ PyObject *Matrix_CreatePyObject(float *mat,
int type, PyTypeObject *base_type); int type, PyTypeObject *base_type);
PyObject *Matrix_CreatePyObject_cb(PyObject *user, PyObject *Matrix_CreatePyObject_cb(PyObject *user,
const unsigned short num_col, const unsigned short num_row, const unsigned short num_col, const unsigned short num_row,
int cb_type, int cb_subtype); unsigned char cb_type, unsigned char cb_subtype);
extern unsigned char mathutils_matrix_row_cb_index; /* default */ extern unsigned char mathutils_matrix_row_cb_index; /* default */
extern unsigned char mathutils_matrix_col_cb_index; extern unsigned char mathutils_matrix_col_cb_index;

@ -1268,14 +1268,15 @@ PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_ty
return (PyObject *) self; return (PyObject *) self;
} }
PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
unsigned char cb_type, unsigned char cb_subtype)
{ {
QuaternionObject *self = (QuaternionObject *)Quaternion_CreatePyObject(NULL, Py_NEW, NULL); QuaternionObject *self = (QuaternionObject *)Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
if (self) { if (self) {
Py_INCREF(cb_user); Py_INCREF(cb_user);
self->cb_user = cb_user; self->cb_user = cb_user;
self->cb_type = (unsigned char)cb_type; self->cb_type = cb_type;
self->cb_subtype = (unsigned char)cb_subtype; self->cb_subtype = cb_subtype;
PyObject_GC_Track(self); PyObject_GC_Track(self);
} }

@ -49,6 +49,7 @@ typedef struct {
//prototypes //prototypes
PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type); PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type);
PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype); PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
unsigned char cb_type, unsigned char cb_subtype);
#endif /* __MATHUTILS_QUATERNION_H__ */ #endif /* __MATHUTILS_QUATERNION_H__ */

@ -46,7 +46,8 @@ typedef struct {
/*prototypes*/ /*prototypes*/
PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type); PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type);
PyObject *Vector_CreatePyObject_cb(PyObject *user, int size, unsigned char callback_type, unsigned char subtype); PyObject *Vector_CreatePyObject_cb(PyObject *user, int size,
unsigned char cb_type, unsigned char subtype);
PyObject *Vector_CreatePyObject_alloc(float *vec, const int size, PyTypeObject *base_type); PyObject *Vector_CreatePyObject_alloc(float *vec, const int size, PyTypeObject *base_type);
#endif /* __MATHUTILS_VECTOR_H__ */ #endif /* __MATHUTILS_VECTOR_H__ */