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 <campbell@blender.org>2022-09-25 10:04:52 +0300
committerCampbell Barton <campbell@blender.org>2022-09-25 11:26:27 +0300
commit891949cbb47143420f4324cb60efc05ef5d70b39 (patch)
treefe70a45612ae96f9ce1f37378ef5ff035d3127f5 /source/blender/blenlib
parentc9e35c2ced92082c86f1ecb9ecd16c6230218c7c (diff)
Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by 'unsigned char(x)'.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/BLI_args.c2
-rw-r--r--source/blender/blenlib/intern/BLI_filelist.c2
-rw-r--r--source/blender/blenlib/intern/BLI_ghash_utils.c6
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c2
-rw-r--r--source/blender/blenlib/intern/BLI_memarena.c6
-rw-r--r--source/blender/blenlib/intern/array_store_utils.c4
-rw-r--r--source/blender/blenlib/intern/endian_switch.c4
-rw-r--r--source/blender/blenlib/intern/hash_mm2a.c8
-rw-r--r--source/blender/blenlib/intern/jitter_2d.c8
-rw-r--r--source/blender/blenlib/intern/lasso_2d.c10
-rw-r--r--source/blender/blenlib/intern/math_color.c54
-rw-r--r--source/blender/blenlib/intern/math_geom.c28
-rw-r--r--source/blender/blenlib/intern/math_interp.c86
-rw-r--r--source/blender/blenlib/intern/math_rotation.c2
-rw-r--r--source/blender/blenlib/intern/mesh_intersect.cc6
-rw-r--r--source/blender/blenlib/intern/noise.c4
-rw-r--r--source/blender/blenlib/intern/path_util.c2
-rw-r--r--source/blender/blenlib/intern/rand.cc61
-rw-r--r--source/blender/blenlib/intern/scanfill.c19
-rw-r--r--source/blender/blenlib/intern/scanfill_utils.c8
-rw-r--r--source/blender/blenlib/intern/stack.c2
-rw-r--r--source/blender/blenlib/intern/string_utf8.c6
-rw-r--r--source/blender/blenlib/intern/threads.cc8
-rw-r--r--source/blender/blenlib/tests/BLI_array_store_test.cc23
-rw-r--r--source/blender/blenlib/tests/BLI_ghash_test.cc14
-rw-r--r--source/blender/blenlib/tests/BLI_hash_mm2a_test.cc12
-rw-r--r--source/blender/blenlib/tests/BLI_polyfill_2d_test.cc114
-rw-r--r--source/blender/blenlib/tests/BLI_stack_cxx_test.cc8
-rw-r--r--source/blender/blenlib/tests/BLI_stack_test.cc2
-rw-r--r--source/blender/blenlib/tests/BLI_string_test.cc6
-rw-r--r--source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc40
31 files changed, 268 insertions, 289 deletions
diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c
index 61447ab1a9e..3c745716ec8 100644
--- a/source/blender/blenlib/intern/BLI_args.c
+++ b/source/blender/blenlib/intern/BLI_args.c
@@ -57,7 +57,7 @@ static uint case_strhash(const void *ptr)
{
const char *s = ptr;
uint i = 0;
- unsigned char c;
+ uchar c;
while ((c = tolower(*s++))) {
i = i * 37 + c;
diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c
index c6178ebb3a0..526c14d5e33 100644
--- a/source/blender/blenlib/intern/BLI_filelist.c
+++ b/source/blender/blenlib/intern/BLI_filelist.c
@@ -215,7 +215,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
}
}
-unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist)
+uint BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist)
{
struct BuildDirCtx dir_ctx;
diff --git a/source/blender/blenlib/intern/BLI_ghash_utils.c b/source/blender/blenlib/intern/BLI_ghash_utils.c
index e12e272832f..806d58df260 100644
--- a/source/blender/blenlib/intern/BLI_ghash_utils.c
+++ b/source/blender/blenlib/intern/BLI_ghash_utils.c
@@ -63,7 +63,7 @@ uint BLI_ghashutil_uinthash_v4(const uint key[4])
uint BLI_ghashutil_uinthash_v4_murmur(const uint key[4])
{
- return BLI_hash_mm2((const unsigned char *)key, sizeof(int[4]) /* sizeof(key) */, 0);
+ return BLI_hash_mm2((const uchar *)key, sizeof(int[4]) /* sizeof(key) */, 0);
}
bool BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b)
@@ -101,7 +101,7 @@ uint BLI_ghashutil_inthash_p_murmur(const void *ptr)
{
uintptr_t key = (uintptr_t)ptr;
- return BLI_hash_mm2((const unsigned char *)&key, sizeof(key), 0);
+ return BLI_hash_mm2((const uchar *)&key, sizeof(key), 0);
}
uint BLI_ghashutil_inthash_p_simple(const void *ptr)
@@ -143,7 +143,7 @@ uint BLI_ghashutil_strhash_p(const void *ptr)
}
uint BLI_ghashutil_strhash_p_murmur(const void *ptr)
{
- const unsigned char *key = ptr;
+ const uchar *key = ptr;
return BLI_hash_mm2(key, strlen((const char *)key) + 1, 0);
}
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 71c48ed994b..de71147f015 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -58,7 +58,7 @@
/** \name Struct Definitions
* \{ */
-typedef unsigned char axis_t;
+typedef uchar axis_t;
typedef struct BVHNode {
struct BVHNode **children;
diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c
index 71a5dd0e044..f423eff60cb 100644
--- a/source/blender/blenlib/intern/BLI_memarena.c
+++ b/source/blender/blenlib/intern/BLI_memarena.c
@@ -38,7 +38,7 @@ struct MemBuf {
};
struct MemArena {
- unsigned char *curbuf;
+ uchar *curbuf;
const char *name;
struct MemBuf *bufs;
@@ -106,9 +106,9 @@ void BLI_memarena_free(MemArena *ma)
/** Align alloc'ed memory (needed if `align > 8`). */
static void memarena_curbuf_align(MemArena *ma)
{
- unsigned char *tmp;
+ uchar *tmp;
- tmp = (unsigned char *)PADUP((intptr_t)ma->curbuf, (int)ma->align);
+ tmp = (uchar *)PADUP((intptr_t)ma->curbuf, (int)ma->align);
ma->cursize -= (size_t)(tmp - ma->curbuf);
ma->curbuf = tmp;
}
diff --git a/source/blender/blenlib/intern/array_store_utils.c b/source/blender/blenlib/intern/array_store_utils.c
index 9ac8630204a..51b5ce0519f 100644
--- a/source/blender/blenlib/intern/array_store_utils.c
+++ b/source/blender/blenlib/intern/array_store_utils.c
@@ -27,9 +27,9 @@ BArrayStore *BLI_array_store_at_size_ensure(struct BArrayStore_AtSize *bs_stride
if ((*bs_p) == NULL) {
/* calculate best chunk-count to fit a power of two */
- unsigned int chunk_count = chunk_size;
+ uint chunk_count = chunk_size;
{
- unsigned int size = chunk_count * stride;
+ uint size = chunk_count * stride;
size = power_of_2_max_u(size);
size = MEM_SIZE_OPTIMAL(size);
chunk_count = size / stride;
diff --git a/source/blender/blenlib/intern/endian_switch.c b/source/blender/blenlib/intern/endian_switch.c
index 10d0bfb815b..c1a5b69fb23 100644
--- a/source/blender/blenlib/intern/endian_switch.c
+++ b/source/blender/blenlib/intern/endian_switch.c
@@ -18,7 +18,7 @@ void BLI_endian_switch_int16_array(short *val, const int size)
}
}
-void BLI_endian_switch_uint16_array(unsigned short *val, const int size)
+void BLI_endian_switch_uint16_array(ushort *val, const int size)
{
if (size > 0) {
int i = size;
@@ -38,7 +38,7 @@ void BLI_endian_switch_int32_array(int *val, const int size)
}
}
-void BLI_endian_switch_uint32_array(unsigned int *val, const int size)
+void BLI_endian_switch_uint32_array(uint *val, const int size)
{
if (size > 0) {
int i = size;
diff --git a/source/blender/blenlib/intern/hash_mm2a.c b/source/blender/blenlib/intern/hash_mm2a.c
index 8411b49ef38..d13c20e4edb 100644
--- a/source/blender/blenlib/intern/hash_mm2a.c
+++ b/source/blender/blenlib/intern/hash_mm2a.c
@@ -41,7 +41,7 @@
} \
(void)0
-static void mm2a_mix_tail(BLI_HashMurmur2A *mm2, const unsigned char **data, size_t *len)
+static void mm2a_mix_tail(BLI_HashMurmur2A *mm2, const uchar **data, size_t *len)
{
while (*len && ((*len < 4) || mm2->count)) {
mm2->tail |= (uint32_t)(**data) << (mm2->count * 8);
@@ -66,7 +66,7 @@ void BLI_hash_mm2a_init(BLI_HashMurmur2A *mm2, uint32_t seed)
mm2->size = 0;
}
-void BLI_hash_mm2a_add(BLI_HashMurmur2A *mm2, const unsigned char *data, size_t len)
+void BLI_hash_mm2a_add(BLI_HashMurmur2A *mm2, const uchar *data, size_t len)
{
mm2->size += (uint32_t)len;
@@ -83,7 +83,7 @@ void BLI_hash_mm2a_add(BLI_HashMurmur2A *mm2, const unsigned char *data, size_t
void BLI_hash_mm2a_add_int(BLI_HashMurmur2A *mm2, int data)
{
- BLI_hash_mm2a_add(mm2, (const unsigned char *)&data, sizeof(data));
+ BLI_hash_mm2a_add(mm2, (const uchar *)&data, sizeof(data));
}
uint32_t BLI_hash_mm2a_end(BLI_HashMurmur2A *mm2)
@@ -96,7 +96,7 @@ uint32_t BLI_hash_mm2a_end(BLI_HashMurmur2A *mm2)
return mm2->hash;
}
-uint32_t BLI_hash_mm2(const unsigned char *data, size_t len, uint32_t seed)
+uint32_t BLI_hash_mm2(const uchar *data, size_t len, uint32_t seed)
{
/* Initialize the hash to a 'random' value */
uint32_t h = seed ^ len;
diff --git a/source/blender/blenlib/intern/jitter_2d.c b/source/blender/blenlib/intern/jitter_2d.c
index 8fa0f2c1e15..4b86f3cfeef 100644
--- a/source/blender/blenlib/intern/jitter_2d.c
+++ b/source/blender/blenlib/intern/jitter_2d.c
@@ -70,7 +70,7 @@ void BLI_jitterate1(float (*jit1)[2], float (*jit2)[2], int num, float radius1)
jit2[i][0] = x;
jit2[i][1] = y;
}
- memcpy(jit1, jit2, 2 * (unsigned int)num * sizeof(float));
+ memcpy(jit1, jit2, 2 * (uint)num * sizeof(float));
}
void BLI_jitterate2(float (*jit1)[2], float (*jit2)[2], int num, float radius2)
@@ -120,7 +120,7 @@ void BLI_jitterate2(float (*jit1)[2], float (*jit2)[2], int num, float radius2)
jit2[i][0] = x;
jit2[i][1] = y;
}
- memcpy(jit1, jit2, (unsigned int)num * sizeof(float[2]));
+ memcpy(jit1, jit2, (uint)num * sizeof(float[2]));
}
void BLI_jitter_init(float (*jitarr)[2], int num)
@@ -138,12 +138,12 @@ void BLI_jitter_init(float (*jitarr)[2], int num)
number_fl = (float)num;
number_fl_sqrt = sqrtf(number_fl);
- jit2 = MEM_mallocN(12 + (unsigned int)num * sizeof(float[2]), "initjit");
+ jit2 = MEM_mallocN(12 + (uint)num * sizeof(float[2]), "initjit");
rad1 = 1.0f / number_fl_sqrt;
rad2 = 1.0f / number_fl;
rad3 = number_fl_sqrt / number_fl;
- rng = BLI_rng_new(31415926 + (unsigned int)num);
+ rng = BLI_rng_new(31415926 + (uint)num);
x = 0;
for (i = 0; i < num; i++) {
diff --git a/source/blender/blenlib/intern/lasso_2d.c b/source/blender/blenlib/intern/lasso_2d.c
index 13b0e416b76..4752864ea3a 100644
--- a/source/blender/blenlib/intern/lasso_2d.c
+++ b/source/blender/blenlib/intern/lasso_2d.c
@@ -12,9 +12,9 @@
#include "BLI_lasso_2d.h" /* own include */
-void BLI_lasso_boundbox(rcti *rect, const int mcoords[][2], const unsigned int mcoords_len)
+void BLI_lasso_boundbox(rcti *rect, const int mcoords[][2], const uint mcoords_len)
{
- unsigned int a;
+ uint a;
rect->xmin = rect->xmax = mcoords[0][0];
rect->ymin = rect->ymax = mcoords[0][1];
@@ -36,7 +36,7 @@ void BLI_lasso_boundbox(rcti *rect, const int mcoords[][2], const unsigned int m
}
bool BLI_lasso_is_point_inside(const int mcoords[][2],
- const unsigned int mcoords_len,
+ const uint mcoords_len,
const int sx,
const int sy,
const int error_value)
@@ -50,7 +50,7 @@ bool BLI_lasso_is_point_inside(const int mcoords[][2],
}
bool BLI_lasso_is_edge_inside(const int mcoords[][2],
- const unsigned int mcoords_len,
+ const uint mcoords_len,
int x0,
int y0,
int x1,
@@ -77,7 +77,7 @@ bool BLI_lasso_is_edge_inside(const int mcoords[][2],
if (isect_seg_seg_v2_int(mcoords[0], mcoords[mcoords_len - 1], v1, v2) > 0) {
return true;
}
- for (unsigned int a = 0; a < mcoords_len - 1; a++) {
+ for (uint a = 0; a < mcoords_len - 1; a++) {
if (isect_seg_seg_v2_int(mcoords[a], mcoords[a + 1], v1, v2) > 0) {
return true;
}
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 9058ef43604..e4b352dc22c 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -176,7 +176,7 @@ void ycc_to_rgb(float y, float cb, float cr, float *r_r, float *r_g, float *r_b,
void hex_to_rgb(const char *hexcol, float *r_r, float *r_g, float *r_b)
{
- unsigned int ri, gi, bi;
+ uint ri, gi, bi;
if (hexcol[0] == '#') {
hexcol++;
@@ -329,29 +329,29 @@ void hsv_clamp_v(float hsv[3], float v_max)
CLAMP(hsv[2], 0.0f, v_max);
}
-unsigned int hsv_to_cpack(float h, float s, float v)
+uint hsv_to_cpack(float h, float s, float v)
{
- unsigned int r, g, b;
+ uint r, g, b;
float rf, gf, bf;
- unsigned int col;
+ uint col;
hsv_to_rgb(h, s, v, &rf, &gf, &bf);
- r = (unsigned int)(rf * 255.0f);
- g = (unsigned int)(gf * 255.0f);
- b = (unsigned int)(bf * 255.0f);
+ r = (uint)(rf * 255.0f);
+ g = (uint)(gf * 255.0f);
+ b = (uint)(bf * 255.0f);
col = (r + (g * 256) + (b * 256 * 256));
return col;
}
-unsigned int rgb_to_cpack(float r, float g, float b)
+uint rgb_to_cpack(float r, float g, float b)
{
- unsigned int ir, ig, ib;
+ uint ir, ig, ib;
- ir = (unsigned int)floorf(255.0f * max_ff(r, 0.0f));
- ig = (unsigned int)floorf(255.0f * max_ff(g, 0.0f));
- ib = (unsigned int)floorf(255.0f * max_ff(b, 0.0f));
+ ir = (uint)floorf(255.0f * max_ff(r, 0.0f));
+ ig = (uint)floorf(255.0f * max_ff(g, 0.0f));
+ ib = (uint)floorf(255.0f * max_ff(b, 0.0f));
if (ir > 255) {
ir = 255;
@@ -366,21 +366,21 @@ unsigned int rgb_to_cpack(float r, float g, float b)
return (ir + (ig * 256) + (ib * 256 * 256));
}
-void cpack_to_rgb(unsigned int col, float *r_r, float *r_g, float *r_b)
+void cpack_to_rgb(uint col, float *r_r, float *r_g, float *r_b)
{
*r_r = ((float)(col & 0xFF)) * (1.0f / 255.0f);
*r_g = ((float)((col >> 8) & 0xFF)) * (1.0f / 255.0f);
*r_b = ((float)((col >> 16) & 0xFF)) * (1.0f / 255.0f);
}
-void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
+void rgb_uchar_to_float(float r_col[3], const uchar col_ub[3])
{
r_col[0] = ((float)col_ub[0]) * (1.0f / 255.0f);
r_col[1] = ((float)col_ub[1]) * (1.0f / 255.0f);
r_col[2] = ((float)col_ub[2]) * (1.0f / 255.0f);
}
-void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
+void rgba_uchar_to_float(float r_col[4], const uchar col_ub[4])
{
r_col[0] = ((float)col_ub[0]) * (1.0f / 255.0f);
r_col[1] = ((float)col_ub[1]) * (1.0f / 255.0f);
@@ -388,12 +388,12 @@ void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
r_col[3] = ((float)col_ub[3]) * (1.0f / 255.0f);
}
-void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
+void rgb_float_to_uchar(uchar r_col[3], const float col_f[3])
{
unit_float_to_uchar_clamp_v3(r_col, col_f);
}
-void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
+void rgba_float_to_uchar(uchar r_col[4], const float col_f[4])
{
unit_float_to_uchar_clamp_v4(r_col, col_f);
}
@@ -500,7 +500,7 @@ void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset)
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
}
-void rgb_byte_set_hue_float_offset(unsigned char rgb[3], float hue_offset)
+void rgb_byte_set_hue_float_offset(uchar rgb[3], float hue_offset)
{
float rgb_float[3];
@@ -515,13 +515,13 @@ void rgb_byte_set_hue_float_offset(unsigned char rgb[3], float hue_offset)
*/
float BLI_color_from_srgb_table[256];
-unsigned short BLI_color_to_srgb_table[0x10000];
+ushort BLI_color_to_srgb_table[0x10000];
-static unsigned short hipart(const float f)
+static ushort hipart(const float f)
{
union {
float f;
- unsigned short us[2];
+ ushort us[2];
} tmp;
tmp.f = f;
@@ -533,12 +533,12 @@ static unsigned short hipart(const float f)
#endif
}
-static float index_to_float(const unsigned short i)
+static float index_to_float(const ushort i)
{
union {
float f;
- unsigned short us[2];
+ ushort us[2];
} tmp;
/* positive and negative zeros, and all gradual underflow, turn into zero: */
@@ -567,7 +567,7 @@ static float index_to_float(const unsigned short i)
void BLI_init_srgb_conversion(void)
{
static bool initialized = false;
- unsigned int i, b;
+ uint i, b;
if (initialized) {
return;
@@ -576,12 +576,12 @@ void BLI_init_srgb_conversion(void)
/* Fill in the lookup table to convert floats to bytes: */
for (i = 0; i < 0x10000; i++) {
- float f = linearrgb_to_srgb(index_to_float((unsigned short)i)) * 255.0f;
+ float f = linearrgb_to_srgb(index_to_float((ushort)i)) * 255.0f;
if (f <= 0) {
BLI_color_to_srgb_table[i] = 0;
}
else if (f < 255) {
- BLI_color_to_srgb_table[i] = (unsigned short)(f * 0x100 + 0.5f);
+ BLI_color_to_srgb_table[i] = (ushort)(f * 0x100 + 0.5f);
}
else {
BLI_color_to_srgb_table[i] = 0xff00;
@@ -594,6 +594,6 @@ void BLI_init_srgb_conversion(void)
BLI_color_from_srgb_table[b] = f;
i = hipart(f);
/* replace entries so byte->float->byte does not change the data: */
- BLI_color_to_srgb_table[i] = (unsigned short)(b * 0x100);
+ BLI_color_to_srgb_table[i] = (ushort)(b * 0x100);
}
}
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 03f9b6441be..2da8d3d7bc8 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -68,7 +68,7 @@ float normal_quad_v3(
return normalize_v3(n);
}
-float normal_poly_v3(float n[3], const float verts[][3], unsigned int nr)
+float normal_poly_v3(float n[3], const float verts[][3], uint nr)
{
cross_poly_v3(n, verts, nr);
return normalize_v3(n);
@@ -122,14 +122,14 @@ float area_tri_signed_v3(const float v1[3],
return area;
}
-float area_poly_v3(const float verts[][3], unsigned int nr)
+float area_poly_v3(const float verts[][3], uint nr)
{
float n[3];
cross_poly_v3(n, verts, nr);
return len_v3(n) * 0.5f;
}
-float area_squared_poly_v3(const float verts[][3], unsigned int nr)
+float area_squared_poly_v3(const float verts[][3], uint nr)
{
float n[3];
@@ -138,9 +138,9 @@ float area_squared_poly_v3(const float verts[][3], unsigned int nr)
return len_squared_v3(n);
}
-float cross_poly_v2(const float verts[][2], unsigned int nr)
+float cross_poly_v2(const float verts[][2], uint nr)
{
- unsigned int a;
+ uint a;
float cross;
const float *co_curr, *co_prev;
@@ -157,11 +157,11 @@ float cross_poly_v2(const float verts[][2], unsigned int nr)
return cross;
}
-void cross_poly_v3(float n[3], const float verts[][3], unsigned int nr)
+void cross_poly_v3(float n[3], const float verts[][3], uint nr)
{
const float *v_prev = verts[nr - 1];
const float *v_curr = verts[0];
- unsigned int i;
+ uint i;
zero_v3(n);
@@ -171,17 +171,17 @@ void cross_poly_v3(float n[3], const float verts[][3], unsigned int nr)
}
}
-float area_poly_v2(const float verts[][2], unsigned int nr)
+float area_poly_v2(const float verts[][2], uint nr)
{
return fabsf(0.5f * cross_poly_v2(verts, nr));
}
-float area_poly_signed_v2(const float verts[][2], unsigned int nr)
+float area_poly_signed_v2(const float verts[][2], uint nr)
{
return (0.5f * cross_poly_v2(verts, nr));
}
-float area_squared_poly_v2(const float verts[][2], unsigned int nr)
+float area_squared_poly_v2(const float verts[][2], uint nr)
{
float area = area_poly_signed_v2(verts, nr);
return area * area;
@@ -1458,12 +1458,12 @@ int isect_line_sphere_v2(const float l1[2],
bool isect_point_poly_v2(const float pt[2],
const float verts[][2],
- const unsigned int nr,
+ const uint nr,
const bool UNUSED(use_holes))
{
/* Keep in sync with #isect_point_poly_v2_int. */
- unsigned int i, j;
+ uint i, j;
bool isect = false;
for (i = 0, j = nr - 1; i < nr; j = i++) {
if (((verts[i][1] > pt[1]) != (verts[j][1] > pt[1])) &&
@@ -1477,12 +1477,12 @@ bool isect_point_poly_v2(const float pt[2],
}
bool isect_point_poly_v2_int(const int pt[2],
const int verts[][2],
- const unsigned int nr,
+ const uint nr,
const bool UNUSED(use_holes))
{
/* Keep in sync with #isect_point_poly_v2. */
- unsigned int i, j;
+ uint i, j;
bool isect = false;
for (i = 0, j = nr - 1; i < nr; j = i++) {
if (((verts[i][1] > pt[1]) != (verts[j][1] > pt[1])) &&
diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c
index 34fcb583232..6867c2ac022 100644
--- a/source/blender/blenlib/intern/math_interp.c
+++ b/source/blender/blenlib/intern/math_interp.c
@@ -56,7 +56,7 @@ static void vector_from_float(const float *data, float vector[4], int components
}
}
-static void vector_from_byte(const unsigned char *data, float vector[4], int components)
+static void vector_from_byte(const uchar *data, float vector[4], int components)
{
if (components == 1) {
vector[0] = data[0];
@@ -75,9 +75,9 @@ static void vector_from_byte(const unsigned char *data, float vector[4], int com
}
/* BICUBIC INTERPOLATION */
-BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer,
+BLI_INLINE void bicubic_interpolation(const uchar *byte_buffer,
const float *float_buffer,
- unsigned char *byte_output,
+ uchar *byte_output,
float *float_output,
int width,
int height,
@@ -135,7 +135,7 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer,
vector_from_float(float_data, data, components);
}
else {
- const unsigned char *byte_data = byte_buffer + width * y1 * components + components * x1;
+ const uchar *byte_data = byte_buffer + width * y1 * components + components * x1;
vector_from_byte(byte_data, data, components);
}
@@ -211,18 +211,18 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer,
}
else {
if (components == 1) {
- byte_output[0] = (unsigned char)(out[0] + 0.5f);
+ byte_output[0] = (uchar)(out[0] + 0.5f);
}
else if (components == 3) {
- byte_output[0] = (unsigned char)(out[0] + 0.5f);
- byte_output[1] = (unsigned char)(out[1] + 0.5f);
- byte_output[2] = (unsigned char)(out[2] + 0.5f);
+ byte_output[0] = (uchar)(out[0] + 0.5f);
+ byte_output[1] = (uchar)(out[1] + 0.5f);
+ byte_output[2] = (uchar)(out[2] + 0.5f);
}
else {
- byte_output[0] = (unsigned char)(out[0] + 0.5f);
- byte_output[1] = (unsigned char)(out[1] + 0.5f);
- byte_output[2] = (unsigned char)(out[2] + 0.5f);
- byte_output[3] = (unsigned char)(out[3] + 0.5f);
+ byte_output[0] = (uchar)(out[0] + 0.5f);
+ byte_output[1] = (uchar)(out[1] + 0.5f);
+ byte_output[2] = (uchar)(out[2] + 0.5f);
+ byte_output[3] = (uchar)(out[3] + 0.5f);
}
}
}
@@ -233,21 +233,16 @@ void BLI_bicubic_interpolation_fl(
bicubic_interpolation(NULL, buffer, NULL, output, width, height, components, u, v);
}
-void BLI_bicubic_interpolation_char(const unsigned char *buffer,
- unsigned char *output,
- int width,
- int height,
- int components,
- float u,
- float v)
+void BLI_bicubic_interpolation_char(
+ const uchar *buffer, uchar *output, int width, int height, int components, float u, float v)
{
bicubic_interpolation(buffer, NULL, output, NULL, width, height, components, u, v);
}
/* BILINEAR INTERPOLATION */
-BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer,
+BLI_INLINE void bilinear_interpolation(const uchar *byte_buffer,
const float *float_buffer,
- unsigned char *byte_output,
+ uchar *byte_output,
float *float_output,
int width,
int height,
@@ -351,8 +346,8 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer,
}
}
else {
- const unsigned char *row1, *row2, *row3, *row4;
- unsigned char empty[4] = {0, 0, 0, 0};
+ const uchar *row1, *row2, *row3, *row4;
+ uchar empty[4] = {0, 0, 0, 0};
/* pixel value must be already wrapped, however values at boundaries may flip */
if (wrap_x) {
@@ -418,26 +413,26 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer,
ma_mb = (1.0f - a) * (1.0f - b);
if (components == 1) {
- byte_output[0] = (unsigned char)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] +
- a_b * row4[0] + 0.5f);
+ byte_output[0] = (uchar)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0] +
+ 0.5f);
}
else if (components == 3) {
- byte_output[0] = (unsigned char)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] +
- a_b * row4[0] + 0.5f);
- byte_output[1] = (unsigned char)(ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] +
- a_b * row4[1] + 0.5f);
- byte_output[2] = (unsigned char)(ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] +
- a_b * row4[2] + 0.5f);
+ byte_output[0] = (uchar)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0] +
+ 0.5f);
+ byte_output[1] = (uchar)(ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1] +
+ 0.5f);
+ byte_output[2] = (uchar)(ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2] +
+ 0.5f);
}
else {
- byte_output[0] = (unsigned char)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] +
- a_b * row4[0] + 0.5f);
- byte_output[1] = (unsigned char)(ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] +
- a_b * row4[1] + 0.5f);
- byte_output[2] = (unsigned char)(ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] +
- a_b * row4[2] + 0.5f);
- byte_output[3] = (unsigned char)(ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] +
- a_b * row4[3] + 0.5f);
+ byte_output[0] = (uchar)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0] +
+ 0.5f);
+ byte_output[1] = (uchar)(ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1] +
+ 0.5f);
+ byte_output[2] = (uchar)(ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2] +
+ 0.5f);
+ byte_output[3] = (uchar)(ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] + a_b * row4[3] +
+ 0.5f);
}
}
}
@@ -449,13 +444,8 @@ void BLI_bilinear_interpolation_fl(
NULL, buffer, NULL, output, width, height, components, u, v, false, false);
}
-void BLI_bilinear_interpolation_char(const unsigned char *buffer,
- unsigned char *output,
- int width,
- int height,
- int components,
- float u,
- float v)
+void BLI_bilinear_interpolation_char(
+ const uchar *buffer, uchar *output, int width, int height, int components, float u, float v)
{
bilinear_interpolation(
buffer, NULL, output, NULL, width, height, components, u, v, false, false);
@@ -475,8 +465,8 @@ void BLI_bilinear_interpolation_wrap_fl(const float *buffer,
NULL, buffer, NULL, output, width, height, components, u, v, wrap_x, wrap_y);
}
-void BLI_bilinear_interpolation_wrap_char(const unsigned char *buffer,
- unsigned char *output,
+void BLI_bilinear_interpolation_wrap_char(const uchar *buffer,
+ uchar *output,
int width,
int height,
int components,
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 3f072c153ad..91b07639e9b 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1477,7 +1477,7 @@ void compatible_eul(float eul[3], const float oldrot[3])
const float pi_x2 = (2.0f * (float)M_PI);
float deul[3];
- unsigned int i;
+ uint i;
/* correct differences of about 360 degrees first */
for (i = 0; i < 3; i++) {
diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc
index e8aa359fbe4..a48df0aa977 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -2032,10 +2032,10 @@ static Array<Face *> polyfill_triangulate_poly(Face *f, IMeshArena *arena)
}
/* Project along negative face normal so (x,y) can be used in 2d. */ float axis_mat[3][3];
float(*projverts)[2];
- unsigned int(*tris)[3];
+ uint(*tris)[3];
const int totfilltri = flen - 2;
/* Prepare projected vertices and array to receive triangles in tessellation. */
- tris = static_cast<unsigned int(*)[3]>(MEM_malloc_arrayN(totfilltri, sizeof(*tris), __func__));
+ tris = static_cast<uint(*)[3]>(MEM_malloc_arrayN(totfilltri, sizeof(*tris), __func__));
projverts = static_cast<float(*)[2]>(MEM_malloc_arrayN(flen, sizeof(*projverts), __func__));
axis_dominant_v3_to_m3_negate(axis_mat, no);
for (int j = 0; j < flen; ++j) {
@@ -2047,7 +2047,7 @@ static Array<Face *> polyfill_triangulate_poly(Face *f, IMeshArena *arena)
/* Put tessellation triangles into Face form. Record original edges where they exist. */
Array<Face *> ans(totfilltri);
for (int t = 0; t < totfilltri; ++t) {
- unsigned int *tri = tris[t];
+ uint *tri = tris[t];
int eo[3];
const Vert *v[3];
for (int k = 0; k < 3; k++) {
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 3ec7c3f9804..182c21ca76c 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -115,8 +115,8 @@ static const float hashpntf[768] = {
0.713870, 0.555261, 0.951333,
};
-extern const unsigned char BLI_noise_hash_uchar_512[512]; /* Quiet warning. */
-const unsigned char BLI_noise_hash_uchar_512[512] = {
+extern const uchar BLI_noise_hash_uchar_512[512]; /* Quiet warning. */
+const uchar BLI_noise_hash_uchar_512[512] = {
0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE,
0x95, 0x2E, 0xDC, 0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC, 0x79, 0x32,
0xD1, 0x59, 0xF4, 0x8, 0x8B, 0x63, 0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7,
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 9b91636b055..a3be9732a68 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -121,7 +121,7 @@ int BLI_path_sequence_decode(const char *string, char *head, char *tail, ushort
}
void BLI_path_sequence_encode(
- char *string, const char *head, const char *tail, unsigned short numlen, int pic)
+ char *string, const char *head, const char *tail, ushort numlen, int pic)
{
sprintf(string, "%s%.*d%s", head, numlen, MAX2(0, pic), tail);
}
diff --git a/source/blender/blenlib/intern/rand.cc b/source/blender/blenlib/intern/rand.cc
index f6d91cdcc4f..40bbe14101b 100644
--- a/source/blender/blenlib/intern/rand.cc
+++ b/source/blender/blenlib/intern/rand.cc
@@ -24,7 +24,7 @@
#include "BLI_strict_flags.h"
#include "BLI_sys_types.h"
-extern "C" unsigned char BLI_noise_hash_uchar_512[512]; /* noise.c */
+extern "C" uchar BLI_noise_hash_uchar_512[512]; /* noise.c */
#define hash BLI_noise_hash_uchar_512
/**
@@ -36,14 +36,14 @@ struct RNG {
MEM_CXX_CLASS_ALLOC_FUNCS("RNG")
};
-RNG *BLI_rng_new(unsigned int seed)
+RNG *BLI_rng_new(uint seed)
{
RNG *rng = new RNG();
rng->rng.seed(seed);
return rng;
}
-RNG *BLI_rng_new_srandom(unsigned int seed)
+RNG *BLI_rng_new_srandom(uint seed)
{
RNG *rng = new RNG();
rng->rng.seed_random(seed);
@@ -60,12 +60,12 @@ void BLI_rng_free(RNG *rng)
delete rng;
}
-void BLI_rng_seed(RNG *rng, unsigned int seed)
+void BLI_rng_seed(RNG *rng, uint seed)
{
rng->rng.seed(seed);
}
-void BLI_rng_srandom(RNG *rng, unsigned int seed)
+void BLI_rng_srandom(RNG *rng, uint seed)
{
rng->rng.seed_random(seed);
}
@@ -80,7 +80,7 @@ int BLI_rng_get_int(RNG *rng)
return rng->rng.get_int32();
}
-unsigned int BLI_rng_get_uint(RNG *rng)
+uint BLI_rng_get_uint(RNG *rng)
{
return rng->rng.get_uint32();
}
@@ -117,21 +117,21 @@ void BLI_rng_get_tri_sample_float_v3(
copy_v3_v3(r_pt, rng->rng.get_triangle_sample_3d(v1, v2, v3));
}
-void BLI_rng_shuffle_array(RNG *rng, void *data, unsigned int elem_size_i, unsigned int elem_num)
+void BLI_rng_shuffle_array(RNG *rng, void *data, uint elem_size_i, uint elem_num)
{
if (elem_num <= 1) {
return;
}
const uint elem_size = elem_size_i;
- unsigned int i = elem_num;
+ uint i = elem_num;
void *temp = malloc(elem_size);
while (i--) {
- const unsigned int j = BLI_rng_get_uint(rng) % elem_num;
+ const uint j = BLI_rng_get_uint(rng) % elem_num;
if (i != j) {
- void *iElem = (unsigned char *)data + i * elem_size_i;
- void *jElem = (unsigned char *)data + j * elem_size_i;
+ void *iElem = (uchar *)data + i * elem_size_i;
+ void *jElem = (uchar *)data + j * elem_size_i;
memcpy(temp, iElem, elem_size);
memcpy(iElem, jElem, elem_size);
memcpy(jElem, temp, elem_size);
@@ -141,15 +141,15 @@ void BLI_rng_shuffle_array(RNG *rng, void *data, unsigned int elem_size_i, unsig
free(temp);
}
-void BLI_rng_shuffle_bitmap(struct RNG *rng, BLI_bitmap *bitmap, unsigned int bits_num)
+void BLI_rng_shuffle_bitmap(struct RNG *rng, BLI_bitmap *bitmap, uint bits_num)
{
if (bits_num <= 1) {
return;
}
- unsigned int i = bits_num;
+ uint i = bits_num;
while (i--) {
- const unsigned int j = BLI_rng_get_uint(rng) % bits_num;
+ const uint j = BLI_rng_get_uint(rng) % bits_num;
if (i != j) {
const bool i_bit = BLI_BITMAP_TEST(bitmap, i);
const bool j_bit = BLI_BITMAP_TEST(bitmap, j);
@@ -166,7 +166,7 @@ void BLI_rng_skip(RNG *rng, int n)
/***/
-void BLI_array_frand(float *ar, int count, unsigned int seed)
+void BLI_array_frand(float *ar, int count, uint seed)
{
RNG rng;
@@ -177,7 +177,7 @@ void BLI_array_frand(float *ar, int count, unsigned int seed)
}
}
-float BLI_hash_frand(unsigned int seed)
+float BLI_hash_frand(uint seed)
{
RNG rng;
@@ -185,10 +185,7 @@ float BLI_hash_frand(unsigned int seed)
return BLI_rng_get_float(&rng);
}
-void BLI_array_randomize(void *data,
- unsigned int elem_size,
- unsigned int elem_num,
- unsigned int seed)
+void BLI_array_randomize(void *data, uint elem_size, uint elem_num, uint seed)
{
RNG rng;
@@ -196,7 +193,7 @@ void BLI_array_randomize(void *data,
BLI_rng_shuffle_array(&rng, data, elem_size, elem_num);
}
-void BLI_bitmap_randomize(BLI_bitmap *bitmap, unsigned int bits_num, unsigned int seed)
+void BLI_bitmap_randomize(BLI_bitmap *bitmap, uint bits_num, uint seed)
{
RNG rng;
@@ -208,7 +205,7 @@ void BLI_bitmap_randomize(BLI_bitmap *bitmap, unsigned int bits_num, unsigned in
static RNG rng_tab[BLENDER_MAX_THREADS];
-void BLI_thread_srandom(int thread, unsigned int seed)
+void BLI_thread_srandom(int thread, uint seed)
{
if (thread >= BLENDER_MAX_THREADS) {
thread = 0;
@@ -237,12 +234,12 @@ struct RNG_THREAD_ARRAY {
RNG_THREAD_ARRAY *BLI_rng_threaded_new()
{
- unsigned int i;
+ uint i;
RNG_THREAD_ARRAY *rngarr = (RNG_THREAD_ARRAY *)MEM_mallocN(sizeof(RNG_THREAD_ARRAY),
"random_array");
for (i = 0; i < BLENDER_MAX_THREADS; i++) {
- BLI_rng_srandom(&rngarr->rng_tab[i], (unsigned int)clock());
+ BLI_rng_srandom(&rngarr->rng_tab[i], (uint)clock());
}
return rngarr;
@@ -284,7 +281,7 @@ BLI_INLINE double halton_ex(double invprimes, double *offset)
return *offset;
}
-void BLI_halton_1d(unsigned int prime, double offset, int n, double *r)
+void BLI_halton_1d(uint prime, double offset, int n, double *r)
{
const double invprime = 1.0 / (double)prime;
@@ -295,7 +292,7 @@ void BLI_halton_1d(unsigned int prime, double offset, int n, double *r)
}
}
-void BLI_halton_2d(const unsigned int prime[2], double offset[2], int n, double *r)
+void BLI_halton_2d(const uint prime[2], double offset[2], int n, double *r)
{
const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]};
@@ -308,7 +305,7 @@ void BLI_halton_2d(const unsigned int prime[2], double offset[2], int n, double
}
}
-void BLI_halton_3d(const unsigned int prime[3], double offset[3], int n, double *r)
+void BLI_halton_3d(const uint prime[3], double offset[3], int n, double *r)
{
const double invprimes[3] = {
1.0 / (double)prime[0], 1.0 / (double)prime[1], 1.0 / (double)prime[2]};
@@ -322,7 +319,7 @@ void BLI_halton_3d(const unsigned int prime[3], double offset[3], int n, double
}
}
-void BLI_halton_2d_sequence(const unsigned int prime[2], double offset[2], int n, double *r)
+void BLI_halton_2d_sequence(const uint prime[2], double offset[2], int n, double *r)
{
const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]};
@@ -335,7 +332,7 @@ void BLI_halton_2d_sequence(const unsigned int prime[2], double offset[2], int n
/* From "Sampling with Hammersley and Halton Points" TT Wong
* Appendix: Source Code 1 */
-BLI_INLINE double radical_inverse(unsigned int n)
+BLI_INLINE double radical_inverse(uint n)
{
double u = 0;
@@ -350,14 +347,14 @@ BLI_INLINE double radical_inverse(unsigned int n)
return u;
}
-void BLI_hammersley_1d(unsigned int n, double *r)
+void BLI_hammersley_1d(uint n, double *r)
{
*r = radical_inverse(n);
}
-void BLI_hammersley_2d_sequence(unsigned int n, double *r)
+void BLI_hammersley_2d_sequence(uint n, double *r)
{
- for (unsigned int s = 0; s < n; s++) {
+ for (uint s = 0; s < n; s++) {
r[s * 2 + 0] = (double)(s + 0.5) / (double)n;
r[s * 2 + 1] = radical_inverse(s);
}
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 33d387a5447..00ac1c0ecd7 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -33,9 +33,9 @@
/* local types */
typedef struct PolyFill {
- unsigned int edges, verts;
+ uint edges, verts;
float min_xy[2], max_xy[2];
- unsigned short nr;
+ ushort nr;
bool f;
} PolyFill;
@@ -304,9 +304,7 @@ static bool addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
return true;
}
-static ScanFillVertLink *addedgetoscanlist(ScanFillVertLink *scdata,
- ScanFillEdge *eed,
- unsigned int len)
+static ScanFillVertLink *addedgetoscanlist(ScanFillVertLink *scdata, ScanFillEdge *eed, uint len)
{
/* inserts edge at correct location in ScanFillVertLink list */
/* returns sc when edge already exists */
@@ -428,10 +426,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx)
}
}
-static void splitlist(ScanFillContext *sf_ctx,
- ListBase *tempve,
- ListBase *temped,
- unsigned short nr)
+static void splitlist(ScanFillContext *sf_ctx, ListBase *tempve, ListBase *temped, ushort nr)
{
/* Everything is in temp-list, write only poly nr to fill-list. */
ScanFillVert *eve, *eve_next;
@@ -457,14 +452,14 @@ static void splitlist(ScanFillContext *sf_ctx,
}
}
-static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
+static uint scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
{
ScanFillVertLink *scdata;
ScanFillVertLink *sc = NULL, *sc1;
ScanFillVert *eve, *v1, *v2, *v3;
ScanFillEdge *eed, *eed_next, *ed1, *ed2, *ed3;
- unsigned int a, b, verts, maxface, totface;
- const unsigned short nr = pf->nr;
+ uint a, b, verts, maxface, totface;
+ const ushort nr = pf->nr;
bool twoconnected = false;
/* PRINTS */
diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c
index 1d2225a5b56..3550854eabd 100644
--- a/source/blender/blenlib/intern/scanfill_utils.c
+++ b/source/blender/blenlib/intern/scanfill_utils.c
@@ -41,7 +41,7 @@ typedef struct ScanFillIsect {
#define EFLAG_SET(eed, val) \
{ \
CHECK_TYPE(eed, ScanFillEdge *); \
- (eed)->user_flag = (eed)->user_flag | (unsigned int)val; \
+ (eed)->user_flag = (eed)->user_flag | (uint)val; \
} \
(void)0
#if 0
@@ -56,7 +56,7 @@ typedef struct ScanFillIsect {
#define VFLAG_SET(eve, val) \
{ \
CHECK_TYPE(eve, ScanFillVert *); \
- (eve)->user_flag = (eve)->user_flag | (unsigned int)val; \
+ (eve)->user_flag = (eve)->user_flag | (uint)val; \
} \
(void)0
#if 0
@@ -130,7 +130,7 @@ static int edge_isect_ls_sort_cb(void *thunk, const void *def_a_ptr, const void
}
static ScanFillEdge *edge_step(PolyInfo *poly_info,
- const unsigned short poly_nr,
+ const ushort poly_nr,
ScanFillVert *v_prev,
ScanFillVert *v_curr,
ScanFillEdge *e_curr)
@@ -158,7 +158,7 @@ static ScanFillEdge *edge_step(PolyInfo *poly_info,
static bool scanfill_preprocess_self_isect(ScanFillContext *sf_ctx,
PolyInfo *poly_info,
- const unsigned short poly_nr,
+ const ushort poly_nr,
ListBase *filledgebase)
{
PolyInfo *pi = &poly_info[poly_nr];
diff --git a/source/blender/blenlib/intern/stack.c b/source/blender/blenlib/intern/stack.c
index ff34cfe41cb..a7bc57ab95f 100644
--- a/source/blender/blenlib/intern/stack.c
+++ b/source/blender/blenlib/intern/stack.c
@@ -141,7 +141,7 @@ void BLI_stack_pop(BLI_Stack *stack, void *dst)
BLI_stack_discard(stack);
}
-void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n)
+void BLI_stack_pop_n(BLI_Stack *stack, void *dst, uint n)
{
BLI_assert(n <= BLI_stack_count(stack));
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 17fb451e422..4fb8311048f 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -55,11 +55,11 @@ ptrdiff_t BLI_str_utf8_invalid_byte(const char *str, size_t length)
* length is in bytes, since without knowing whether the string is valid
* it's hard to know how many characters there are! */
- const unsigned char *p, *perr, *pend = (const unsigned char *)str + length;
- unsigned char c;
+ const uchar *p, *perr, *pend = (const uchar *)str + length;
+ uchar c;
int ab;
- for (p = (const unsigned char *)str; p < pend; p++, length--) {
+ for (p = (const uchar *)str; p < pend; p++, length--) {
c = *p;
perr = p; /* Erroneous char is always the first of an invalid utf8 sequence... */
if (ELEM(c, 0xfe, 0xff, 0x00)) {
diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc
index 37fccf6f4fe..e7470ed86f8 100644
--- a/source/blender/blenlib/intern/threads.cc
+++ b/source/blender/blenlib/intern/threads.cc
@@ -108,7 +108,7 @@ static pthread_mutex_t _colormanage_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _fftw_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _view3d_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_t mainid;
-static unsigned int thread_levels = 0; /* threads can be invoked inside threads */
+static uint thread_levels = 0; /* threads can be invoked inside threads */
static int threads_override_num = 0;
/* just a max for security reasons */
@@ -153,7 +153,7 @@ void BLI_threadpool_init(ListBase *threadbase, void *(*do_thread)(void *), int t
}
}
- unsigned int level = atomic_fetch_and_add_u(&thread_levels, 1);
+ uint level = atomic_fetch_and_add_u(&thread_levels, 1);
if (level == 0) {
#ifdef USE_APPLE_OMP_FIX
/* Workaround for Apple gcc 4.2.1 OMP vs background thread bug,
@@ -524,7 +524,7 @@ void BLI_rw_mutex_free(ThreadRWMutex *mutex)
struct TicketMutex {
pthread_cond_t cond;
pthread_mutex_t mutex;
- unsigned int queue_head, queue_tail;
+ uint queue_head, queue_tail;
};
TicketMutex *BLI_ticket_mutex_alloc()
@@ -547,7 +547,7 @@ void BLI_ticket_mutex_free(TicketMutex *ticket)
void BLI_ticket_mutex_lock(TicketMutex *ticket)
{
- unsigned int queue_me;
+ uint queue_me;
pthread_mutex_lock(&ticket->mutex);
queue_me = ticket->queue_tail++;
diff --git a/source/blender/blenlib/tests/BLI_array_store_test.cc b/source/blender/blenlib/tests/BLI_array_store_test.cc
index 8e95557466e..c52d439308f 100644
--- a/source/blender/blenlib/tests/BLI_array_store_test.cc
+++ b/source/blender/blenlib/tests/BLI_array_store_test.cc
@@ -168,7 +168,7 @@ static void testbuffer_list_state_from_data__stride_expand(ListBase *lb,
#define testbuffer_list_state_from_string_array(lb, data_array) \
{ \
- unsigned int i_ = 0; \
+ uint i_ = 0; \
const char *data; \
while ((data = data_array[i_++])) { \
testbuffer_list_state_from_data(lb, data, strlen(data)); \
@@ -224,7 +224,7 @@ static bool testbuffer_list_validate(const ListBase *lb)
return true;
}
-static void testbuffer_list_data_randomize(ListBase *lb, unsigned int random_seed)
+static void testbuffer_list_data_randomize(ListBase *lb, uint random_seed)
{
for (TestBuffer *tb = (TestBuffer *)lb->first; tb; tb = tb->next) {
BLI_array_randomize((void *)tb->data, 1, tb->data_len, random_seed++);
@@ -301,7 +301,7 @@ TEST(array_store, Nop)
TEST(array_store, NopState)
{
BArrayStore *bs = BLI_array_store_create(1, 32);
- const unsigned char data[] = "test";
+ const uchar data[] = "test";
BArrayState *state = BLI_array_store_state_add(bs, data, sizeof(data) - 1, nullptr);
EXPECT_EQ(BLI_array_store_state_size_get(state), sizeof(data) - 1);
BLI_array_store_state_remove(bs, state);
@@ -556,18 +556,15 @@ TEST(array_store, TextSentencesRandom_Stride128_Chunk6)
/* -------------------------------------------------------------------- */
/* Random Data Tests */
-static unsigned int rand_range_i(RNG *rng,
- unsigned int min_i,
- unsigned int max_i,
- unsigned int step)
+static uint rand_range_i(RNG *rng, uint min_i, uint max_i, uint step)
{
if (min_i == max_i) {
return min_i;
}
BLI_assert(min_i <= max_i);
BLI_assert(((min_i % step) == 0) && ((max_i % step) == 0));
- unsigned int range = (max_i - min_i);
- unsigned int value = BLI_rng_get_uint(rng) % range;
+ uint range = (max_i - min_i);
+ uint value = BLI_rng_get_uint(rng) % range;
value = (value / step) * step;
return min_i + value;
}
@@ -577,7 +574,7 @@ static void testbuffer_list_state_random_data(ListBase *lb,
const size_t data_min_len,
const size_t data_max_len,
- const unsigned int mutate,
+ const uint mutate,
RNG *rng)
{
size_t data_len = rand_range_i(rng, data_min_len, data_max_len + stride, stride);
@@ -612,7 +609,7 @@ static void testbuffer_list_state_random_data(ListBase *lb,
break;
}
case MUTATE_ADD: {
- const unsigned int offset = rand_range_i(rng, 0, data_len, stride);
+ const uint offset = rand_range_i(rng, 0, data_len, stride);
if (data_len < data_max_len) {
data_len += stride;
data = (char *)MEM_reallocN((void *)data, data_len);
@@ -622,7 +619,7 @@ static void testbuffer_list_state_random_data(ListBase *lb,
break;
}
case MUTATE_REMOVE: {
- const unsigned int offset = rand_range_i(rng, 0, data_len, stride);
+ const uint offset = rand_range_i(rng, 0, data_len, stride);
if (data_len > data_min_len) {
memmove(&data[offset], &data[offset + stride], data_len - (offset + stride));
data_len -= stride;
@@ -638,7 +635,7 @@ static void testbuffer_list_state_random_data(ListBase *lb,
}
case MUTATE_RANDOMIZE: {
if (data_len > 0) {
- const unsigned int offset = rand_range_i(rng, 0, data_len - stride, stride);
+ const uint offset = rand_range_i(rng, 0, data_len - stride, stride);
BLI_rng_get_char_n(rng, &data[offset], stride);
}
break;
diff --git a/source/blender/blenlib/tests/BLI_ghash_test.cc b/source/blender/blenlib/tests/BLI_ghash_test.cc
index da5207cb3f8..5e763dc928f 100644
--- a/source/blender/blenlib/tests/BLI_ghash_test.cc
+++ b/source/blender/blenlib/tests/BLI_ghash_test.cc
@@ -34,10 +34,10 @@
/* NOTE: for pure-ghash testing, nature of the keys and data have absolutely no importance! So here
* we just use mere random integers stored in pointers. */
-static void init_keys(unsigned int keys[TESTCASE_SIZE], const int seed)
+static void init_keys(uint keys[TESTCASE_SIZE], const int seed)
{
RNG *rng = BLI_rng_new(seed);
- unsigned int *k;
+ uint *k;
int i;
for (i = 0, k = keys; i < TESTCASE_SIZE;) {
@@ -61,7 +61,7 @@ static void init_keys(unsigned int keys[TESTCASE_SIZE], const int seed)
TEST(ghash, InsertLookup)
{
GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__);
- unsigned int keys[TESTCASE_SIZE], *k;
+ uint keys[TESTCASE_SIZE], *k;
int i;
init_keys(keys, 0);
@@ -85,7 +85,7 @@ TEST(ghash, InsertLookup)
TEST(ghash, InsertRemove)
{
GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__);
- unsigned int keys[TESTCASE_SIZE], *k;
+ uint keys[TESTCASE_SIZE], *k;
int i, bkt_size;
init_keys(keys, 10);
@@ -112,7 +112,7 @@ TEST(ghash, InsertRemove)
TEST(ghash, InsertRemoveShrink)
{
GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__);
- unsigned int keys[TESTCASE_SIZE], *k;
+ uint keys[TESTCASE_SIZE], *k;
int i, bkt_size;
BLI_ghash_flag_set(ghash, GHASH_FLAG_ALLOW_SHRINK);
@@ -141,7 +141,7 @@ TEST(ghash, Copy)
{
GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__);
GHash *ghash_copy;
- unsigned int keys[TESTCASE_SIZE], *k;
+ uint keys[TESTCASE_SIZE], *k;
int i;
init_keys(keys, 30);
@@ -170,7 +170,7 @@ TEST(ghash, Copy)
TEST(ghash, Pop)
{
GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__);
- unsigned int keys[TESTCASE_SIZE], *k;
+ uint keys[TESTCASE_SIZE], *k;
int i;
BLI_ghash_flag_set(ghash, GHASH_FLAG_ALLOW_SHRINK);
diff --git a/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc b/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc
index 99bb107840f..90f5aa6189f 100644
--- a/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc
+++ b/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc
@@ -16,7 +16,7 @@ TEST(hash_mm2a, MM2ABasic)
const char *data = "Blender";
BLI_hash_mm2a_init(&mm2, 0);
- BLI_hash_mm2a_add(&mm2, (const unsigned char *)data, strlen(data));
+ BLI_hash_mm2a_add(&mm2, (const uchar *)data, strlen(data));
#ifdef __LITTLE_ENDIAN__
EXPECT_EQ(BLI_hash_mm2a_end(&mm2), 1633988145);
#else
@@ -35,12 +35,12 @@ TEST(hash_mm2a, MM2AConcatenateStrings)
const char *data123 = "Blender is FaNtAsTiC";
BLI_hash_mm2a_init(&mm2, 0);
- BLI_hash_mm2a_add(&mm2, (const unsigned char *)data1, strlen(data1));
- BLI_hash_mm2a_add(&mm2, (const unsigned char *)data2, strlen(data2));
- BLI_hash_mm2a_add(&mm2, (const unsigned char *)data3, strlen(data3));
+ BLI_hash_mm2a_add(&mm2, (const uchar *)data1, strlen(data1));
+ BLI_hash_mm2a_add(&mm2, (const uchar *)data2, strlen(data2));
+ BLI_hash_mm2a_add(&mm2, (const uchar *)data3, strlen(data3));
hash = BLI_hash_mm2a_end(&mm2);
BLI_hash_mm2a_init(&mm2, 0);
- BLI_hash_mm2a_add(&mm2, (const unsigned char *)data123, strlen(data123));
+ BLI_hash_mm2a_add(&mm2, (const uchar *)data123, strlen(data123));
#ifdef __LITTLE_ENDIAN__
EXPECT_EQ(hash, 1545105348);
#else
@@ -63,7 +63,7 @@ TEST(hash_mm2a, MM2AIntegers)
BLI_hash_mm2a_add_int(&mm2, ints[3]);
hash = BLI_hash_mm2a_end(&mm2);
BLI_hash_mm2a_init(&mm2, 0);
- BLI_hash_mm2a_add(&mm2, (const unsigned char *)ints, sizeof(ints));
+ BLI_hash_mm2a_add(&mm2, (const uchar *)ints, sizeof(ints));
/* Yes, same hash here on little and big endian. */
#ifdef __LITTLE_ENDIAN__
EXPECT_EQ(hash, 405493096);
diff --git a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
index db2fb1ba671..69c60c5bdb9 100644
--- a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
+++ b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
@@ -29,20 +29,20 @@
static void polyfill_to_obj(const char *id,
const float poly[][2],
- const unsigned int poly_num,
- const unsigned int tris[][3],
- const unsigned int tris_num);
+ const uint poly_num,
+ const uint tris[][3],
+ const uint tris_num);
/* -------------------------------------------------------------------- */
/* test utility functions */
-#define TRI_ERROR_VALUE (unsigned int)-1
+#define TRI_ERROR_VALUE (uint) - 1
-static void test_valid_polyfill_prepare(unsigned int tris[][3], unsigned int tris_num)
+static void test_valid_polyfill_prepare(uint tris[][3], uint tris_num)
{
- unsigned int i;
+ uint i;
for (i = 0; i < tris_num; i++) {
- unsigned int j;
+ uint j;
for (j = 0; j < 3; j++) {
tris[i][j] = TRI_ERROR_VALUE;
}
@@ -57,14 +57,14 @@ static void test_valid_polyfill_prepare(unsigned int tris[][3], unsigned int tri
* - all verts used at least once.
*/
static void test_polyfill_simple(const float /*poly*/[][2],
- const unsigned int poly_num,
- const unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ const uint tris[][3],
+ const uint tris_num)
{
- unsigned int i;
+ uint i;
int *used_num = (int *)MEM_callocN(poly_num * sizeof(int), __func__);
for (i = 0; i < tris_num; i++) {
- unsigned int j;
+ uint j;
for (j = 0; j < 3; j++) {
EXPECT_NE(TRI_ERROR_VALUE, tris[i][j]);
used_num[tris[i][j]] += 1;
@@ -80,18 +80,18 @@ static void test_polyfill_simple(const float /*poly*/[][2],
}
static void test_polyfill_topology(const float /*poly*/[][2],
- const unsigned int poly_num,
- const unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ const uint tris[][3],
+ const uint tris_num)
{
EdgeHash *edgehash = BLI_edgehash_new(__func__);
EdgeHashIterator *ehi;
- unsigned int i;
+ uint i;
for (i = 0; i < tris_num; i++) {
- unsigned int j;
+ uint j;
for (j = 0; j < 3; j++) {
- const unsigned int v1 = tris[i][j];
- const unsigned int v2 = tris[i][(j + 1) % 3];
+ const uint v1 = tris[i][j];
+ const uint v2 = tris[i][(j + 1) % 3];
void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
if (p) {
*p = (void *)((intptr_t)*p + (intptr_t)1);
@@ -104,8 +104,8 @@ static void test_polyfill_topology(const float /*poly*/[][2],
EXPECT_EQ(BLI_edgehash_len(edgehash), poly_num + (poly_num - 3));
for (i = 0; i < poly_num; i++) {
- const unsigned int v1 = i;
- const unsigned int v2 = (i + 1) % poly_num;
+ const uint v1 = i;
+ const uint v2 = (i + 1) % poly_num;
void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
EXPECT_NE((void *)p, nullptr);
EXPECT_EQ((intptr_t)*p, 1);
@@ -125,12 +125,12 @@ static void test_polyfill_topology(const float /*poly*/[][2],
* Check all faces are flipped the same way
*/
static void test_polyfill_winding(const float poly[][2],
- const unsigned int /*poly_num*/,
- const unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint /*poly_num*/,
+ const uint tris[][3],
+ const uint tris_num)
{
- unsigned int i;
- unsigned int count[2] = {0, 0};
+ uint i;
+ uint count[2] = {0, 0};
for (i = 0; i < tris_num; i++) {
float winding_test = cross_tri_v2(poly[tris[i][0]], poly[tris[i][1]], poly[tris[i][2]]);
if (fabsf(winding_test) > FLT_EPSILON) {
@@ -144,11 +144,11 @@ static void test_polyfill_winding(const float poly[][2],
* Check the accumulated triangle area is close to the original area.
*/
static void test_polyfill_area(const float poly[][2],
- const unsigned int poly_num,
- const unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ const uint tris[][3],
+ const uint tris_num)
{
- unsigned int i;
+ uint i;
const float area_total = area_poly_v2(poly, poly_num);
float area_total_tris = 0.0f;
const float eps_abs = 0.00001f;
@@ -167,9 +167,9 @@ static void test_polyfill_area(const float poly[][2],
static void test_polyfill_template_check(const char *id,
bool is_degenerate,
const float poly[][2],
- const unsigned int poly_num,
- const unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ const uint tris[][3],
+ const uint tris_num)
{
test_polyfill_simple(poly, poly_num, tris, tris_num);
test_polyfill_topology(poly, poly_num, tris, tris_num);
@@ -184,9 +184,9 @@ static void test_polyfill_template_check(const char *id,
static void test_polyfill_template(const char *id,
bool is_degenerate,
const float poly[][2],
- const unsigned int poly_num,
- unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ uint tris[][3],
+ const uint tris_num)
{
test_valid_polyfill_prepare(tris, tris_num);
BLI_polyfill_calc(poly, poly_num, 0, tris);
@@ -213,9 +213,9 @@ static void test_polyfill_template(const char *id,
static void test_polyfill_template_flip_sign(const char *id,
bool is_degenerate,
const float poly[][2],
- const unsigned int poly_num,
- unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ uint tris[][3],
+ const uint tris_num)
{
float(*poly_copy)[2] = (float(*)[2])MEM_mallocN(sizeof(float[2]) * poly_num, id);
for (int flip_x = 0; flip_x < 2; flip_x++) {
@@ -236,19 +236,19 @@ static void test_polyfill_template_flip_sign(const char *id,
static void test_polyfill_template_main(const char *id,
bool is_degenerate,
const float poly[][2],
- const unsigned int poly_num,
- unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ uint tris[][3],
+ const uint tris_num)
{
/* overkill? - try at _every_ offset & reverse */
- unsigned int poly_reverse;
+ uint poly_reverse;
float(*poly_copy)[2] = (float(*)[2])MEM_mallocN(sizeof(float[2]) * poly_num, id);
float tmp[2];
memcpy(poly_copy, poly, sizeof(float[2]) * poly_num);
for (poly_reverse = 0; poly_reverse < 2; poly_reverse++) {
- unsigned int poly_cycle;
+ uint poly_cycle;
if (poly_reverse) {
BLI_array_reverse(poly_copy, poly_num);
@@ -271,9 +271,9 @@ static void test_polyfill_template_main(const char *id,
static void test_polyfill_template_main(const char *id,
bool is_degenerate,
const float poly[][2],
- const unsigned int poly_num,
- unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ uint tris[][3],
+ const uint tris_num)
{
test_polyfill_template_flip_sign(id, is_degenerate, poly, poly_num, tris, tris_num);
}
@@ -281,9 +281,9 @@ static void test_polyfill_template_main(const char *id,
#define TEST_POLYFILL_TEMPLATE_STATIC(poly, is_degenerate) \
{ \
- unsigned int tris[POLY_TRI_COUNT(ARRAY_SIZE(poly))][3]; \
- const unsigned int poly_num = ARRAY_SIZE(poly); \
- const unsigned int tris_num = ARRAY_SIZE(tris); \
+ uint tris[POLY_TRI_COUNT(ARRAY_SIZE(poly))][3]; \
+ const uint poly_num = ARRAY_SIZE(poly); \
+ const uint tris_num = ARRAY_SIZE(tris); \
const char *id = typeid(*this).name(); \
\
test_polyfill_template_main(id, is_degenerate, poly, poly_num, tris, tris_num); \
@@ -296,13 +296,13 @@ static void test_polyfill_template_main(const char *id,
#ifdef USE_OBJ_PREVIEW
static void polyfill_to_obj(const char *id,
const float poly[][2],
- const unsigned int poly_num,
- const unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ const uint tris[][3],
+ const uint tris_num)
{
char path[1024];
FILE *f;
- unsigned int i;
+ uint i;
BLI_snprintf(path, sizeof(path), "%s.obj", id);
@@ -324,9 +324,9 @@ static void polyfill_to_obj(const char *id,
#else
static void polyfill_to_obj(const char *id,
const float poly[][2],
- const unsigned int poly_num,
- const unsigned int tris[][3],
- const unsigned int tris_num)
+ const uint poly_num,
+ const uint tris[][3],
+ const uint tris_num)
{
(void)id;
(void)poly, (void)poly_num;
diff --git a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc
index 0707759666d..5c7f1106993 100644
--- a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc
+++ b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc
@@ -118,19 +118,19 @@ TEST(stack, PushPopMany)
Stack<int> stack;
for (int i = 0; i < 1000; i++) {
stack.push(i);
- EXPECT_EQ(stack.size(), static_cast<unsigned int>(i + 1));
+ EXPECT_EQ(stack.size(), static_cast<uint>(i + 1));
}
for (int i = 999; i > 50; i--) {
EXPECT_EQ(stack.pop(), i);
- EXPECT_EQ(stack.size(), static_cast<unsigned int>(i));
+ EXPECT_EQ(stack.size(), static_cast<uint>(i));
}
for (int i = 51; i < 5000; i++) {
stack.push(i);
- EXPECT_EQ(stack.size(), static_cast<unsigned int>(i + 1));
+ EXPECT_EQ(stack.size(), static_cast<uint>(i + 1));
}
for (int i = 4999; i >= 0; i--) {
EXPECT_EQ(stack.pop(), i);
- EXPECT_EQ(stack.size(), static_cast<unsigned int>(i));
+ EXPECT_EQ(stack.size(), static_cast<uint>(i));
}
}
diff --git a/source/blender/blenlib/tests/BLI_stack_test.cc b/source/blender/blenlib/tests/BLI_stack_test.cc
index 216c8bd6d55..5f361a78929 100644
--- a/source/blender/blenlib/tests/BLI_stack_test.cc
+++ b/source/blender/blenlib/tests/BLI_stack_test.cc
@@ -28,7 +28,7 @@ TEST(stack, Empty)
TEST(stack, One)
{
BLI_Stack *stack;
- unsigned int in = -1, out = 1;
+ uint in = -1, out = 1;
stack = BLI_stack_new(sizeof(in), __func__);
diff --git a/source/blender/blenlib/tests/BLI_string_test.cc b/source/blender/blenlib/tests/BLI_string_test.cc
index eaaa65dd39f..9bdf6075c70 100644
--- a/source/blender/blenlib/tests/BLI_string_test.cc
+++ b/source/blender/blenlib/tests/BLI_string_test.cc
@@ -174,7 +174,7 @@ TEST(string, StrPartitionEx)
/* BLI_str_partition_utf8 */
TEST(string, StrPartitionUtf8)
{
- const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
+ const uint delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
const char *sep, *suf;
size_t pre_len;
@@ -233,7 +233,7 @@ TEST(string, StrPartitionUtf8)
/* BLI_str_rpartition_utf8 */
TEST(string, StrRPartitionUtf8)
{
- const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
+ const uint delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
const char *sep, *suf;
size_t pre_len;
@@ -292,7 +292,7 @@ TEST(string, StrRPartitionUtf8)
/* BLI_str_partition_ex_utf8 */
TEST(string, StrPartitionExUtf8)
{
- const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
+ const uint delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
const char *sep, *suf;
size_t pre_len;
diff --git a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
index 09bb1e7239f..e1d3adc6e78 100644
--- a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
+++ b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
@@ -177,12 +177,12 @@ TEST(ghash, TextMurmur2a)
/* Int: uniform 100M first integers. */
-static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int count)
+static void int_ghash_tests(GHash *ghash, const char *id, const uint count)
{
printf("\n========== STARTING %s ==========\n", id);
{
- unsigned int i = count;
+ uint i = count;
TIMEIT_START(int_insert);
@@ -200,7 +200,7 @@ static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int cou
PRINTF_GHASH_STATS(ghash);
{
- unsigned int i = count;
+ uint i = count;
TIMEIT_START(int_lookup);
@@ -266,13 +266,13 @@ TEST(ghash, IntMurmur2a100000000)
/* Int: random 50M integers. */
-static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int count)
+static void randint_ghash_tests(GHash *ghash, const char *id, const uint count)
{
printf("\n========== STARTING %s ==========\n", id);
- unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__);
- unsigned int *dt;
- unsigned int i;
+ uint *data = (uint *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__);
+ uint *dt;
+ uint i;
{
RNG *rng = BLI_rng_new(1);
@@ -347,7 +347,7 @@ TEST(ghash, IntRandMurmur2a50000000)
}
#endif
-static unsigned int ghashutil_tests_nohash_p(const void *p)
+static uint ghashutil_tests_nohash_p(const void *p)
{
return POINTER_AS_UINT(p);
}
@@ -375,14 +375,14 @@ TEST(ghash, Int4NoHash50000000)
/* Int_v4: 20M of randomly-generated integer vectors. */
-static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int count)
+static void int4_ghash_tests(GHash *ghash, const char *id, const uint count)
{
printf("\n========== STARTING %s ==========\n", id);
- void *data_v = MEM_mallocN(sizeof(unsigned int[4]) * (size_t)count, __func__);
- unsigned int(*data)[4] = (unsigned int(*)[4])data_v;
- unsigned int(*dt)[4];
- unsigned int i, j;
+ void *data_v = MEM_mallocN(sizeof(uint[4]) * (size_t)count, __func__);
+ uint(*data)[4] = (uint(*)[4])data_v;
+ uint(*dt)[4];
+ uint i, j;
{
RNG *rng = BLI_rng_new(1);
@@ -483,11 +483,11 @@ TEST(ghash, Int2NoHash50000000)
/* MultiSmall: create and manipulate a lot of very small ghash's
* (90% < 10 items, 9% < 100 items, 1% < 1000 items). */
-static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned int count)
+static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const uint count)
{
- unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__);
- unsigned int *dt;
- unsigned int i;
+ uint *data = (uint *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__);
+ uint *dt;
+ uint i;
for (i = count, dt = data; i--; dt++) {
*dt = BLI_rng_get_uint(rng);
@@ -510,7 +510,7 @@ static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned i
MEM_freeN(data);
}
-static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned int count)
+static void multi_small_ghash_tests(GHash *ghash, const char *id, const uint count)
{
printf("\n========== STARTING %s ==========\n", id);
@@ -518,7 +518,7 @@ static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned
TIMEIT_START(multi_small_ghash);
- unsigned int i = count;
+ uint i = count;
while (i--) {
const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) *
(!(i % 100) ? 100 : (!(i % 10) ? 10 : 1));
@@ -529,7 +529,7 @@ static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned
TIMEIT_START(multi_small2_ghash);
- unsigned int i = count;
+ uint i = count;
while (i--) {
const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) / 2 *
(!(i % 100) ? 100 : (!(i % 10) ? 10 : 1));