From 2a6df7dfe5ae9c25780166771c56ff921cc90f63 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Feb 2020 15:38:58 +1100 Subject: Cleanup: use named unsigned types in the Python API --- source/blender/python/bmesh/bmesh_py_ops.c | 4 +- source/blender/python/bmesh/bmesh_py_ops_call.c | 2 +- source/blender/python/bmesh/bmesh_py_types.c | 10 +-- source/blender/python/bmesh/bmesh_py_types.h | 2 +- .../blender/python/bmesh/bmesh_py_types_meshdata.c | 6 +- source/blender/python/generic/bgl.c | 28 +++---- source/blender/python/generic/blf_py_api.c | 2 +- source/blender/python/generic/py_capi_utils.c | 8 +- source/blender/python/gpu/gpu_py_select.c | 2 +- source/blender/python/intern/bpy_app.c | 2 +- .../blender/python/intern/bpy_app_translations.c | 4 +- source/blender/python/intern/bpy_interface.c | 4 +- source/blender/python/intern/bpy_intern_string.c | 4 +- source/blender/python/intern/bpy_rna.c | 12 +-- source/blender/python/intern/bpy_rna.h | 12 +-- source/blender/python/intern/bpy_rna_array.c | 4 +- .../blender/python/intern/bpy_rna_id_collection.c | 2 +- source/blender/python/mathutils/mathutils.c | 8 +- source/blender/python/mathutils/mathutils_Color.c | 4 +- source/blender/python/mathutils/mathutils_Euler.c | 4 +- source/blender/python/mathutils/mathutils_Matrix.c | 39 +++++---- source/blender/python/mathutils/mathutils_Matrix.h | 16 ++-- .../python/mathutils/mathutils_Quaternion.c | 4 +- source/blender/python/mathutils/mathutils_Vector.c | 9 +-- .../blender/python/mathutils/mathutils_bvhtree.c | 94 +++++++++++----------- .../blender/python/mathutils/mathutils_geometry.c | 6 +- source/blender/python/mathutils/mathutils_kdtree.c | 10 +-- source/blender/python/mathutils/mathutils_noise.c | 12 +-- 28 files changed, 152 insertions(+), 162 deletions(-) diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c index a3bfe791c88..4708736ca27 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.c +++ b/source/blender/python/bmesh/bmesh_py_ops.c @@ -259,8 +259,8 @@ static PyObject *bpy_bmesh_ops_fakemod_getattro(PyObject *UNUSED(self), PyObject static PyObject *bpy_bmesh_ops_fakemod_dir(PyObject *UNUSED(self)) { - const unsigned int tot = bmo_opdefines_total; - unsigned int i; + const uint tot = bmo_opdefines_total; + uint i; PyObject *ret; ret = PyList_New(bmo_opdefines_total); diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c index f9196f7f100..f44fa2aeac3 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.c +++ b/source/blender/python/bmesh/bmesh_py_ops_call.c @@ -337,7 +337,7 @@ static int bpy_slot_from_py(BMesh *bm, BMIter iter; BMHeader *ele; int tot; - unsigned int i; + uint i; if (bpy_slot_from_py_elemseq_check( (BPy_BMGeneric *)value, diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index ebfce204456..12ae18a5bf5 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -2680,12 +2680,12 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec double *keys; int *elem_idx; - unsigned int *elem_map_idx; + uint *elem_map_idx; int (*elem_idx_compare_by_keys)(const void *, const void *, void *); - unsigned int *vert_idx = NULL; - unsigned int *edge_idx = NULL; - unsigned int *face_idx = NULL; + uint *vert_idx = NULL; + uint *edge_idx = NULL; + uint *face_idx = NULL; int i; BMesh *bm = self->bm; @@ -4065,7 +4065,7 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self) int bpy_bm_generic_valid_check_source(BMesh *bm_source, const char *error_prefix, void **args, - unsigned int args_tot) + uint args_tot) { int ret = 0; diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h index c61fdeab4b0..74bfbcec3c7 100644 --- a/source/blender/python/bmesh/bmesh_py_types.h +++ b/source/blender/python/bmesh/bmesh_py_types.h @@ -177,7 +177,7 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self); int bpy_bm_generic_valid_check_source(BMesh *bm_source, const char *error_prefix, void **args, - unsigned int args_n) ATTR_NONNULL(1, 2); + uint args_n) ATTR_NONNULL(1, 2); #define BPY_BM_CHECK_OBJ(obj) \ if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { \ diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c index 08d934251af..7cecc844f9a 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c @@ -284,15 +284,15 @@ PyObject *BPy_BMVertSkin_CreatePyObject(struct MVertSkin *mvertskin) static void mloopcol_to_float(const MLoopCol *mloopcol, float r_col[3]) { - rgba_uchar_to_float(r_col, (const unsigned char *)&mloopcol->r); + rgba_uchar_to_float(r_col, (const uchar *)&mloopcol->r); } static void mloopcol_from_float(MLoopCol *mloopcol, const float col[3]) { - rgba_float_to_uchar((unsigned char *)&mloopcol->r, col); + rgba_float_to_uchar((uchar *)&mloopcol->r, col); } -static unsigned char mathutils_bmloopcol_cb_index = -1; +static uchar mathutils_bmloopcol_cb_index = -1; static int mathutils_bmloopcol_check(BaseMathObject *UNUSED(bmo)) { diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 3f8ec826cc3..5471fc25f37 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -167,19 +167,19 @@ typedef struct BufferOrOffset { * so we use signed everything (even stuff that should be unsigned. */ -/* typedef unsigned int GLenum; */ +/* typedef uint GLenum; */ #define GLenum_str "i" #define GLenum_var(num) bgl_var##num #define GLenum_ref(num) &bgl_var##num #define GLenum_def(num) /* unsigned */ int GLenum_var(num) -/* typedef unsigned int GLboolean; */ +/* typedef uint GLboolean; */ #define GLboolean_str "b" #define GLboolean_var(num) bgl_var##num #define GLboolean_ref(num) &bgl_var##num #define GLboolean_def(num) /* unsigned */ char GLboolean_var(num) -/* typedef unsigned int GLbitfield; */ +/* typedef uint GLbitfield; */ #define GLbitfield_str "i" #define GLbitfield_var(num) bgl_var##num #define GLbitfield_ref(num) &bgl_var##num @@ -223,27 +223,27 @@ typedef struct BufferOrOffset { #define GLintptr_ref(num) &bgl_var##num #define GLintptr_def(num) size_t GLintptr_var(num) -/* typedef unsigned char GLubyte; */ +/* typedef uchar GLubyte; */ #define GLubyte_str "B" #define GLubyte_var(num) bgl_var##num #define GLubyte_ref(num) &bgl_var##num #define GLubyte_def(num) /* unsigned */ char GLubyte_var(num) #if 0 -/* typedef unsigned short GLushort; */ +/* typedef ushort GLushort; */ # define GLushort_str "H" # define GLushort_var(num) bgl_var##num # define GLushort_ref(num) &bgl_var##num # define GLushort_def(num) /* unsigned */ short GLushort_var(num) #endif -/* typedef unsigned int GLuint; */ +/* typedef uint GLuint; */ #define GLuint_str "I" #define GLuint_var(num) bgl_var##num #define GLuint_ref(num) &bgl_var##num #define GLuint_def(num) /* unsigned */ int GLuint_var(num) -/* typedef unsigned int GLuint64; */ +/* typedef uint GLuint64; */ #if 0 # define GLuint64_str "Q" # define GLuint64_var(num) bgl_var##num @@ -251,7 +251,7 @@ typedef struct BufferOrOffset { # define GLuint64_def(num) /* unsigned */ int GLuint64_var(num) #endif -/* typedef unsigned int GLsync; */ +/* typedef uint GLsync; */ #if 0 # define GLsync_str "I" # define GLsync_var(num) bgl_var##num @@ -384,7 +384,7 @@ typedef struct BufferOrOffset { #define ret_set_GLint ret_int = #define ret_ret_GLint return PyLong_FromLong(ret_int) -#define ret_def_GLuint unsigned int ret_uint +#define ret_def_GLuint uint ret_uint #define ret_set_GLuint ret_uint = #define ret_ret_GLuint return PyLong_FromLong((long)ret_uint) @@ -395,20 +395,20 @@ typedef struct BufferOrOffset { #endif #if 0 -# define ret_def_GLsync unsigned int ret_sync +# define ret_def_GLsync uint ret_sync # define ret_set_GLsync ret_sync = # define ret_ret_GLsync return PyLong_FromLong((long)ret_sync) #endif -#define ret_def_GLenum unsigned int ret_uint +#define ret_def_GLenum uint ret_uint #define ret_set_GLenum ret_uint = #define ret_ret_GLenum return PyLong_FromLong((long)ret_uint) -#define ret_def_GLboolean unsigned char ret_bool +#define ret_def_GLboolean uchar ret_bool #define ret_set_GLboolean ret_bool = #define ret_ret_GLboolean return PyLong_FromLong((long)ret_bool) -#define ret_def_GLstring const unsigned char *ret_str +#define ret_def_GLstring const uchar *ret_str #define ret_set_GLstring ret_str = #define ret_ret_GLstring \ @@ -2612,7 +2612,7 @@ PyObject *BPyInit_bgl(void) static PyObject *Method_ShaderSource(PyObject *UNUSED(self), PyObject *args) { - unsigned int shader; + uint shader; const char *source; if (!PyArg_ParseTuple(args, "Is", &shader, &source)) { diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 62f5a568ee1..269ff3b5d69 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -186,7 +186,7 @@ static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args) return NULL; } - BLF_draw(fontid, text, (unsigned int)text_length); + BLF_draw(fontid, text, (uint)text_length); Py_RETURN_NONE; } diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 8ea627589f2..35fff8699d1 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -198,8 +198,8 @@ PyObject *PyC_Tuple_PackArray_Bool(const bool *array, uint len) */ void PyC_Tuple_Fill(PyObject *tuple, PyObject *value) { - unsigned int tot = PyTuple_GET_SIZE(tuple); - unsigned int i; + uint tot = PyTuple_GET_SIZE(tuple); + uint i; for (i = 0; i < tot; i++) { PyTuple_SET_ITEM(tuple, i, value); @@ -209,8 +209,8 @@ void PyC_Tuple_Fill(PyObject *tuple, PyObject *value) void PyC_List_Fill(PyObject *list, PyObject *value) { - unsigned int tot = PyList_GET_SIZE(list); - unsigned int i; + uint tot = PyList_GET_SIZE(list); + uint i; for (i = 0; i < tot; i++) { PyList_SET_ITEM(list, i, value); diff --git a/source/blender/python/gpu/gpu_py_select.c b/source/blender/python/gpu/gpu_py_select.c index 21832b58015..b0b0e16f139 100644 --- a/source/blender/python/gpu/gpu_py_select.c +++ b/source/blender/python/gpu/gpu_py_select.c @@ -45,7 +45,7 @@ PyDoc_STRVAR(bpygpu_select_load_id_doc, "\n" " Set the selection ID.\n" "\n" - " :param id: Number (32-bit unsigned int).\n" + " :param id: Number (32-bit uint).\n" " :type select: int\n"); static PyObject *bpygpu_select_load_id(PyObject *UNUSED(self), PyObject *value) { diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index b6784f2cdc2..9b7842460b5 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -66,7 +66,7 @@ #ifdef BUILD_DATE extern char build_date[]; extern char build_time[]; -extern unsigned long build_commit_timestamp; +extern ulong build_commit_timestamp; extern char build_commit_date[]; extern char build_commit_time[]; extern char build_hash[]; diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index 2e88a9ccca7..54699663b91 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -80,10 +80,10 @@ static GHashKey *_ghashutil_keyalloc(const void *msgctxt, const void *msgid) return key; } -static unsigned int _ghashutil_keyhash(const void *ptr) +static uint _ghashutil_keyhash(const void *ptr) { const GHashKey *key = ptr; - unsigned int hash = BLI_ghashutil_strhash(key->msgctxt); + uint hash = BLI_ghashutil_strhash(key->msgctxt); return hash ^ BLI_ghashutil_strhash(key->msgid); } diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 28afab1a6eb..1e1a070208c 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -1040,12 +1040,12 @@ bool BPY_string_is_keyword(const char *str) /* EVIL, define text.c functions here... */ /* BKE_text.h */ -int text_check_identifier_unicode(const unsigned int ch) +int text_check_identifier_unicode(const uint ch) { return (ch < 255 && text_check_identifier((char)ch)) || Py_UNICODE_ISALNUM(ch); } -int text_check_identifier_nodigit_unicode(const unsigned int ch) +int text_check_identifier_nodigit_unicode(const uint ch) { return (ch < 255 && text_check_identifier_nodigit((char)ch)) || Py_UNICODE_ISALPHA(ch); } diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c index 141f03c22aa..1f3148ca809 100644 --- a/source/blender/python/intern/bpy_intern_string.c +++ b/source/blender/python/intern/bpy_intern_string.c @@ -49,7 +49,7 @@ PyObject *bpy_intern_str_unregister; void bpy_intern_string_init(void) { - unsigned int i = 0; + uint i = 0; #define BPY_INTERN_STR(var, str) \ { \ @@ -81,7 +81,7 @@ void bpy_intern_string_init(void) void bpy_intern_string_exit(void) { - unsigned int i = ARRAY_SIZE(bpy_intern_str_arr); + uint i = ARRAY_SIZE(bpy_intern_str_arr); while (i--) { Py_DECREF(bpy_intern_str_arr[i]); } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 6c2896db703..ff81b4a15ff 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -130,8 +130,8 @@ struct gc_generation { static void id_release_gc(struct ID *id) { - unsigned int j; - // unsigned int i = 0; + uint j; + // uint i = 0; for (j = 0; j < 3; j++) { /* Hack below to get the 2 other lists from _PyGC_generation0 that are normally not exposed. */ PyGC_Head *gen = (PyGC_Head *)(((char *)_PyGC_generation0) + (sizeof(gc_generation) * j)); @@ -382,7 +382,7 @@ static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **r_prop_eul_order); /* bpyrna vector/euler/quat callbacks. */ -static unsigned char mathutils_rna_array_cb_index = -1; /* Index for our callbacks. */ +static uchar mathutils_rna_array_cb_index = -1; /* Index for our callbacks. */ /* Subtype not used much yet. */ # define MATHUTILS_CB_SUBTYPE_EUL 0 @@ -532,7 +532,7 @@ static Mathutils_Callback mathutils_rna_array_cb = { }; /* bpyrna matrix callbacks */ -static unsigned char mathutils_rna_matrix_cb_index = -1; /* Index for our callbacks. */ +static uchar mathutils_rna_matrix_cb_index = -1; /* Index for our callbacks. */ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype)) { @@ -1302,7 +1302,7 @@ BLI_bitmap *pyrna_set_to_enum_bitmap(const EnumPropertyItem *items, if (type_size == 2) { union { signed short as_signed; - unsigned short as_unsigned; + ushort as_unsigned; } ret_convert; ret_convert.as_signed = (signed short)ret; index = (int)ret_convert.as_unsigned; @@ -1310,7 +1310,7 @@ BLI_bitmap *pyrna_set_to_enum_bitmap(const EnumPropertyItem *items, else if (type_size == 1) { union { signed char as_signed; - unsigned char as_unsigned; + uchar as_unsigned; } ret_convert; ret_convert.as_signed = (signed char)ret; index = (int)ret_convert.as_unsigned; diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index cf6bd54d8a5..5899c1659b5 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -202,12 +202,12 @@ int pyrna_pydict_to_props(PointerRNA *ptr, const char *error_prefix); PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop); -unsigned int *pyrna_set_to_enum_bitmap(const struct EnumPropertyItem *items, - PyObject *value, - int type_size, - bool type_convert_sign, - int bitmap_size, - const char *error_prefix); +uint *pyrna_set_to_enum_bitmap(const struct EnumPropertyItem *items, + PyObject *value, + int type_size, + bool type_convert_sign, + int bitmap_size, + const char *error_prefix); PyObject *pyrna_enum_bitfield_to_py(const struct EnumPropertyItem *items, int value); int pyrna_set_to_enum_bitfield(const struct EnumPropertyItem *items, PyObject *value, diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index a8312d89ef8..29e3a07625a 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -433,7 +433,7 @@ static char *copy_value_single(PyObject *item, PointerRNA *ptr, PropertyRNA *prop, char *data, - unsigned int item_size, + uint item_size, int *index, const ItemConvert_FuncArg *convert_item, RNA_SetIndexFunc rna_set_index) @@ -462,7 +462,7 @@ static char *copy_values(PyObject *seq, PropertyRNA *prop, int dim, char *data, - unsigned int item_size, + uint item_size, int *index, const ItemConvert_FuncArg *convert_item, RNA_SetIndexFunc rna_set_index) diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c index ca5cb287401..2ff1dae6ca4 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.c +++ b/source/blender/python/intern/bpy_rna_id_collection.c @@ -70,7 +70,7 @@ typedef struct IDUserMapData { static int id_code_as_index(const short idcode) { - return (int)*((unsigned short *)&idcode); + return (int)*((ushort *)&idcode); } static bool id_check_type(const ID *id, const BLI_bitmap *types_bitmap) diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index 2b1ddbbb03a..5764db4e70c 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -125,7 +125,7 @@ Py_hash_t mathutils_array_hash(const float *array, size_t array_len) int mathutils_array_parse( float *array, int array_min, int array_max, PyObject *value, const char *error_prefix) { - const unsigned int flag = array_max; + const uint flag = array_max; int size; array_max &= ~MU_ARRAY_FLAGS; @@ -540,7 +540,7 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error * [3] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ * instead. */ -#define SIGNMASK(i) (-(int)(((unsigned int)(i)) >> 31)) +#define SIGNMASK(i) (-(int)(((uint)(i)) >> 31)) int EXPP_FloatsAreEqual(float af, float bf, int maxDiff) { @@ -593,9 +593,9 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds) #define MATHUTILS_TOT_CB 17 static Mathutils_Callback *mathutils_callbacks[MATHUTILS_TOT_CB] = {NULL}; -unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb) +uchar Mathutils_RegisterCallback(Mathutils_Callback *cb) { - unsigned char i; + uchar i; /* find the first free slot */ for (i = 0; mathutils_callbacks[i]; i++) { diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index 739ffb87dbb..59bddf01cae 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -1004,9 +1004,7 @@ PyObject *Color_CreatePyObject_wrap(float col[3], PyTypeObject *base_type) return (PyObject *)self; } -PyObject *Color_CreatePyObject_cb(PyObject *cb_user, - unsigned char cb_type, - unsigned char cb_subtype) +PyObject *Color_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype) { ColorObject *self = (ColorObject *)Color_CreatePyObject(NULL, NULL); if (self) { diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index 65ca932d118..4375ba31439 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -848,8 +848,8 @@ PyObject *Euler_CreatePyObject_wrap(float eul[3], const short order, PyTypeObjec PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, const short order, - unsigned char cb_type, - unsigned char cb_subtype) + uchar cb_type, + uchar cb_subtype) { EulerObject *self = (EulerObject *)Euler_CreatePyObject(NULL, order, NULL); if (self) { diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 34412ce041b..352d8326901 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -75,7 +75,7 @@ static int matrix_col_vector_check(MatrixObject *mat, VectorObject *vec, int col * matrix row callbacks * this is so you can do matrix[i][j] = val OR matrix.row[i][j] = val */ -unsigned char mathutils_matrix_row_cb_index = -1; +uchar mathutils_matrix_row_cb_index = -1; static int mathutils_matrix_row_check(BaseMathObject *bmo) { @@ -166,7 +166,7 @@ Mathutils_Callback mathutils_matrix_row_cb = { * matrix row callbacks * this is so you can do matrix.col[i][j] = val */ -unsigned char mathutils_matrix_col_cb_index = -1; +uchar mathutils_matrix_col_cb_index = -1; static int mathutils_matrix_col_check(BaseMathObject *bmo) { @@ -266,7 +266,7 @@ Mathutils_Callback mathutils_matrix_col_cb = { * this is so you can do matrix.translation = val * note, this is _exactly like matrix.col except the 4th component is always omitted */ -unsigned char mathutils_matrix_translation_cb_index = -1; +uchar mathutils_matrix_translation_cb_index = -1; static int mathutils_matrix_translation_check(BaseMathObject *bmo) { @@ -364,13 +364,13 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) /* Input is now as a sequence of rows so length of sequence * is the number of rows */ /* -1 is an error, size checks will account for this */ - const unsigned short num_row = PySequence_Size(arg); + const ushort num_row = PySequence_Size(arg); if (num_row >= 2 && num_row <= 4) { PyObject *item = PySequence_GetItem(arg, 0); /* Since each item is a row, number of items is the * same as the number of columns */ - const unsigned short num_col = PySequence_Size(item); + const ushort num_col = PySequence_Size(item); Py_XDECREF(item); if (num_col >= 2 && num_col <= 4) { @@ -1002,8 +1002,8 @@ static void matrix_unit_internal(MatrixObject *self) /* transposes memory layout, rol/col's don't have to match */ static void matrix_transpose_internal(float mat_dst_fl[], const MatrixObject *mat_src) { - unsigned short col, row; - unsigned int i = 0; + ushort col, row; + uint i = 0; for (row = 0; row < mat_src->num_row; row++) { for (col = 0; col < mat_src->num_col; col++) { @@ -1037,7 +1037,7 @@ static float matrix_determinant_internal(const MatrixObject *self) } } -static void adjoint_matrix_n(float *mat_dst, const float *mat_src, const unsigned short dim) +static void adjoint_matrix_n(float *mat_dst, const float *mat_src, const ushort dim) { /* calculate the classical adjoint */ switch (dim) { @@ -1061,10 +1061,10 @@ static void adjoint_matrix_n(float *mat_dst, const float *mat_src, const unsigne static void matrix_invert_with_det_n_internal(float *mat_dst, const float *mat_src, const float det, - const unsigned short dim) + const ushort dim) { float mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM]; - unsigned short i, j, k; + ushort i, j, k; BLI_assert(det != 0.0f); @@ -3204,8 +3204,8 @@ PyTypeObject matrix_Type = { }; PyObject *Matrix_CreatePyObject(const float *mat, - const unsigned short num_col, - const unsigned short num_row, + const ushort num_col, + const ushort num_row, PyTypeObject *base_type) { MatrixObject *self; @@ -3258,8 +3258,8 @@ PyObject *Matrix_CreatePyObject(const float *mat, } PyObject *Matrix_CreatePyObject_wrap(float *mat, - const unsigned short num_col, - const unsigned short num_row, + const ushort num_col, + const ushort num_row, PyTypeObject *base_type) { MatrixObject *self; @@ -3287,11 +3287,8 @@ PyObject *Matrix_CreatePyObject_wrap(float *mat, return (PyObject *)self; } -PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user, - const unsigned short num_col, - const unsigned short num_row, - unsigned char cb_type, - unsigned char cb_subtype) +PyObject *Matrix_CreatePyObject_cb( + PyObject *cb_user, const ushort num_col, const ushort num_row, uchar cb_type, uchar cb_subtype) { MatrixObject *self = (MatrixObject *)Matrix_CreatePyObject(NULL, num_col, num_row, NULL); if (self) { @@ -3308,8 +3305,8 @@ PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user, * \param mat: Initialized matrix value to use in-place, allocated with #PyMem_Malloc */ PyObject *Matrix_CreatePyObject_alloc(float *mat, - const unsigned short num_col, - const unsigned short num_row, + const ushort num_col, + const ushort num_row, PyTypeObject *base_type) { MatrixObject *self; diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h index abb023e576d..5eb5223edfe 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.h +++ b/source/blender/python/mathutils/mathutils_Matrix.h @@ -49,8 +49,8 @@ extern PyTypeObject matrix_access_Type; typedef struct { BASE_MATH_MEMBERS(matrix); - unsigned short num_col; - unsigned short num_row; + ushort num_col; + ushort num_row; } MatrixObject; /* struct data contains a pointer to the actual data that the @@ -60,12 +60,12 @@ typedef struct { /* prototypes */ PyObject *Matrix_CreatePyObject(const float *mat, - const unsigned short num_col, - const unsigned short num_row, + const ushort num_col, + const ushort num_row, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT; PyObject *Matrix_CreatePyObject_wrap(float *mat, - const unsigned short num_col, - const unsigned short num_row, + const ushort num_col, + const ushort num_row, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); PyObject *Matrix_CreatePyObject_cb(PyObject *user, @@ -75,8 +75,8 @@ PyObject *Matrix_CreatePyObject_cb(PyObject *user, unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT; PyObject *Matrix_CreatePyObject_alloc(float *mat, - const unsigned short num_col, - const unsigned short num_row, + const ushort num_col, + const ushort num_row, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT; /* PyArg_ParseTuple's "O&" formatting helpers. */ diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index ac7dd8590f2..6a2a1161ca9 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -1655,9 +1655,7 @@ PyObject *Quaternion_CreatePyObject_wrap(float quat[4], PyTypeObject *base_type) return (PyObject *)self; } -PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, - unsigned char cb_type, - unsigned char cb_subtype) +PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype) { QuaternionObject *self = (QuaternionObject *)Quaternion_CreatePyObject(NULL, NULL); if (self) { diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index b9befee9f22..6ea0dd52ed7 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -2419,7 +2419,7 @@ static PyObject *Vector_swizzle_get(VectorObject *self, void *closure) size_t axis_to; size_t axis_from; float vec[MAX_DIMENSIONS]; - unsigned int swizzleClosure; + uint swizzleClosure; if (BaseMath_ReadCallback(self) == -1) { return NULL; @@ -2464,7 +2464,7 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure size_t axis_from; size_t axis_to; - unsigned int swizzleClosure; + uint swizzleClosure; float tvec[MAX_DIMENSIONS]; float vec_assign[MAX_DIMENSIONS]; @@ -3218,10 +3218,7 @@ PyObject *Vector_CreatePyObject_wrap(float *vec, const int size, PyTypeObject *b * Create a vector where the value is defined by registered callbacks, * see: #Mathutils_RegisterCallback */ -PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, - int size, - unsigned char cb_type, - unsigned char cb_subtype) +PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, int size, uchar cb_type, uchar cb_subtype) { VectorObject *self = (VectorObject *)Vector_CreatePyObject(NULL, size, NULL); if (self) { diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c index 8af6e9a527e..ecc128bf008 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.c +++ b/source/blender/python/mathutils/mathutils_bvhtree.c @@ -97,8 +97,8 @@ typedef struct { float epsilon; float (*coords)[3]; - unsigned int (*tris)[3]; - unsigned int coords_len, tris_len; + uint (*tris)[3]; + uint coords_len, tris_len; /* Optional members */ /* aligned with 'tris' */ @@ -115,9 +115,9 @@ static PyObject *bvhtree_CreatePyObject(BVHTree *tree, float epsilon, float (*coords)[3], - unsigned int coords_len, - unsigned int (*tris)[3], - unsigned int tris_len, + uint coords_len, + uint (*tris)[3], + uint tris_len, /* optional arrays */ int *orig_index, @@ -276,7 +276,7 @@ static void py_bvhtree_raycast_cb(void *userdata, const PyBVHTree *self = userdata; const float(*coords)[3] = (const float(*)[3])self->coords; - const unsigned int *tri = self->tris[index]; + const uint *tri = self->tris[index]; const float *tri_co[3] = {coords[tri[0]], coords[tri[1]], coords[tri[2]]}; float dist; @@ -308,7 +308,7 @@ static void py_bvhtree_nearest_point_cb(void *userdata, PyBVHTree *self = userdata; const float(*coords)[3] = (const float(*)[3])self->coords; - const unsigned int *tri = self->tris[index]; + const uint *tri = self->tris[index]; const float *tri_co[3] = {coords[tri[0]], coords[tri[1]], coords[tri[2]]}; float nearest_tmp[3], dist_sq; @@ -435,7 +435,7 @@ static void py_bvhtree_nearest_point_range_cb(void *userdata, PyBVHTree *self = data->self; const float(*coords)[3] = (const float(*)[3])self->coords; - const unsigned int *tri = self->tris[index]; + const uint *tri = self->tris[index]; const float *tri_co[3] = {coords[tri[0]], coords[tri[1]], coords[tri[2]]}; float nearest_tmp[3], dist_sq; @@ -502,11 +502,11 @@ static PyObject *py_bvhtree_find_nearest_range(PyBVHTree *self, PyObject *args) return ret; } -BLI_INLINE unsigned int overlap_hash(const void *overlap_v) +BLI_INLINE uint overlap_hash(const void *overlap_v) { const BVHTreeOverlap *overlap = overlap_v; /* same constants as edge-hash */ - return (((unsigned int)overlap->indexA * 65) ^ ((unsigned int)overlap->indexA * 31)); + return (((uint)overlap->indexA * 65) ^ ((uint)overlap->indexA * 31)); } BLI_INLINE bool overlap_cmp(const void *a_v, const void *b_v) @@ -526,8 +526,8 @@ static bool py_bvhtree_overlap_cb(void *userdata, int index_a, int index_b, int struct PyBVHTree_OverlapData *data = userdata; PyBVHTree *tree_a = data->tree_pair[0]; PyBVHTree *tree_b = data->tree_pair[1]; - const unsigned int *tri_a = tree_a->tris[index_a]; - const unsigned int *tri_b = tree_b->tris[index_b]; + const uint *tri_a = tree_a->tris[index_a]; + const uint *tri_b = tree_b->tris[index_b]; const float *tri_a_co[3] = { tree_a->coords[tri_a[0]], tree_a->coords[tri_a[1]], tree_a->coords[tri_a[2]]}; const float *tri_b_co[3] = { @@ -569,7 +569,7 @@ static PyObject *py_bvhtree_overlap(PyBVHTree *self, PyBVHTree *other) { struct PyBVHTree_OverlapData data; BVHTreeOverlap *overlap; - unsigned int overlap_len = 0; + uint overlap_len = 0; PyObject *ret; if (!PyBVHTree_CheckExact(other)) { @@ -595,7 +595,7 @@ static PyObject *py_bvhtree_overlap(PyBVHTree *self, PyBVHTree *other) BLI_gset_new_ex(overlap_hash, overlap_cmp, __func__, overlap_len) : NULL; /* simple case, no index remapping */ - unsigned int i; + uint i; for (i = 0; i < overlap_len; i++) { PyObject *item; @@ -664,8 +664,8 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P MemArena *pf_arena = NULL; float(*coords)[3] = NULL; - unsigned int(*tris)[3] = NULL; - unsigned int coords_len, tris_len; + uint(*tris)[3] = NULL; + uint coords_len, tris_len; float epsilon = 0.0f; bool all_triangles = false; @@ -673,7 +673,7 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P int *orig_index = NULL; float(*orig_normal)[3] = NULL; - unsigned int i; + uint i; bool valid = true; if (!PyArg_ParseTupleAndKeywords(args, @@ -696,7 +696,7 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P if (valid) { PyObject **py_coords_fast_items = PySequence_Fast_ITEMS(py_coords_fast); - coords_len = (unsigned int)PySequence_Fast_GET_SIZE(py_coords_fast); + coords_len = (uint)PySequence_Fast_GET_SIZE(py_coords_fast); coords = MEM_mallocN((size_t)coords_len * sizeof(*coords), __func__); for (i = 0; i < coords_len; i++) { @@ -715,14 +715,14 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P else if (all_triangles) { /* all triangles, simple case */ PyObject **py_tris_fast_items = PySequence_Fast_ITEMS(py_tris_fast); - tris_len = (unsigned int)PySequence_Fast_GET_SIZE(py_tris_fast); + tris_len = (uint)PySequence_Fast_GET_SIZE(py_tris_fast); tris = MEM_mallocN((size_t)tris_len * sizeof(*tris), __func__); for (i = 0; i < tris_len; i++) { PyObject *py_tricoords = py_tris_fast_items[i]; PyObject *py_tricoords_fast; PyObject **py_tricoords_fast_items; - unsigned int *tri = tris[i]; + uint *tri = tris[i]; int j; if (!(py_tricoords_fast = PySequence_Fast(py_tricoords, error_prefix))) { @@ -745,7 +745,7 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P for (j = 0; j < 3; j++) { tri[j] = PyC_Long_AsU32(py_tricoords_fast_items[j]); - if (UNLIKELY(tri[j] >= (unsigned int)coords_len)) { + if (UNLIKELY(tri[j] >= (uint)coords_len)) { PyErr_Format(PyExc_ValueError, "%s: index %d must be less than %d", error_prefix, @@ -763,11 +763,11 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P } else { /* ngon support (much more involved) */ - const unsigned int polys_len = (unsigned int)PySequence_Fast_GET_SIZE(py_tris_fast); + const uint polys_len = (uint)PySequence_Fast_GET_SIZE(py_tris_fast); struct PolyLink { struct PolyLink *next; - unsigned int len; - unsigned int poly[0]; + uint len; + uint poly[0]; } *plink_first = NULL, **p_plink_prev = &plink_first, *plink = NULL; int poly_index; @@ -779,27 +779,27 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P PyObject *py_tricoords = PySequence_Fast_GET_ITEM(py_tris_fast, i); PyObject *py_tricoords_fast; PyObject **py_tricoords_fast_items; - unsigned int py_tricoords_len; - unsigned int j; + uint py_tricoords_len; + uint j; if (!(py_tricoords_fast = PySequence_Fast(py_tricoords, error_prefix))) { valid = false; break; } - py_tricoords_len = (unsigned int)PySequence_Fast_GET_SIZE(py_tricoords_fast); + py_tricoords_len = (uint)PySequence_Fast_GET_SIZE(py_tricoords_fast); py_tricoords_fast_items = PySequence_Fast_ITEMS(py_tricoords_fast); plink = BLI_memarena_alloc(poly_arena, sizeof(*plink) + (sizeof(int) * (size_t)py_tricoords_len)); - plink->len = (unsigned int)py_tricoords_len; + plink->len = (uint)py_tricoords_len; *p_plink_prev = plink; p_plink_prev = &plink->next; for (j = 0; j < py_tricoords_len; j++) { plink->poly[j] = PyC_Long_AsU32(py_tricoords_fast_items[j]); - if (UNLIKELY(plink->poly[j] >= (unsigned int)coords_len)) { + if (UNLIKELY(plink->poly[j] >= (uint)coords_len)) { PyErr_Format(PyExc_ValueError, "%s: index %d must be less than %d", error_prefix, @@ -829,8 +829,8 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P for (plink = plink_first, poly_index = 0, i = 0; plink; plink = plink->next, poly_index++) { if (plink->len == 3) { - unsigned int *tri = tris[i]; - memcpy(tri, plink->poly, sizeof(unsigned int[3])); + uint *tri = tris[i]; + memcpy(tri, plink->poly, sizeof(uint[3])); orig_index[i] = poly_index; normal_tri_v3(orig_normal[poly_index], coords[tri[0]], coords[tri[1]], coords[tri[2]]); i++; @@ -841,8 +841,8 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P const float *co_prev; const float *co_curr; float axis_mat[3][3]; - unsigned int(*tris_offset)[3] = &tris[i]; - unsigned int j; + uint(*tris_offset)[3] = &tris[i]; + uint j; /* calc normal and setup 'proj_coords' */ zero_v3(normal); @@ -864,7 +864,7 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P j = plink->len - 2; while (j--) { - unsigned int *tri = tris_offset[j]; + uint *tri = tris_offset[j]; /* remap to global indices */ tri[0] = plink->poly[tri[0]]; tri[1] = plink->poly[tri[1]]; @@ -942,8 +942,8 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb BPy_BMesh *py_bm; float(*coords)[3] = NULL; - unsigned int(*tris)[3] = NULL; - unsigned int coords_len, tris_len; + uint(*tris)[3] = NULL; + uint coords_len, tris_len; float epsilon = 0.0f; BMesh *bm; @@ -965,8 +965,8 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb { int tris_len_dummy; - coords_len = (unsigned int)bm->totvert; - tris_len = (unsigned int)poly_to_tri_count(bm->totface, bm->totloop); + coords_len = (uint)bm->totvert; + tris_len = (uint)poly_to_tri_count(bm->totface, bm->totloop); coords = MEM_mallocN(sizeof(*coords) * (size_t)coords_len, __func__); tris = MEM_mallocN(sizeof(*tris) * (size_t)tris_len, __func__); @@ -980,7 +980,7 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb { BMIter iter; BVHTree *tree; - unsigned int i; + uint i; int *orig_index = NULL; float(*orig_normal)[3] = NULL; @@ -1006,9 +1006,9 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb for (i = 0; i < tris_len; i++) { float co[3][3]; - tris[i][0] = (unsigned int)BM_elem_index_get(looptris[i][0]->v); - tris[i][1] = (unsigned int)BM_elem_index_get(looptris[i][1]->v); - tris[i][2] = (unsigned int)BM_elem_index_get(looptris[i][2]->v); + tris[i][0] = (uint)BM_elem_index_get(looptris[i][0]->v); + tris[i][1] = (uint)BM_elem_index_get(looptris[i][1]->v); + tris[i][2] = (uint)BM_elem_index_get(looptris[i][2]->v); copy_v3_v3(co[0], coords[tris[i][0]]); copy_v3_v3(co[1], coords[tris[i][1]]); @@ -1136,8 +1136,8 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO const MLoop *mloop; float(*coords)[3] = NULL; - unsigned int(*tris)[3] = NULL; - unsigned int coords_len, tris_len; + uint(*tris)[3] = NULL; + uint coords_len, tris_len; float epsilon = 0.0f; if (!PyArg_ParseTupleAndKeywords(args, @@ -1167,8 +1167,8 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO { lt = BKE_mesh_runtime_looptri_ensure(mesh); - tris_len = (unsigned int)BKE_mesh_runtime_looptri_len(mesh); - coords_len = (unsigned int)mesh->totvert; + tris_len = (uint)BKE_mesh_runtime_looptri_len(mesh); + coords_len = (uint)mesh->totvert; coords = MEM_mallocN(sizeof(*coords) * (size_t)coords_len, __func__); tris = MEM_mallocN(sizeof(*tris) * (size_t)tris_len, __func__); @@ -1183,7 +1183,7 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO { BVHTree *tree; - unsigned int i; + uint i; int *orig_index = NULL; float(*orig_normal)[3] = NULL; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 859ece61ace..56bb60bf921 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1084,7 +1084,7 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a { PyObject *py_planes; float(*planes)[4]; - unsigned int planes_len; + uint planes_len; if (!PyArg_ParseTuple(args, "O:points_in_planes", &py_planes)) { return NULL; @@ -1097,8 +1097,8 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a else { /* note, this could be refactored into plain C easy - py bits are noted */ const float eps = 0.0001f; - const unsigned int len = (unsigned int)planes_len; - unsigned int i, j, k, l; + const uint len = (uint)planes_len; + uint i, j, k, l; float n1n2[3], n2n3[3], n3n1[3]; float potentialVertex[3]; diff --git a/source/blender/python/mathutils/mathutils_kdtree.c b/source/blender/python/mathutils/mathutils_kdtree.c index c6383f23d60..ec35d25bdd5 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.c +++ b/source/blender/python/mathutils/mathutils_kdtree.c @@ -38,9 +38,9 @@ typedef struct { PyObject_HEAD KDTree_3d *obj; - unsigned int maxsize; - unsigned int count; - unsigned int count_balance; /* size when we last balanced */ + uint maxsize; + uint count; + uint count_balance; /* size when we last balanced */ } PyKDTree; /* -------------------------------------------------------------------- */ @@ -92,7 +92,7 @@ static PyObject *kdtree_nearest_to_py_and_check(const KDTreeNearest_3d *nearest) static int PyKDTree__tp_init(PyKDTree *self, PyObject *args, PyObject *kwargs) { - unsigned int maxsize; + uint maxsize; const char *keywords[] = {"size", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "I:KDTree", (char **)keywords, &maxsize)) { @@ -273,7 +273,7 @@ static PyObject *py_kdtree_find_n(PyKDTree *self, PyObject *args, PyObject *kwar PyObject *py_co; float co[3]; KDTreeNearest_3d *nearest; - unsigned int n; + uint n; int i, found; const char *keywords[] = {"co", "n", NULL}; diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c index 1b438072329..8ec0c9ce44a 100644 --- a/source/blender/python/mathutils/mathutils_noise.c +++ b/source/blender/python/mathutils/mathutils_noise.c @@ -93,14 +93,14 @@ #define MIXBITS(u, v) (((u)&UMASK) | ((v)&LMASK)) #define TWIST(u, v) ((MIXBITS(u, v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL)) -static unsigned long state[N]; /* the array for the state vector */ +static ulong state[N]; /* the array for the state vector */ static int left = 1; static int initf = 0; -static unsigned long *next; +static ulong *next; static float state_offset_vector[3 * 3]; /* initializes state[N] with a seed */ -static void init_genrand(unsigned long s) +static void init_genrand(ulong s) { int j; state[0] = s & 0xffffffffUL; @@ -117,7 +117,7 @@ static void init_genrand(unsigned long s) /* update vector offset */ { - const unsigned long *state_offset = &state[N - ARRAY_SIZE(state_offset_vector)]; + const ulong *state_offset = &state[N - ARRAY_SIZE(state_offset_vector)]; const float range = 32; /* range in both pos/neg direction */ for (j = 0; j < ARRAY_SIZE(state_offset_vector); j++, state_offset++) { /* overflow is fine here */ @@ -128,7 +128,7 @@ static void init_genrand(unsigned long s) static void next_state(void) { - unsigned long *p = state; + ulong *p = state; int j; /* if init_genrand() has not been called, */ @@ -166,7 +166,7 @@ static void setRndSeed(int seed) /* float number in range [0, 1) using the mersenne twister rng */ static float frand(void) { - unsigned long y; + ulong y; if (--left == 0) { next_state(); -- cgit v1.2.3