diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-26 03:56:05 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-26 04:33:22 +0300 |
commit | 3961d3493be9c666850e71abe6102f72d3db9332 (patch) | |
tree | 83b903f8040f6384cbd4f702546db52a02bcd3dc /source | |
parent | 3a7dc572dc9bbad35bdff3a3aeca8eab0ccb3fb7 (diff) |
Cleanup: use 'u' prefixed integer types for brevity in C code
This also simplifies using function style casts when moving to C++.
Diffstat (limited to 'source')
70 files changed, 377 insertions, 414 deletions
diff --git a/source/blender/blendthumb/src/blendthumb_win32.cc b/source/blender/blendthumb/src/blendthumb_win32.cc index 4ba91955bd3..206309b6caf 100644 --- a/source/blender/blendthumb/src/blendthumb_win32.cc +++ b/source/blender/blendthumb/src/blendthumb_win32.cc @@ -172,10 +172,10 @@ IFACEMETHODIMP CBlendThumb::GetThumbnail(UINT cx, HBITMAP *phbmp, WTS_ALPHATYPE *pdwAlpha = WTSAT_ARGB; /* Scale up the thumbnail if required. */ - if ((unsigned)thumb.width < cx && (unsigned)thumb.height < cx) { + if (uint(thumb.width) < cx && uint(thumb.height) < cx) { float scale = 1.0f / (std::max(thumb.width, thumb.height) / float(cx)); - LONG NewWidth = (LONG)(thumb.width * scale); - LONG NewHeight = (LONG)(thumb.height * scale); + LONG NewWidth = LONG(thumb.width * scale); + LONG NewHeight = LONG(thumb.height * scale); IWICImagingFactory *pImgFac; hr = CoCreateInstance( diff --git a/source/blender/blenfont/intern/blf_font_win32_compat.c b/source/blender/blenfont/intern/blf_font_win32_compat.c index 17213275c74..4bb2a010dd9 100644 --- a/source/blender/blenfont/intern/blf_font_win32_compat.c +++ b/source/blender/blenfont/intern/blf_font_win32_compat.c @@ -39,10 +39,7 @@ static void ft_ansi_stream_close(FT_Stream stream) MEM_freeN(stream); } -static unsigned long ft_ansi_stream_io(FT_Stream stream, - unsigned long offset, - unsigned char *buffer, - unsigned long count) +static ulong ft_ansi_stream_io(FT_Stream stream, ulong offset, uchar *buffer, ulong count) { FILE *file; if (!count && offset > stream->size) { diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c index 110ef97fd3a..2eed7418220 100644 --- a/source/blender/blenfont/intern/blf_thumbs.c +++ b/source/blender/blenfont/intern/blf_thumbs.c @@ -283,8 +283,7 @@ static const char32_t *blf_get_sample_text(FT_Face face) return sample; } -bool BLF_thumb_preview( - const char *filename, unsigned char *buf, int w, int h, int UNUSED(channels)) +bool BLF_thumb_preview(const char *filename, uchar *buf, int w, int h, int UNUSED(channels)) { /* Use own FT_Library and direct FreeType calls as this is called from multiple threads. */ FT_Library ft_lib = NULL; diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 8c3098069c4..e85e19f04c9 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1148,7 +1148,7 @@ static void cloth_update_springs(ClothModifierData *clmd) /* Update rest verts, for dynamically deformable cloth */ static void cloth_update_verts(Object *ob, ClothModifierData *clmd, Mesh *mesh) { - unsigned int i = 0; + uint i = 0; const MVert *mvert = BKE_mesh_verts(mesh); ClothVertex *verts = clmd->clothObject->verts; @@ -1180,9 +1180,9 @@ static void cloth_update_spring_lengths(ClothModifierData *clmd, Mesh *mesh) { Cloth *cloth = clmd->clothObject; LinkNode *search = cloth->springs; - unsigned int struct_springs = 0; - unsigned int i = 0; - unsigned int mvert_num = (unsigned int)mesh->totvert; + uint struct_springs = 0; + uint i = 0; + uint mvert_num = (uint)mesh->totvert; float shrink_factor; clmd->sim_parms->avg_spring_len = 0.0f; @@ -1373,12 +1373,12 @@ BLI_INLINE bool cloth_bend_set_poly_vert_array(int **poly, int len, const MLoop } static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata, - unsigned int v_idx, + uint v_idx, RNG *rng, float max_length, float max_diversion, bool check_normal, - unsigned int *r_tar_v_idx) + uint *r_tar_v_idx) { float co[3], no[3], new_co[3]; float radius; @@ -1415,7 +1415,7 @@ static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata, BLI_bvhtree_ray_cast( treedata->tree, new_co, no, radius, &rayhit, treedata->raycast_callback, treedata); - unsigned int vert_idx = -1; + uint vert_idx = -1; const MLoop *mloop = treedata->loop; const MLoopTri *lt = NULL; @@ -1429,7 +1429,7 @@ static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata, lt = &treedata->looptri[rayhit.index]; for (int i = 0; i < 3; i++) { - unsigned int tmp_vert_idx = mloop[lt->tri[i]].v; + uint tmp_vert_idx = mloop[lt->tri[i]].v; if (tmp_vert_idx == v_idx) { /* We managed to hit ourselves. */ return false; @@ -1453,10 +1453,10 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) { Cloth *cloth = clmd->clothObject; ClothSpring *spring = NULL, *tspring = NULL, *tspring2 = NULL; - unsigned int struct_springs = 0, shear_springs = 0, bend_springs = 0, struct_springs_real = 0; - unsigned int mvert_num = (unsigned int)mesh->totvert; - unsigned int numedges = (unsigned int)mesh->totedge; - unsigned int numpolys = (unsigned int)mesh->totpoly; + uint struct_springs = 0, shear_springs = 0, bend_springs = 0, struct_springs_real = 0; + uint mvert_num = (uint)mesh->totvert; + uint numedges = (uint)mesh->totedge; + uint numpolys = (uint)mesh->totpoly; float shrink_factor; const MEdge *medge = BKE_mesh_edges(mesh); const MPoly *mpoly = BKE_mesh_polys(mesh); @@ -1499,7 +1499,7 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) if (use_internal_springs && numpolys > 0) { BVHTreeFromMesh treedata = {NULL}; - unsigned int tar_v_idx; + uint tar_v_idx; Mesh *tmp_mesh = NULL; RNG *rng; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index dc7a4968f59..2acdc6543b5 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -1216,10 +1216,7 @@ static void hair_collision(void *__restrict userdata, } } -static void add_collision_object(ListBase *relations, - Object *ob, - int level, - unsigned int modifier_type) +static void add_collision_object(ListBase *relations, Object *ob, int level, uint modifier_type) { /* only get objects with collision modifier */ ModifierData *cmd = BKE_modifiers_findby_type(ob, modifier_type); @@ -1246,7 +1243,7 @@ static void add_collision_object(ListBase *relations, ListBase *BKE_collision_relations_create(Depsgraph *depsgraph, Collection *collection, - unsigned int modifier_type) + uint modifier_type) { const Scene *scene = DEG_get_input_scene(depsgraph); ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); @@ -1276,8 +1273,8 @@ void BKE_collision_relations_free(ListBase *relations) Object **BKE_collision_objects_create(Depsgraph *depsgraph, Object *self, Collection *collection, - unsigned int *numcollobj, - unsigned int modifier_type) + uint *numcollobj, + uint modifier_type) { ListBase *relations = DEG_get_collision_relations(depsgraph, collection, modifier_type); @@ -1549,7 +1546,7 @@ int cloth_bvh_collision( ClothVertex *verts = NULL; int ret = 0, ret2 = 0; Object **collobjs = NULL; - unsigned int numcollobj = 0; + uint numcollobj = 0; uint *coll_counts_obj = NULL; BVHTreeOverlap **overlap_obj = NULL; uint coll_count_self = 0; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index e4c46703f8a..cc379ebb561 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1098,8 +1098,8 @@ void BKE_curvemapping_evaluate_premulRGBF(const CurveMapping *cumap, } void BKE_curvemapping_evaluate_premulRGB(const CurveMapping *cumap, - unsigned char vecout_byte[3], - const unsigned char vecin_byte[3]) + uchar vecout_byte[3], + const uchar vecin_byte[3]) { float vecin[3], vecout[3]; @@ -1368,7 +1368,7 @@ void BKE_histogram_update_sample_line(Histogram *hist, { int i, x, y; const float *fp; - unsigned char *cp; + uchar *cp; int x1 = roundf(hist->co[0][0] * ibuf->x); int x2 = roundf(hist->co[1][0] * ibuf->x); @@ -1432,7 +1432,7 @@ void BKE_histogram_update_sample_line(Histogram *hist, hist->data_a[i] = rgba[3]; } else if (ibuf->rect) { - cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x); + cp = (uchar *)(ibuf->rect + y * ibuf->x + x); hist->data_luma[i] = (float)IMB_colormanagement_get_luminance_byte(cp) / 255.0f; hist->data_r[i] = (float)cp[0] / 255.0f; hist->data_g[i] = (float)cp[1] / 255.0f; @@ -1452,16 +1452,16 @@ typedef struct ScopesUpdateData { Scopes *scopes; const ImBuf *ibuf; struct ColormanageProcessor *cm_processor; - const unsigned char *display_buffer; + const uchar *display_buffer; const int ycc_mode; } ScopesUpdateData; typedef struct ScopesUpdateDataChunk { - unsigned int bin_lum[256]; - unsigned int bin_r[256]; - unsigned int bin_g[256]; - unsigned int bin_b[256]; - unsigned int bin_a[256]; + uint bin_lum[256]; + uint bin_r[256]; + uint bin_g[256]; + uint bin_b[256]; + uint bin_a[256]; float min[3], max[3]; } ScopesUpdateDataChunk; @@ -1474,20 +1474,20 @@ static void scopes_update_cb(void *__restrict userdata, Scopes *scopes = data->scopes; const ImBuf *ibuf = data->ibuf; struct ColormanageProcessor *cm_processor = data->cm_processor; - const unsigned char *display_buffer = data->display_buffer; + const uchar *display_buffer = data->display_buffer; const int ycc_mode = data->ycc_mode; ScopesUpdateDataChunk *data_chunk = tls->userdata_chunk; - unsigned int *bin_lum = data_chunk->bin_lum; - unsigned int *bin_r = data_chunk->bin_r; - unsigned int *bin_g = data_chunk->bin_g; - unsigned int *bin_b = data_chunk->bin_b; - unsigned int *bin_a = data_chunk->bin_a; + uint *bin_lum = data_chunk->bin_lum; + uint *bin_r = data_chunk->bin_r; + uint *bin_g = data_chunk->bin_g; + uint *bin_b = data_chunk->bin_b; + uint *bin_a = data_chunk->bin_a; float *min = data_chunk->min; float *max = data_chunk->max; const float *rf = NULL; - const unsigned char *rc = NULL; + const uchar *rc = NULL; const int rows_per_sample_line = ibuf->y / scopes->sample_lines; const int savedlines = y / rows_per_sample_line; const bool do_sample_line = (savedlines < scopes->sample_lines) && @@ -1571,16 +1571,16 @@ static void scopes_update_reduce(const void *__restrict UNUSED(userdata), ScopesUpdateDataChunk *join_chunk = chunk_join; const ScopesUpdateDataChunk *data_chunk = chunk; - unsigned int *bin_lum = join_chunk->bin_lum; - unsigned int *bin_r = join_chunk->bin_r; - unsigned int *bin_g = join_chunk->bin_g; - unsigned int *bin_b = join_chunk->bin_b; - unsigned int *bin_a = join_chunk->bin_a; - const unsigned int *bin_lum_c = data_chunk->bin_lum; - const unsigned int *bin_r_c = data_chunk->bin_r; - const unsigned int *bin_g_c = data_chunk->bin_g; - const unsigned int *bin_b_c = data_chunk->bin_b; - const unsigned int *bin_a_c = data_chunk->bin_a; + uint *bin_lum = join_chunk->bin_lum; + uint *bin_r = join_chunk->bin_r; + uint *bin_g = join_chunk->bin_g; + uint *bin_b = join_chunk->bin_b; + uint *bin_a = join_chunk->bin_a; + const uint *bin_lum_c = data_chunk->bin_lum; + const uint *bin_r_c = data_chunk->bin_r; + const uint *bin_g_c = data_chunk->bin_g; + const uint *bin_b_c = data_chunk->bin_b; + const uint *bin_a_c = data_chunk->bin_a; const float *min = data_chunk->min; const float *max = data_chunk->max; @@ -1609,9 +1609,9 @@ void BKE_scopes_update(Scopes *scopes, const ColorManagedDisplaySettings *display_settings) { int a; - unsigned int nl, na, nr, ng, nb; + uint nl, na, nr, ng, nb; double divl, diva, divr, divg, divb; - const unsigned char *display_buffer = NULL; + const uchar *display_buffer = NULL; int ycc_mode = -1; void *cache_handle = NULL; struct ColormanageProcessor *cm_processor = NULL; @@ -1696,7 +1696,7 @@ void BKE_scopes_update(Scopes *scopes, cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings); } else { - display_buffer = (const unsigned char *)IMB_display_buffer_acquire( + display_buffer = (const uchar *)IMB_display_buffer_acquire( ibuf, view_settings, display_settings, &cache_handle); } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index cd381e15635..a6a6a1ca28f 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2855,7 +2855,7 @@ static void actcon_get_tarmat(struct Depsgraph *depsgraph, axis = data->type - 20; } - BLI_assert((unsigned int)axis < 3); + BLI_assert((uint)axis < 3); /* Target defines the animation */ s = (vec[axis] - data->min) / (data->max - data->min); diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c index cbfaf2831d1..85e88996c0a 100644 --- a/source/blender/blenkernel/intern/customdata_file.c +++ b/source/blender/blenkernel/intern/customdata_file.c @@ -310,7 +310,7 @@ bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay) return (BLI_fseek(cdf->readf, offset, SEEK_SET) == 0); } -bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data) +bool cdf_read_data(CDataFile *cdf, uint size, void *data) { /* read data */ if (!fread(data, size, 1, cdf->readf)) { @@ -384,7 +384,7 @@ bool cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay)) return true; } -bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data) +bool cdf_write_data(CDataFile *cdf, uint size, void *data) { /* write data */ if (!fwrite(data, size, 1, cdf->writef)) { diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index a655e7e15c4..b5c3147b0f1 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -865,7 +865,7 @@ int BKE_defvert_find_shared(const MDeformVert *dvert_a, const MDeformVert *dvert { if (dvert_a->totweight && dvert_b->totweight) { MDeformWeight *dw = dvert_a->dw; - unsigned int i; + uint i; for (i = dvert_a->totweight; i != 0; i--, dw++) { if (dw->weight > 0.0f && BKE_defvert_find_weight(dvert_b, dw->def_nr) > 0.0f) { diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index f0726048647..03358f50d40 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2512,7 +2512,7 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa const MLoopTri *mlooptri = data->mlooptri; const MLoopUV *mloopuv = data->mloopuv; - const unsigned int *loop_idx = mlooptri[tri_index].tri; + const uint *loop_idx = mlooptri[tri_index].tri; /* Enumerate all edges of the triangle, rotating the vertex list accordingly. */ for (int edge_idx = 0; edge_idx < 3; edge_idx++) { @@ -2566,7 +2566,7 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa continue; } - const unsigned int *other_loop_idx = mlooptri[lt_index].tri; + const uint *other_loop_idx = mlooptri[lt_index].tri; /* Check edges for match, looping in the same order as the outer loop. */ for (int j = 0; j < 3; j++) { @@ -5339,12 +5339,12 @@ static void dynamic_paint_effect_drip_cb(void *__restrict userdata, float dir_factor, a_factor; const float speed_scale = eff_scale * force[index * 4 + 3] / bNeighs[n_idx].dist; - const unsigned int n_trgt = (unsigned int)n_target[n_idx]; + const uint n_trgt = (uint)n_target[n_idx]; /* Sort of spinlock, but only for given ePoint. * Since the odds a same ePoint is modified at the same time by several threads is very low, * this is much more efficient than a global spin lock. */ - const unsigned int epointlock_idx = n_trgt / 8; + const uint epointlock_idx = n_trgt / 8; const uint8_t epointlock_bitmask = 1 << (n_trgt & 7); /* 7 == 0b111 */ while (atomic_fetch_and_or_uint8(&point_locks[epointlock_idx], epointlock_bitmask) & epointlock_bitmask) { @@ -5391,7 +5391,7 @@ static void dynamic_paint_effect_drip_cb(void *__restrict userdata, } { - const unsigned int ppointlock_idx = index / 8; + const uint ppointlock_idx = index / 8; const uint8_t ppointlock_bitmask = 1 << (index & 7); /* 7 == 0b111 */ while (atomic_fetch_and_or_uint8(&point_locks[ppointlock_idx], ppointlock_bitmask) & ppointlock_bitmask) { @@ -6063,10 +6063,8 @@ static bool dynamicPaint_generateBakeData(DynamicPaintSurface *surface, /* Init bdata */ bData->bNormal = (struct PaintBakeNormal *)MEM_mallocN( sData->total_points * sizeof(struct PaintBakeNormal), "Dynamic Paint step data"); - bData->s_pos = MEM_mallocN(sData->total_points * sizeof(unsigned int), - "Dynamic Paint bData s_pos"); - bData->s_num = MEM_mallocN(sData->total_points * sizeof(unsigned int), - "Dynamic Paint bData s_num"); + bData->s_pos = MEM_mallocN(sData->total_points * sizeof(uint), "Dynamic Paint bData s_pos"); + bData->s_num = MEM_mallocN(sData->total_points * sizeof(uint), "Dynamic Paint bData s_num"); bData->realCoord = (struct Vec3f *)MEM_mallocN(surface_totalSamples(surface) * sizeof(Vec3f), "Dynamic Paint point coords"); bData->prev_verts = MEM_mallocN(canvasNumOfVerts * sizeof(MVert), @@ -6189,7 +6187,7 @@ static int dynamicPaint_doStep(Depsgraph *depsgraph, * Loop through surface's target paint objects and do painting */ { - unsigned int numobjects; + uint numobjects; Object **objects = BKE_collision_objects_create( depsgraph, NULL, surface->brush_group, &numobjects, eModifierType_DynamicPaint); diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c index edf3539681c..5e58a049135 100644 --- a/source/blender/blenkernel/intern/editmesh_bvh.c +++ b/source/blender/blenkernel/intern/editmesh_bvh.c @@ -551,7 +551,7 @@ static bool bmbvh_overlap_cb(void *userdata, int index_a, int index_b, int UNUSE BVHTreeOverlap *BKE_bmbvh_overlap(const BMBVHTree *bmtree_a, const BMBVHTree *bmtree_b, - unsigned int *r_overlap_tot) + uint *r_overlap_tot) { struct BMBVHTree_OverlapData data; @@ -572,7 +572,7 @@ static bool bmbvh_overlap_self_cb(void *userdata, int index_a, int index_b, int return false; } -BVHTreeOverlap *BKE_bmbvh_overlap_self(const BMBVHTree *bmtree, unsigned int *r_overlap_tot) +BVHTreeOverlap *BKE_bmbvh_overlap_self(const BMBVHTree *bmtree, uint *r_overlap_tot) { struct BMBVHTree_OverlapData data; diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 58350b8cda5..4b91efff08d 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1368,7 +1368,7 @@ void sort_time_fcurve(FCurve *fcu) bool test_time_fcurve(FCurve *fcu) { - unsigned int a; + uint a; /* Sanity checks. */ if (fcu == NULL) { @@ -1778,7 +1778,7 @@ static float fcurve_eval_keyframes_interpolate(FCurve *fcu, BezTriple *bezts, fl { const float eps = 1.e-8f; BezTriple *bezt, *prevbezt; - unsigned int a; + uint a; /* Evaltime occurs somewhere in the middle of the curve. */ bool exact = false; diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index f6082d886d9..8d6f8a06e8c 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1953,9 +1953,7 @@ bool BKE_gpencil_material_index_used(bGPdata *gpd, int index) return false; } -void BKE_gpencil_material_remap(struct bGPdata *gpd, - const unsigned int *remap, - unsigned int remap_len) +void BKE_gpencil_material_remap(struct bGPdata *gpd, const uint *remap, uint remap_len) { const short remap_len_short = (short)remap_len; diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c index bf224a9613e..a0a579e6d65 100644 --- a/source/blender/blenkernel/intern/gpencil_curve.c +++ b/source/blender/blenkernel/intern/gpencil_curve.c @@ -645,10 +645,10 @@ bGPDcurve *BKE_gpencil_stroke_editcurve_generate(bGPDstroke *gps, } float *r_cubic_array = NULL; - unsigned int r_cubic_array_len = 0; - unsigned int *r_cubic_orig_index = NULL; - unsigned int *r_corners_index_array = NULL; - unsigned int r_corners_index_len = 0; + uint r_cubic_array_len = 0; + uint *r_cubic_orig_index = NULL; + uint *r_corners_index_array = NULL; + uint r_corners_index_len = 0; int r = curve_fit_cubic_to_points_refit_fl(points, gps->totpoints, POINT_DIM, @@ -992,7 +992,7 @@ static float *gpencil_stroke_points_from_editcurve_fixed_resolu(bGPDcurve_point float(*r_points)[9] = MEM_callocN((stride * points_len * (is_cyclic ? 2 : 1)), __func__); float *points_offset = &r_points[0][0]; - for (unsigned int i = 0; i < array_last; i++) { + for (uint i = 0; i < array_last; i++) { bGPDcurve_point *cpt_curr = &curve_point_array[i]; bGPDcurve_point *cpt_next = &curve_point_array[i + 1]; diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index a0474d1ae7c..aef64247346 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -410,7 +410,7 @@ static void checker_board_text( } static void checker_board_color_prepare_slice( - unsigned char *rect, float *rect_float, int width, int height, int offset, int total_height) + uchar *rect, float *rect_float, int width, int height, int offset, int total_height) { checker_board_color_fill(rect, rect_float, width, height, offset, total_height); checker_board_color_tint(rect, rect_float, width, height, 1, 0.03f, offset); @@ -421,7 +421,7 @@ static void checker_board_color_prepare_slice( } typedef struct FillCheckerColorThreadData { - unsigned char *rect; + uchar *rect; float *rect_float; int width, height; } FillCheckerColorThreadData; @@ -431,16 +431,13 @@ static void checker_board_color_prepare_thread_do(void *data_v, int scanline) FillCheckerColorThreadData *data = (FillCheckerColorThreadData *)data_v; const int num_scanlines = 1; size_t offset = ((size_t)data->width) * scanline * 4; - unsigned char *rect = (data->rect != NULL) ? (data->rect + offset) : NULL; + uchar *rect = (data->rect != NULL) ? (data->rect + offset) : NULL; float *rect_float = (data->rect_float != NULL) ? (data->rect_float + offset) : NULL; checker_board_color_prepare_slice( rect, rect_float, data->width, num_scanlines, scanline, data->height); } -void BKE_image_buf_fill_checker_color(unsigned char *rect, - float *rect_float, - int width, - int height) +void BKE_image_buf_fill_checker_color(uchar *rect, float *rect_float, int width, int height) { if (((size_t)width) * height < 64 * 64) { checker_board_color_prepare_slice(rect, rect_float, width, height, 0, height); diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 40a5c08a068..6a8edde9c49 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1492,7 +1492,7 @@ static void icu_to_fcurves(ID *id, * 3) filter the keyframes for the flag of interest */ for (b = 0; b < totbits; b++, abp++) { - unsigned int i = 0; + uint i = 0; /* make a copy of existing base-data if not the last curve */ if (b < (totbits - 1)) { @@ -1562,7 +1562,7 @@ static void icu_to_fcurves(ID *id, } } else { - unsigned int i = 0; + uint i = 0; /* get rna-path * - we will need to set the 'disabled' flag if no path is able to be made (for now) diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 220b28a32f1..12472cf9dc5 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1686,7 +1686,7 @@ static void layer_collection_local_visibility_unset_recursive(LayerCollection *l static void layer_collection_local_sync(const Scene *scene, ViewLayer *view_layer, LayerCollection *layer_collection, - const unsigned short local_collections_uuid, + const ushort local_collections_uuid, bool visible) { if ((layer_collection->local_collections_bits & local_collections_uuid) == 0) { @@ -1718,7 +1718,7 @@ void BKE_layer_collection_local_sync(const Scene *scene, ViewLayer *view_layer, return; } - const unsigned short local_collections_uuid = v3d->local_collections_uuid; + const ushort local_collections_uuid = v3d->local_collections_uuid; /* Reset flags and set the bases visible by default. */ BKE_view_layer_synced_ensure(scene, view_layer); diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c index 7ece6946e00..e76c7894f9f 100644 --- a/source/blender/blenkernel/intern/mask_evaluate.c +++ b/source/blender/blenkernel/intern/mask_evaluate.c @@ -565,9 +565,9 @@ static float ( /** only called from #BKE_mask_spline_feather_differentiated_points_with_resolution() ! */ static float (*mask_spline_feather_differentiated_points_with_resolution__double( MaskSpline *spline, - const unsigned int resol, + const uint resol, const bool do_feather_isect, - unsigned int *r_tot_feather_point))[2] + uint *r_tot_feather_point))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); @@ -704,11 +704,11 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__double return feather; } -float (*BKE_mask_spline_feather_differentiated_points_with_resolution( - MaskSpline *spline, - const unsigned int resol, - const bool do_feather_isect, - unsigned int *r_tot_feather_point))[2] +float ( + *BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, + const uint resol, + const bool do_feather_isect, + uint *r_tot_feather_point))[2] { switch (spline->offset_mode) { case MASK_SPLINE_OFFSET_EVEN: @@ -768,14 +768,11 @@ float (*BKE_mask_spline_feather_points(MaskSpline *spline, int *r_tot_feather_po return feather; } -float *BKE_mask_point_segment_feather_diff(MaskSpline *spline, - MaskSplinePoint *point, - int width, - int height, - unsigned int *r_tot_feather_point) +float *BKE_mask_point_segment_feather_diff( + MaskSpline *spline, MaskSplinePoint *point, int width, int height, uint *r_tot_feather_point) { float *feather, *fp; - unsigned int resol = BKE_mask_spline_feather_resolution(spline, width, height); + uint resol = BKE_mask_spline_feather_resolution(spline, width, height); feather = fp = MEM_callocN(2 * resol * sizeof(float), "mask point spline feather diff points"); @@ -796,11 +793,8 @@ float *BKE_mask_point_segment_feather_diff(MaskSpline *spline, return feather; } -float *BKE_mask_point_segment_diff(MaskSpline *spline, - MaskSplinePoint *point, - int width, - int height, - unsigned int *r_tot_diff_point) +float *BKE_mask_point_segment_diff( + MaskSpline *spline, MaskSplinePoint *point, int width, int height, uint *r_tot_diff_point) { MaskSplinePoint *points_array = BKE_mask_spline_point_array_from_point(spline, point); diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 2bbf9e8d891..b9ea3eaba69 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -93,7 +93,7 @@ // printf("%u %u %u %u\n", _t[0], _t[1], _t[2], _t[3]); # define FACE_ASSERT(face, vert_max) \ { \ - unsigned int *_t = face; \ + uint *_t = face; \ BLI_assert(_t[0] < vert_max); \ BLI_assert(_t[1] < vert_max); \ BLI_assert(_t[2] < vert_max); \ @@ -493,7 +493,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) uint bucket_index = (layer->buckets_x * yi) + xi_min; for (xi = xi_min; xi <= xi_max; xi++, bucket_index++) { /* correct but do in outer loop */ - // unsigned int bucket_index = (layer->buckets_x * yi) + xi; + // uint bucket_index = (layer->buckets_x * yi) + xi; BLI_assert(xi < layer->buckets_x); BLI_assert(yi < layer->buckets_y); @@ -570,10 +570,10 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, const float zvec[3] = {0.0f, 0.0f, -1.0f}; MaskLayer *masklay; - unsigned int masklay_index; + uint masklay_index; MemArena *sf_arena; - mr_handle->layers_tot = (unsigned int)BLI_listbase_count(&mask->masklayers); + mr_handle->layers_tot = (uint)BLI_listbase_count(&mask->masklayers); mr_handle->layers = MEM_mallocN(sizeof(MaskRasterLayer) * mr_handle->layers_tot, "MaskRasterLayer"); BLI_rctf_init_minmax(&mr_handle->bounds); @@ -584,9 +584,9 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, masklay = masklay->next, masklay_index++) { /* we need to store vertex ranges for open splines for filling */ - unsigned int tot_splines; + uint tot_splines; MaskRasterSplineInfo *open_spline_ranges; - unsigned int open_spline_index = 0; + uint open_spline_index = 0; MaskSpline *spline; @@ -596,12 +596,12 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, ScanFillVert *sf_vert_next = NULL; ScanFillFace *sf_tri; - unsigned int sf_vert_tot = 0; - unsigned int tot_feather_quads = 0; + uint sf_vert_tot = 0; + uint tot_feather_quads = 0; #ifdef USE_SCANFILL_EDGE_WORKAROUND - unsigned int tot_boundary_used = 0; - unsigned int tot_boundary_found = 0; + uint tot_boundary_used = 0; + uint tot_boundary_found = 0; #endif if (masklay->visibility_flag & MASK_HIDE_RENDER) { @@ -611,7 +611,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, continue; } - tot_splines = (unsigned int)BLI_listbase_count(&masklay->splines); + tot_splines = (uint)BLI_listbase_count(&masklay->splines); open_spline_ranges = MEM_callocN(sizeof(*open_spline_ranges) * tot_splines, __func__); BLI_scanfill_begin_arena(&sf_ctx, sf_arena); @@ -621,15 +621,15 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, const bool is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0; float(*diff_points)[2]; - unsigned int tot_diff_point; + uint tot_diff_point; float(*diff_feather_points)[2]; float(*diff_feather_points_flip)[2]; - unsigned int tot_diff_feather_points; + uint tot_diff_feather_points; - const unsigned int resol_a = BKE_mask_spline_resolution(spline, width, height) / 4; - const unsigned int resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4; - const unsigned int resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512); + const uint resol_a = BKE_mask_spline_resolution(spline, width, height) / 4; + const uint resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4; + const uint resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512); diff_points = BKE_mask_spline_differentiate_with_resolution(spline, resol, &tot_diff_point); @@ -645,7 +645,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, if (tot_diff_point > 3) { ScanFillVert *sf_vert_prev; - unsigned int j; + uint j; sf_ctx.poly_nr++; @@ -828,19 +828,18 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, const float *fp_cent; const float *fp_turn; - unsigned int k; + uint k; fp_cent = diff_points[0]; fp_turn = diff_feather_points[0]; #define CALC_CAP_RESOL \ - clampis_uint( \ - (unsigned int)(len_v2v2(fp_cent, fp_turn) / (pixel_size * SPLINE_RESOL_CAP_PER_PIXEL)), \ - SPLINE_RESOL_CAP_MIN, \ - SPLINE_RESOL_CAP_MAX) + clampis_uint((uint)(len_v2v2(fp_cent, fp_turn) / (pixel_size * SPLINE_RESOL_CAP_PER_PIXEL)), \ + SPLINE_RESOL_CAP_MIN, \ + SPLINE_RESOL_CAP_MAX) { - const unsigned int vertex_total_cap = CALC_CAP_RESOL; + const uint vertex_total_cap = CALC_CAP_RESOL; for (k = 1; k < vertex_total_cap; k++) { const float angle = (float)k * (1.0f / (float)vertex_total_cap) * (float)M_PI; @@ -861,7 +860,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, fp_turn = diff_feather_points[tot_diff_point - 1]; { - const unsigned int vertex_total_cap = CALC_CAP_RESOL; + const uint vertex_total_cap = CALC_CAP_RESOL; for (k = 1; k < vertex_total_cap; k++) { const float angle = (float)k * (1.0f / (float)vertex_total_cap) * (float)M_PI; @@ -898,11 +897,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, } { - unsigned int(*face_array)[4], *face; /* access coords */ - float(*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */ - unsigned int sf_tri_tot; + uint(*face_array)[4], *face; /* access coords */ + float(*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */ + uint sf_tri_tot; rctf bounds; - unsigned int face_index; + uint face_index; int scanfill_flag = 0; bool is_isect = false; @@ -939,8 +938,8 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, if ((masklay->flag & MASK_LAYERFLAG_FILL_OVERLAP) && (is_isect = BLI_scanfill_calc_self_isect( &sf_ctx, &isect_remvertbase, &isect_remedgebase))) { - unsigned int sf_vert_tot_isect = (unsigned int)BLI_listbase_count(&sf_ctx.fillvertbase); - unsigned int i = sf_vert_tot; + uint sf_vert_tot_isect = (uint)BLI_listbase_count(&sf_ctx.fillvertbase); + uint i = sf_vert_tot; face_coords = MEM_reallocN(face_coords, sizeof(float[3]) * (sf_vert_tot + sf_vert_tot_isect)); @@ -965,7 +964,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, scanfill_flag |= BLI_SCANFILL_CALC_HOLES; } - sf_tri_tot = (unsigned int)BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, zvec); + sf_tri_tot = (uint)BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, zvec); if (is_isect) { /* add removed data back, we only need edges for feather, @@ -980,7 +979,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, face_index = 0; /* faces */ - face = (unsigned int *)face_array; + face = (uint *)face_array; for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) { *(face++) = sf_tri->v3->tmp.u; *(face++) = sf_tri->v2->tmp.u; @@ -1022,13 +1021,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, /* feather only splines */ while (open_spline_index > 0) { - const unsigned int vertex_offset = open_spline_ranges[--open_spline_index].vertex_offset; - unsigned int vertex_total = open_spline_ranges[open_spline_index].vertex_total; - unsigned int vertex_total_cap_head = - open_spline_ranges[open_spline_index].vertex_total_cap_head; - unsigned int vertex_total_cap_tail = - open_spline_ranges[open_spline_index].vertex_total_cap_tail; - unsigned int k, j; + const uint vertex_offset = open_spline_ranges[--open_spline_index].vertex_offset; + uint vertex_total = open_spline_ranges[open_spline_index].vertex_total; + uint vertex_total_cap_head = open_spline_ranges[open_spline_index].vertex_total_cap_head; + uint vertex_total_cap_tail = open_spline_ranges[open_spline_index].vertex_total_cap_tail; + uint k, j; j = vertex_offset; @@ -1068,7 +1065,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, FACE_ASSERT(face - 4, sf_vert_tot); } else { - unsigned int midvidx = vertex_offset; + uint midvidx = vertex_offset; /*************** * cap end 'a' */ @@ -1222,7 +1219,7 @@ static float maskrasterize_layer_z_depth_quad( return w[2] + w[3]; /* we can make this assumption for small speedup */ } -static float maskrasterize_layer_isect(const unsigned int *face, +static float maskrasterize_layer_isect(const uint *face, float (*cos)[3], const float dist_orig, const float xy[2]) @@ -1281,22 +1278,21 @@ static float maskrasterize_layer_isect(const unsigned int *face, return 1.0f; } -BLI_INLINE unsigned int layer_bucket_index_from_xy(MaskRasterLayer *layer, const float xy[2]) +BLI_INLINE uint layer_bucket_index_from_xy(MaskRasterLayer *layer, const float xy[2]) { BLI_assert(BLI_rctf_isect_pt_v(&layer->bounds, xy)); - return ((unsigned int)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0])) + - (((unsigned int)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1])) * - layer->buckets_x); + return ((uint)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0])) + + (((uint)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1])) * layer->buckets_x); } static float layer_bucket_depth_from_xy(MaskRasterLayer *layer, const float xy[2]) { - unsigned int index = layer_bucket_index_from_xy(layer, xy); - unsigned int *face_index = layer->buckets_face[index]; + uint index = layer_bucket_index_from_xy(layer, xy); + uint *face_index = layer->buckets_face[index]; if (face_index) { - unsigned int(*face_array)[4] = layer->face_array; + uint(*face_array)[4] = layer->face_array; float(*cos)[3] = layer->face_coords; float best_dist = 1.0f; while (*face_index != TRI_TERMINATOR_ID) { @@ -1323,7 +1319,7 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x /* can't do this because some layers may invert */ /* if (BLI_rctf_isect_pt_v(&mr_handle->bounds, xy)) */ - const unsigned int layers_tot = mr_handle->layers_tot; + const uint layers_tot = mr_handle->layers_tot; MaskRasterLayer *layer = mr_handle->layers; /* return value */ @@ -1448,8 +1444,8 @@ static void maskrasterize_buffer_cb(void *__restrict userdata, } void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, - const unsigned int width, - const unsigned int height, + const uint width, + const uint height, /* Cannot be const, because it is assigned to non-const variable. * NOLINTNEXTLINE: readability-non-const-parameter. */ float *buffer) diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index 809f58f1c4c..1bb50c2c97f 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -1076,7 +1076,7 @@ static void closest_latice(int r[3], const float pos[3], const float size) /** * Find at most 26 cubes to start polygonization from. */ -static void find_first_points(PROCESS *process, const unsigned int em) +static void find_first_points(PROCESS *process, const uint em) { const MetaElem *ml; int center[3], lbn[3], rtf[3], it[3], dir[3], add[3]; @@ -1164,7 +1164,7 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje MetaBall *mb; const MetaElem *ml; float obinv[4][4], obmat[4][4]; - unsigned int i; + uint i; int obnr, zero_size = 0; char obname[MAX_ID_NAME]; SceneBaseIter iter; diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c index d63d064eb3c..cb05d33bc2e 100644 --- a/source/blender/blenkernel/intern/mesh_remap.c +++ b/source/blender/blenkernel/intern/mesh_remap.c @@ -1050,7 +1050,7 @@ static void mesh_island_to_astar_graph_edge_process(MeshIslandStore *islands, const bool is_edge_innercut, const int *poly_island_index_map, float (*poly_centers)[3], - unsigned char *poly_status) + uchar *poly_status) { int *poly_island_indices = BLI_array_alloca(poly_island_indices, (size_t)edge_to_poly_map[edge_idx].count); @@ -1114,7 +1114,7 @@ static void mesh_island_to_astar_graph(MeshIslandStore *islands, BLI_bitmap *done_edges = BLI_BITMAP_NEW(numedges, __func__); const int node_num = islands ? island_poly_map->count : numpolys; - unsigned char *poly_status = MEM_callocN(sizeof(*poly_status) * (size_t)node_num, __func__); + uchar *poly_status = MEM_callocN(sizeof(*poly_status) * (size_t)node_num, __func__); float(*poly_centers)[3]; int pidx_isld; diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c index a72d68710ed..c1fe10dca6b 100644 --- a/source/blender/blenkernel/intern/object_deform.c +++ b/source/blender/blenkernel/intern/object_deform.c @@ -613,7 +613,7 @@ bool *BKE_object_defgroup_selected_get(Object *ob, int defbase_tot, int *r_dg_fl { bool *dg_selection = MEM_mallocN(defbase_tot * sizeof(bool), __func__); bDeformGroup *defgroup; - unsigned int i; + uint i; Object *armob = BKE_object_pose_armature_get(ob); (*r_dg_flags_sel_tot) = 0; @@ -700,7 +700,7 @@ void BKE_object_defgroup_mirror_selection(struct Object *ob, const ListBase *defbase = BKE_object_defgroup_list(ob); bDeformGroup *defgroup; - unsigned int i; + uint i; int i_mirr; for (i = 0, defgroup = defbase->first; i < defbase_tot && defgroup; diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index cd1f24fee37..c142f096395 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -915,7 +915,7 @@ bool BKE_ocean_init(struct Ocean *o, /* This ensures we get a value tied to the surface location, avoiding dramatic surface * change with changing resolution. * Explicitly cast to signed int first to ensure consistent behavior on all processors, - * since behavior of float to unsigned int cast is undefined in C. */ + * since behavior of `float` to `uint` cast is undefined in C. */ const int hash_x = o->_kx[i] * 360.0f; const int hash_z = o->_kz[j] * 360.0f; int new_seed = seed + BLI_hash_int_2d(hash_x, hash_z); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 4acd65750bf..5ec69f9bc45 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1951,9 +1951,9 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra) if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS) { for (i = 0; i < BPHYS_TOT_DATA; i++) { - unsigned int out_len = pm->totpoint * ptcache_data_size[i]; + uint out_len = pm->totpoint * ptcache_data_size[i]; if (pf->data_types & (1 << i)) { - ptcache_file_compressed_read(pf, (unsigned char *)(pm->data[i]), out_len); + ptcache_file_compressed_read(pf, (uchar *)(pm->data[i]), out_len); } } } @@ -1974,22 +1974,21 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra) } if (!error && pf->flag & PTCACHE_TYPEFLAG_EXTRADATA) { - unsigned int extratype = 0; + uint extratype = 0; - while (ptcache_file_read(pf, &extratype, 1, sizeof(unsigned int))) { + while (ptcache_file_read(pf, &extratype, 1, sizeof(uint))) { PTCacheExtra *extra = MEM_callocN(sizeof(PTCacheExtra), "Pointcache extradata"); extra->type = extratype; - ptcache_file_read(pf, &extra->totdata, 1, sizeof(unsigned int)); + ptcache_file_read(pf, &extra->totdata, 1, sizeof(uint)); extra->data = MEM_callocN(extra->totdata * ptcache_extra_datasize[extra->type], "Pointcache extradata->data"); if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS) { - ptcache_file_compressed_read(pf, - (unsigned char *)(extra->data), - extra->totdata * ptcache_extra_datasize[extra->type]); + ptcache_file_compressed_read( + pf, (uchar *)(extra->data), extra->totdata * ptcache_extra_datasize[extra->type]); } else { ptcache_file_read(pf, extra->data, extra->totdata, ptcache_extra_datasize[extra->type]); @@ -2016,7 +2015,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra) static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) { PTCacheFile *pf = NULL; - unsigned int i, error = 0; + uint i, error = 0; BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, pm->frame); @@ -2050,11 +2049,10 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) if (pid->cache->compression) { for (i = 0; i < BPHYS_TOT_DATA; i++) { if (pm->data[i]) { - unsigned int in_len = pm->totpoint * ptcache_data_size[i]; - unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len) * 4, - "pointcache_lzo_buffer"); + uint in_len = pm->totpoint * ptcache_data_size[i]; + uchar *out = (uchar *)MEM_callocN(LZO_OUT_LEN(in_len) * 4, "pointcache_lzo_buffer"); ptcache_file_compressed_write( - pf, (unsigned char *)(pm->data[i]), in_len, out, pid->cache->compression); + pf, (uchar *)(pm->data[i]), in_len, out, pid->cache->compression); MEM_freeN(out); } } @@ -2083,15 +2081,14 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) continue; } - ptcache_file_write(pf, &extra->type, 1, sizeof(unsigned int)); - ptcache_file_write(pf, &extra->totdata, 1, sizeof(unsigned int)); + ptcache_file_write(pf, &extra->type, 1, sizeof(uint)); + ptcache_file_write(pf, &extra->totdata, 1, sizeof(uint)); if (pid->cache->compression) { - unsigned int in_len = extra->totdata * ptcache_extra_datasize[extra->type]; - unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len) * 4, - "pointcache_lzo_buffer"); + uint in_len = extra->totdata * ptcache_extra_datasize[extra->type]; + uchar *out = (uchar *)MEM_callocN(LZO_OUT_LEN(in_len) * 4, "pointcache_lzo_buffer"); ptcache_file_compressed_write( - pf, (unsigned char *)(extra->data), in_len, out, pid->cache->compression); + pf, (uchar *)(extra->data), in_len, out, pid->cache->compression); MEM_freeN(out); } else { @@ -2531,7 +2528,7 @@ static int ptcache_write_needed(PTCacheID *pid, int cfra, int *overwrite) return 0; } -int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra) +int BKE_ptcache_write(PTCacheID *pid, uint cfra) { PointCache *cache = pid->cache; if (!pid->totpoint) { @@ -2583,10 +2580,10 @@ int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra) /* Clears & resets. */ -void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) +void BKE_ptcache_id_clear(PTCacheID *pid, int mode, uint cfra) { - unsigned int len; /* store the length of the string */ - unsigned int sta, end; + uint len; /* store the length of the string */ + uint sta, end; /* mode is same as fopen's modes */ DIR *dir; @@ -2808,8 +2805,8 @@ void BKE_ptcache_id_time( } if (cache->cached_frames == NULL && cache->endframe > cache->startframe) { - unsigned int sta = cache->startframe; - unsigned int end = cache->endframe; + uint sta = cache->startframe; + uint end = cache->endframe; cache->cached_frames_len = cache->endframe - cache->startframe + 1; cache->cached_frames = MEM_callocN(sizeof(char) * cache->cached_frames_len, @@ -2822,7 +2819,7 @@ void BKE_ptcache_id_time( char path[MAX_PTCACHE_PATH]; char filepath[MAX_PTCACHE_FILE]; char ext[MAX_PTCACHE_PATH]; - unsigned int len; /* store the length of the string */ + uint len; /* store the length of the string */ ptcache_path(pid, path); diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 2705241425b..6b4cddb05f2 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -2261,7 +2261,7 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime /* write cache for current frame */ BKE_ptcache_validate(cache, (int)ctime); - BKE_ptcache_write(&pid, (unsigned int)ctime); + BKE_ptcache_write(&pid, (uint)ctime); rbw->ltime = ctime; } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 6e23ca0e89f..d08fba0e657 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -556,7 +556,7 @@ static void sound_load_audio(Main *bmain, bSound *sound, bool free_waveform) /* but we need a packed file then */ if (pf) { - sound->handle = AUD_Sound_bufferFile((unsigned char *)pf->data, pf->size); + sound->handle = AUD_Sound_bufferFile((uchar *)pf->data, pf->size); } else { /* or else load it from disk */ diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 97b9218ce52..c37f4b1ea2f 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -327,7 +327,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, int nverts = mp->totloop; int j, j_next; CCGFace *origf = ccgSubSurf_getFace(origss, POINTER_FROM_INT(i)); - /* unsigned int *fv = &mp->v1; */ + /* uint *fv = &mp->v1; */ MLoop *ml = mloop + mp->loopstart; #ifdef USE_DYNSIZE diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 98c401aacb0..c32ab64c478 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1757,7 +1757,7 @@ void txt_duplicate_line(Text *text) void txt_delete_char(Text *text) { - unsigned int c = '\n'; + uint c = '\n'; if (!text->curl) { return; @@ -1805,7 +1805,7 @@ void txt_delete_word(Text *text) void txt_backspace_char(Text *text) { - unsigned int c = '\n'; + uint c = '\n'; if (!text->curl) { return; @@ -1873,7 +1873,7 @@ static void txt_convert_tab_to_spaces(Text *text) txt_insert_buf(text, sb, strlen(sb)); } -static bool txt_add_char_intern(Text *text, unsigned int add, bool replace_tabs) +static bool txt_add_char_intern(Text *text, uint add, bool replace_tabs) { char *tmp, ch[BLI_UTF8_MAX]; size_t add_len; @@ -1916,12 +1916,12 @@ static bool txt_add_char_intern(Text *text, unsigned int add, bool replace_tabs) return 1; } -bool txt_add_char(Text *text, unsigned int add) +bool txt_add_char(Text *text, uint add) { return txt_add_char_intern(text, add, (text->flags & TXT_TABSTOSPACES) != 0); } -bool txt_add_raw_char(Text *text, unsigned int add) +bool txt_add_raw_char(Text *text, uint add) { return txt_add_char_intern(text, add, 0); } @@ -1932,9 +1932,9 @@ void txt_delete_selected(Text *text) txt_make_dirty(text); } -bool txt_replace_char(Text *text, unsigned int add) +bool txt_replace_char(Text *text, uint add) { - unsigned int del; + uint del; size_t del_size = 0, add_size; char ch[BLI_UTF8_MAX]; @@ -2361,12 +2361,12 @@ bool text_check_identifier_nodigit(const char ch) } #ifndef WITH_PYTHON -int text_check_identifier_unicode(const unsigned int ch) +int text_check_identifier_unicode(const uint ch) { - return (ch < 255 && text_check_identifier((unsigned int)ch)); + return (ch < 255 && text_check_identifier((uint)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)); } diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index cd1af5a8de4..c6efe235172 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2396,21 +2396,21 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, else { if (undistort) { libmv_cameraIntrinsicsUndistortByte(distortion->intrinsics, - (unsigned char *)ibuf->rect, + (uchar *)ibuf->rect, ibuf->x, ibuf->y, overscan, ibuf->channels, - (unsigned char *)resibuf->rect); + (uchar *)resibuf->rect); } else { libmv_cameraIntrinsicsDistortByte(distortion->intrinsics, - (unsigned char *)ibuf->rect, + (uchar *)ibuf->rect, ibuf->x, ibuf->y, overscan, ibuf->channels, - (unsigned char *)resibuf->rect); + (uchar *)resibuf->rect); } } @@ -2693,7 +2693,7 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, &warped_position_y); } else { - libmv_samplePlanarPatchByte((unsigned char *)search_ibuf->rect, + libmv_samplePlanarPatchByte((uchar *)search_ibuf->rect, search_ibuf->x, search_ibuf->y, 4, @@ -2702,7 +2702,7 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, num_samples_x, num_samples_y, mask, - (unsigned char *)pattern_ibuf->rect, + (uchar *)pattern_ibuf->rect, &warped_position_x, &warped_position_y); } @@ -2868,7 +2868,7 @@ ImBuf *BKE_tracking_get_plane_imbuf(const ImBuf *frame_ibuf, &warped_position_y); } else { - libmv_samplePlanarPatchByte((unsigned char *)frame_ibuf->rect, + libmv_samplePlanarPatchByte((uchar *)frame_ibuf->rect, frame_ibuf->x, frame_ibuf->y, 4, @@ -2877,7 +2877,7 @@ ImBuf *BKE_tracking_get_plane_imbuf(const ImBuf *frame_ibuf, num_samples_x, num_samples_y, NULL, - (unsigned char *)plane_ibuf->rect, + (uchar *)plane_ibuf->rect, &warped_position_x, &warped_position_y); } diff --git a/source/blender/blenkernel/intern/tracking_detect.c b/source/blender/blenkernel/intern/tracking_detect.c index 540f880905d..910d02ef50a 100644 --- a/source/blender/blenkernel/intern/tracking_detect.c +++ b/source/blender/blenkernel/intern/tracking_detect.c @@ -121,7 +121,7 @@ static void run_configured_detector(MovieTracking *tracking, features = libmv_detectFeaturesFloat(ibuf->rect_float, ibuf->x, ibuf->y, 4, options); } else if (ibuf->rect) { - features = libmv_detectFeaturesByte((unsigned char *)ibuf->rect, ibuf->x, ibuf->y, 4, options); + features = libmv_detectFeaturesByte((uchar *)ibuf->rect, ibuf->x, ibuf->y, 4, options); } if (features != NULL) { diff --git a/source/blender/blenkernel/intern/tracking_util.c b/source/blender/blenkernel/intern/tracking_util.c index e97aa49f4ca..aaf262d120b 100644 --- a/source/blender/blenkernel/intern/tracking_util.c +++ b/source/blender/blenkernel/intern/tracking_util.c @@ -723,7 +723,7 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor, int dst_index = (dst_y * width + dst_x) * 4, src_index = (src_y * orig_ibuf->x + src_x) * 4; rgba_uchar_to_float(final_ibuf->rect_float + dst_index, - (unsigned char *)orig_ibuf->rect + src_index); + (uchar *)orig_ibuf->rect + src_index); } } } diff --git a/source/blender/blenkernel/intern/vfont.c b/source/blender/blenkernel/intern/vfont.c index 7e321a9d500..0e04da246fc 100644 --- a/source/blender/blenkernel/intern/vfont.c +++ b/source/blender/blenkernel/intern/vfont.c @@ -1505,7 +1505,7 @@ static bool vfont_to_curve(Object *ob, ct = chartransdata; for (i = 0; i < slen; i++) { - unsigned int cha = (unsigned int)mem[i]; + uint cha = (uint)mem[i]; info = &(custrinfo[i]); if ((cu->overflow == CU_OVERFLOW_TRUNCATE) && (ob && ob->mode != OB_MODE_EDIT) && diff --git a/source/blender/blenkernel/intern/vfontdata_freetype.c b/source/blender/blenkernel/intern/vfontdata_freetype.c index 79d9b64b0f6..30e5f29e6a8 100644 --- a/source/blender/blenkernel/intern/vfontdata_freetype.c +++ b/source/blender/blenkernel/intern/vfontdata_freetype.c @@ -418,7 +418,7 @@ VFontData *BKE_vfontdata_copy(const VFontData *vfont_src, const int UNUSED(flag) return vfont_dst; } -VChar *BKE_vfontdata_char_from_freetypefont(VFont *vfont, unsigned long character) +VChar *BKE_vfontdata_char_from_freetypefont(VFont *vfont, ulong character) { VChar *che = NULL; diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index f4de82824c1..dbdf8cc395d 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -237,7 +237,7 @@ static int append_avi(void *context_v, const char *UNUSED(suffix), ReportList *UNUSED(reports)) { - unsigned int *rt1, *rt2, *rectot; + uint *rt1, *rt2, *rectot; int x, y; char *cp, rt; AviMovie *avi = context_v; @@ -249,7 +249,7 @@ static int append_avi(void *context_v, /* note that libavi free's the buffer... stupid interface - zr */ rectot = MEM_mallocN(rectx * recty * sizeof(int), "rectot"); rt1 = rectot; - rt2 = (unsigned int *)pixels + (recty - 1) * rectx; + rt2 = (uint *)pixels + (recty - 1) * rectx; /* flip y and convert to abgr */ for (y = 0; y < recty; y++, rt1 += rectx, rt2 -= rectx) { memcpy(rt1, rt2, rectx * sizeof(int)); diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 5593625ed89..99df07b6105 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1282,7 +1282,7 @@ int BKE_ffmpeg_append(void *context_v, PRINT("Writing frame %i, render width=%d, render height=%d\n", frame, rectx, recty); if (context->video_stream) { - avframe = generate_video_frame(context, (unsigned char *)pixels); + avframe = generate_video_frame(context, (uchar *)pixels); success = (avframe && write_video_frame(context, avframe, reports)); # ifdef WITH_AUDASPACE /* Add +1 frame because we want to encode audio up until the next video frame. */ diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index 526c14d5e33..37636ef1cf1 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -395,9 +395,9 @@ void BLI_filelist_entry_duplicate(struct direntry *dst, const struct direntry *s void BLI_filelist_duplicate(struct direntry **dest_filelist, struct direntry *const src_filelist, - const unsigned int nrentries) + const uint nrentries) { - unsigned int i; + uint i; *dest_filelist = MEM_mallocN(sizeof(**dest_filelist) * (size_t)(nrentries), __func__); for (i = 0; i < nrentries; i++) { @@ -417,9 +417,9 @@ void BLI_filelist_entry_free(struct direntry *entry) } } -void BLI_filelist_free(struct direntry *filelist, const unsigned int nrentries) +void BLI_filelist_free(struct direntry *filelist, const uint nrentries) { - unsigned int i; + uint i; for (i = 0; i < nrentries; i++) { BLI_filelist_entry_free(&filelist[i]); } diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c index f423eff60cb..3c353a1c8c8 100644 --- a/source/blender/blenlib/intern/BLI_memarena.c +++ b/source/blender/blenlib/intern/BLI_memarena.c @@ -209,7 +209,7 @@ void BLI_memarena_merge(MemArena *ma_dst, MemArena *ma_src) void BLI_memarena_clear(MemArena *ma) { if (ma->bufs) { - unsigned char *curbuf_prev; + uchar *curbuf_prev; size_t curbuf_used; if (ma->bufs->next) { diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c index 9a8bda48c8d..bb57dc18534 100644 --- a/source/blender/blenlib/intern/array_store.c +++ b/source/blender/blenlib/intern/array_store.c @@ -736,17 +736,17 @@ static void bchunk_list_fill_from_array(const BArrayInfo *info, BLI_INLINE uint hash_data_single(const uchar p) { - return ((HASH_INIT << 5) + HASH_INIT) + (unsigned int)(*((signed char *)&p)); + return ((HASH_INIT << 5) + HASH_INIT) + (uint)(*((signed char *)&p)); } /* hash bytes, from BLI_ghashutil_strhash_n */ static uint hash_data(const uchar *key, size_t n) { const signed char *p; - unsigned int h = HASH_INIT; + uint h = HASH_INIT; for (p = (const signed char *)key; n--; p++) { - h = ((h << 5) + h) + (unsigned int)*p; + h = (uint)((h << 5) + h) + (uint)*p; } return h; diff --git a/source/blender/blenlib/intern/convexhull_2d.c b/source/blender/blenlib/intern/convexhull_2d.c index 33d1a68a76e..ee5d000b72f 100644 --- a/source/blender/blenlib/intern/convexhull_2d.c +++ b/source/blender/blenlib/intern/convexhull_2d.c @@ -202,9 +202,9 @@ int BLI_convexhull_2d(const float (*points)[2], const int n, int r_points[]) /** \name Utility Convex-Hull Functions * \{ */ -float BLI_convexhull_aabb_fit_hull_2d(const float (*points_hull)[2], unsigned int n) +float BLI_convexhull_aabb_fit_hull_2d(const float (*points_hull)[2], uint n) { - unsigned int i, i_prev; + uint i, i_prev; float area_best = FLT_MAX; float dvec_best[2]; /* best angle, delay atan2 */ @@ -218,7 +218,7 @@ float BLI_convexhull_aabb_fit_hull_2d(const float (*points_hull)[2], unsigned in if (normalize_v2(dvec) != 0.0f) { /* rotation matrix */ float min[2] = {FLT_MAX, FLT_MAX}, max[2] = {-FLT_MAX, -FLT_MAX}; - unsigned int j; + uint j; float area; for (j = 0; j < n; j++) { @@ -249,7 +249,7 @@ float BLI_convexhull_aabb_fit_hull_2d(const float (*points_hull)[2], unsigned in return (area_best != FLT_MAX) ? atan2f(dvec_best[0], dvec_best[1]) : 0.0f; } -float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], unsigned int n) +float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], uint n) { int *index_map; int points_hull_num; @@ -269,7 +269,7 @@ float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], unsigned int n copy_v2_v2(points_hull[j], points[index_map[j]]); } - angle = BLI_convexhull_aabb_fit_hull_2d(points_hull, (unsigned int)points_hull_num); + angle = BLI_convexhull_aabb_fit_hull_2d(points_hull, (uint)points_hull_num); MEM_freeN(points_hull); } else { diff --git a/source/blender/blenlib/intern/hash_mm3.c b/source/blender/blenlib/intern/hash_mm3.c index cc1143bf55f..3c05ead5e62 100644 --- a/source/blender/blenlib/intern/hash_mm3.c +++ b/source/blender/blenlib/intern/hash_mm3.c @@ -69,7 +69,7 @@ BLI_INLINE uint64_t fmix64(uint64_t k) return k; } -uint32_t BLI_hash_mm3(const unsigned char *data, size_t len, uint32_t seed) +uint32_t BLI_hash_mm3(const uchar *data, size_t len, uint32_t seed) { const uint8_t *in_data = (const uint8_t *)data; const int nblocks = len / 4; diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 2da8d3d7bc8..2a003100c7a 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2696,7 +2696,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], z = x + y - (a * c - b * b); if (z <= 0.0f && (x >= 0.0f && y >= 0.0f)) { - //(((unsigned int)z)& ~(((unsigned int)x)|((unsigned int)y))) & 0x80000000) { + //(((uint)z)& ~(((uint)x)|((uint)y))) & 0x80000000) { *r_lambda = t0; copy_v3_v3(ipoint, point); return true; @@ -5803,10 +5803,10 @@ bool is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], return (isect_seg_seg_v2(v1, v3, v2, v4) > 0); } -bool is_poly_convex_v2(const float verts[][2], unsigned int nr) +bool is_poly_convex_v2(const float verts[][2], uint nr) { - unsigned int sign_flag = 0; - unsigned int a; + uint sign_flag = 0; + uint a; const float *co_curr, *co_prev; float dir_curr[2], dir_prev[2]; diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index 6867c2ac022..4feb1d5ee56 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -174,7 +174,7 @@ BLI_INLINE void bicubic_interpolation(const uchar *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); } @@ -669,7 +669,7 @@ void BLI_ewa_filter(const int width, for (u = u1; u <= u2; u++) { if (Q < (float)(EWA_MAXIDX + 1)) { float tc[4]; - const float wt = EWA_WTS[(Q < 0.0f) ? 0 : (unsigned int)Q]; + const float wt = EWA_WTS[(Q < 0.0f) ? 0 : (uint)Q]; read_pixel_cb(userdata, u, v, tc); madd_v3_v3fl(result, tc, wt); result[3] += use_alpha ? tc[3] * wt : 0.0f; diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 182c21ca76c..c03243acb26 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1115,7 +1115,7 @@ static float BLI_cellNoiseU(float x, float y, float z) int xi = (int)(floor(x)); int yi = (int)(floor(y)); int zi = (int)(floor(z)); - unsigned int n = xi + yi * 1301 + zi * 314159; + uint n = xi + yi * 1301 + zi * 314159; n ^= (n << 13); return ((float)(n * (n * n * 15731 + 789221) + 1376312589) / 4294967296.0f); } diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 00ac1c0ecd7..4145125c1d7 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -805,7 +805,7 @@ void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, MemArena *arena) BLI_listbase_clear(&sf_ctx->fillfacebase); } -unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float nor_proj[3]) +uint BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float nor_proj[3]) { /* * - fill works with its own lists, so create that first (no faces!) @@ -820,8 +820,8 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const ScanFillEdge *eed, *eed_next; PolyFill *pflist, *pf; float *min_xy_p, *max_xy_p; - unsigned int totfaces = 0; /* total faces added */ - unsigned short a, c, poly = 0; + uint totfaces = 0; /* total faces added */ + ushort a, c, poly = 0; bool ok; float mat_2d[3][3]; @@ -890,7 +890,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const /* STEP 1: COUNT POLYS */ if (sf_ctx->poly_nr != SF_POLY_UNSET) { - poly = (unsigned short)(sf_ctx->poly_nr + 1); + poly = (ushort)(sf_ctx->poly_nr + 1); sf_ctx->poly_nr = SF_POLY_UNSET; } @@ -900,7 +900,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const /* get first vertex with no poly number */ if (eve->poly_nr == SF_POLY_UNSET) { - unsigned int toggle = 0; + uint toggle = 0; /* now a sort of select connected */ ok = true; eve->poly_nr = poly; @@ -957,7 +957,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const /* STEP 2: remove loose edges and strings of edges */ if (flag & BLI_SCANFILL_CALC_LOOSE) { - unsigned int toggle = 0; + uint toggle = 0; for (eed = sf_ctx->filledgebase.first; eed; eed = eed->next) { if (eed->v1->edge_count++ > 250) { break; @@ -1064,7 +1064,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const * WATCH IT: ONLY WORKS WITH SORTED POLYS!!! */ if ((flag & BLI_SCANFILL_CALC_HOLES) && (poly > 1)) { - unsigned short *polycache, *pc; + ushort *polycache, *pc; /* so, sort first */ qsort(pflist, (size_t)poly, sizeof(PolyFill), vergpoly); @@ -1081,7 +1081,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const polycache = pc = MEM_callocN(sizeof(*polycache) * (size_t)poly, "polycache"); pf = pflist; for (a = 0; a < poly; a++, pf++) { - for (c = (unsigned short)(a + 1); c < poly; c++) { + for (c = (ushort)(a + 1); c < poly; c++) { /* if 'a' inside 'c': join (bbox too) * Careful: 'a' can also be inside another poly. @@ -1137,7 +1137,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const return totfaces; } -unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, const int flag) +uint BLI_scanfill_calc(ScanFillContext *sf_ctx, const int flag) { return BLI_scanfill_calc_ex(sf_ctx, flag, NULL); } diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c index 3550854eabd..6bf3c4719f6 100644 --- a/source/blender/blenlib/intern/scanfill_utils.c +++ b/source/blender/blenlib/intern/scanfill_utils.c @@ -48,7 +48,7 @@ typedef struct ScanFillIsect { # define EFLAG_CLEAR(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 #endif @@ -63,7 +63,7 @@ typedef struct ScanFillIsect { # define VFLAG_CLEAR(eve, val) \ { \ CHECK_TYPE(eve, ScanFillVert *); \ - (eve)->user_flags = (eve)->user_flag & ~(unsigned int)val; \ + (eve)->user_flags = (eve)->user_flag & ~(uint)val; \ } \ (void)0 #endif @@ -72,7 +72,7 @@ typedef struct ScanFillIsect { void BLI_scanfill_obj_dump(ScanFillContext *sf_ctx) { FILE *f = fopen("test.obj", "w"); - unsigned int i = 1; + uint i = 1; ScanFillVert *eve; ScanFillEdge *eed; @@ -359,8 +359,8 @@ bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx, ListBase *remvertbase, ListBase *remedgebase) { - const unsigned int poly_num = (unsigned int)sf_ctx->poly_nr + 1; - unsigned int eed_index = 0; + const uint poly_num = (uint)sf_ctx->poly_nr + 1; + uint eed_index = 0; int totvert_new = 0; bool changed = false; @@ -378,7 +378,7 @@ bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx, poly_info->edge_last = sf_ctx->filledgebase.last; } else { - unsigned short poly_nr; + ushort poly_nr; ScanFillEdge *eed; poly_nr = 0; @@ -407,7 +407,7 @@ bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx, /* self-intersect each polygon */ { - unsigned short poly_nr; + ushort poly_nr; for (poly_nr = 0; poly_nr < poly_num; poly_nr++) { changed |= scanfill_preprocess_self_isect(sf_ctx, poly_info, poly_nr, remedgebase); } diff --git a/source/blender/blenlib/intern/stack.c b/source/blender/blenlib/intern/stack.c index a7bc57ab95f..1a83e8cd86c 100644 --- a/source/blender/blenlib/intern/stack.c +++ b/source/blender/blenlib/intern/stack.c @@ -151,7 +151,7 @@ void BLI_stack_pop_n(BLI_Stack *stack, void *dst, uint n) } } -void BLI_stack_pop_n_reverse(BLI_Stack *stack, void *dst, unsigned int n) +void BLI_stack_pop_n_reverse(BLI_Stack *stack, void *dst, uint n) { BLI_assert(n <= BLI_stack_count(stack)); diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 976b9a5cd02..38b6f015148 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -1121,7 +1121,7 @@ size_t BLI_str_format_int_grouped(char dst[16], int num) size_t BLI_str_format_uint64_grouped(char dst[16], uint64_t num) { - /* NOTE: Buffer to hold maximum unsigned int64, which is 1.8e+19. but + /* NOTE: Buffer to hold maximum `uint64`, which is 1.8e+19. but * we also need space for commas and null-terminator. */ char src[27]; int num_len = sprintf(src, "%" PRIu64 "", num); diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 4fb8311048f..26facda7abf 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -454,7 +454,7 @@ int BLI_str_utf8_size(const char *p) /* NOTE: uses glib functions but not from GLIB. */ int mask = 0, len; - const unsigned char c = (unsigned char)*p; + const uchar c = (uchar)*p; UTF8_COMPUTE(c, mask, len, -1); @@ -466,7 +466,7 @@ int BLI_str_utf8_size(const char *p) int BLI_str_utf8_size_safe(const char *p) { int mask = 0, len; - const unsigned char c = (unsigned char)*p; + const uchar c = (uchar)*p; UTF8_COMPUTE(c, mask, len, 1); @@ -482,7 +482,7 @@ uint BLI_str_utf8_as_unicode(const char *p) int i, len; uint mask = 0; uint result; - const unsigned char c = (unsigned char)*p; + const uchar c = (uchar)*p; UTF8_COMPUTE(c, mask, len, -1); if (UNLIKELY(len == -1)) { @@ -500,7 +500,7 @@ uint BLI_str_utf8_as_unicode_step_or_error(const char *__restrict p, int i, len; uint mask = 0; uint result; - const unsigned char c = (unsigned char)*(p += *index); + const uchar c = (uchar) * (p += *index); BLI_assert(*index < p_len); BLI_assert(c != '\0'); diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c index f7249e491d7..40a8fa24570 100644 --- a/source/blender/blenlib/intern/system.c +++ b/source/blender/blenlib/intern/system.c @@ -34,7 +34,7 @@ int BLI_cpu_support_sse2(void) return 1; #elif defined(__GNUC__) && defined(i386) /* for GCC x86 we check cpuid */ - unsigned int d; + uint d; __asm__( "pushl %%ebx\n\t" "cpuid\n\t" @@ -44,7 +44,7 @@ int BLI_cpu_support_sse2(void) return (d & 0x04000000) != 0; #elif (defined(_MSC_VER) && defined(_M_IX86)) /* also check cpuid for MSVC x86 */ - unsigned int d; + uint d; __asm { xor eax, eax inc eax diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc index 1d38e4e60a9..988b1c0d533 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc @@ -191,7 +191,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, uint c Y[L - 1] = cf[0] * W[L - 1] + cf[1] * tsv[0] + cf[2] * tsv[1] + cf[3] * tsv[2]; \ Y[L - 2] = cf[0] * W[L - 2] + cf[1] * Y[L - 1] + cf[2] * tsv[0] + cf[3] * tsv[1]; \ Y[L - 3] = cf[0] * W[L - 3] + cf[1] * Y[L - 2] + cf[2] * Y[L - 1] + cf[3] * tsv[0]; \ - /* 'i != UINT_MAX' is really 'i >= 0', but necessary for unsigned int wrapping */ \ + /* `i != UINT_MAX` is really `i >= 0`, but necessary for `uint` wrapping. */ \ for (i = L - 4; i != UINT_MAX; i--) { \ Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3]; \ } \ diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.c b/source/blender/editors/space_sequencer/sequencer_thumbnails.c index 862ddc803e2..6f443d0353e 100644 --- a/source/blender/editors/space_sequencer/sequencer_thumbnails.c +++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.c @@ -536,7 +536,7 @@ void draw_seq_strip_thumbnail(View2D *v2d, if (seq->flag & SEQ_OVERLAP) { GPU_blend(GPU_BLEND_ALPHA); if (ibuf->rect) { - unsigned char *buf = (unsigned char *)ibuf->rect; + uchar *buf = (uchar *)ibuf->rect; for (int pixel = ibuf->x * ibuf->y; pixel--; buf += 4) { buf[3] = OVERLAP_ALPHA; } diff --git a/source/blender/io/avi/intern/avi.c b/source/blender/io/avi/intern/avi.c index b4438bfb0a8..298aa9c8dfa 100644 --- a/source/blender/io/avi/intern/avi.c +++ b/source/blender/io/avi/intern/avi.c @@ -917,7 +917,7 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...) va_start(ap, frame_num); for (stream = 0; stream < movie->header->Streams; stream++) { - unsigned int tbuf = 0; + uint tbuf = 0; format = va_arg(ap, AviFormat); buffer = va_arg(ap, void *); diff --git a/source/blender/io/avi/intern/avi_mjpeg.c b/source/blender/io/avi/intern/avi_mjpeg.c index 16417fd12f7..de75fe8d69e 100644 --- a/source/blender/io/avi/intern/avi_mjpeg.c +++ b/source/blender/io/avi/intern/avi_mjpeg.c @@ -343,7 +343,7 @@ static void interlace(uchar *to, uchar *from, int width, int height) } } -static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height) +static void deinterlace(int odd, uchar *to, uchar *from, int width, int height) { size_t i, rowstride = width * 3; @@ -357,20 +357,17 @@ static void deinterlace(int odd, unsigned char *to, unsigned char *from, int wid } } -void *avi_converter_from_mjpeg(AviMovie *movie, - int stream, - unsigned char *buffer, - const size_t *size) +void *avi_converter_from_mjpeg(AviMovie *movie, int stream, uchar *buffer, const size_t *size) { int deint; - unsigned char *buf; + uchar *buf; (void)stream; /* unused */ buf = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, - sizeof(unsigned char), + sizeof(uchar), "avi.avi_converter_from_mjpeg 1"); if (!buf) { return NULL; @@ -384,7 +381,7 @@ void *avi_converter_from_mjpeg(AviMovie *movie, buffer = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, - sizeof(unsigned char), + sizeof(uchar), "avi.avi_converter_from_mjpeg 2"); if (buffer) { interlace(buffer, buf, movie->header->Width, movie->header->Height); @@ -397,9 +394,9 @@ void *avi_converter_from_mjpeg(AviMovie *movie, return buf; } -void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) +void *avi_converter_to_mjpeg(AviMovie *movie, int stream, uchar *buffer, size_t *size) { - unsigned char *buf; + uchar *buf; size_t bufsize = *size; numbytes = 0; @@ -408,7 +405,7 @@ void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, buf = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, - sizeof(unsigned char), + sizeof(uchar), "avi.avi_converter_to_mjpeg 1"); if (!buf) { return NULL; @@ -431,7 +428,7 @@ void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, buf = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, - sizeof(unsigned char), + sizeof(uchar), "avi.avi_converter_to_mjpeg 1"); if (buf) { @@ -478,7 +475,7 @@ static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo) MEM_freeN(cinfo->dest); } -static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, size_t bufsize) +static void jpegmemdestmgr_build(j_compress_ptr cinfo, uchar *buffer, size_t bufsize) { cinfo->dest = MEM_mallocN(sizeof(*(cinfo->dest)), "avi.jpegmemdestmgr_build"); @@ -501,7 +498,7 @@ static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) { - unsigned char *buf = (unsigned char *)dinfo->src->next_input_byte - 2; + uchar *buf = (uchar *)dinfo->src->next_input_byte - 2; /* if we get called, must have run out of data */ WARNMS(dinfo, JWRN_JPEG_EOF); @@ -532,9 +529,7 @@ static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo) MEM_freeN(dinfo->src); } -static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, - const unsigned char *buffer, - size_t bufsize) +static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, const uchar *buffer, size_t bufsize) { dinfo->src = MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build"); diff --git a/source/blender/io/avi/intern/avi_mjpeg.h b/source/blender/io/avi/intern/avi_mjpeg.h index 79fa0fe9995..aa74d771646 100644 --- a/source/blender/io/avi/intern/avi_mjpeg.h +++ b/source/blender/io/avi/intern/avi_mjpeg.h @@ -7,8 +7,5 @@ #pragma once -void *avi_converter_from_mjpeg(AviMovie *movie, - int stream, - unsigned char *buffer, - const size_t *size); -void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, size_t *size); +void *avi_converter_from_mjpeg(AviMovie *movie, int stream, uchar *buffer, const size_t *size); +void *avi_converter_to_mjpeg(AviMovie *movie, int stream, uchar *buffer, size_t *size); diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 42df7912e3a..d4a20a29bf7 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -790,13 +790,13 @@ static void cast_primitive_type(const eSDNA_Type old_type, *new_data = (char)old_value_i; break; case SDNA_TYPE_UCHAR: - *((unsigned char *)new_data) = (unsigned char)old_value_i; + *((uchar *)new_data) = (uchar)old_value_i; break; case SDNA_TYPE_SHORT: *((short *)new_data) = (short)old_value_i; break; case SDNA_TYPE_USHORT: - *((unsigned short *)new_data) = (unsigned short)old_value_i; + *((ushort *)new_data) = (ushort)old_value_i; break; case SDNA_TYPE_INT: *((int *)new_data) = (int)old_value_i; diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index d31a312816a..c91e0e1805e 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -1140,7 +1140,7 @@ static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum e BKE_previewimg_clear_single(prv_img, size); if (values[0] && values[1]) { - prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect"); + prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(uint), "prv_rect"); prv_img->w[size] = values[0]; prv_img->h[size] = values[1]; @@ -1178,7 +1178,7 @@ static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIcon BKE_previewimg_ensure(prv_img, size); - memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int)); + memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(uint)); } static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum eIconSizes size) @@ -1190,7 +1190,7 @@ static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); } - memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int)); + memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(uint)); prv_img->flag[size] |= PRV_USER_EDITED; } @@ -1201,7 +1201,7 @@ static int rna_ImagePreview_pixels_float_get_length(const PointerRNA *ptr, ID *id = ptr->owner_id; PreviewImage *prv_img = (PreviewImage *)ptr->data; - BLI_assert(sizeof(unsigned int) == 4); + BLI_assert(sizeof(uint) == 4); if (id != NULL) { BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); @@ -1219,11 +1219,11 @@ static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, en ID *id = ptr->owner_id; PreviewImage *prv_img = (PreviewImage *)ptr->data; - unsigned char *data = (unsigned char *)prv_img->rect[size]; + uchar *data = (uchar *)prv_img->rect[size]; const size_t len = prv_img->w[size] * prv_img->h[size] * 4; size_t i; - BLI_assert(sizeof(unsigned int) == 4); + BLI_assert(sizeof(uint) == 4); if (id != NULL) { BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); @@ -1243,11 +1243,11 @@ static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr, ID *id = ptr->owner_id; PreviewImage *prv_img = (PreviewImage *)ptr->data; - unsigned char *data = (unsigned char *)prv_img->rect[size]; + uchar *data = (uchar *)prv_img->rect[size]; const size_t len = prv_img->w[size] * prv_img->h[size] * 4; size_t i; - BLI_assert(sizeof(unsigned int) == 4); + BLI_assert(sizeof(uint) == 4); if (id != NULL) { BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index b7ab7689dd7..4e7c06bd37c 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -177,7 +177,7 @@ void rna_Image_generated_color_set(PointerRNA *ptr, const float values[4]) { Image *ima = (Image *)(ptr->data); ImageTile *base_tile = BKE_image_get_tile(ima, 0); - for (unsigned int i = 0; i < 4; i++) { + for (uint i = 0; i < 4; i++) { base_tile->gen_color[i] = CLAMPIS(values[i], 0.0f, FLT_MAX); } } @@ -625,7 +625,7 @@ static void rna_Image_pixels_get(PointerRNA *ptr, float *values) } else { for (i = 0; i < size; i++) { - values[i] = ((unsigned char *)ibuf->rect)[i] * (1.0f / 255.0f); + values[i] = ((uchar *)ibuf->rect)[i] * (1.0f / 255.0f); } } } @@ -650,7 +650,7 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values) } else { for (i = 0; i < size; i++) { - ((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]); + ((uchar *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]); } } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index cc0a396932f..9c6702142f7 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -708,9 +708,9 @@ static void rna_MeshLoopTriangle_normal_get(PointerRNA *ptr, float *values) MLoopTri *lt = (MLoopTri *)ptr->data; const MVert *verts = BKE_mesh_verts(me); const MLoop *loops = BKE_mesh_loops(me); - unsigned int v1 = loops[lt->tri[0]].v; - unsigned int v2 = loops[lt->tri[1]].v; - unsigned int v3 = loops[lt->tri[2]].v; + uint v1 = loops[lt->tri[0]].v; + uint v2 = loops[lt->tri[1]].v; + uint v3 = loops[lt->tri[2]].v; normal_tri_v3(values, verts[v1].co, verts[v2].co, verts[v3].co); } @@ -739,9 +739,9 @@ static float rna_MeshLoopTriangle_area_get(PointerRNA *ptr) MLoopTri *lt = (MLoopTri *)ptr->data; const MVert *verts = BKE_mesh_verts(me); const MLoop *loops = BKE_mesh_loops(me); - unsigned int v1 = loops[lt->tri[0]].v; - unsigned int v2 = loops[lt->tri[1]].v; - unsigned int v3 = loops[lt->tri[2]].v; + uint v1 = loops[lt->tri[0]].v; + uint v2 = loops[lt->tri[1]].v; + uint v3 = loops[lt->tri[2]].v; return area_tri_v3(verts[v1].co, verts[v2].co, verts[v3].co); } @@ -1377,7 +1377,7 @@ static void rna_MeshPoly_vertices_get(PointerRNA *ptr, int *values) MPoly *mp = (MPoly *)ptr->data; const MLoop *loops = BKE_mesh_loops(me); const MLoop *ml = &loops[mp->loopstart]; - unsigned int i; + uint i; for (i = mp->totloop; i > 0; i--, values++, ml++) { *values = ml->v; } @@ -1390,7 +1390,7 @@ static void rna_MeshPoly_vertices_set(PointerRNA *ptr, const int *values) MLoop *loops = BKE_mesh_loops_for_write(me); MLoop *ml = &loops[mp->loopstart]; - unsigned int i; + uint i; for (i = mp->totloop; i > 0; i--, values++, ml++) { ml->v = *values; } diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 8d5e82cbfa8..54ccba24247 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -465,7 +465,7 @@ static void rna_Struct_property_tags_begin(CollectionPropertyIterator *iter, Poi /* here ptr->data should always be the same as iter->parent.type */ StructRNA *srna = (StructRNA *)ptr->data; const EnumPropertyItem *tag_defines = RNA_struct_property_tag_defines(srna); - unsigned int tag_count = tag_defines ? RNA_enum_items_count(tag_defines) : 0; + uint tag_count = tag_defines ? RNA_enum_items_count(tag_defines) : 0; rna_iterator_array_begin( iter, (void *)tag_defines, sizeof(EnumPropertyItem), tag_count, 0, NULL); diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c index ed3be815235..96b732c3aba 100644 --- a/source/blender/makesrna/intern/rna_test.c +++ b/source/blender/makesrna/intern/rna_test.c @@ -103,7 +103,7 @@ void RNA_def_test(BlenderRNA *brna) # ifdef UNIT_TEST StructRNA *srna; PropertyRNA *prop; - unsigned short dimsize[] = {MARRAY_DIMSIZE}; + ushort dimsize[] = {MARRAY_DIMSIZE}; srna = RNA_def_struct(brna, "Test", NULL); RNA_def_struct_sdna(srna, "Test"); diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index be864d30445..53bfdc35b31 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -1329,7 +1329,7 @@ static void deformVert(void *__restrict userdata, const SDefDeformData *const data = (SDefDeformData *)userdata; const SDefBind *sdbind = data->bind_verts[index].binds; const int sdbind_num = data->bind_verts[index].binds_num; - const unsigned int vertex_idx = data->bind_verts[index].vertex_idx; + const uint vertex_idx = data->bind_verts[index].vertex_idx; float *const vertexCos = data->vertexCos[vertex_idx]; float norm[3], temp[3], offset[3]; diff --git a/source/blender/render/intern/multires_bake.c b/source/blender/render/intern/multires_bake.c index 79eddd20bdf..f701d9a987a 100644 --- a/source/blender/render/intern/multires_bake.c +++ b/source/blender/render/intern/multires_bake.c @@ -996,7 +996,7 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, rrgbf[3] = 1.0f; } else { - unsigned char *rrgb = (unsigned char *)ibuf->rect + pixel * 4; + uchar *rrgb = (uchar *)ibuf->rect + pixel * 4; rgb_float_to_uchar(rrgb, vec); rrgb[3] = 255; } @@ -1009,8 +1009,8 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, /* Must be a power of two. */ # define MAX_NUMBER_OF_AO_RAYS 1024 -static unsigned short ao_random_table_1[MAX_NUMBER_OF_AO_RAYS]; -static unsigned short ao_random_table_2[MAX_NUMBER_OF_AO_RAYS]; +static ushort ao_random_table_1[MAX_NUMBER_OF_AO_RAYS]; +static ushort ao_random_table_2[MAX_NUMBER_OF_AO_RAYS]; static void init_ao_random(void) { @@ -1022,18 +1022,18 @@ static void init_ao_random(void) } } -static unsigned short get_ao_random1(const int i) +static ushort get_ao_random1(const int i) { return ao_random_table_1[i & (MAX_NUMBER_OF_AO_RAYS - 1)]; } -static unsigned short get_ao_random2(const int i) +static ushort get_ao_random2(const int i) { return ao_random_table_2[i & (MAX_NUMBER_OF_AO_RAYS - 1)]; } -static void build_permutation_table(unsigned short permutation[], - unsigned short temp_permutation[], +static void build_permutation_table(ushort permutation[], + ushort temp_permutation[], const int number_of_rays, const int is_first_perm_table) { @@ -1044,9 +1044,9 @@ static void build_permutation_table(unsigned short permutation[], } for (i = 0; i < number_of_rays; i++) { - const unsigned int nr_entries_left = number_of_rays - i; - unsigned short rnd = is_first_perm_table != false ? get_ao_random1(i) : get_ao_random2(i); - const unsigned short entry = rnd % nr_entries_left; + const uint nr_entries_left = number_of_rays - i; + ushort rnd = is_first_perm_table != false ? get_ao_random1(i) : get_ao_random2(i); + const ushort entry = rnd % nr_entries_left; /* pull entry */ permutation[i] = temp_permutation[entry]; @@ -1116,7 +1116,7 @@ static void *init_ao_data(MultiresBakeRender *bkr, ImBuf *UNUSED(ibuf)) { MAOBakeData *ao_data; DerivedMesh *lodm = bkr->lores_dm; - unsigned short *temp_permutation_table; + ushort *temp_permutation_table; size_t permutation_size; init_ao_random(); @@ -1131,7 +1131,7 @@ static void *init_ao_data(MultiresBakeRender *bkr, ImBuf *UNUSED(ibuf)) create_ao_raytree(bkr, ao_data); /* initialize permutation tables */ - permutation_size = sizeof(unsigned short) * bkr->number_of_rays; + permutation_size = sizeof(ushort) * bkr->number_of_rays; ao_data->permutation_table_1 = MEM_callocN(permutation_size, "multires AO baker perm1"); ao_data->permutation_table_2 = MEM_callocN(permutation_size, "multires AO baker perm2"); temp_permutation_table = MEM_callocN(permutation_size, "multires AO baker temp perm"); @@ -1273,9 +1273,9 @@ static void apply_ao_callback(DerivedMesh *lores_dm, /* use N-Rooks to distribute our N ray samples across * a multi-dimensional domain (2D) */ - const unsigned short I = + const ushort I = ao_data->permutation_table_1[(i + perm_ofs) % ao_data->number_of_rays]; - const unsigned short J = ao_data->permutation_table_2[i]; + const ushort J = ao_data->permutation_table_2[i]; const float JitPh = (get_ao_random2(I + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) / ((float)MAX_NUMBER_OF_AO_RAYS); @@ -1317,7 +1317,7 @@ static void apply_ao_callback(DerivedMesh *lores_dm, rrgbf[3] = 1.0f; } else { - unsigned char *rrgb = (unsigned char *)ibuf->rect + pixel * 4; + uchar *rrgb = (uchar *)ibuf->rect + pixel * 4; rrgb[0] = rrgb[1] = rrgb[2] = unit_float_to_uchar_clamp(value); rrgb[3] = 255; } @@ -1393,7 +1393,7 @@ static void bake_ibuf_normalize_displacement(ImBuf *ibuf, } if (ibuf->rect) { - unsigned char *cp = (unsigned char *)(ibuf->rect + i); + uchar *cp = (uchar *)(ibuf->rect + i); cp[0] = cp[1] = cp[2] = unit_float_to_uchar_clamp(normalized_displacement); cp[3] = 255; } diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index 7de18d9b20b..8469876ba25 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -2272,9 +2272,9 @@ static ImBuf *do_glow_effect(const SeqRenderData *context, fac, context->rectx, context->recty, - (unsigned char *)ibuf1->rect, + (uchar *)ibuf1->rect, NULL, - (unsigned char *)out->rect); + (uchar *)out->rect); } return out; @@ -2336,13 +2336,13 @@ static ImBuf *do_solid_color(const SeqRenderData *context, int y = out->y; if (out->rect) { - unsigned char color[4]; + uchar color[4]; color[0] = cv->col[0] * 255; color[1] = cv->col[1] * 255; color[2] = cv->col[2] * 255; color[3] = 255; - unsigned char *rect = (unsigned char *)out->rect; + uchar *rect = (uchar *)out->rect; for (int i = 0; i < y; i++) { for (int j = 0; j < x; j++) { @@ -2728,7 +2728,7 @@ static void do_overdrop_effect(const SeqRenderData *context, do_alphaover_effect_float(fac, x, y, rect1, rect2, rect_out); } else { - unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL; + uchar *rect1 = NULL, *rect2 = NULL, *rect_out = NULL; slice_get_byte_buffers( context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out); @@ -2818,8 +2818,8 @@ static void do_gaussian_blur_effect_byte_x(Sequence *seq, int y, int frame_width, int UNUSED(frame_height), - const unsigned char *rect, - unsigned char *out) + const uchar *rect, + uchar *out) { #define INDEX(_x, _y) (((_y) * (x) + (_x)) * 4) GaussianBlurVars *data = seq->effectdata; @@ -2868,8 +2868,8 @@ static void do_gaussian_blur_effect_byte_y(Sequence *seq, int y, int UNUSED(frame_width), int frame_height, - const unsigned char *rect, - unsigned char *out) + const uchar *rect, + uchar *out) { #define INDEX(_x, _y) (((_y) * (x) + (_x)) * 4) GaussianBlurVars *data = seq->effectdata; @@ -3015,7 +3015,7 @@ static void do_gaussian_blur_effect_x_cb(const SeqRenderData *context, rect_out); } else { - unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL; + uchar *rect1 = NULL, *rect2 = NULL, *rect_out = NULL; slice_get_byte_buffers( context, ibuf, NULL, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out); @@ -3026,7 +3026,7 @@ static void do_gaussian_blur_effect_x_cb(const SeqRenderData *context, total_lines, context->rectx, context->recty, - (unsigned char *)ibuf->rect, + (uchar *)ibuf->rect, rect_out); } } @@ -3054,7 +3054,7 @@ static void do_gaussian_blur_effect_y_cb(const SeqRenderData *context, rect_out); } else { - unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL; + uchar *rect1 = NULL, *rect2 = NULL, *rect_out = NULL; slice_get_byte_buffers( context, ibuf, NULL, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out); @@ -3065,7 +3065,7 @@ static void do_gaussian_blur_effect_y_cb(const SeqRenderData *context, total_lines, context->rectx, context->recty, - (unsigned char *)ibuf->rect, + (uchar *)ibuf->rect, rect_out); } } @@ -3341,8 +3341,7 @@ static ImBuf *do_text_effect(const SeqRenderData *context, /* use max width to enable newlines only */ BLF_wordwrap(font, (data->wrap_width != 0.0f) ? data->wrap_width * width : -1); - BLF_buffer( - font, out->rect_float, (unsigned char *)out->rect, width, height, out->channels, display); + BLF_buffer(font, out->rect_float, (uchar *)out->rect, width, height, out->channels, display); line_height = BLF_height_max(font); diff --git a/source/blender/sequencer/intern/modifier.c b/source/blender/sequencer/intern/modifier.c index da982913de1..a962bcdbd06 100644 --- a/source/blender/sequencer/intern/modifier.c +++ b/source/blender/sequencer/intern/modifier.c @@ -348,7 +348,7 @@ static void make_cb_table_float_sop( static void color_balance_byte_byte( StripColorBalance *cb_, uchar *rect, uchar *mask_rect, int width, int height, float mul) { - // unsigned char cb_tab[3][256]; + // uchar cb_tab[3][256]; uchar *cp = rect; uchar *e = cp + width * 4 * height; uchar *m = mask_rect; @@ -986,9 +986,9 @@ typedef struct BrightContrastThreadData { static void brightcontrast_apply_threaded(int width, int height, - unsigned char *rect, + uchar *rect, float *rect_float, - unsigned char *mask_rect, + uchar *mask_rect, const float *mask_rect_float, void *data_v) { @@ -1022,14 +1022,14 @@ static void brightcontrast_apply_threaded(int width, int pixel_index = (y * width + x) * 4; if (rect) { - unsigned char *pixel = rect + pixel_index; + uchar *pixel = rect + pixel_index; for (c = 0; c < 3; c++) { i = (float)pixel[c] / 255.0f; v = a * i + b; if (mask_rect) { - unsigned char *m = mask_rect + pixel_index; + uchar *m = mask_rect + pixel_index; float t = (float)m[c] / 255.0f; v = (float)pixel[c] / 255.0f * (1.0f - t) + v * t; @@ -1088,9 +1088,9 @@ static SequenceModifierTypeInfo seqModifier_BrightContrast = { static void maskmodifier_apply_threaded(int width, int height, - unsigned char *rect, + uchar *rect, float *rect_float, - unsigned char *mask_rect, + uchar *mask_rect, const float *mask_rect_float, void *UNUSED(data_v)) { @@ -1109,9 +1109,9 @@ static void maskmodifier_apply_threaded(int width, int pixel_index = (y * width + x) * 4; if (rect) { - unsigned char *pixel = rect + pixel_index; - unsigned char *mask_pixel = mask_rect + pixel_index; - unsigned char mask = min_iii(mask_pixel[0], mask_pixel[1], mask_pixel[2]); + uchar *pixel = rect + pixel_index; + uchar *mask_pixel = mask_rect + pixel_index; + uchar mask = min_iii(mask_pixel[0], mask_pixel[1], mask_pixel[2]); /* byte buffer is straight, so only affect on alpha itself, * this is the only way to alpha-over byte strip after @@ -1186,9 +1186,9 @@ static void tonemapmodifier_init_data(SequenceModifierData *smd) static void tonemapmodifier_apply_threaded_simple(int width, int height, - unsigned char *rect, + uchar *rect, float *rect_float, - unsigned char *mask_rect, + uchar *mask_rect, const float *mask_rect_float, void *data_v) { @@ -1245,9 +1245,9 @@ static void tonemapmodifier_apply_threaded_simple(int width, static void tonemapmodifier_apply_threaded_photoreceptor(int width, int height, - unsigned char *rect, + uchar *rect, float *rect_float, - unsigned char *mask_rect, + uchar *mask_rect, const float *mask_rect_float, void *data_v) { @@ -1315,7 +1315,7 @@ static void tonemapmodifier_apply(struct SequenceModifierData *smd, ImBuf *ibuf, float lsum = 0.0f; int p = ibuf->x * ibuf->y; float *fp = ibuf->rect_float; - unsigned char *cp = (unsigned char *)ibuf->rect; + uchar *cp = (uchar *)ibuf->rect; float avl, maxl = -FLT_MAX, minl = FLT_MAX; const float sc = 1.0f / p; float Lav = 0.0f; diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index 1e060321bb8..1b6c4b42730 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -1294,15 +1294,15 @@ ImBuf *seq_render_mask(const SeqRenderData *context, else { /* pixels */ const float *fp_src; - unsigned char *ub_dst; + uchar *ub_dst; ibuf = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect); fp_src = maskbuf; - ub_dst = (unsigned char *)ibuf->rect; + ub_dst = (uchar *)ibuf->rect; i = context->rectx * context->recty; while (--i) { - ub_dst[0] = ub_dst[1] = ub_dst[2] = (unsigned char)(*fp_src * 255.0f); /* already clamped */ + ub_dst[0] = ub_dst[1] = ub_dst[2] = (uchar)(*fp_src * 255.0f); /* already clamped */ ub_dst[3] = 255; fp_src += 1; @@ -1447,7 +1447,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, BKE_render_resolution(&scene->r, false, &width, &height); const char *viewname = BKE_scene_multiview_render_view_name_get(&scene->r, context->view_id); - unsigned int draw_flags = V3D_OFSDRAW_NONE; + uint draw_flags = V3D_OFSDRAW_NONE; draw_flags |= (use_gpencil) ? V3D_OFSDRAW_SHOW_ANNOTATION : 0; draw_flags |= (context->scene->r.seq_flag & R_SEQ_OVERRIDE_SCENE_SETTINGS) ? V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS : diff --git a/source/blender/simulation/intern/implicit_blender.c b/source/blender/simulation/intern/implicit_blender.c index 5f08bca9875..cdfa3ba88c1 100644 --- a/source/blender/simulation/intern/implicit_blender.c +++ b/source/blender/simulation/intern/implicit_blender.c @@ -110,9 +110,9 @@ static void print_fvector(float m3[3]) /* long float vector float (*)[3] */ /////////////////////////// /* print long vector on console: for debug output */ -DO_INLINE void print_lfvector(float (*fLongVector)[3], unsigned int verts) +DO_INLINE void print_lfvector(float (*fLongVector)[3], uint verts) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < verts; i++) { print_fvector(fLongVector[i]); } @@ -257,7 +257,7 @@ static void print_fmatrix(float m3[3][3]) static void print_sparse_matrix(fmatrix3x3 *m) { if (m) { - unsigned int i; + uint i; for (i = 0; i < m[0].vcount + m[0].scount; i++) { printf("%d:\n", i); print_fmatrix(m[i].m); @@ -360,7 +360,7 @@ DO_INLINE float det_fmatrix(float m[3][3]) DO_INLINE void inverse_fmatrix(float to[3][3], float from[3][3]) { - unsigned int i, j; + uint i, j; float d; if ((d = det_fmatrix(from)) == 0) { @@ -510,7 +510,7 @@ BLI_INLINE void madd_m3_m3fl(float r[3][3], const float m[3][3], float f) # if 0 static void print_bfmatrix(fmatrix3x3 *m3) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < m3[0].vcount + m3[0].scount; i++) { print_fmatrix(m3[i].m); @@ -756,11 +756,11 @@ DO_INLINE void filter(lfVector *V, fmatrix3x3 *S) static int cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z, fmatrix3x3 *S) { /* Solves for unknown X in equation AX=B */ - unsigned int conjgrad_loopcount = 0, conjgrad_looplimit = 100; + uint conjgrad_loopcount = 0, conjgrad_looplimit = 100; float conjgrad_epsilon = 0.0001f /* , conjgrad_lasterror=0 */ /* UNUSED */; lfVector *q, *d, *tmp, *r; float s, starget, a, s_prev; - unsigned int numverts = lA[0].vcount; + uint numverts = lA[0].vcount; q = create_lfvector(numverts); d = create_lfvector(numverts); tmp = create_lfvector(numverts); @@ -919,7 +919,7 @@ static int cg_filtered(lfVector *ldV, /* block diagonalizer */ DO_INLINE void BuildPPinv(fmatrix3x3 *lA, fmatrix3x3 *P, fmatrix3x3 *Pinv) { - unsigned int i = 0; + uint i = 0; /* Take only the diagonal blocks of A */ // #pragma omp parallel for private(i) if (lA[0].vcount > CLOTH_OPENMP_LIMIT) @@ -940,7 +940,7 @@ static int cg_filtered_pre(lfVector *dv, fmatrix3x3 *P, fmatrix3x3 *Pinv) { - unsigned int numverts = lA[0].vcount, iterations = 0, conjgrad_looplimit = 100; + uint numverts = lA[0].vcount, iterations = 0, conjgrad_looplimit = 100; float delta0 = 0, deltaNew = 0, deltaOld = 0, alpha = 0; float conjgrad_epsilon = 0.0001; /* 0.2 is dt for steps=5 */ lfVector *r = create_lfvector(numverts); @@ -1018,7 +1018,7 @@ static int cg_filtered_pre(lfVector *dv, fmatrix3x3 *Pinv, fmatrix3x3 *bigI) { - unsigned int numverts = lA[0].vcount, iterations = 0, conjgrad_looplimit = 100; + uint numverts = lA[0].vcount, iterations = 0, conjgrad_looplimit = 100; float delta0 = 0, deltaNew = 0, deltaOld = 0, alpha = 0, tol = 0; lfVector *r = create_lfvector(numverts); lfVector *p = create_lfvector(numverts); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index b7a3538aeb2..85e1227ab73 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1628,7 +1628,7 @@ wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, - unsigned int type, + uint type, double timestep) { wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer"); diff --git a/source/blender/windowmanager/xr/intern/wm_xr_action.c b/source/blender/windowmanager/xr/intern/wm_xr_action.c index a83415c98af..68f6bfc1aff 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_action.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_action.c @@ -72,8 +72,8 @@ static wmXrAction *action_create(const char *action_name, strcpy(action->name, action_name); action->type = type; - const unsigned int count = (unsigned int)BLI_listbase_count(user_paths); - unsigned int subaction_idx = 0; + const uint count = (uint)BLI_listbase_count(user_paths); + uint subaction_idx = 0; action->count_subaction_paths = count; action->subaction_paths = MEM_mallocN(sizeof(*action->subaction_paths) * count, @@ -142,7 +142,7 @@ static void action_destroy(void *val) char **subaction_paths = action->subaction_paths; if (subaction_paths) { - for (unsigned int i = 0; i < action->count_subaction_paths; ++i) { + for (uint i = 0; i < action->count_subaction_paths; ++i) { MEM_SAFE_FREE(subaction_paths[i]); } MEM_freeN(subaction_paths); @@ -241,8 +241,8 @@ bool WM_xr_action_create(wmXrData *xr, action_flag, haptic_flag); - const unsigned int count = (unsigned int)BLI_listbase_count(user_paths); - unsigned int subaction_idx = 0; + const uint count = (uint)BLI_listbase_count(user_paths); + uint subaction_idx = 0; char **subaction_paths = MEM_calloc_arrayN( count, sizeof(*subaction_paths), "XrAction_SubactionPathPointers"); @@ -336,8 +336,8 @@ bool WM_xr_action_binding_create(wmXrData *xr, const eXrAxisFlag *axis_flags, const struct wmXrPose *poses) { - const unsigned int count = (unsigned int)BLI_listbase_count(user_paths); - BLI_assert(count == (unsigned int)BLI_listbase_count(component_paths)); + const uint count = (uint)BLI_listbase_count(user_paths); + BLI_assert(count == (uint)BLI_listbase_count(component_paths)); GHOST_XrActionBindingInfo *binding_infos = MEM_calloc_arrayN( count, sizeof(*binding_infos), "XrActionBinding_Infos"); @@ -345,7 +345,7 @@ bool WM_xr_action_binding_create(wmXrData *xr, char **subaction_paths = MEM_calloc_arrayN( count, sizeof(*subaction_paths), "XrActionBinding_SubactionPathPointers"); - for (unsigned int i = 0; i < count; ++i) { + for (uint i = 0; i < count; ++i) { GHOST_XrActionBindingInfo *binding_info = &binding_infos[i]; const XrUserPath *user_path = BLI_findlink(user_paths, i); const XrComponentPath *component_path = BLI_findlink(component_paths, i); @@ -448,12 +448,12 @@ bool WM_xr_controller_pose_actions_set(wmXrData *xr, } /* Ensure consistent subaction paths. */ - const unsigned int count = grip_action->count_subaction_paths; + const uint count = grip_action->count_subaction_paths; if (count != aim_action->count_subaction_paths) { return false; } - for (unsigned int i = 0; i < count; ++i) { + for (uint i = 0; i < count; ++i) { if (!STREQ(grip_action->subaction_paths[i], aim_action->subaction_paths[i])) { return false; } @@ -483,7 +483,7 @@ bool WM_xr_action_state_get(const wmXrData *xr, r_state->type = (int)action->type; /* Find the action state corresponding to the subaction path. */ - for (unsigned int i = 0; i < action->count_subaction_paths; ++i) { + for (uint i = 0; i < action->count_subaction_paths; ++i) { if (STREQ(subaction_path, action->subaction_paths[i])) { switch (action->type) { case XR_BOOLEAN_INPUT: diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.c b/source/blender/windowmanager/xr/intern/wm_xr_draw.c index 3b1acee2b99..6e32c5a0aae 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_draw.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_draw.c @@ -213,9 +213,9 @@ static GPUBatch *wm_xr_controller_model_batch_create(GHOST_XrContextHandle xr_co GPUIndexBuf *ibo = NULL; if (model_data.count_indices > 0 && ((model_data.count_indices % 3) == 0)) { GPUIndexBufBuilder ibo_builder; - const unsigned int prim_len = model_data.count_indices / 3; + const uint prim_len = model_data.count_indices / 3; GPU_indexbuf_init(&ibo_builder, GPU_PRIM_TRIS, prim_len, model_data.count_vertices); - for (unsigned int i = 0; i < prim_len; ++i) { + for (uint i = 0; i < prim_len; ++i) { const uint32_t *idx = &model_data.indices[i * 3]; GPU_indexbuf_add_tri_verts(&ibo_builder, idx[0], idx[1], idx[2]); } @@ -261,8 +261,7 @@ static void wm_xr_controller_model_draw(const XrSessionSettings *settings, GPU_matrix_push(); GPU_matrix_mul(controller->grip_mat); - for (unsigned int component_idx = 0; component_idx < model_data.count_components; - ++component_idx) { + for (uint component_idx = 0; component_idx < model_data.count_components; ++component_idx) { const GHOST_XrControllerModelComponent *component = &model_data.components[component_idx]; GPU_matrix_push(); GPU_matrix_mul(component->transform); diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c index a4d2a65830f..abc41833de6 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_session.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c @@ -432,7 +432,7 @@ bool WM_xr_session_state_viewer_pose_matrix_info_get(const wmXrData *xr, } bool WM_xr_session_state_controller_grip_location_get(const wmXrData *xr, - unsigned int subaction_idx, + uint subaction_idx, float r_location[3]) { if (!WM_xr_session_is_ready(xr) || !xr->runtime->session_state.is_view_data_set || @@ -449,7 +449,7 @@ bool WM_xr_session_state_controller_grip_location_get(const wmXrData *xr, } bool WM_xr_session_state_controller_grip_rotation_get(const wmXrData *xr, - unsigned int subaction_idx, + uint subaction_idx, float r_rotation[4]) { if (!WM_xr_session_is_ready(xr) || !xr->runtime->session_state.is_view_data_set || @@ -466,7 +466,7 @@ bool WM_xr_session_state_controller_grip_rotation_get(const wmXrData *xr, } bool WM_xr_session_state_controller_aim_location_get(const wmXrData *xr, - unsigned int subaction_idx, + uint subaction_idx, float r_location[3]) { if (!WM_xr_session_is_ready(xr) || !xr->runtime->session_state.is_view_data_set || @@ -483,7 +483,7 @@ bool WM_xr_session_state_controller_aim_location_get(const wmXrData *xr, } bool WM_xr_session_state_controller_aim_rotation_get(const wmXrData *xr, - unsigned int subaction_idx, + uint subaction_idx, float r_rotation[4]) { if (!WM_xr_session_is_ready(xr) || !xr->runtime->session_state.is_view_data_set || @@ -615,7 +615,7 @@ static void wm_xr_session_controller_data_update(const XrSessionSettings *settin BLI_assert(grip_action->count_subaction_paths == aim_action->count_subaction_paths); BLI_assert(grip_action->count_subaction_paths == BLI_listbase_count(&state->controllers)); - unsigned int subaction_idx = 0; + uint subaction_idx = 0; float view_ofs[3], base_mat[4][4], nav_mat[4][4]; if ((settings->flag & XR_SESSION_USE_POSITION_TRACKING) == 0) { @@ -816,7 +816,7 @@ static void wm_xr_session_haptic_timers_check(ListBase *active_haptic_actions, i static void wm_xr_session_action_states_interpret(wmXrData *xr, const char *action_set_name, wmXrAction *action, - unsigned int subaction_idx, + uint subaction_idx, ListBase *active_modal_actions, ListBase *active_haptic_actions, int64_t time_now, @@ -960,8 +960,8 @@ static void wm_xr_session_action_states_interpret(wmXrData *xr, static bool wm_xr_session_action_test_bimanual(const wmXrSessionState *session_state, wmXrAction *action, - unsigned int subaction_idx, - unsigned int *r_subaction_idx_other, + uint subaction_idx, + uint *r_subaction_idx_other, const GHOST_XrPose **r_aim_pose_other) { if ((action->action_flag & XR_ACTION_BIMANUAL) == 0) { @@ -971,7 +971,7 @@ static bool wm_xr_session_action_test_bimanual(const wmXrSessionState *session_s bool bimanual = false; *r_subaction_idx_other = (subaction_idx == 0) ? - (unsigned int)min_ii(1, action->count_subaction_paths - 1) : + (uint)min_ii(1, action->count_subaction_paths - 1) : 0; switch (action->type) { @@ -1018,8 +1018,8 @@ static wmXrActionData *wm_xr_session_event_create(const char *action_set_name, const wmXrAction *action, const GHOST_XrPose *controller_aim_pose, const GHOST_XrPose *controller_aim_pose_other, - unsigned int subaction_idx, - unsigned int subaction_idx_other, + uint subaction_idx, + uint subaction_idx_other, bool bimanual) { wmXrActionData *data = MEM_callocN(sizeof(wmXrActionData), __func__); @@ -1092,7 +1092,7 @@ static void wm_xr_session_events_dispatch(wmXrData *xr, { const char *action_set_name = action_set->name; - const unsigned int count = GHOST_XrGetActionCount(xr_context, action_set_name); + const uint count = GHOST_XrGetActionCount(xr_context, action_set_name); if (count < 1) { return; } @@ -1109,14 +1109,14 @@ static void wm_xr_session_events_dispatch(wmXrData *xr, /* Check haptic action timers. */ wm_xr_session_haptic_timers_check(active_haptic_actions, time_now); - for (unsigned int action_idx = 0; action_idx < count; ++action_idx) { + for (uint action_idx = 0; action_idx < count; ++action_idx) { wmXrAction *action = actions[action_idx]; if (action && action->ot) { const bool modal = action->ot->modal; const bool haptic = (GHOST_XrGetActionCustomdata( xr_context, action_set_name, action->haptic_name) != NULL); - for (unsigned int subaction_idx = 0; subaction_idx < action->count_subaction_paths; + for (uint subaction_idx = 0; subaction_idx < action->count_subaction_paths; ++subaction_idx) { short val = KM_NOTHING; @@ -1143,7 +1143,7 @@ static void wm_xr_session_events_dispatch(wmXrData *xr, const GHOST_XrPose *aim_pose = wm_xr_session_controller_aim_pose_find( session_state, action->subaction_paths[subaction_idx]); const GHOST_XrPose *aim_pose_other = NULL; - unsigned int subaction_idx_other = 0; + uint subaction_idx_other = 0; /* Test for bimanual interaction. */ const bool bimanual = wm_xr_session_action_test_bimanual( @@ -1242,11 +1242,11 @@ void wm_xr_session_controller_data_populate(const wmXrAction *grip_action, ListBase *controllers = &state->controllers; BLI_assert(grip_action->count_subaction_paths == aim_action->count_subaction_paths); - const unsigned int count = grip_action->count_subaction_paths; + const uint count = grip_action->count_subaction_paths; wm_xr_session_controller_data_free(state); - for (unsigned int i = 0; i < count; ++i) { + for (uint i = 0; i < count; ++i) { wmXrController *controller = MEM_callocN(sizeof(*controller), __func__); BLI_assert(STREQ(grip_action->subaction_paths[i], aim_action->subaction_paths[i])); |