Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-02-20 07:38:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-02-20 07:40:05 +0300
commit2a6df7dfe5ae9c25780166771c56ff921cc90f63 (patch)
treead638ee71b52f5915b937bf538051f49b0ac120b /source/blender/python/mathutils
parent1e3ffd1f872b1a52a5c392b135c29ae71744137d (diff)
Cleanup: use named unsigned types in the Python API
Diffstat (limited to 'source/blender/python/mathutils')
-rw-r--r--source/blender/python/mathutils/mathutils.c8
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c39
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.h16
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c9
-rw-r--r--source/blender/python/mathutils/mathutils_bvhtree.c94
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c6
-rw-r--r--source/blender/python/mathutils/mathutils_kdtree.c10
-rw-r--r--source/blender/python/mathutils/mathutils_noise.c12
11 files changed, 98 insertions, 108 deletions
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();