diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 10:04:52 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 11:26:27 +0300 |
commit | 891949cbb47143420f4324cb60efc05ef5d70b39 (patch) | |
tree | fe70a45612ae96f9ce1f37378ef5ff035d3127f5 /source | |
parent | c9e35c2ced92082c86f1ecb9ecd16c6230218c7c (diff) |
Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by
'unsigned char(x)'.
Diffstat (limited to 'source')
226 files changed, 1385 insertions, 1537 deletions
diff --git a/source/blender/blendthumb/src/blendthumb_png.cc b/source/blender/blendthumb/src/blendthumb_png.cc index 64326c9abb1..e3e3e929e63 100644 --- a/source/blender/blendthumb/src/blendthumb_png.cc +++ b/source/blender/blendthumb/src/blendthumb_png.cc @@ -61,7 +61,7 @@ static blender::Vector<uint8_t> filtered_rows_from_thumb(const Thumbnail *thumb) static std::optional<blender::Vector<uint8_t>> zlib_compress(const blender::Vector<uint8_t> &data) { - unsigned long uncompressed_size = data.size(); + ulong uncompressed_size = data.size(); uLongf compressed_size = compressBound(uncompressed_size); blender::Vector<uint8_t> compressed(compressed_size, 0x00); diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 4e904768f79..df8a9734c9a 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -117,7 +117,7 @@ static int blf_search_available(void) return -1; } -bool BLF_has_glyph(int fontid, unsigned int unicode) +bool BLF_has_glyph(int fontid, uint unicode) { FontBLF *font = blf_get(fontid); if (font) { @@ -174,7 +174,7 @@ int BLF_load_unique(const char *name) return i; } -void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size) +void BLF_metrics_attach(int fontid, uchar *mem, int mem_size) { FontBLF *font = blf_get(fontid); @@ -183,7 +183,7 @@ void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size) } } -int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size) +int BLF_load_mem(const char *name, const uchar *mem, int mem_size) { int i = blf_search(name); if (i >= 0) { @@ -193,7 +193,7 @@ int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size) return BLF_load_mem_unique(name, mem, mem_size); } -int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size) +int BLF_load_mem_unique(const char *name, const uchar *mem, int mem_size) { /* * Don't search in the cache, make a new object font! @@ -379,7 +379,7 @@ void BLF_blur(int fontid, int size) } #endif -void BLF_color4ubv(int fontid, const unsigned char rgba[4]) +void BLF_color4ubv(int fontid, const uchar rgba[4]) { FontBLF *font = blf_get(fontid); @@ -391,7 +391,7 @@ void BLF_color4ubv(int fontid, const unsigned char rgba[4]) } } -void BLF_color3ubv_alpha(int fontid, const unsigned char rgb[3], unsigned char alpha) +void BLF_color3ubv_alpha(int fontid, const uchar rgb[3], uchar alpha) { FontBLF *font = blf_get(fontid); @@ -403,13 +403,12 @@ void BLF_color3ubv_alpha(int fontid, const unsigned char rgb[3], unsigned char a } } -void BLF_color3ubv(int fontid, const unsigned char rgb[3]) +void BLF_color3ubv(int fontid, const uchar rgb[3]) { BLF_color3ubv_alpha(fontid, rgb, 255); } -void BLF_color4ub( - int fontid, unsigned char r, unsigned char g, unsigned char b, unsigned char alpha) +void BLF_color4ub(int fontid, uchar r, uchar g, uchar b, uchar alpha) { FontBLF *font = blf_get(fontid); @@ -421,7 +420,7 @@ void BLF_color4ub( } } -void BLF_color3ub(int fontid, unsigned char r, unsigned char g, unsigned char b) +void BLF_color3ub(int fontid, uchar r, uchar g, uchar b) { FontBLF *font = blf_get(fontid); @@ -814,7 +813,7 @@ void BLF_shadow_offset(int fontid, int x, int y) void BLF_buffer(int fontid, float *fbuf, - unsigned char *cbuf, + uchar *cbuf, int w, int h, int nch, diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c index 09ddb56e53b..2243da4df18 100644 --- a/source/blender/blenfont/intern/blf_util.c +++ b/source/blender/blenfont/intern/blf_util.c @@ -15,7 +15,7 @@ #include "blf_internal.h" -unsigned int blf_next_p2(unsigned int x) +uint blf_next_p2(uint x) { x -= 1; x |= (x >> 16); @@ -27,9 +27,9 @@ unsigned int blf_next_p2(unsigned int x) return x; } -unsigned int blf_hash(unsigned int val) +uint blf_hash(uint val) { - unsigned int key; + uint key; key = val; key += ~(key << 16); diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 375e7b456cd..b4cc46619a7 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -279,8 +279,8 @@ bool DM_release(DerivedMesh *dm) void DM_ensure_looptri_data(DerivedMesh *dm) { - const unsigned int totpoly = dm->numPolyData; - const unsigned int totloop = dm->numLoopData; + const uint totpoly = dm->numPolyData; + const uint totloop = dm->numLoopData; const int looptris_num = poly_to_tri_count(totpoly, totloop); BLI_assert(dm->looptris.array_wip == nullptr); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 9b00d427320..2e73cac99b5 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -698,7 +698,7 @@ void BKE_armature_refresh_layer_used(struct Depsgraph *depsgraph, struct bArmatu bool bone_autoside_name( char name[MAXBONENAME], int UNUSED(strip_number), short axis, float head, float tail) { - unsigned int len; + uint len; char basename[MAXBONENAME] = ""; char extension[5] = ""; diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c index 84bb1af011a..4acbcbfb13e 100644 --- a/source/blender/blenkernel/intern/armature_deform.c +++ b/source/blender/blenkernel/intern/armature_deform.c @@ -314,7 +314,7 @@ static void armature_vert_task_with_dvert(const ArmatureUserdata *data, if (use_dverts && dvert && dvert->totweight) { /* use weight groups ? */ const MDeformWeight *dw = dvert->dw; int deformed = 0; - unsigned int j; + uint j; for (j = dvert->totweight; j != 0; j--, dw++) { const uint index = dw->def_nr; if (index < data->defbase_len && (pchan = data->pchan_from_defbase[index])) { diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index c3384239cb6..e404c982d55 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -579,7 +579,7 @@ typedef struct CameraViewFrameData { float dist_vals[CAMERA_VIEWFRAME_NUM_PLANES]; /* distance (signed) */ float camera_no[3]; float z_range[2]; - unsigned int tot; + uint tot; bool do_zrange; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index bcdd01aa8b3..1f97f8a848c 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -115,8 +115,8 @@ static void cdDM_getVertNo(DerivedMesh *dm, int index, float r_no[3]) static void cdDM_recalc_looptri(DerivedMesh *dm) { CDDerivedMesh *cddm = (CDDerivedMesh *)dm; - const unsigned int totpoly = dm->numPolyData; - const unsigned int totloop = dm->numLoopData; + const uint totpoly = dm->numPolyData; + const uint totloop = dm->numLoopData; DM_ensure_looptri_data(dm); BLI_assert(totpoly == 0 || cddm->dm.looptris.array_wip != NULL); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index f3bda8b1c99..8c3098069c4 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -117,7 +117,7 @@ static BVHTree *bvhtree_build_from_cloth(ClothModifierData *clmd, float epsilon) void bvhtree_update_from_cloth(ClothModifierData *clmd, bool moving, bool self) { - unsigned int i = 0; + uint i = 0; Cloth *cloth = clmd->clothObject; BVHTree *bvhtree; ClothVertex *verts = cloth->verts; @@ -252,7 +252,7 @@ static int do_step_cloth( Cloth *cloth; ListBase *effectors = NULL; MVert *mvert; - unsigned int i = 0; + uint i = 0; int ret = 0; bool vert_mass_changed = false; @@ -576,7 +576,7 @@ void cloth_free_modifier_extern(ClothModifierData *clmd) */ static void cloth_to_object(Object *ob, ClothModifierData *clmd, float (*vertexCos)[3]) { - unsigned int i = 0; + uint i = 0; Cloth *cloth = clmd->clothObject; if (clmd->clothObject) { @@ -825,8 +825,8 @@ static void cloth_from_mesh(ClothModifierData *clmd, const Object *ob, Mesh *mes { const MLoop *mloop = BKE_mesh_loops(mesh); const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(mesh); - const unsigned int mvert_num = mesh->totvert; - const unsigned int looptri_num = mesh->runtime.looptris.len; + const uint mvert_num = mesh->totvert; + const uint looptri_num = mesh->runtime.looptris.len; /* Allocate our vertices. */ clmd->clothObject->mvert_num = mvert_num; @@ -884,7 +884,7 @@ BLI_INLINE void spring_verts_ordered_set(ClothSpring *spring, int v0, int v1) } } -static void cloth_free_edgelist(LinkNodePair *edgelist, unsigned int mvert_num) +static void cloth_free_edgelist(LinkNodePair *edgelist, uint mvert_num) { if (edgelist) { for (uint i = 0; i < mvert_num; i++) { diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 0bacd657981..dc7a4968f59 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -67,7 +67,7 @@ void collision_move_object(CollisionModifierData *collmd, const float prevstep, const bool moving_bvh) { - unsigned int i = 0; + uint i = 0; /* the collider doesn't move this frame */ if (collmd->is_static) { diff --git a/source/blender/blenkernel/intern/cryptomatte.cc b/source/blender/blenkernel/intern/cryptomatte.cc index 72204f6624e..e5f85f6aecf 100644 --- a/source/blender/blenkernel/intern/cryptomatte.cc +++ b/source/blender/blenkernel/intern/cryptomatte.cc @@ -311,7 +311,7 @@ static std::string cryptomatte_determine_name(const ViewLayer *view_layer, static uint32_t cryptomatte_determine_identifier(const blender::StringRef name) { - return BLI_hash_mm3(reinterpret_cast<const unsigned char *>(name.data()), name.size(), 0); + return BLI_hash_mm3(reinterpret_cast<const uchar *>(name.data()), name.size(), 0); } static void add_render_result_meta_data(RenderResult *render_result, diff --git a/source/blender/blenkernel/intern/curve.cc b/source/blender/blenkernel/intern/curve.cc index ca390fae424..652315e74f9 100644 --- a/source/blender/blenkernel/intern/curve.cc +++ b/source/blender/blenkernel/intern/curve.cc @@ -395,7 +395,7 @@ void BKE_curve_init(Curve *cu, const short curve_type) cu->flag |= CU_FRONT | CU_BACK; cu->vfont = cu->vfontb = cu->vfonti = cu->vfontbi = BKE_vfont_builtin_get(); cu->vfont->id.us += 4; - cu->str = (char *)MEM_malloc_arrayN(12, sizeof(unsigned char), "str"); + cu->str = (char *)MEM_malloc_arrayN(12, sizeof(uchar), "str"); BLI_strncpy(cu->str, "Text", 12); cu->len = cu->len_char32 = cu->pos = 4; cu->strinfo = (CharInfo *)MEM_calloc_arrayN(12, sizeof(CharInfo), "strinfo new"); @@ -1499,7 +1499,7 @@ void BKE_nurb_makeFaces(const Nurb *nu, float *coord_array, int rowstride, int r } u += ustep; if (rowstride != 0) { - in = (float *)(((unsigned char *)in) + (rowstride - 3 * totv * sizeof(*in))); + in = (float *)(((uchar *)in) + (rowstride - 3 * totv * sizeof(*in))); } } @@ -1647,35 +1647,34 @@ void BKE_nurb_makeCurve(const Nurb *nu, MEM_freeN(basisu); } -unsigned int BKE_curve_calc_coords_axis_len(const unsigned int bezt_array_len, - const unsigned int resolu, - const bool is_cyclic, - const bool use_cyclic_duplicate_endpoint) +uint BKE_curve_calc_coords_axis_len(const uint bezt_array_len, + const uint resolu, + const bool is_cyclic, + const bool use_cyclic_duplicate_endpoint) { - const unsigned int segments = bezt_array_len - (is_cyclic ? 0 : 1); - const unsigned int points_len = (segments * resolu) + - (is_cyclic ? (use_cyclic_duplicate_endpoint) : 1); + const uint segments = bezt_array_len - (is_cyclic ? 0 : 1); + const uint points_len = (segments * resolu) + (is_cyclic ? (use_cyclic_duplicate_endpoint) : 1); return points_len; } void BKE_curve_calc_coords_axis(const BezTriple *bezt_array, - const unsigned int bezt_array_len, - const unsigned int resolu, + const uint bezt_array_len, + const uint resolu, const bool is_cyclic, const bool use_cyclic_duplicate_endpoint, /* array params */ - const unsigned int axis, - const unsigned int stride, + const uint axis, + const uint stride, float *r_points) { - const unsigned int points_len = BKE_curve_calc_coords_axis_len( + const uint points_len = BKE_curve_calc_coords_axis_len( bezt_array_len, resolu, is_cyclic, use_cyclic_duplicate_endpoint); float *r_points_offset = r_points; - const unsigned int resolu_stride = resolu * stride; - const unsigned int bezt_array_last = bezt_array_len - 1; + const uint resolu_stride = resolu * stride; + const uint bezt_array_last = bezt_array_len - 1; - for (unsigned int i = 0; i < bezt_array_last; i++) { + for (uint i = 0; i < bezt_array_last; i++) { const BezTriple *bezt_curr = &bezt_array[i]; const BezTriple *bezt_next = &bezt_array[i + 1]; BKE_curve_forward_diff_bezier(bezt_curr->vec[1][axis], @@ -5390,7 +5389,7 @@ bool BKE_curve_material_index_validate(Curve *cu) return false; } -void BKE_curve_material_remap(Curve *cu, const unsigned int *remap, unsigned int remap_len) +void BKE_curve_material_remap(Curve *cu, const uint *remap, uint remap_len) { const int curvetype = BKE_curve_type_get(cu); const short remap_len_short = (short)remap_len; diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index 51c3b405ebc..86be7ba8e7c 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -646,7 +646,7 @@ static void layerCopy_mdisps(const void *source, void *dest, const int count) for (int i = 0; i < count; i++) { if (s[i].disps) { d[i].disps = static_cast<float(*)[3]>(MEM_dupallocN(s[i].disps)); - d[i].hidden = static_cast<unsigned int *>(MEM_dupallocN(s[i].hidden)); + d[i].hidden = static_cast<uint *>(MEM_dupallocN(s[i].hidden)); } else { d[i].disps = nullptr; @@ -832,7 +832,7 @@ static void layerCopyValue_mloopcol(const void *source, { const MLoopCol *m1 = static_cast<const MLoopCol *>(source); MLoopCol *m2 = static_cast<MLoopCol *>(dest); - unsigned char tmp_col[4]; + uchar tmp_col[4]; if (ELEM(mixmode, CDT_MIX_NOMIX, @@ -855,8 +855,8 @@ static void layerCopyValue_mloopcol(const void *source, m2->a = m1->a; } else { /* Modes that support 'real' mix factor. */ - unsigned char src[4] = {m1->r, m1->g, m1->b, m1->a}; - unsigned char dst[4] = {m2->r, m2->g, m2->b, m2->a}; + uchar src[4] = {m1->r, m1->g, m1->b, m1->a}; + uchar dst[4] = {m2->r, m2->g, m2->b, m2->a}; if (mixmode == CDT_MIX_MIX) { blend_color_mix_byte(tmp_col, dst, src); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 7940d65b1bb..a655e7e15c4 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -271,7 +271,7 @@ void BKE_defvert_normalize(MDeformVert *dvert) } else { MDeformWeight *dw; - unsigned int i; + uint i; float tot_weight = 0.0f; for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) { @@ -309,7 +309,7 @@ void BKE_defvert_normalize_lock_single(MDeformVert *dvert, else { MDeformWeight *dw_lock = NULL; MDeformWeight *dw; - unsigned int i; + uint i; float tot_weight = 0.0f; float lock_iweight = 1.0f; @@ -363,7 +363,7 @@ void BKE_defvert_normalize_lock_map(MDeformVert *dvert, } else { MDeformWeight *dw; - unsigned int i; + uint i; float tot_weight = 0.0f; float lock_iweight = 0.0f; @@ -752,7 +752,7 @@ MDeformWeight *BKE_defvert_find_index(const MDeformVert *dvert, const int defgro { if (dvert && defgroup >= 0) { MDeformWeight *dw = dvert->dw; - unsigned int i; + uint i; for (i = dvert->totweight; i != 0; i--, dw++) { if (dw->def_nr == defgroup) { diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index ddffb91cef7..f0726048647 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -212,13 +212,13 @@ typedef struct PaintBakeData { typedef struct PaintUVPoint { /* Pixel / mesh data */ /** tri index on domain derived mesh */ - unsigned int tri_index; - unsigned int pixel_index; + uint tri_index; + uint pixel_index; /* vertex indexes */ - unsigned int v1, v2, v3; + uint v1, v2, v3; /** If this pixel isn't uv mapped to any face, but its neighboring pixel is. */ - unsigned int neighbor_pixel; + uint neighbor_pixel; } PaintUVPoint; typedef struct ImgSeqFormatData { @@ -514,7 +514,7 @@ static void scene_setSubframe(Scene *scene, float subframe) static int surface_getBrushFlags(DynamicPaintSurface *surface, Depsgraph *depsgraph) { - unsigned int numobjects; + uint numobjects; Object **objects = BKE_collision_objects_create( depsgraph, NULL, surface->brush_group, &numobjects, eModifierType_DynamicPaint); @@ -1496,7 +1496,7 @@ static void dynamic_paint_set_init_color_tex_to_vcol_cb( for (int j = 3; j--;) { TexResult texres = {0}; - const unsigned int vert = mloop[mlooptri[i].tri[j]].v; + const uint vert = mloop[mlooptri[i].tri[j]].v; /* remap to [-1.0, 1.0] */ uv[0] = mloopuv[mlooptri[i].tri[j]].uv[0] * 2.0f - 1.0f; @@ -1569,7 +1569,7 @@ static void dynamic_paint_set_init_color_vcol_to_imseq_cb( /* collect color values */ for (int j = 3; j--;) { - rgba_uchar_to_float(colors[j], (const unsigned char *)&mloopcol[mlooptri[tri_idx].tri[j]].r); + rgba_uchar_to_float(colors[j], (const uchar *)&mloopcol[mlooptri[tri_idx].tri[j]].r); } /* interpolate final color */ @@ -1669,7 +1669,7 @@ static void dynamicPaint_setInitialColor(const Scene *scene, DynamicPaintSurface } for (int i = 0; i < totloop; i++) { - rgba_uchar_to_float(pPoint[mloop[i].v].color, (const unsigned char *)&col[i].r); + rgba_uchar_to_float(pPoint[mloop[i].v].color, (const uchar *)&col[i].r); } } else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) { @@ -1698,7 +1698,7 @@ void dynamicPaint_clearSurface(const Scene *scene, DynamicPaintSurface *surface) { PaintSurfaceData *sData = surface->data; if (sData && sData->type_data) { - unsigned int data_size; + uint data_size; if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) { data_size = sizeof(PaintPoint); @@ -1862,7 +1862,7 @@ static void dynamic_paint_apply_surface_vpaint_cb(void *__restrict userdata, /* save layer data to output layer */ /* apply color */ if (mloopcol) { - rgba_float_to_uchar((unsigned char *)&mloopcol[l_index].r, fcolor[v_index]); + rgba_float_to_uchar((uchar *)&mloopcol[l_index].r, fcolor[v_index]); } /* apply wetness */ if (mloopcol_wet) { diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index f5876e48241..58350b8cda5 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1308,7 +1308,7 @@ void BKE_fcurve_handles_recalc(FCurve *fcu) void testhandles_fcurve(FCurve *fcu, eBezTriple_Flag sel_flag, const bool use_handle) { BezTriple *bezt; - unsigned int a; + uint a; /* Only beztriples have handles (bpoints don't though). */ if (ELEM(NULL, fcu, fcu->bezt)) { diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 11c3dfc18dc..551bab75d4b 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -203,7 +203,7 @@ static void fcm_generator_evaluate( case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* Factorized polynomial */ { float value = 1.0f, *cp = NULL; - unsigned int i; + uint i; /* For each coefficient pair, * solve for that bracket before accumulating in value by multiplying. */ diff --git a/source/blender/blenkernel/intern/icons.cc b/source/blender/blenkernel/intern/icons.cc index f59f5352aad..76a02316e9f 100644 --- a/source/blender/blenkernel/intern/icons.cc +++ b/source/blender/blenkernel/intern/icons.cc @@ -566,9 +566,9 @@ void BKE_previewimg_ensure(PreviewImage *prv, const int size) ImBuf *BKE_previewimg_to_imbuf(PreviewImage *prv, const int size) { - const unsigned int w = prv->w[size]; - const unsigned int h = prv->h[size]; - const unsigned int *rect = prv->rect[size]; + const uint w = prv->w[size]; + const uint h = prv->h[size]; + const uint *rect = prv->rect[size]; ImBuf *ima = nullptr; diff --git a/source/blender/blenkernel/intern/icons_rasterize.c b/source/blender/blenkernel/intern/icons_rasterize.c index 00dbdcfa1e5..56854c1318e 100644 --- a/source/blender/blenkernel/intern/icons_rasterize.c +++ b/source/blender/blenkernel/intern/icons_rasterize.c @@ -67,9 +67,7 @@ static void tri_fill_smooth(int x, int x_end, int y, void *user_data) } } -ImBuf *BKE_icon_geom_rasterize(const struct Icon_Geom *geom, - const unsigned int size_x, - const unsigned int size_y) +ImBuf *BKE_icon_geom_rasterize(const struct Icon_Geom *geom, const uint size_x, const uint size_y) { const int coords_len = geom->coords_len; diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc index 3cc0727a94a..64f6ceba32b 100644 --- a/source/blender/blenkernel/intern/image.cc +++ b/source/blender/blenkernel/intern/image.cc @@ -484,7 +484,7 @@ struct ImageCacheKey { int index; }; -static unsigned int imagecache_hashhash(const void *key_v) +static uint imagecache_hashhash(const void *key_v) { const ImageCacheKey *key = static_cast<const ImageCacheKey *>(key_v); return key->index; @@ -1080,7 +1080,7 @@ struct ImageFillData { short gen_type; uint width; uint height; - unsigned char *rect; + uchar *rect; float *rect_float; float fill_color[4]; }; @@ -1093,7 +1093,7 @@ static void image_buf_fill_isolated(void *usersata_v) const uint width = usersata->width; const uint height = usersata->height; - unsigned char *rect = usersata->rect; + uchar *rect = usersata->rect; float *rect_float = usersata->rect_float; switch (gen_type) { @@ -1112,7 +1112,7 @@ static void image_buf_fill_isolated(void *usersata_v) static ImBuf *add_ibuf_for_tile(Image *ima, ImageTile *tile) { ImBuf *ibuf; - unsigned char *rect = nullptr; + uchar *rect = nullptr; float *rect_float = nullptr; float fill_color[4]; @@ -1152,7 +1152,7 @@ static ImBuf *add_ibuf_for_tile(Image *ima, ImageTile *tile) } if (ibuf != nullptr) { - rect = (unsigned char *)ibuf->rect; + rect = (uchar *)ibuf->rect; IMB_colormanagement_assign_rect_colorspace(ibuf, ima->colorspace_settings.name); } @@ -1183,8 +1183,8 @@ static ImBuf *add_ibuf_for_tile(Image *ima, ImageTile *tile) } Image *BKE_image_add_generated(Main *bmain, - unsigned int width, - unsigned int height, + uint width, + uint height, const char *name, int depth, int floatbuf, @@ -1943,7 +1943,7 @@ static void stampdata_from_template(StampData *stamp_data, void BKE_image_stamp_buf(Scene *scene, Object *camera, const StampData *stamp_data_template, - unsigned char *rect, + uchar *rect, float *rectf, int width, int height, @@ -2524,7 +2524,7 @@ bool BKE_imbuf_alpha_test(ImBuf *ibuf) } } else if (ibuf->rect) { - unsigned char *buf = (unsigned char *)ibuf->rect; + uchar *buf = (uchar *)ibuf->rect; for (tot = ibuf->x * ibuf->y; tot--; buf += 4) { if (buf[3] != 255) { return true; @@ -4101,7 +4101,7 @@ static ImBuf *load_image_single(Image *ima, LISTBASE_FOREACH (ImagePackedFile *, imapf, &ima->packedfiles) { if (imapf->view == view_id && imapf->tile_number == tile_number) { if (imapf->packedfile) { - ibuf = IMB_ibImageFromMemory((unsigned char *)imapf->packedfile->data, + ibuf = IMB_ibImageFromMemory((uchar *)imapf->packedfile->data, imapf->packedfile->size, flag, ima->colorspace_settings.name, @@ -4291,7 +4291,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc Render *re; RenderView *rv; float *rectf, *rectz; - unsigned int *rect; + uint *rect; float dither; int channels, layer, pass; ImBuf *ibuf; @@ -4350,12 +4350,12 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc /* this gives active layer, composite or sequence result */ if (rv == nullptr) { - rect = (unsigned int *)rres.rect32; + rect = (uint *)rres.rect32; rectf = rres.rectf; rectz = rres.rectz; } else { - rect = (unsigned int *)rv->rect32; + rect = (uint *)rv->rect32; rectf = rv->rectf; rectz = rv->rectz; } @@ -5120,7 +5120,7 @@ void BKE_image_user_file_path_ex(const Main *bmain, if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_TILED)) { char head[FILE_MAX], tail[FILE_MAX]; - unsigned short numlen; + ushort numlen; int index; if (ima->source == IMA_SRC_SEQUENCE) { @@ -5204,13 +5204,13 @@ void BKE_image_get_aspect(Image *image, float *r_aspx, float *r_aspy) } } -unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame, int tile) +uchar *BKE_image_get_pixels_for_frame(struct Image *image, int frame, int tile) { ImageUser iuser; BKE_imageuser_default(&iuser); void *lock; ImBuf *ibuf; - unsigned char *pixels = nullptr; + uchar *pixels = nullptr; iuser.framenr = frame; iuser.tile = tile; @@ -5218,10 +5218,10 @@ unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame, in ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock); if (ibuf) { - pixels = (unsigned char *)ibuf->rect; + pixels = (uchar *)ibuf->rect; if (pixels) { - pixels = static_cast<unsigned char *>(MEM_dupallocN(pixels)); + pixels = static_cast<uchar *>(MEM_dupallocN(pixels)); } BKE_image_release_ibuf(image, ibuf, lock); diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index 32795baaa37..a0474d1ae7c 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -19,14 +19,14 @@ #include "BLF_api.h" typedef struct FillColorThreadData { - unsigned char *rect; + uchar *rect; float *rect_float; int width; float color[4]; } FillColorThreadData; static void image_buf_fill_color_slice( - unsigned char *rect, float *rect_float, int width, int height, const float color[4]) + uchar *rect, float *rect_float, int width, int height, const float color[4]) { int x, y; @@ -41,7 +41,7 @@ static void image_buf_fill_color_slice( } if (rect) { - unsigned char ccol[4]; + uchar ccol[4]; rgba_float_to_uchar(ccol, color); for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { @@ -60,13 +60,13 @@ static void image_buf_fill_color_thread_do(void *data_v, int scanline) FillColorThreadData *data = (FillColorThreadData *)data_v; const int num_scanlines = 1; size_t offset = ((size_t)scanline) * data->width * 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; image_buf_fill_color_slice(rect, rect_float, data->width, num_scanlines, data->color); } void BKE_image_buf_fill_color( - unsigned char *rect, float *rect_float, int width, int height, const float color[4]) + uchar *rect, float *rect_float, int width, int height, const float color[4]) { if (((size_t)width) * height < 64 * 64) { image_buf_fill_color_slice(rect, rect_float, width, height, color); @@ -82,7 +82,7 @@ void BKE_image_buf_fill_color( } static void image_buf_fill_checker_slice( - unsigned char *rect, float *rect_float, int width, int height, int offset) + uchar *rect, float *rect_float, int width, int height, int offset) { /* these two passes could be combined into one, but it's more readable and * easy to tweak like this, speed isn't really that much of an issue in this situation... */ @@ -90,7 +90,7 @@ static void image_buf_fill_checker_slice( int checkerwidth = 32; int x, y; - unsigned char *rect_orig = rect; + uchar *rect_orig = rect; float *rect_float_orig = rect_float; float hsv[3] = {0.0f, 0.9f, 0.9f}; @@ -178,7 +178,7 @@ static void image_buf_fill_checker_slice( } typedef struct FillCheckerThreadData { - unsigned char *rect; + uchar *rect; float *rect_float; int width; } FillCheckerThreadData; @@ -188,12 +188,12 @@ static void image_buf_fill_checker_thread_do(void *data_v, int scanline) FillCheckerThreadData *data = (FillCheckerThreadData *)data_v; size_t offset = ((size_t)scanline) * data->width * 4; const int num_scanlines = 1; - 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; image_buf_fill_checker_slice(rect, rect_float, data->width, num_scanlines, scanline); } -void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height) +void BKE_image_buf_fill_checker(uchar *rect, float *rect_float, int width, int height) { if (((size_t)width) * height < 64 * 64) { image_buf_fill_checker_slice(rect, rect_float, width, height, 0); @@ -214,7 +214,7 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt ((real + (char)(add * 255.0f)) <= 255) ? (real + (char)(add * 255.0f)) : 255 static void checker_board_color_fill( - 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) { int hue_step, y, x; float hsv[3], rgb[3]; @@ -255,13 +255,8 @@ static void checker_board_color_fill( } } -static void checker_board_color_tint(unsigned char *rect, - float *rect_float, - int width, - int height, - int size, - float blend, - int offset) +static void checker_board_color_tint( + uchar *rect, float *rect_float, int width, int height, int size, float blend, int offset) { int x, y; float blend_half = blend * 0.5f; @@ -310,7 +305,7 @@ static void checker_board_color_tint(unsigned char *rect, } static void checker_board_grid_fill( - unsigned char *rect, float *rect_float, int width, int height, float blend, int offset) + uchar *rect, float *rect_float, int width, int height, float blend, int offset) { int x, y; for (y = offset; y < height + offset; y++) { @@ -348,7 +343,7 @@ static void checker_board_grid_fill( /* defined in image.c */ static void checker_board_text( - unsigned char *rect, float *rect_float, int width, int height, int step, int outline) + uchar *rect, float *rect_float, int width, int height, int step, int outline) { int x, y; int pen_x, pen_y; diff --git a/source/blender/blenkernel/intern/image_save.cc b/source/blender/blenkernel/intern/image_save.cc index 6f62ee123cb..74582446315 100644 --- a/source/blender/blenkernel/intern/image_save.cc +++ b/source/blender/blenkernel/intern/image_save.cc @@ -473,7 +473,7 @@ static bool image_save_single(ReportList *reports, } /* individual multiview images */ else if (imf->views_format == R_IMF_VIEWS_INDIVIDUAL) { - unsigned char planes = ibuf->planes; + uchar planes = ibuf->planes; const int totviews = (rr ? BLI_listbase_count(&rr->views) : BLI_listbase_count(&ima->views)); if (!is_exr_rr) { @@ -543,7 +543,7 @@ static bool image_save_single(ReportList *reports, else { ImBuf *ibuf_stereo[2] = {nullptr}; - unsigned char planes = ibuf->planes; + uchar planes = ibuf->planes; const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; /* we need to get the specific per-view buffers */ diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index e0959182fa4..f6a409ee3f0 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -245,7 +245,7 @@ int BKE_lattice_index_flip( void BKE_lattice_bitmap_from_flag( Lattice *lt, BLI_bitmap *bitmap, const uint8_t flag, const bool clear, const bool respecthide) { - const unsigned int tot = lt->pntsu * lt->pntsv * lt->pntsw; + const uint tot = lt->pntsu * lt->pntsv * lt->pntsw; BPoint *bp; bp = lt->def; diff --git a/source/blender/blenkernel/intern/main_idmap.c b/source/blender/blenkernel/intern/main_idmap.c index a01dbd14e65..24c1da782fe 100644 --- a/source/blender/blenkernel/intern/main_idmap.c +++ b/source/blender/blenkernel/intern/main_idmap.c @@ -184,10 +184,10 @@ struct Main *BKE_main_idmap_main_get(struct IDNameLib_Map *id_map) return id_map->bmain; } -static unsigned int idkey_hash(const void *ptr) +static uint idkey_hash(const void *ptr) { const struct IDNameLib_Key *idkey = ptr; - unsigned int key = BLI_ghashutil_strhash(idkey->name); + uint key = BLI_ghashutil_strhash(idkey->name); if (idkey->lib) { key ^= BLI_ghashutil_ptrhash(idkey->lib); } diff --git a/source/blender/blenkernel/intern/main_namemap.cc b/source/blender/blenkernel/intern/main_namemap.cc index a600afb4ed1..82133204e19 100644 --- a/source/blender/blenkernel/intern/main_namemap.cc +++ b/source/blender/blenkernel/intern/main_namemap.cc @@ -97,7 +97,7 @@ struct UniqueName_Key { * one larger. */ struct UniqueName_Value { - static constexpr unsigned max_exact_tracking = 1024; + static constexpr uint max_exact_tracking = 1024; BLI_BITMAP_DECLARE(mask, max_exact_tracking); int max_value = 0; diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c index 3425510c8b9..7ece6946e00 100644 --- a/source/blender/blenkernel/intern/mask_evaluate.c +++ b/source/blender/blenkernel/intern/mask_evaluate.c @@ -24,10 +24,10 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" -unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height) +uint BKE_mask_spline_resolution(MaskSpline *spline, int width, int height) { float max_segment = 0.01f; - unsigned int i, resol = 1; + uint i, resol = 1; if (width != 0 && height != 0) { max_segment = 1.0f / (float)max_ii(width, height); @@ -37,7 +37,7 @@ unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int heigh MaskSplinePoint *point = &spline->points[i]; BezTriple *bezt_curr, *bezt_next; float a, b, c, len; - unsigned int cur_resol; + uint cur_resol; bezt_curr = &point->bezt; bezt_next = BKE_mask_spline_point_next_bezt(spline, spline->points, point); @@ -63,10 +63,10 @@ unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int heigh return CLAMPIS(resol, 1, MASK_RESOL_MAX); } -unsigned int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height) +uint BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height) { const float max_segment = 0.005; - unsigned int resol = BKE_mask_spline_resolution(spline, width, height); + uint resol = BKE_mask_spline_resolution(spline, width, height); float max_jump = 0.0f; /* avoid checking the featrher if we already hit the maximum value */ @@ -102,7 +102,7 @@ unsigned int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, i return CLAMPIS(resol, 1, MASK_RESOL_MAX); } -int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const unsigned int resol) +int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const uint resol) { if (spline->flag & MASK_SPLINE_CYCLIC) { return spline->tot_point * resol; @@ -112,8 +112,8 @@ int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const uns } float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, - const unsigned int resol, - unsigned int *r_tot_diff_point))[2] + const uint resol, + uint *r_tot_diff_point))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); @@ -176,7 +176,7 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, } float (*BKE_mask_spline_differentiate( - MaskSpline *spline, int width, int height, unsigned int *r_tot_diff_point))[2] + MaskSpline *spline, int width, int height, uint *r_tot_diff_point))[2] { uint resol = BKE_mask_spline_resolution(spline, width, height); @@ -316,7 +316,7 @@ static void feather_bucket_get_diagonal(FeatherEdgesBucket *buckets, void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, float (*feather_points)[2], - const unsigned int tot_feather_point) + const uint tot_feather_point) { #define BUCKET_INDEX(co) feather_bucket_index_from_coord(co, min, bucket_scale, buckets_per_side) @@ -340,7 +340,7 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, INIT_MINMAX2(min, max); for (uint i = 0; i < tot_feather_point; i++) { - unsigned int next = i + 1; + uint next = i + 1; float delta; minmax_v2v2_v2(min, max, feather_points[i]); @@ -489,11 +489,11 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, } /** only called from #BKE_mask_spline_feather_differentiated_points_with_resolution() ! */ -static float (*mask_spline_feather_differentiated_points_with_resolution__even( - MaskSpline *spline, - const unsigned int resol, - const bool do_feather_isect, - unsigned int *r_tot_feather_point))[2] +static float ( + *mask_spline_feather_differentiated_points_with_resolution__even(MaskSpline *spline, + const uint resol, + const bool do_feather_isect, + uint *r_tot_feather_point))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); MaskSplinePoint *point_curr, *point_prev; diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 84aabbc7a9b..2bbf9e8d891 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -83,10 +83,10 @@ #define BUCKET_PIXELS_PER_CELL 4 #define SF_EDGE_IS_BOUNDARY 0xff -#define SF_KEYINDEX_TEMP_ID ((unsigned int)-1) +#define SF_KEYINDEX_TEMP_ID ((uint)-1) -#define TRI_TERMINATOR_ID ((unsigned int)-1) -#define TRI_VERT ((unsigned int)-1) +#define TRI_TERMINATOR_ID ((uint)-1) +#define TRI_VERT ((uint)-1) /* for debugging add... */ #ifndef NDEBUG @@ -127,9 +127,7 @@ static void rotate_point_v2( r_p[1] = p_new[1] + cent[1]; } -BLI_INLINE unsigned int clampis_uint(const unsigned int v, - const unsigned int min, - const unsigned int max) +BLI_INLINE uint clampis_uint(const uint v, const uint min, const uint max) { return v < min ? min : (v > max ? max : v); } @@ -156,19 +154,19 @@ static ScanFillVert *scanfill_vert_add_v2_with_depth(ScanFillContext *sf_ctx, /* internal use only */ typedef struct MaskRasterLayer { /* geometry */ - unsigned int face_tot; - unsigned int (*face_array)[4]; /* access coords tri/quad */ - float (*face_coords)[3]; /* xy, z 0-1 (1.0 == filled) */ + uint face_tot; + uint (*face_array)[4]; /* access coords tri/quad */ + float (*face_coords)[3]; /* xy, z 0-1 (1.0 == filled) */ /* 2d bounds (to quickly skip bucket lookup) */ rctf bounds; /* buckets */ - unsigned int **buckets_face; + uint **buckets_face; /* cache divide and subtract */ float buckets_xy_scalar[2]; /* (1.0 / (buckets_width + FLT_EPSILON)) * buckets_x */ - unsigned int buckets_x; - unsigned int buckets_y; + uint buckets_x; + uint buckets_y; /* copied direct from #MaskLayer.--- */ /* blending options */ @@ -181,12 +179,12 @@ typedef struct MaskRasterLayer { typedef struct MaskRasterSplineInfo { /* body of the spline */ - unsigned int vertex_offset; - unsigned int vertex_total; + uint vertex_offset; + uint vertex_total; /* capping for non-filled, non cyclic splines */ - unsigned int vertex_total_cap_head; - unsigned int vertex_total_cap_tail; + uint vertex_total_cap_head; + uint vertex_total_cap_tail; bool is_cyclic; } MaskRasterSplineInfo; @@ -196,7 +194,7 @@ typedef struct MaskRasterSplineInfo { */ struct MaskRasterHandle { MaskRasterLayer *layers; - unsigned int layers_tot; + uint layers_tot; /* 2d bounds (to quickly skip bucket lookup) */ rctf bounds; @@ -217,7 +215,7 @@ MaskRasterHandle *BKE_maskrasterize_handle_new(void) void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle) { - const unsigned int layers_tot = mr_handle->layers_tot; + const uint layers_tot = mr_handle->layers_tot; MaskRasterLayer *layer = mr_handle->layers; for (uint i = 0; i < layers_tot; i++, layer++) { @@ -231,10 +229,10 @@ void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle) } if (layer->buckets_face) { - const unsigned int bucket_tot = layer->buckets_x * layer->buckets_y; - unsigned int bucket_index; + const uint bucket_tot = layer->buckets_x * layer->buckets_y; + uint bucket_index; for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) { - unsigned int *face_index = layer->buckets_face[bucket_index]; + uint *face_index = layer->buckets_face[bucket_index]; if (face_index) { MEM_freeN(face_index); } @@ -250,15 +248,15 @@ void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle) static void maskrasterize_spline_differentiate_point_outset(float (*diff_feather_points)[2], float (*diff_points)[2], - const unsigned int tot_diff_point, + const uint tot_diff_point, const float ofs, const bool do_test) { - unsigned int k_prev = tot_diff_point - 2; - unsigned int k_curr = tot_diff_point - 1; - unsigned int k_next = 0; + uint k_prev = tot_diff_point - 2; + uint k_curr = tot_diff_point - 1; + uint k_next = 0; - unsigned int k; + uint k; float d_prev[2]; float d_next[2]; @@ -320,14 +318,14 @@ static void maskrasterize_spline_differentiate_point_outset(float (*diff_feather * are to any of the triangle edges. */ static bool layer_bucket_isect_test(const MaskRasterLayer *layer, - unsigned int face_index, - const unsigned int bucket_x, - const unsigned int bucket_y, + uint face_index, + const uint bucket_x, + const uint bucket_y, const float bucket_size_x, const float bucket_size_y, const float bucket_max_rad_squared) { - unsigned int *face = layer->face_array[face_index]; + uint *face = layer->face_array[face_index]; float(*cos)[3] = layer->face_coords; const float xmin = layer->bounds.xmin + (bucket_size_x * (float)bucket_x); @@ -403,8 +401,8 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) const float bucket_dim_x = BLI_rctf_size_x(&layer->bounds); const float bucket_dim_y = BLI_rctf_size_y(&layer->bounds); - layer->buckets_x = (unsigned int)((bucket_dim_x / pixel_size) / (float)BUCKET_PIXELS_PER_CELL); - layer->buckets_y = (unsigned int)((bucket_dim_y / pixel_size) / (float)BUCKET_PIXELS_PER_CELL); + layer->buckets_x = (uint)((bucket_dim_x / pixel_size) / (float)BUCKET_PIXELS_PER_CELL); + layer->buckets_y = (uint)((bucket_dim_y / pixel_size) / (float)BUCKET_PIXELS_PER_CELL); // printf("bucket size %ux%u\n", layer->buckets_x, layer->buckets_y); @@ -422,14 +420,14 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) FLT_EPSILON; const float bucket_max_rad_squared = bucket_max_rad * bucket_max_rad; - unsigned int *face = &layer->face_array[0][0]; + uint *face = &layer->face_array[0][0]; float(*cos)[3] = layer->face_coords; - const unsigned int bucket_tot = layer->buckets_x * layer->buckets_y; + const uint bucket_tot = layer->buckets_x * layer->buckets_y; LinkNode **bucketstore = MEM_callocN(bucket_tot * sizeof(LinkNode *), __func__); - unsigned int *bucketstore_tot = MEM_callocN(bucket_tot * sizeof(unsigned int), __func__); + uint *bucketstore_tot = MEM_callocN(bucket_tot * sizeof(uint), __func__); - unsigned int face_index; + uint face_index; for (face_index = 0; face_index < layer->face_tot; face_index++, face += 4) { float xmin; @@ -468,17 +466,13 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) CLAMP(ymax, 0.0f, 1.0f); { - unsigned int xi_min = (unsigned int)((xmin - layer->bounds.xmin) * - layer->buckets_xy_scalar[0]); - unsigned int xi_max = (unsigned int)((xmax - layer->bounds.xmin) * - layer->buckets_xy_scalar[0]); - unsigned int yi_min = (unsigned int)((ymin - layer->bounds.ymin) * - layer->buckets_xy_scalar[1]); - unsigned int yi_max = (unsigned int)((ymax - layer->bounds.ymin) * - layer->buckets_xy_scalar[1]); + uint xi_min = (uint)((xmin - layer->bounds.xmin) * layer->buckets_xy_scalar[0]); + uint xi_max = (uint)((xmax - layer->bounds.xmin) * layer->buckets_xy_scalar[0]); + uint yi_min = (uint)((ymin - layer->bounds.ymin) * layer->buckets_xy_scalar[1]); + uint yi_max = (uint)((ymax - layer->bounds.ymin) * layer->buckets_xy_scalar[1]); void *face_index_void = POINTER_FROM_UINT(face_index); - unsigned int xi, yi; + uint xi, yi; /* this should _almost_ never happen but since it can in extreme cases, * we have to clamp the values or we overrun the buffer and crash */ @@ -496,7 +490,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) } for (yi = yi_min; yi <= yi_max; yi++) { - unsigned int bucket_index = (layer->buckets_x * yi) + xi_min; + 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; @@ -528,13 +522,12 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) if (1) { /* now convert linknodes into arrays for faster per pixel access */ - unsigned int **buckets_face = MEM_mallocN(bucket_tot * sizeof(*buckets_face), __func__); - unsigned int bucket_index; + uint **buckets_face = MEM_mallocN(bucket_tot * sizeof(*buckets_face), __func__); + uint bucket_index; for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) { if (bucketstore_tot[bucket_index]) { - unsigned int *bucket = MEM_mallocN( - (bucketstore_tot[bucket_index] + 1) * sizeof(unsigned int), __func__); + uint *bucket = MEM_mallocN((bucketstore_tot[bucket_index] + 1) * sizeof(uint), __func__); LinkNode *bucket_node; buckets_face[bucket_index] = bucket; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3ea6dd3d735..6c6d2298dbd 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1069,7 +1069,7 @@ void BKE_object_material_assign_single_obdata(struct Main *bmain, object_material_assign(bmain, ob, ma, act, BKE_MAT_ASSIGN_OBDATA, false); } -void BKE_object_material_remap(Object *ob, const unsigned int *remap) +void BKE_object_material_remap(Object *ob, const uint *remap) { Material ***matar = BKE_object_material_array_p(ob); const short *totcol_p = BKE_object_material_len_p(ob); diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index 48fadd2e9b8..809f58f1c4c 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -93,32 +93,32 @@ typedef struct MetaballBVHNode { /* BVH node */ struct MetaballBVHNode *child[2]; } MetaballBVHNode; -typedef struct process { /* parameters, storage */ - float thresh, size; /* mball threshold, single cube size */ - float delta; /* small delta for calculating normals */ - unsigned int converge_res; /* converge procedure resolution (more = slower) */ +typedef struct process { /* parameters, storage */ + float thresh, size; /* mball threshold, single cube size */ + float delta; /* small delta for calculating normals */ + uint converge_res; /* converge procedure resolution (more = slower) */ - MetaElem **mainb; /* array of all metaelems */ - unsigned int totelem, mem; /* number of metaelems */ + MetaElem **mainb; /* array of all metaelems */ + uint totelem, mem; /* number of metaelems */ MetaballBVHNode metaball_bvh; /* The simplest bvh */ Box allbb; /* Bounding box of all metaelems */ MetaballBVHNode **bvh_queue; /* Queue used during bvh traversal */ - unsigned int bvh_queue_size; + uint bvh_queue_size; CUBES *cubes; /* stack of cubes waiting for polygonization */ CENTERLIST **centers; /* cube center hash table */ CORNER **corners; /* corner value hash table */ EDGELIST **edges; /* edge and vertex id hash table */ - int (*indices)[4]; /* output indices */ - unsigned int totindex; /* size of memory allocated for indices */ - unsigned int curindex; /* number of currently added indices */ + int (*indices)[4]; /* output indices */ + uint totindex; /* size of memory allocated for indices */ + uint curindex; /* number of currently added indices */ float (*co)[3], (*no)[3]; /* surface vertices - positions and normals */ - unsigned int totvertex; /* memory size */ - unsigned int curvertex; /* currently added vertices */ + uint totvertex; /* memory size */ + uint curvertex; /* currently added vertices */ /* memory allocation from common pool */ MemArena *pgn_elements; @@ -155,10 +155,9 @@ static void make_box_from_metaelem(Box *r, const MetaElem *ml) * where centroids of elements in the [start, i) segment lie "on the right side" of div, * and elements in the [i, end) segment lie "on the left" */ -static unsigned int partition_mainb( - MetaElem **mainb, unsigned int start, unsigned int end, unsigned int s, float div) +static uint partition_mainb(MetaElem **mainb, uint start, uint end, uint s, float div) { - unsigned int i = start, j = end - 1; + uint i = start, j = end - 1; div *= 2.0f; while (1) { @@ -188,13 +187,10 @@ static unsigned int partition_mainb( /** * Recursively builds a BVH, dividing elements along the middle of the longest axis of allbox. */ -static void build_bvh_spatial(PROCESS *process, - MetaballBVHNode *node, - unsigned int start, - unsigned int end, - const Box *allbox) +static void build_bvh_spatial( + PROCESS *process, MetaballBVHNode *node, uint start, uint end, const Box *allbox) { - unsigned int part, j, s; + uint part, j, s; float dim[3], div; /* Maximum bvh queue size is number of nodes which are made, equals calls to this function. */ @@ -401,7 +397,7 @@ static float densfunc(const MetaElem *ball, float x, float y, float z) static float metaball(PROCESS *process, float x, float y, float z) { float dens = 0.0f; - unsigned int front = 0, back = 0; + uint front = 0, back = 0; MetaballBVHNode *node; process->bvh_queue[front++] = &process->metaball_bvh; diff --git a/source/blender/blenkernel/intern/mesh_mapping.cc b/source/blender/blenkernel/intern/mesh_mapping.cc index b612564ef09..e7f5ce03c40 100644 --- a/source/blender/blenkernel/intern/mesh_mapping.cc +++ b/source/blender/blenkernel/intern/mesh_mapping.cc @@ -87,7 +87,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly, nverts = mp->totloop; for (i = 0; i < nverts; i++) { - buf->loop_of_poly_index = (unsigned short)i; + buf->loop_of_poly_index = (ushort)i; buf->poly_index = a; buf->separate = 0; buf->next = vmap->vert[mloop[mp->loopstart + i].v]; diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 46e05b39076..58c3ef3bba0 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -357,7 +357,7 @@ IDTypeInfo IDType_ID_MC = { /*********************** movieclip buffer loaders *************************/ -static int sequence_guess_offset(const char *full_name, int head_len, unsigned short numlen) +static int sequence_guess_offset(const char *full_name, int head_len, ushort numlen) { char num[FILE_MAX] = {0}; @@ -425,7 +425,7 @@ static int get_timecode(MovieClip *clip, int flag) static void get_sequence_fname(const MovieClip *clip, const int framenr, char *name) { - unsigned short numlen; + ushort numlen; char head[FILE_MAX], tail[FILE_MAX]; int offset; @@ -647,7 +647,7 @@ static void movieclip_calc_length(MovieClip *clip) } } else if (clip->source == MCLIP_SRC_SEQUENCE) { - unsigned short numlen; + ushort numlen; char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX]; BLI_path_sequence_decode(clip->filepath, head, tail, &numlen); @@ -735,7 +735,7 @@ static int user_frame_to_cache_frame(MovieClip *clip, int framenr) if (clip->source == MCLIP_SRC_SEQUENCE) { if (clip->cache->sequence_offset == -1) { - unsigned short numlen; + ushort numlen; char head[FILE_MAX], tail[FILE_MAX]; BLI_path_sequence_decode(clip->filepath, head, tail, &numlen); @@ -763,7 +763,7 @@ static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *ren *render_flags = key->render_flag; } -static unsigned int moviecache_hashhash(const void *keyv) +static uint moviecache_hashhash(const void *keyv) { const MovieClipImBufCacheKey *key = keyv; int rval = key->framenr; @@ -880,7 +880,7 @@ static bool put_imbuf_cache( clip->cache->moviecache = moviecache; clip->cache->sequence_offset = -1; if (clip->source == MCLIP_SRC_SEQUENCE) { - unsigned short numlen; + ushort numlen; BLI_path_sequence_decode(clip->filepath, NULL, NULL, &numlen); clip->cache->is_still_sequence = (numlen == 0); } diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 1c7b1b9fa3e..081f30c4329 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -2716,8 +2716,8 @@ bNodePreview *BKE_node_preview_verify(bNodeInstanceHash *previews, } if (preview->rect == nullptr) { - preview->rect = (unsigned char *)MEM_callocN(4 * xsize + xsize * ysize * sizeof(char[4]), - "node preview rect"); + preview->rect = (uchar *)MEM_callocN(4 * xsize + xsize * ysize * sizeof(char[4]), + "node preview rect"); preview->xsize = xsize; preview->ysize = ysize; } @@ -2730,7 +2730,7 @@ bNodePreview *BKE_node_preview_copy(bNodePreview *preview) { bNodePreview *new_preview = (bNodePreview *)MEM_dupallocN(preview); if (preview->rect) { - new_preview->rect = (unsigned char *)MEM_dupallocN(preview->rect); + new_preview->rect = (uchar *)MEM_dupallocN(preview->rect); } return new_preview; } @@ -3899,15 +3899,15 @@ bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key, return key; } -static unsigned int node_instance_hash_key(const void *key) +static uint node_instance_hash_key(const void *key) { return ((const bNodeInstanceKey *)key)->value; } static bool node_instance_hash_key_cmp(const void *a, const void *b) { - unsigned int value_a = ((const bNodeInstanceKey *)a)->value; - unsigned int value_b = ((const bNodeInstanceKey *)b)->value; + uint value_a = ((const bNodeInstanceKey *)a)->value; + uint value_b = ((const bNodeInstanceKey *)b)->value; return (value_a != value_b); } diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index 7ea6a4c597e..0e5cb446802 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -3012,7 +3012,7 @@ void BKE_object_tfm_protected_restore(Object *ob, const ObjectTfmProtectedChannels *obtfm, const short protectflag) { - unsigned int i; + uint i; for (i = 0; i < 3; i++) { if (protectflag & (OB_LOCK_LOCX << i)) { @@ -5268,12 +5268,12 @@ void BKE_object_groups_clear(Main *bmain, Scene *scene, Object *ob) KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot) { KDTree_3d *tree = nullptr; - unsigned int tot = 0; + uint tot = 0; switch (ob->type) { case OB_MESH: { Mesh *me = (Mesh *)ob->data; - unsigned int i; + uint i; Mesh *me_eval = ob->runtime.mesh_deform_eval ? ob->runtime.mesh_deform_eval : BKE_object_get_evaluated_mesh(ob); @@ -5316,7 +5316,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot) case OB_SURF: { /* TODO: take deformation into account */ Curve *cu = (Curve *)ob->data; - unsigned int i, a; + uint i, a; Nurb *nu; @@ -5360,7 +5360,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot) /* TODO: take deformation into account */ Lattice *lt = (Lattice *)ob->data; BPoint *bp; - unsigned int i; + uint i; tot = lt->pntsu * lt->pntsv * lt->pntsw; tree = BLI_kdtree_3d_new(tot); diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc index dde3130a5b0..e7410b06deb 100644 --- a/source/blender/blenkernel/intern/object_dupli.cc +++ b/source/blender/blenkernel/intern/object_dupli.cc @@ -211,7 +211,7 @@ static DupliObject *make_dupli( if (dob->persistent_id[0] != INT_MAX) { for (i = 0; i < MAX_DUPLI_RECUR; i++) { - dob->random_id = BLI_hash_int_2d(dob->random_id, (unsigned int)dob->persistent_id[i]); + dob->random_id = BLI_hash_int_2d(dob->random_id, (uint)dob->persistent_id[i]); } } else { @@ -649,7 +649,7 @@ static const DupliGenerator gen_dupli_verts = { * \{ */ static Object *find_family_object( - Main *bmain, const char *family, size_t family_len, unsigned int ch, GHash *family_gh) + Main *bmain, const char *family, size_t family_len, uint ch, GHash *family_gh) { void *ch_key = POINTER_FROM_UINT(ch); @@ -727,7 +727,7 @@ static void make_duplis_font(const DupliContext *ctx) /* XXX That G.main is *really* ugly, but not sure what to do here. * Definitively don't think it would be safe to put back `Main *bmain` pointer * in #DupliContext as done in 2.7x? */ - ob = find_family_object(G.main, cu->family, family_len, (unsigned int)text[a], family_gh); + ob = find_family_object(G.main, cu->family, family_len, (uint)text[a], family_gh); if (is_eval_curve) { /* Workaround for the above hack. */ @@ -1294,7 +1294,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem totpart = psys->totcached; } - RNG *rng = BLI_rng_new_srandom(31415926u + (unsigned int)psys->seed); + RNG *rng = BLI_rng_new_srandom(31415926u + (uint)psys->seed); psys->lattice_deform_data = psys_create_lattice_deform_data(&sim); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index bbd462d5ae1..3675dea50e3 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -507,8 +507,8 @@ IDTypeInfo IDType_ID_PA = { .lib_override_apply_post = NULL, }; -unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]; -unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]; +uint PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]; +uint PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]; float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]; void BKE_particle_init_rng(void) @@ -516,8 +516,8 @@ void BKE_particle_init_rng(void) RNG *rng = BLI_rng_new_srandom(5831); /* arbitrary */ for (int i = 0; i < PSYS_FRAND_COUNT; i++) { PSYS_FRAND_BASE[i] = BLI_rng_get_float(rng); - PSYS_FRAND_SEED_OFFSET[i] = (unsigned int)BLI_rng_get_int(rng); - PSYS_FRAND_SEED_MULTIPLIER[i] = (unsigned int)BLI_rng_get_int(rng); + PSYS_FRAND_SEED_OFFSET[i] = (uint)BLI_rng_get_int(rng); + PSYS_FRAND_SEED_MULTIPLIER[i] = (uint)BLI_rng_get_int(rng); } BLI_rng_free(rng); } diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index 561043b553e..ce9fec6043d 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -480,7 +480,7 @@ static void distribute_from_verts_exec(ParticleTask *thread, ParticleData *pa, i * map to equal-colored parts of a texture */ for (int i = 0; i < ctx->mesh->totface; i++, mface++) { if (ELEM(pa->num, mface->v1, mface->v2, mface->v3, mface->v4)) { - unsigned int *vert = &mface->v1; + uint *vert = &mface->v1; for (int j = 0; j < 4; j++, vert++) { if (*vert == pa->num) { diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index fb61c3750a1..1d65e958e1c 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -234,8 +234,7 @@ void pbvh_grow_nodes(PBVH *pbvh, int totnode) /* Add a vertex to the map, with a positive value for unique vertices and * a negative value for additional vertices */ -static int map_insert_vert( - PBVH *pbvh, GHash *map, unsigned int *face_verts, unsigned int *uniq_verts, int vertex) +static int map_insert_vert(PBVH *pbvh, GHash *map, uint *face_verts, uint *uniq_verts, int vertex) { void *key, **value_p; @@ -1023,7 +1022,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata, float(*vnors)[3] = data->vnors; if (node->flag & PBVH_UpdateNormals) { - unsigned int mpoly_prev = UINT_MAX; + uint mpoly_prev = UINT_MAX; float fn[3]; const int *faces = node->prim_indices; @@ -1031,7 +1030,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata, for (int i = 0; i < totface; i++) { const MLoopTri *lt = &pbvh->looptri[faces[i]]; - const unsigned int vtri[3] = { + const uint vtri[3] = { pbvh->mloop[lt->tri[0]].v, pbvh->mloop[lt->tri[1]].v, pbvh->mloop[lt->tri[2]].v, diff --git a/source/blender/blenkernel/intern/pbvh.cc b/source/blender/blenkernel/intern/pbvh.cc index 70aeb10f087..215d04fdc4d 100644 --- a/source/blender/blenkernel/intern/pbvh.cc +++ b/source/blender/blenkernel/intern/pbvh.cc @@ -63,7 +63,7 @@ template<typename T> void to_float(const T &src, float dst[4]); template<> void to_float(const MLoopCol &src, float dst[4]) { - rgba_uchar_to_float(dst, reinterpret_cast<const unsigned char *>(&src)); + rgba_uchar_to_float(dst, reinterpret_cast<const uchar *>(&src)); srgb_to_linearrgb_v3_v3(dst, dst); } template<> void to_float(const MPropCol &src, float dst[4]) @@ -78,7 +78,7 @@ template<> void from_float(const float src[4], MLoopCol &dst) float temp[4]; linearrgb_to_srgb_v3_v3(temp, src); temp[3] = src[3]; - rgba_float_to_uchar(reinterpret_cast<unsigned char *>(&dst), temp); + rgba_float_to_uchar(reinterpret_cast<uchar *>(&dst), temp); } template<> void from_float(const float src[4], MPropCol &dst) { diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 687ee6497b4..81dbff980d5 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -730,7 +730,7 @@ typedef struct EdgeQueue { const float *view_normal; #ifdef USE_EDGEQUEUE_FRONTFACE - unsigned int use_view_normal : 1; + uint use_view_normal : 1; #endif } EdgeQueue; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index ce04d781980..4acd65750bf 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -103,14 +103,14 @@ static CLG_LogRef LOG = {"bke.pointcache"}; static int ptcache_data_size[] = { - sizeof(unsigned int), /* BPHYS_DATA_INDEX */ - sizeof(float[3]), /* BPHYS_DATA_LOCATION */ - sizeof(float[3]), /* BPHYS_DATA_VELOCITY */ - sizeof(float[4]), /* BPHYS_DATA_ROTATION */ - sizeof(float[3]), /* BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */ - sizeof(float), /* BPHYS_DATA_SIZE */ - sizeof(float[3]), /* BPHYS_DATA_TIMES */ - sizeof(BoidData), /* case BPHYS_DATA_BOIDS */ + sizeof(uint), /* BPHYS_DATA_INDEX */ + sizeof(float[3]), /* BPHYS_DATA_LOCATION */ + sizeof(float[3]), /* BPHYS_DATA_VELOCITY */ + sizeof(float[4]), /* BPHYS_DATA_ROTATION */ + sizeof(float[3]), /* BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */ + sizeof(float), /* BPHYS_DATA_SIZE */ + sizeof(float[3]), /* BPHYS_DATA_TIMES */ + sizeof(BoidData), /* case BPHYS_DATA_BOIDS */ }; static int ptcache_extra_datasize[] = { @@ -120,11 +120,11 @@ static int ptcache_extra_datasize[] = { }; /* forward declarations */ -static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result, unsigned int len); +static int ptcache_file_compressed_read(PTCacheFile *pf, uchar *result, uint len); static int ptcache_file_compressed_write( - PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode); -static int ptcache_file_write(PTCacheFile *pf, const void *f, unsigned int tot, unsigned int size); -static int ptcache_file_read(PTCacheFile *pf, void *f, unsigned int tot, unsigned int size); + PTCacheFile *pf, uchar *in, uint in_len, uchar *out, int mode); +static int ptcache_file_write(PTCacheFile *pf, const void *f, uint tot, uint size); +static int ptcache_file_read(PTCacheFile *pf, void *f, uint tot, uint size); /* Common functions */ static int ptcache_basic_header_read(PTCacheFile *pf) @@ -132,11 +132,11 @@ static int ptcache_basic_header_read(PTCacheFile *pf) int error = 0; /* Custom functions should read these basic elements too! */ - if (!error && !fread(&pf->totpoint, sizeof(unsigned int), 1, pf->fp)) { + if (!error && !fread(&pf->totpoint, sizeof(uint), 1, pf->fp)) { error = 1; } - if (!error && !fread(&pf->data_types, sizeof(unsigned int), 1, pf->fp)) { + if (!error && !fread(&pf->data_types, sizeof(uint), 1, pf->fp)) { error = 1; } @@ -145,20 +145,17 @@ static int ptcache_basic_header_read(PTCacheFile *pf) static int ptcache_basic_header_write(PTCacheFile *pf) { /* Custom functions should write these basic elements too! */ - if (!fwrite(&pf->totpoint, sizeof(unsigned int), 1, pf->fp)) { + if (!fwrite(&pf->totpoint, sizeof(uint), 1, pf->fp)) { return 0; } - if (!fwrite(&pf->data_types, sizeof(unsigned int), 1, pf->fp)) { + if (!fwrite(&pf->data_types, sizeof(uint), 1, pf->fp)) { return 0; } return 1; } -static void ptcache_add_extra_data(PTCacheMem *pm, - unsigned int type, - unsigned int count, - void *data) +static void ptcache_add_extra_data(PTCacheMem *pm, uint type, uint count, void *data) { PTCacheExtra *extra = MEM_callocN(sizeof(PTCacheExtra), "Point cache: extra data descriptor"); @@ -683,8 +680,8 @@ static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v) if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) { int total_points = surface->data->total_points; - unsigned int in_len; - unsigned char *out; + uint in_len; + uchar *out; /* cache type */ ptcache_file_write(pf, &surface->type, 1, sizeof(int)); @@ -702,10 +699,10 @@ static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v) return 0; } - out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len), "pointcache_lzo_buffer"); + out = (uchar *)MEM_callocN(LZO_OUT_LEN(in_len), "pointcache_lzo_buffer"); ptcache_file_compressed_write( - pf, (unsigned char *)surface->data->type_data, in_len, out, cache_compress); + pf, (uchar *)surface->data->type_data, in_len, out, cache_compress); MEM_freeN(out); } return 1; @@ -723,7 +720,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v) } if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) { - unsigned int data_len; + uint data_len; int surface_type; /* cache type */ @@ -748,7 +745,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v) } ptcache_file_compressed_read( - pf, (unsigned char *)surface->data->type_data, data_len * surface->data->total_points); + pf, (uchar *)surface->data->type_data, data_len * surface->data->total_points); } return 1; } @@ -1424,7 +1421,7 @@ static int ptcache_filepath( idname = (pid->owner_id->name + 2); /* convert chars to hex so they are always a valid filename */ while ('\0' != *idname) { - BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "%02X", (unsigned int)(*idname++)); + BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "%02X", (uint)(*idname++)); newname += 2; len += 2; } @@ -1500,29 +1497,28 @@ static void ptcache_file_close(PTCacheFile *pf) } } -static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result, unsigned int len) +static int ptcache_file_compressed_read(PTCacheFile *pf, uchar *result, uint len) { int r = 0; - unsigned char compressed = 0; + uchar compressed = 0; size_t in_len; #ifdef WITH_LZO size_t out_len = len; #endif - unsigned char *in; - unsigned char *props = MEM_callocN(sizeof(char[16]), "tmp"); + uchar *in; + uchar *props = MEM_callocN(sizeof(char[16]), "tmp"); - ptcache_file_read(pf, &compressed, 1, sizeof(unsigned char)); + ptcache_file_read(pf, &compressed, 1, sizeof(uchar)); if (compressed) { - unsigned int size; - ptcache_file_read(pf, &size, 1, sizeof(unsigned int)); + uint size; + ptcache_file_read(pf, &size, 1, sizeof(uint)); in_len = (size_t)size; if (in_len == 0) { /* do nothing */ } else { - in = (unsigned char *)MEM_callocN(sizeof(unsigned char) * in_len, - "pointcache_compressed_buffer"); - ptcache_file_read(pf, in, in_len, sizeof(unsigned char)); + in = (uchar *)MEM_callocN(sizeof(uchar) * in_len, "pointcache_compressed_buffer"); + ptcache_file_read(pf, in, in_len, sizeof(uchar)); #ifdef WITH_LZO if (compressed == 1) { r = lzo1x_decompress_safe(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL); @@ -1532,9 +1528,9 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result, if (compressed == 2) { size_t sizeOfIt; size_t leni = in_len, leno = len; - ptcache_file_read(pf, &size, 1, sizeof(unsigned int)); + ptcache_file_read(pf, &size, 1, sizeof(uint)); sizeOfIt = (size_t)size; - ptcache_file_read(pf, props, sizeOfIt, sizeof(unsigned char)); + ptcache_file_read(pf, props, sizeOfIt, sizeof(uchar)); r = LzmaUncompress(result, &leno, in, &leni, props, sizeOfIt); } #endif @@ -1542,7 +1538,7 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result, } } else { - ptcache_file_read(pf, result, len, sizeof(unsigned char)); + ptcache_file_read(pf, result, len, sizeof(uchar)); } MEM_freeN(props); @@ -1550,12 +1546,12 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result, return r; } static int ptcache_file_compressed_write( - PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode) + PTCacheFile *pf, uchar *in, uint in_len, uchar *out, int mode) { int r = 0; - unsigned char compressed = 0; + uchar compressed = 0; size_t out_len = 0; - unsigned char *props = MEM_callocN(sizeof(char[16]), "tmp"); + uchar *props = MEM_callocN(sizeof(char[16]), "tmp"); size_t sizeOfIt = 5; (void)mode; /* unused when building w/o compression */ @@ -1600,31 +1596,31 @@ static int ptcache_file_compressed_write( } #endif - ptcache_file_write(pf, &compressed, 1, sizeof(unsigned char)); + ptcache_file_write(pf, &compressed, 1, sizeof(uchar)); if (compressed) { - unsigned int size = out_len; - ptcache_file_write(pf, &size, 1, sizeof(unsigned int)); - ptcache_file_write(pf, out, out_len, sizeof(unsigned char)); + uint size = out_len; + ptcache_file_write(pf, &size, 1, sizeof(uint)); + ptcache_file_write(pf, out, out_len, sizeof(uchar)); } else { - ptcache_file_write(pf, in, in_len, sizeof(unsigned char)); + ptcache_file_write(pf, in, in_len, sizeof(uchar)); } if (compressed == 2) { - unsigned int size = sizeOfIt; - ptcache_file_write(pf, &sizeOfIt, 1, sizeof(unsigned int)); - ptcache_file_write(pf, props, size, sizeof(unsigned char)); + uint size = sizeOfIt; + ptcache_file_write(pf, &sizeOfIt, 1, sizeof(uint)); + ptcache_file_write(pf, props, size, sizeof(uchar)); } MEM_freeN(props); return r; } -static int ptcache_file_read(PTCacheFile *pf, void *f, unsigned int tot, unsigned int size) +static int ptcache_file_read(PTCacheFile *pf, void *f, uint tot, uint size) { return (fread(f, size, tot, pf->fp) == tot); } -static int ptcache_file_write(PTCacheFile *pf, const void *f, unsigned int tot, unsigned int size) +static int ptcache_file_write(PTCacheFile *pf, const void *f, uint tot, uint size) { return (fwrite(f, size, tot, pf->fp) == tot); } @@ -1656,7 +1652,7 @@ static int ptcache_file_data_write(PTCacheFile *pf) } static int ptcache_file_header_begin_read(PTCacheFile *pf) { - unsigned int typeflag = 0; + uint typeflag = 0; int error = 0; char bphysics[8]; @@ -1670,7 +1666,7 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf) error = 1; } - if (!error && !fread(&typeflag, sizeof(unsigned int), 1, pf->fp)) { + if (!error && !fread(&typeflag, sizeof(uint), 1, pf->fp)) { error = 1; } @@ -1687,13 +1683,13 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf) static int ptcache_file_header_begin_write(PTCacheFile *pf) { const char *bphysics = "BPHYSICS"; - unsigned int typeflag = pf->type + pf->flag; + uint typeflag = pf->type + pf->flag; if (fwrite(bphysics, sizeof(char), 8, pf->fp) != 8) { return 0; } - if (!fwrite(&typeflag, sizeof(unsigned int), 1, pf->fp)) { + if (!fwrite(&typeflag, sizeof(uint), 1, pf->fp)) { return 0; } @@ -1722,11 +1718,11 @@ static void ptcache_file_pointers_init(PTCacheFile *pf) pf->cur[BPHYS_DATA_BOIDS] = (data_types & (1 << BPHYS_DATA_BOIDS)) ? &pf->data.boids : NULL; } -int BKE_ptcache_mem_index_find(PTCacheMem *pm, unsigned int index) +int BKE_ptcache_mem_index_find(PTCacheMem *pm, uint index) { if (pm->totpoint > 0 && pm->data[BPHYS_DATA_INDEX]) { - unsigned int *data = pm->data[BPHYS_DATA_INDEX]; - unsigned int mid, low = 0, high = pm->totpoint - 1; + uint *data = pm->data[BPHYS_DATA_INDEX]; + uint mid, low = 0, high = pm->totpoint - 1; if (index < *data || index > *(data + high)) { return -1; @@ -1868,7 +1864,7 @@ static int ptcache_old_elemsize(PTCacheID *pid) return 0; } -static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *fra1, int *fra2) +static void ptcache_find_frames_around(PTCacheID *pid, uint frame, int *fra1, int *fra2) { if (pid->cache->flag & PTCACHE_DISK_CACHE) { int cfra1 = frame, cfra2 = frame + 1; @@ -1930,7 +1926,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra) { PTCacheFile *pf = ptcache_file_open(pid, PTCACHE_FILE_READ, cfra); PTCacheMem *pm = NULL; - unsigned int i, error = 0; + uint i, error = 0; if (pf == NULL) { return NULL; diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index 0d12a26276f..fc36e3d00e7 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -880,8 +880,8 @@ static bool seq_foreach_path_callback(Sequence *seq, void *user_data) } else if ((seq->type == SEQ_TYPE_IMAGE) && se) { /* NOTE: An option not to loop over all strips could be useful? */ - unsigned int len = (unsigned int)MEM_allocN_len(se) / (unsigned int)sizeof(*se); - unsigned int i; + uint len = (uint)MEM_allocN_len(se) / (uint)sizeof(*se); + uint i; if (bpath_data->flag & BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE) { /* only operate on one path */ @@ -3315,10 +3315,10 @@ struct DepsgraphKey { */ }; -static unsigned int depsgraph_key_hash(const void *key_v) +static uint depsgraph_key_hash(const void *key_v) { const DepsgraphKey *key = static_cast<const DepsgraphKey *>(key_v); - unsigned int hash = BLI_ghashutil_ptrhash(key->view_layer); + uint hash = BLI_ghashutil_ptrhash(key->view_layer); /* TODO(sergey): Include hash from other fields in the key. */ return hash; } diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 4b4e3bdcfa6..f94836551bb 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -200,7 +200,7 @@ static ShrinkwrapBoundaryData *shrinkwrap_build_boundary_data(struct Mesh *mesh) char *edge_mode = MEM_calloc_arrayN((size_t)mesh->totedge, sizeof(char), __func__); for (int i = 0; i < mesh->totloop; i++) { - unsigned int eidx = mloop[i].e; + uint eidx = mloop[i].e; if (edge_mode[eidx] < 2) { edge_mode[eidx]++; @@ -210,7 +210,7 @@ static ShrinkwrapBoundaryData *shrinkwrap_build_boundary_data(struct Mesh *mesh) /* Build the boundary edge bitmask. */ BLI_bitmap *edge_is_boundary = BLI_BITMAP_NEW(mesh->totedge, "ShrinkwrapBoundaryData::edge_is_boundary"); - unsigned int num_boundary_edges = 0; + uint num_boundary_edges = 0; for (int i = 0; i < mesh->totedge; i++) { edge_mode[i] = (edge_mode[i] == 1); @@ -268,7 +268,7 @@ static ShrinkwrapBoundaryData *shrinkwrap_build_boundary_data(struct Mesh *mesh) } } - unsigned int num_boundary_verts = 0; + uint num_boundary_verts = 0; for (int i = 0; i < mesh->totvert; i++) { vert_boundary_id[i] = (vert_boundary_id[i] != 0) ? (int)num_boundary_verts++ : -1; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 75f2015cdad..14a7d26a354 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -510,7 +510,7 @@ static void ccd_build_deflector_hash(Depsgraph *depsgraph, return; } - unsigned int numobjects; + uint numobjects; Object **objects = BKE_collision_objects_create( depsgraph, vertexowner, collection, &numobjects, eModifierType_Collision); @@ -547,7 +547,7 @@ static void ccd_update_deflector_hash(Depsgraph *depsgraph, return; } - unsigned int numobjects; + uint numobjects; Object **objects = BKE_collision_objects_create( depsgraph, vertexowner, collection, &numobjects, eModifierType_Collision); @@ -963,7 +963,7 @@ static void free_softbody_intern(SoftBody *sb) */ static int query_external_colliders(Depsgraph *depsgraph, Collection *collection) { - unsigned int numobjects; + uint numobjects; Object **objects = BKE_collision_objects_create( depsgraph, NULL, collection, &numobjects, eModifierType_Collision); BKE_collision_objects_free(objects); diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index 64f998ea67f..9610443ef70 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -342,9 +342,7 @@ static void *studiolight_multilayer_addlayer(void *base, const char *UNUSED(laye /* Convert a multilayer pass to ImBuf channel 4 float buffer. * NOTE: Parameter rect will become invalid. Do not use rect after calling this * function */ -static float *studiolight_multilayer_convert_pass(ImBuf *ibuf, - float *rect, - const unsigned int channels) +static float *studiolight_multilayer_convert_pass(ImBuf *ibuf, float *rect, const uint channels) { if (channels == 4) { return rect; diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c index 03937b270bc..e7f89a625b3 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.c +++ b/source/blender/blenkernel/intern/subdiv_ccg.c @@ -171,7 +171,7 @@ static void subdiv_ccg_eval_grid_element_limit(CCGEvalGridsData *data, const int ptex_face_index, const float u, const float v, - unsigned char *element) + uchar *element) { Subdiv *subdiv = data->subdiv; SubdivCCG *subdiv_ccg = data->subdiv_ccg; @@ -195,7 +195,7 @@ static void subdiv_ccg_eval_grid_element_mask(CCGEvalGridsData *data, const int ptex_face_index, const float u, const float v, - unsigned char *element) + uchar *element) { SubdivCCG *subdiv_ccg = data->subdiv_ccg; if (!subdiv_ccg->has_mask) { @@ -214,7 +214,7 @@ static void subdiv_ccg_eval_grid_element(CCGEvalGridsData *data, const int ptex_face_index, const float u, const float v, - unsigned char *element) + uchar *element) { subdiv_ccg_eval_grid_element_limit(data, ptex_face_index, u, v, element); subdiv_ccg_eval_grid_element_mask(data, ptex_face_index, u, v, element); @@ -232,7 +232,7 @@ static void subdiv_ccg_eval_regular_grid(CCGEvalGridsData *data, const int face_ const SubdivCCGFace *face = &faces[face_index]; for (int corner = 0; corner < face->num_grids; corner++) { const int grid_index = face->start_grid_index + corner; - unsigned char *grid = (unsigned char *)subdiv_ccg->grids[grid_index]; + uchar *grid = (uchar *)subdiv_ccg->grids[grid_index]; for (int y = 0; y < grid_size; y++) { const float grid_v = y * grid_size_1_inv; for (int x = 0; x < grid_size; x++) { @@ -264,7 +264,7 @@ static void subdiv_ccg_eval_special_grid(CCGEvalGridsData *data, const int face_ for (int corner = 0; corner < face->num_grids; corner++) { const int grid_index = face->start_grid_index + corner; const int ptex_face_index = data->face_ptex_offset[face_index] + corner; - unsigned char *grid = (unsigned char *)subdiv_ccg->grids[grid_index]; + uchar *grid = (uchar *)subdiv_ccg->grids[grid_index]; for (int y = 0; y < grid_size; y++) { const float u = 1.0f - (y * grid_size_1_inv); for (int x = 0; x < grid_size; x++) { diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index c95c43a8099..97b9218ce52 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -340,8 +340,8 @@ static int ss_sync_from_uv(CCGSubSurf *ss, get_face_uv_map_vert(vmap, mpoly, ml, i, fverts); for (j = 0, j_next = nverts - 1; j < nverts; j_next = j++) { - unsigned int v0 = POINTER_AS_UINT(fverts[j_next]); - unsigned int v1 = POINTER_AS_UINT(fverts[j]); + uint v0 = POINTER_AS_UINT(fverts[j_next]); + uint v1 = POINTER_AS_UINT(fverts[j]); if (BLI_edgeset_add(eset, v0, v1)) { CCGEdge *e, *orige = ccgSubSurf_getFaceEdge(origf, j_next); @@ -892,7 +892,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) int totvert, totedge, totface; int gridSize = ccgSubSurf_getGridSize(ss); int edgeSize = ccgSubSurf_getEdgeSize(ss); - unsigned int i = 0; + uint i = 0; CCG_key_top_level(&key, ss); @@ -960,7 +960,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) int totedge, totface; int gridSize = ccgSubSurf_getGridSize(ss); int edgeSize = ccgSubSurf_getEdgeSize(ss); - unsigned int i = 0; + uint i = 0; short *edgeFlags = ccgdm->edgeFlags; const short ed_interior_flag = ccgdm->drawInteriorEdges ? (ME_EDGEDRAW | ME_EDGERENDER) : 0; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 1444ba1e1c4..98c401aacb0 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -354,7 +354,7 @@ static void cleanup_textline(TextLine *tl) * used for load and reload (unlike txt_insert_buf) * assumes all fields are empty */ -static void text_from_buf(Text *text, const unsigned char *buffer, const int len) +static void text_from_buf(Text *text, const uchar *buffer, const int len) { int i, llen, lines_count; @@ -419,7 +419,7 @@ static void text_from_buf(Text *text, const unsigned char *buffer, const int len bool BKE_text_reload(Text *text) { - unsigned char *buffer; + uchar *buffer; size_t buffer_len; char filepath_abs[FILE_MAX]; BLI_stat_t st; @@ -459,7 +459,7 @@ Text *BKE_text_load_ex(Main *bmain, const char *relbase, const bool is_internal) { - unsigned char *buffer; + uchar *buffer; size_t buffer_len; Text *ta; char filepath_abs[FILE_MAX]; @@ -1088,16 +1088,16 @@ void txt_move_eof(Text *text, const bool sel) } } -void txt_move_toline(Text *text, unsigned int line, const bool sel) +void txt_move_toline(Text *text, uint line, const bool sel) { txt_move_to(text, line, 0, sel); } -void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel) +void txt_move_to(Text *text, uint line, uint ch, const bool sel) { TextLine **linep; int *charp; - unsigned int i; + uint i; if (sel) { txt_curs_sel(text, &linep, &charp); @@ -1118,8 +1118,8 @@ void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel) break; } } - if (ch > (unsigned int)((*linep)->len)) { - ch = (unsigned int)((*linep)->len); + if (ch > (uint)((*linep)->len)) { + ch = (uint)((*linep)->len); } *charp = ch; diff --git a/source/blender/blenkernel/intern/tracking_region_tracker.c b/source/blender/blenkernel/intern/tracking_region_tracker.c index c89d44c4bf0..52df980554b 100644 --- a/source/blender/blenkernel/intern/tracking_region_tracker.c +++ b/source/blender/blenkernel/intern/tracking_region_tracker.c @@ -42,7 +42,7 @@ static void float_rgba_to_gray(const float *rgba, } } -static void uint8_rgba_to_float_gray(const unsigned char *rgba, +static void uint8_rgba_to_float_gray(const uchar *rgba, float *gray, int num_pixels, float weight_red, @@ -50,7 +50,7 @@ static void uint8_rgba_to_float_gray(const unsigned char *rgba, float weight_blue) { for (int i = 0; i < num_pixels; i++) { - const unsigned char *pixel = rgba + i * 4; + const uchar *pixel = rgba + i * 4; gray[i] = (weight_red * pixel[0] + weight_green * pixel[1] + weight_blue * pixel[2]) / 255.0f; } @@ -86,7 +86,7 @@ static float *track_get_search_floatbuf(ImBuf *ibuf, } else { uint8_rgba_to_float_gray( - (unsigned char *)searchibuf->rect, gray_pixels, width * height, 0.2126f, 0.7152f, 0.0722f); + (uchar *)searchibuf->rect, gray_pixels, width * height, 0.2126f, 0.7152f, 0.0722f); } IMB_freeImBuf(searchibuf); diff --git a/source/blender/blenkernel/intern/vfont.c b/source/blender/blenkernel/intern/vfont.c index 7293e1db5d7..7e321a9d500 100644 --- a/source/blender/blenkernel/intern/vfont.c +++ b/source/blender/blenkernel/intern/vfont.c @@ -423,7 +423,7 @@ VFont *BKE_vfont_builtin_get(void) return BKE_vfont_load(G_MAIN, FO_BUILTIN_NAME); } -static VChar *find_vfont_char(VFontData *vfd, unsigned int character) +static VChar *find_vfont_char(VFontData *vfd, uint character) { return BLI_ghash_lookup(vfd->characters, POINTER_FROM_UINT(character)); } @@ -494,7 +494,7 @@ static void build_underline(Curve *cu, void BKE_vfont_build_char(Curve *cu, ListBase *nubase, - unsigned int character, + uint character, CharInfo *info, float ofsx, float ofsy, diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 883591e3e87..5593625ed89 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -425,7 +425,7 @@ static AVRational calc_time_base(uint den, double num, int codec_id) /* Calculate the precision of the initial floating point number. */ if (num > 1.0) { - const uint num_integer_bits = log2_floor_u((unsigned int)num); + const uint num_integer_bits = log2_floor_u((uint)num); /* Formula for calculating the epsilon value: (power of two range) / (pow mantissa bits) * For example, a float has 23 mantissa bits and the float value 3.5f as a pow2 range of diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 61447ab1a9e..3c745716ec8 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -57,7 +57,7 @@ static uint case_strhash(const void *ptr) { const char *s = ptr; uint i = 0; - unsigned char c; + uchar c; while ((c = tolower(*s++))) { i = i * 37 + c; diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index c6178ebb3a0..526c14d5e33 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -215,7 +215,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname) } } -unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist) +uint BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist) { struct BuildDirCtx dir_ctx; diff --git a/source/blender/blenlib/intern/BLI_ghash_utils.c b/source/blender/blenlib/intern/BLI_ghash_utils.c index e12e272832f..806d58df260 100644 --- a/source/blender/blenlib/intern/BLI_ghash_utils.c +++ b/source/blender/blenlib/intern/BLI_ghash_utils.c @@ -63,7 +63,7 @@ uint BLI_ghashutil_uinthash_v4(const uint key[4]) uint BLI_ghashutil_uinthash_v4_murmur(const uint key[4]) { - return BLI_hash_mm2((const unsigned char *)key, sizeof(int[4]) /* sizeof(key) */, 0); + return BLI_hash_mm2((const uchar *)key, sizeof(int[4]) /* sizeof(key) */, 0); } bool BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b) @@ -101,7 +101,7 @@ uint BLI_ghashutil_inthash_p_murmur(const void *ptr) { uintptr_t key = (uintptr_t)ptr; - return BLI_hash_mm2((const unsigned char *)&key, sizeof(key), 0); + return BLI_hash_mm2((const uchar *)&key, sizeof(key), 0); } uint BLI_ghashutil_inthash_p_simple(const void *ptr) @@ -143,7 +143,7 @@ uint BLI_ghashutil_strhash_p(const void *ptr) } uint BLI_ghashutil_strhash_p_murmur(const void *ptr) { - const unsigned char *key = ptr; + const uchar *key = ptr; return BLI_hash_mm2(key, strlen((const char *)key) + 1, 0); } diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 71c48ed994b..de71147f015 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -58,7 +58,7 @@ /** \name Struct Definitions * \{ */ -typedef unsigned char axis_t; +typedef uchar axis_t; typedef struct BVHNode { struct BVHNode **children; diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c index 71a5dd0e044..f423eff60cb 100644 --- a/source/blender/blenlib/intern/BLI_memarena.c +++ b/source/blender/blenlib/intern/BLI_memarena.c @@ -38,7 +38,7 @@ struct MemBuf { }; struct MemArena { - unsigned char *curbuf; + uchar *curbuf; const char *name; struct MemBuf *bufs; @@ -106,9 +106,9 @@ void BLI_memarena_free(MemArena *ma) /** Align alloc'ed memory (needed if `align > 8`). */ static void memarena_curbuf_align(MemArena *ma) { - unsigned char *tmp; + uchar *tmp; - tmp = (unsigned char *)PADUP((intptr_t)ma->curbuf, (int)ma->align); + tmp = (uchar *)PADUP((intptr_t)ma->curbuf, (int)ma->align); ma->cursize -= (size_t)(tmp - ma->curbuf); ma->curbuf = tmp; } diff --git a/source/blender/blenlib/intern/array_store_utils.c b/source/blender/blenlib/intern/array_store_utils.c index 9ac8630204a..51b5ce0519f 100644 --- a/source/blender/blenlib/intern/array_store_utils.c +++ b/source/blender/blenlib/intern/array_store_utils.c @@ -27,9 +27,9 @@ BArrayStore *BLI_array_store_at_size_ensure(struct BArrayStore_AtSize *bs_stride if ((*bs_p) == NULL) { /* calculate best chunk-count to fit a power of two */ - unsigned int chunk_count = chunk_size; + uint chunk_count = chunk_size; { - unsigned int size = chunk_count * stride; + uint size = chunk_count * stride; size = power_of_2_max_u(size); size = MEM_SIZE_OPTIMAL(size); chunk_count = size / stride; diff --git a/source/blender/blenlib/intern/endian_switch.c b/source/blender/blenlib/intern/endian_switch.c index 10d0bfb815b..c1a5b69fb23 100644 --- a/source/blender/blenlib/intern/endian_switch.c +++ b/source/blender/blenlib/intern/endian_switch.c @@ -18,7 +18,7 @@ void BLI_endian_switch_int16_array(short *val, const int size) } } -void BLI_endian_switch_uint16_array(unsigned short *val, const int size) +void BLI_endian_switch_uint16_array(ushort *val, const int size) { if (size > 0) { int i = size; @@ -38,7 +38,7 @@ void BLI_endian_switch_int32_array(int *val, const int size) } } -void BLI_endian_switch_uint32_array(unsigned int *val, const int size) +void BLI_endian_switch_uint32_array(uint *val, const int size) { if (size > 0) { int i = size; diff --git a/source/blender/blenlib/intern/hash_mm2a.c b/source/blender/blenlib/intern/hash_mm2a.c index 8411b49ef38..d13c20e4edb 100644 --- a/source/blender/blenlib/intern/hash_mm2a.c +++ b/source/blender/blenlib/intern/hash_mm2a.c @@ -41,7 +41,7 @@ } \ (void)0 -static void mm2a_mix_tail(BLI_HashMurmur2A *mm2, const unsigned char **data, size_t *len) +static void mm2a_mix_tail(BLI_HashMurmur2A *mm2, const uchar **data, size_t *len) { while (*len && ((*len < 4) || mm2->count)) { mm2->tail |= (uint32_t)(**data) << (mm2->count * 8); @@ -66,7 +66,7 @@ void BLI_hash_mm2a_init(BLI_HashMurmur2A *mm2, uint32_t seed) mm2->size = 0; } -void BLI_hash_mm2a_add(BLI_HashMurmur2A *mm2, const unsigned char *data, size_t len) +void BLI_hash_mm2a_add(BLI_HashMurmur2A *mm2, const uchar *data, size_t len) { mm2->size += (uint32_t)len; @@ -83,7 +83,7 @@ void BLI_hash_mm2a_add(BLI_HashMurmur2A *mm2, const unsigned char *data, size_t void BLI_hash_mm2a_add_int(BLI_HashMurmur2A *mm2, int data) { - BLI_hash_mm2a_add(mm2, (const unsigned char *)&data, sizeof(data)); + BLI_hash_mm2a_add(mm2, (const uchar *)&data, sizeof(data)); } uint32_t BLI_hash_mm2a_end(BLI_HashMurmur2A *mm2) @@ -96,7 +96,7 @@ uint32_t BLI_hash_mm2a_end(BLI_HashMurmur2A *mm2) return mm2->hash; } -uint32_t BLI_hash_mm2(const unsigned char *data, size_t len, uint32_t seed) +uint32_t BLI_hash_mm2(const uchar *data, size_t len, uint32_t seed) { /* Initialize the hash to a 'random' value */ uint32_t h = seed ^ len; diff --git a/source/blender/blenlib/intern/jitter_2d.c b/source/blender/blenlib/intern/jitter_2d.c index 8fa0f2c1e15..4b86f3cfeef 100644 --- a/source/blender/blenlib/intern/jitter_2d.c +++ b/source/blender/blenlib/intern/jitter_2d.c @@ -70,7 +70,7 @@ void BLI_jitterate1(float (*jit1)[2], float (*jit2)[2], int num, float radius1) jit2[i][0] = x; jit2[i][1] = y; } - memcpy(jit1, jit2, 2 * (unsigned int)num * sizeof(float)); + memcpy(jit1, jit2, 2 * (uint)num * sizeof(float)); } void BLI_jitterate2(float (*jit1)[2], float (*jit2)[2], int num, float radius2) @@ -120,7 +120,7 @@ void BLI_jitterate2(float (*jit1)[2], float (*jit2)[2], int num, float radius2) jit2[i][0] = x; jit2[i][1] = y; } - memcpy(jit1, jit2, (unsigned int)num * sizeof(float[2])); + memcpy(jit1, jit2, (uint)num * sizeof(float[2])); } void BLI_jitter_init(float (*jitarr)[2], int num) @@ -138,12 +138,12 @@ void BLI_jitter_init(float (*jitarr)[2], int num) number_fl = (float)num; number_fl_sqrt = sqrtf(number_fl); - jit2 = MEM_mallocN(12 + (unsigned int)num * sizeof(float[2]), "initjit"); + jit2 = MEM_mallocN(12 + (uint)num * sizeof(float[2]), "initjit"); rad1 = 1.0f / number_fl_sqrt; rad2 = 1.0f / number_fl; rad3 = number_fl_sqrt / number_fl; - rng = BLI_rng_new(31415926 + (unsigned int)num); + rng = BLI_rng_new(31415926 + (uint)num); x = 0; for (i = 0; i < num; i++) { diff --git a/source/blender/blenlib/intern/lasso_2d.c b/source/blender/blenlib/intern/lasso_2d.c index 13b0e416b76..4752864ea3a 100644 --- a/source/blender/blenlib/intern/lasso_2d.c +++ b/source/blender/blenlib/intern/lasso_2d.c @@ -12,9 +12,9 @@ #include "BLI_lasso_2d.h" /* own include */ -void BLI_lasso_boundbox(rcti *rect, const int mcoords[][2], const unsigned int mcoords_len) +void BLI_lasso_boundbox(rcti *rect, const int mcoords[][2], const uint mcoords_len) { - unsigned int a; + uint a; rect->xmin = rect->xmax = mcoords[0][0]; rect->ymin = rect->ymax = mcoords[0][1]; @@ -36,7 +36,7 @@ void BLI_lasso_boundbox(rcti *rect, const int mcoords[][2], const unsigned int m } bool BLI_lasso_is_point_inside(const int mcoords[][2], - const unsigned int mcoords_len, + const uint mcoords_len, const int sx, const int sy, const int error_value) @@ -50,7 +50,7 @@ bool BLI_lasso_is_point_inside(const int mcoords[][2], } bool BLI_lasso_is_edge_inside(const int mcoords[][2], - const unsigned int mcoords_len, + const uint mcoords_len, int x0, int y0, int x1, @@ -77,7 +77,7 @@ bool BLI_lasso_is_edge_inside(const int mcoords[][2], if (isect_seg_seg_v2_int(mcoords[0], mcoords[mcoords_len - 1], v1, v2) > 0) { return true; } - for (unsigned int a = 0; a < mcoords_len - 1; a++) { + for (uint a = 0; a < mcoords_len - 1; a++) { if (isect_seg_seg_v2_int(mcoords[a], mcoords[a + 1], v1, v2) > 0) { return true; } diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 9058ef43604..e4b352dc22c 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -176,7 +176,7 @@ void ycc_to_rgb(float y, float cb, float cr, float *r_r, float *r_g, float *r_b, void hex_to_rgb(const char *hexcol, float *r_r, float *r_g, float *r_b) { - unsigned int ri, gi, bi; + uint ri, gi, bi; if (hexcol[0] == '#') { hexcol++; @@ -329,29 +329,29 @@ void hsv_clamp_v(float hsv[3], float v_max) CLAMP(hsv[2], 0.0f, v_max); } -unsigned int hsv_to_cpack(float h, float s, float v) +uint hsv_to_cpack(float h, float s, float v) { - unsigned int r, g, b; + uint r, g, b; float rf, gf, bf; - unsigned int col; + uint col; hsv_to_rgb(h, s, v, &rf, &gf, &bf); - r = (unsigned int)(rf * 255.0f); - g = (unsigned int)(gf * 255.0f); - b = (unsigned int)(bf * 255.0f); + r = (uint)(rf * 255.0f); + g = (uint)(gf * 255.0f); + b = (uint)(bf * 255.0f); col = (r + (g * 256) + (b * 256 * 256)); return col; } -unsigned int rgb_to_cpack(float r, float g, float b) +uint rgb_to_cpack(float r, float g, float b) { - unsigned int ir, ig, ib; + uint ir, ig, ib; - ir = (unsigned int)floorf(255.0f * max_ff(r, 0.0f)); - ig = (unsigned int)floorf(255.0f * max_ff(g, 0.0f)); - ib = (unsigned int)floorf(255.0f * max_ff(b, 0.0f)); + ir = (uint)floorf(255.0f * max_ff(r, 0.0f)); + ig = (uint)floorf(255.0f * max_ff(g, 0.0f)); + ib = (uint)floorf(255.0f * max_ff(b, 0.0f)); if (ir > 255) { ir = 255; @@ -366,21 +366,21 @@ unsigned int rgb_to_cpack(float r, float g, float b) return (ir + (ig * 256) + (ib * 256 * 256)); } -void cpack_to_rgb(unsigned int col, float *r_r, float *r_g, float *r_b) +void cpack_to_rgb(uint col, float *r_r, float *r_g, float *r_b) { *r_r = ((float)(col & 0xFF)) * (1.0f / 255.0f); *r_g = ((float)((col >> 8) & 0xFF)) * (1.0f / 255.0f); *r_b = ((float)((col >> 16) & 0xFF)) * (1.0f / 255.0f); } -void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3]) +void rgb_uchar_to_float(float r_col[3], const uchar col_ub[3]) { r_col[0] = ((float)col_ub[0]) * (1.0f / 255.0f); r_col[1] = ((float)col_ub[1]) * (1.0f / 255.0f); r_col[2] = ((float)col_ub[2]) * (1.0f / 255.0f); } -void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4]) +void rgba_uchar_to_float(float r_col[4], const uchar col_ub[4]) { r_col[0] = ((float)col_ub[0]) * (1.0f / 255.0f); r_col[1] = ((float)col_ub[1]) * (1.0f / 255.0f); @@ -388,12 +388,12 @@ void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4]) r_col[3] = ((float)col_ub[3]) * (1.0f / 255.0f); } -void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3]) +void rgb_float_to_uchar(uchar r_col[3], const float col_f[3]) { unit_float_to_uchar_clamp_v3(r_col, col_f); } -void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4]) +void rgba_float_to_uchar(uchar r_col[4], const float col_f[4]) { unit_float_to_uchar_clamp_v4(r_col, col_f); } @@ -500,7 +500,7 @@ void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset) hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2); } -void rgb_byte_set_hue_float_offset(unsigned char rgb[3], float hue_offset) +void rgb_byte_set_hue_float_offset(uchar rgb[3], float hue_offset) { float rgb_float[3]; @@ -515,13 +515,13 @@ void rgb_byte_set_hue_float_offset(unsigned char rgb[3], float hue_offset) */ float BLI_color_from_srgb_table[256]; -unsigned short BLI_color_to_srgb_table[0x10000]; +ushort BLI_color_to_srgb_table[0x10000]; -static unsigned short hipart(const float f) +static ushort hipart(const float f) { union { float f; - unsigned short us[2]; + ushort us[2]; } tmp; tmp.f = f; @@ -533,12 +533,12 @@ static unsigned short hipart(const float f) #endif } -static float index_to_float(const unsigned short i) +static float index_to_float(const ushort i) { union { float f; - unsigned short us[2]; + ushort us[2]; } tmp; /* positive and negative zeros, and all gradual underflow, turn into zero: */ @@ -567,7 +567,7 @@ static float index_to_float(const unsigned short i) void BLI_init_srgb_conversion(void) { static bool initialized = false; - unsigned int i, b; + uint i, b; if (initialized) { return; @@ -576,12 +576,12 @@ void BLI_init_srgb_conversion(void) /* Fill in the lookup table to convert floats to bytes: */ for (i = 0; i < 0x10000; i++) { - float f = linearrgb_to_srgb(index_to_float((unsigned short)i)) * 255.0f; + float f = linearrgb_to_srgb(index_to_float((ushort)i)) * 255.0f; if (f <= 0) { BLI_color_to_srgb_table[i] = 0; } else if (f < 255) { - BLI_color_to_srgb_table[i] = (unsigned short)(f * 0x100 + 0.5f); + BLI_color_to_srgb_table[i] = (ushort)(f * 0x100 + 0.5f); } else { BLI_color_to_srgb_table[i] = 0xff00; @@ -594,6 +594,6 @@ void BLI_init_srgb_conversion(void) BLI_color_from_srgb_table[b] = f; i = hipart(f); /* replace entries so byte->float->byte does not change the data: */ - BLI_color_to_srgb_table[i] = (unsigned short)(b * 0x100); + BLI_color_to_srgb_table[i] = (ushort)(b * 0x100); } } diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 03f9b6441be..2da8d3d7bc8 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -68,7 +68,7 @@ float normal_quad_v3( return normalize_v3(n); } -float normal_poly_v3(float n[3], const float verts[][3], unsigned int nr) +float normal_poly_v3(float n[3], const float verts[][3], uint nr) { cross_poly_v3(n, verts, nr); return normalize_v3(n); @@ -122,14 +122,14 @@ float area_tri_signed_v3(const float v1[3], return area; } -float area_poly_v3(const float verts[][3], unsigned int nr) +float area_poly_v3(const float verts[][3], uint nr) { float n[3]; cross_poly_v3(n, verts, nr); return len_v3(n) * 0.5f; } -float area_squared_poly_v3(const float verts[][3], unsigned int nr) +float area_squared_poly_v3(const float verts[][3], uint nr) { float n[3]; @@ -138,9 +138,9 @@ float area_squared_poly_v3(const float verts[][3], unsigned int nr) return len_squared_v3(n); } -float cross_poly_v2(const float verts[][2], unsigned int nr) +float cross_poly_v2(const float verts[][2], uint nr) { - unsigned int a; + uint a; float cross; const float *co_curr, *co_prev; @@ -157,11 +157,11 @@ float cross_poly_v2(const float verts[][2], unsigned int nr) return cross; } -void cross_poly_v3(float n[3], const float verts[][3], unsigned int nr) +void cross_poly_v3(float n[3], const float verts[][3], uint nr) { const float *v_prev = verts[nr - 1]; const float *v_curr = verts[0]; - unsigned int i; + uint i; zero_v3(n); @@ -171,17 +171,17 @@ void cross_poly_v3(float n[3], const float verts[][3], unsigned int nr) } } -float area_poly_v2(const float verts[][2], unsigned int nr) +float area_poly_v2(const float verts[][2], uint nr) { return fabsf(0.5f * cross_poly_v2(verts, nr)); } -float area_poly_signed_v2(const float verts[][2], unsigned int nr) +float area_poly_signed_v2(const float verts[][2], uint nr) { return (0.5f * cross_poly_v2(verts, nr)); } -float area_squared_poly_v2(const float verts[][2], unsigned int nr) +float area_squared_poly_v2(const float verts[][2], uint nr) { float area = area_poly_signed_v2(verts, nr); return area * area; @@ -1458,12 +1458,12 @@ int isect_line_sphere_v2(const float l1[2], bool isect_point_poly_v2(const float pt[2], const float verts[][2], - const unsigned int nr, + const uint nr, const bool UNUSED(use_holes)) { /* Keep in sync with #isect_point_poly_v2_int. */ - unsigned int i, j; + uint i, j; bool isect = false; for (i = 0, j = nr - 1; i < nr; j = i++) { if (((verts[i][1] > pt[1]) != (verts[j][1] > pt[1])) && @@ -1477,12 +1477,12 @@ bool isect_point_poly_v2(const float pt[2], } bool isect_point_poly_v2_int(const int pt[2], const int verts[][2], - const unsigned int nr, + const uint nr, const bool UNUSED(use_holes)) { /* Keep in sync with #isect_point_poly_v2. */ - unsigned int i, j; + uint i, j; bool isect = false; for (i = 0, j = nr - 1; i < nr; j = i++) { if (((verts[i][1] > pt[1]) != (verts[j][1] > pt[1])) && diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index 34fcb583232..6867c2ac022 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -56,7 +56,7 @@ static void vector_from_float(const float *data, float vector[4], int components } } -static void vector_from_byte(const unsigned char *data, float vector[4], int components) +static void vector_from_byte(const uchar *data, float vector[4], int components) { if (components == 1) { vector[0] = data[0]; @@ -75,9 +75,9 @@ static void vector_from_byte(const unsigned char *data, float vector[4], int com } /* BICUBIC INTERPOLATION */ -BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, +BLI_INLINE void bicubic_interpolation(const uchar *byte_buffer, const float *float_buffer, - unsigned char *byte_output, + uchar *byte_output, float *float_output, int width, int height, @@ -135,7 +135,7 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, vector_from_float(float_data, data, components); } else { - const unsigned char *byte_data = byte_buffer + width * y1 * components + components * x1; + const uchar *byte_data = byte_buffer + width * y1 * components + components * x1; vector_from_byte(byte_data, data, components); } @@ -211,18 +211,18 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, } else { if (components == 1) { - byte_output[0] = (unsigned char)(out[0] + 0.5f); + byte_output[0] = (uchar)(out[0] + 0.5f); } else if (components == 3) { - byte_output[0] = (unsigned char)(out[0] + 0.5f); - byte_output[1] = (unsigned char)(out[1] + 0.5f); - byte_output[2] = (unsigned char)(out[2] + 0.5f); + byte_output[0] = (uchar)(out[0] + 0.5f); + byte_output[1] = (uchar)(out[1] + 0.5f); + byte_output[2] = (uchar)(out[2] + 0.5f); } else { - byte_output[0] = (unsigned char)(out[0] + 0.5f); - byte_output[1] = (unsigned char)(out[1] + 0.5f); - byte_output[2] = (unsigned char)(out[2] + 0.5f); - byte_output[3] = (unsigned char)(out[3] + 0.5f); + byte_output[0] = (uchar)(out[0] + 0.5f); + byte_output[1] = (uchar)(out[1] + 0.5f); + byte_output[2] = (uchar)(out[2] + 0.5f); + byte_output[3] = (uchar)(out[3] + 0.5f); } } } @@ -233,21 +233,16 @@ void BLI_bicubic_interpolation_fl( bicubic_interpolation(NULL, buffer, NULL, output, width, height, components, u, v); } -void BLI_bicubic_interpolation_char(const unsigned char *buffer, - unsigned char *output, - int width, - int height, - int components, - float u, - float v) +void BLI_bicubic_interpolation_char( + const uchar *buffer, uchar *output, int width, int height, int components, float u, float v) { bicubic_interpolation(buffer, NULL, output, NULL, width, height, components, u, v); } /* BILINEAR INTERPOLATION */ -BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, +BLI_INLINE void bilinear_interpolation(const uchar *byte_buffer, const float *float_buffer, - unsigned char *byte_output, + uchar *byte_output, float *float_output, int width, int height, @@ -351,8 +346,8 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, } } else { - const unsigned char *row1, *row2, *row3, *row4; - unsigned char empty[4] = {0, 0, 0, 0}; + const uchar *row1, *row2, *row3, *row4; + uchar empty[4] = {0, 0, 0, 0}; /* pixel value must be already wrapped, however values at boundaries may flip */ if (wrap_x) { @@ -418,26 +413,26 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, ma_mb = (1.0f - a) * (1.0f - b); if (components == 1) { - byte_output[0] = (unsigned char)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + - a_b * row4[0] + 0.5f); + byte_output[0] = (uchar)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0] + + 0.5f); } else if (components == 3) { - byte_output[0] = (unsigned char)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + - a_b * row4[0] + 0.5f); - byte_output[1] = (unsigned char)(ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + - a_b * row4[1] + 0.5f); - byte_output[2] = (unsigned char)(ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + - a_b * row4[2] + 0.5f); + byte_output[0] = (uchar)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0] + + 0.5f); + byte_output[1] = (uchar)(ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1] + + 0.5f); + byte_output[2] = (uchar)(ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2] + + 0.5f); } else { - byte_output[0] = (unsigned char)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + - a_b * row4[0] + 0.5f); - byte_output[1] = (unsigned char)(ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + - a_b * row4[1] + 0.5f); - byte_output[2] = (unsigned char)(ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + - a_b * row4[2] + 0.5f); - byte_output[3] = (unsigned char)(ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] + - a_b * row4[3] + 0.5f); + byte_output[0] = (uchar)(ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0] + + 0.5f); + byte_output[1] = (uchar)(ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1] + + 0.5f); + byte_output[2] = (uchar)(ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2] + + 0.5f); + byte_output[3] = (uchar)(ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] + a_b * row4[3] + + 0.5f); } } } @@ -449,13 +444,8 @@ void BLI_bilinear_interpolation_fl( NULL, buffer, NULL, output, width, height, components, u, v, false, false); } -void BLI_bilinear_interpolation_char(const unsigned char *buffer, - unsigned char *output, - int width, - int height, - int components, - float u, - float v) +void BLI_bilinear_interpolation_char( + const uchar *buffer, uchar *output, int width, int height, int components, float u, float v) { bilinear_interpolation( buffer, NULL, output, NULL, width, height, components, u, v, false, false); @@ -475,8 +465,8 @@ void BLI_bilinear_interpolation_wrap_fl(const float *buffer, NULL, buffer, NULL, output, width, height, components, u, v, wrap_x, wrap_y); } -void BLI_bilinear_interpolation_wrap_char(const unsigned char *buffer, - unsigned char *output, +void BLI_bilinear_interpolation_wrap_char(const uchar *buffer, + uchar *output, int width, int height, int components, diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 3f072c153ad..91b07639e9b 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1477,7 +1477,7 @@ void compatible_eul(float eul[3], const float oldrot[3]) const float pi_x2 = (2.0f * (float)M_PI); float deul[3]; - unsigned int i; + uint i; /* correct differences of about 360 degrees first */ for (i = 0; i < 3; i++) { diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index e8aa359fbe4..a48df0aa977 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -2032,10 +2032,10 @@ static Array<Face *> polyfill_triangulate_poly(Face *f, IMeshArena *arena) } /* Project along negative face normal so (x,y) can be used in 2d. */ float axis_mat[3][3]; float(*projverts)[2]; - unsigned int(*tris)[3]; + uint(*tris)[3]; const int totfilltri = flen - 2; /* Prepare projected vertices and array to receive triangles in tessellation. */ - tris = static_cast<unsigned int(*)[3]>(MEM_malloc_arrayN(totfilltri, sizeof(*tris), __func__)); + tris = static_cast<uint(*)[3]>(MEM_malloc_arrayN(totfilltri, sizeof(*tris), __func__)); projverts = static_cast<float(*)[2]>(MEM_malloc_arrayN(flen, sizeof(*projverts), __func__)); axis_dominant_v3_to_m3_negate(axis_mat, no); for (int j = 0; j < flen; ++j) { @@ -2047,7 +2047,7 @@ static Array<Face *> polyfill_triangulate_poly(Face *f, IMeshArena *arena) /* Put tessellation triangles into Face form. Record original edges where they exist. */ Array<Face *> ans(totfilltri); for (int t = 0; t < totfilltri; ++t) { - unsigned int *tri = tris[t]; + uint *tri = tris[t]; int eo[3]; const Vert *v[3]; for (int k = 0; k < 3; k++) { diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 3ec7c3f9804..182c21ca76c 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -115,8 +115,8 @@ static const float hashpntf[768] = { 0.713870, 0.555261, 0.951333, }; -extern const unsigned char BLI_noise_hash_uchar_512[512]; /* Quiet warning. */ -const unsigned char BLI_noise_hash_uchar_512[512] = { +extern const uchar BLI_noise_hash_uchar_512[512]; /* Quiet warning. */ +const uchar BLI_noise_hash_uchar_512[512] = { 0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC, 0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC, 0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8, 0x8B, 0x63, 0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7, diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 9b91636b055..a3be9732a68 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -121,7 +121,7 @@ int BLI_path_sequence_decode(const char *string, char *head, char *tail, ushort } void BLI_path_sequence_encode( - char *string, const char *head, const char *tail, unsigned short numlen, int pic) + char *string, const char *head, const char *tail, ushort numlen, int pic) { sprintf(string, "%s%.*d%s", head, numlen, MAX2(0, pic), tail); } diff --git a/source/blender/blenlib/intern/rand.cc b/source/blender/blenlib/intern/rand.cc index f6d91cdcc4f..40bbe14101b 100644 --- a/source/blender/blenlib/intern/rand.cc +++ b/source/blender/blenlib/intern/rand.cc @@ -24,7 +24,7 @@ #include "BLI_strict_flags.h" #include "BLI_sys_types.h" -extern "C" unsigned char BLI_noise_hash_uchar_512[512]; /* noise.c */ +extern "C" uchar BLI_noise_hash_uchar_512[512]; /* noise.c */ #define hash BLI_noise_hash_uchar_512 /** @@ -36,14 +36,14 @@ struct RNG { MEM_CXX_CLASS_ALLOC_FUNCS("RNG") }; -RNG *BLI_rng_new(unsigned int seed) +RNG *BLI_rng_new(uint seed) { RNG *rng = new RNG(); rng->rng.seed(seed); return rng; } -RNG *BLI_rng_new_srandom(unsigned int seed) +RNG *BLI_rng_new_srandom(uint seed) { RNG *rng = new RNG(); rng->rng.seed_random(seed); @@ -60,12 +60,12 @@ void BLI_rng_free(RNG *rng) delete rng; } -void BLI_rng_seed(RNG *rng, unsigned int seed) +void BLI_rng_seed(RNG *rng, uint seed) { rng->rng.seed(seed); } -void BLI_rng_srandom(RNG *rng, unsigned int seed) +void BLI_rng_srandom(RNG *rng, uint seed) { rng->rng.seed_random(seed); } @@ -80,7 +80,7 @@ int BLI_rng_get_int(RNG *rng) return rng->rng.get_int32(); } -unsigned int BLI_rng_get_uint(RNG *rng) +uint BLI_rng_get_uint(RNG *rng) { return rng->rng.get_uint32(); } @@ -117,21 +117,21 @@ void BLI_rng_get_tri_sample_float_v3( copy_v3_v3(r_pt, rng->rng.get_triangle_sample_3d(v1, v2, v3)); } -void BLI_rng_shuffle_array(RNG *rng, void *data, unsigned int elem_size_i, unsigned int elem_num) +void BLI_rng_shuffle_array(RNG *rng, void *data, uint elem_size_i, uint elem_num) { if (elem_num <= 1) { return; } const uint elem_size = elem_size_i; - unsigned int i = elem_num; + uint i = elem_num; void *temp = malloc(elem_size); while (i--) { - const unsigned int j = BLI_rng_get_uint(rng) % elem_num; + const uint j = BLI_rng_get_uint(rng) % elem_num; if (i != j) { - void *iElem = (unsigned char *)data + i * elem_size_i; - void *jElem = (unsigned char *)data + j * elem_size_i; + void *iElem = (uchar *)data + i * elem_size_i; + void *jElem = (uchar *)data + j * elem_size_i; memcpy(temp, iElem, elem_size); memcpy(iElem, jElem, elem_size); memcpy(jElem, temp, elem_size); @@ -141,15 +141,15 @@ void BLI_rng_shuffle_array(RNG *rng, void *data, unsigned int elem_size_i, unsig free(temp); } -void BLI_rng_shuffle_bitmap(struct RNG *rng, BLI_bitmap *bitmap, unsigned int bits_num) +void BLI_rng_shuffle_bitmap(struct RNG *rng, BLI_bitmap *bitmap, uint bits_num) { if (bits_num <= 1) { return; } - unsigned int i = bits_num; + uint i = bits_num; while (i--) { - const unsigned int j = BLI_rng_get_uint(rng) % bits_num; + const uint j = BLI_rng_get_uint(rng) % bits_num; if (i != j) { const bool i_bit = BLI_BITMAP_TEST(bitmap, i); const bool j_bit = BLI_BITMAP_TEST(bitmap, j); @@ -166,7 +166,7 @@ void BLI_rng_skip(RNG *rng, int n) /***/ -void BLI_array_frand(float *ar, int count, unsigned int seed) +void BLI_array_frand(float *ar, int count, uint seed) { RNG rng; @@ -177,7 +177,7 @@ void BLI_array_frand(float *ar, int count, unsigned int seed) } } -float BLI_hash_frand(unsigned int seed) +float BLI_hash_frand(uint seed) { RNG rng; @@ -185,10 +185,7 @@ float BLI_hash_frand(unsigned int seed) return BLI_rng_get_float(&rng); } -void BLI_array_randomize(void *data, - unsigned int elem_size, - unsigned int elem_num, - unsigned int seed) +void BLI_array_randomize(void *data, uint elem_size, uint elem_num, uint seed) { RNG rng; @@ -196,7 +193,7 @@ void BLI_array_randomize(void *data, BLI_rng_shuffle_array(&rng, data, elem_size, elem_num); } -void BLI_bitmap_randomize(BLI_bitmap *bitmap, unsigned int bits_num, unsigned int seed) +void BLI_bitmap_randomize(BLI_bitmap *bitmap, uint bits_num, uint seed) { RNG rng; @@ -208,7 +205,7 @@ void BLI_bitmap_randomize(BLI_bitmap *bitmap, unsigned int bits_num, unsigned in static RNG rng_tab[BLENDER_MAX_THREADS]; -void BLI_thread_srandom(int thread, unsigned int seed) +void BLI_thread_srandom(int thread, uint seed) { if (thread >= BLENDER_MAX_THREADS) { thread = 0; @@ -237,12 +234,12 @@ struct RNG_THREAD_ARRAY { RNG_THREAD_ARRAY *BLI_rng_threaded_new() { - unsigned int i; + uint i; RNG_THREAD_ARRAY *rngarr = (RNG_THREAD_ARRAY *)MEM_mallocN(sizeof(RNG_THREAD_ARRAY), "random_array"); for (i = 0; i < BLENDER_MAX_THREADS; i++) { - BLI_rng_srandom(&rngarr->rng_tab[i], (unsigned int)clock()); + BLI_rng_srandom(&rngarr->rng_tab[i], (uint)clock()); } return rngarr; @@ -284,7 +281,7 @@ BLI_INLINE double halton_ex(double invprimes, double *offset) return *offset; } -void BLI_halton_1d(unsigned int prime, double offset, int n, double *r) +void BLI_halton_1d(uint prime, double offset, int n, double *r) { const double invprime = 1.0 / (double)prime; @@ -295,7 +292,7 @@ void BLI_halton_1d(unsigned int prime, double offset, int n, double *r) } } -void BLI_halton_2d(const unsigned int prime[2], double offset[2], int n, double *r) +void BLI_halton_2d(const uint prime[2], double offset[2], int n, double *r) { const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]}; @@ -308,7 +305,7 @@ void BLI_halton_2d(const unsigned int prime[2], double offset[2], int n, double } } -void BLI_halton_3d(const unsigned int prime[3], double offset[3], int n, double *r) +void BLI_halton_3d(const uint prime[3], double offset[3], int n, double *r) { const double invprimes[3] = { 1.0 / (double)prime[0], 1.0 / (double)prime[1], 1.0 / (double)prime[2]}; @@ -322,7 +319,7 @@ void BLI_halton_3d(const unsigned int prime[3], double offset[3], int n, double } } -void BLI_halton_2d_sequence(const unsigned int prime[2], double offset[2], int n, double *r) +void BLI_halton_2d_sequence(const uint prime[2], double offset[2], int n, double *r) { const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]}; @@ -335,7 +332,7 @@ void BLI_halton_2d_sequence(const unsigned int prime[2], double offset[2], int n /* From "Sampling with Hammersley and Halton Points" TT Wong * Appendix: Source Code 1 */ -BLI_INLINE double radical_inverse(unsigned int n) +BLI_INLINE double radical_inverse(uint n) { double u = 0; @@ -350,14 +347,14 @@ BLI_INLINE double radical_inverse(unsigned int n) return u; } -void BLI_hammersley_1d(unsigned int n, double *r) +void BLI_hammersley_1d(uint n, double *r) { *r = radical_inverse(n); } -void BLI_hammersley_2d_sequence(unsigned int n, double *r) +void BLI_hammersley_2d_sequence(uint n, double *r) { - for (unsigned int s = 0; s < n; s++) { + for (uint s = 0; s < n; s++) { r[s * 2 + 0] = (double)(s + 0.5) / (double)n; r[s * 2 + 1] = radical_inverse(s); } diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 33d387a5447..00ac1c0ecd7 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -33,9 +33,9 @@ /* local types */ typedef struct PolyFill { - unsigned int edges, verts; + uint edges, verts; float min_xy[2], max_xy[2]; - unsigned short nr; + ushort nr; bool f; } PolyFill; @@ -304,9 +304,7 @@ static bool addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed) return true; } -static ScanFillVertLink *addedgetoscanlist(ScanFillVertLink *scdata, - ScanFillEdge *eed, - unsigned int len) +static ScanFillVertLink *addedgetoscanlist(ScanFillVertLink *scdata, ScanFillEdge *eed, uint len) { /* inserts edge at correct location in ScanFillVertLink list */ /* returns sc when edge already exists */ @@ -428,10 +426,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx) } } -static void splitlist(ScanFillContext *sf_ctx, - ListBase *tempve, - ListBase *temped, - unsigned short nr) +static void splitlist(ScanFillContext *sf_ctx, ListBase *tempve, ListBase *temped, ushort nr) { /* Everything is in temp-list, write only poly nr to fill-list. */ ScanFillVert *eve, *eve_next; @@ -457,14 +452,14 @@ static void splitlist(ScanFillContext *sf_ctx, } } -static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) +static uint scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) { ScanFillVertLink *scdata; ScanFillVertLink *sc = NULL, *sc1; ScanFillVert *eve, *v1, *v2, *v3; ScanFillEdge *eed, *eed_next, *ed1, *ed2, *ed3; - unsigned int a, b, verts, maxface, totface; - const unsigned short nr = pf->nr; + uint a, b, verts, maxface, totface; + const ushort nr = pf->nr; bool twoconnected = false; /* PRINTS */ diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c index 1d2225a5b56..3550854eabd 100644 --- a/source/blender/blenlib/intern/scanfill_utils.c +++ b/source/blender/blenlib/intern/scanfill_utils.c @@ -41,7 +41,7 @@ typedef struct ScanFillIsect { #define EFLAG_SET(eed, val) \ { \ CHECK_TYPE(eed, ScanFillEdge *); \ - (eed)->user_flag = (eed)->user_flag | (unsigned int)val; \ + (eed)->user_flag = (eed)->user_flag | (uint)val; \ } \ (void)0 #if 0 @@ -56,7 +56,7 @@ typedef struct ScanFillIsect { #define VFLAG_SET(eve, val) \ { \ CHECK_TYPE(eve, ScanFillVert *); \ - (eve)->user_flag = (eve)->user_flag | (unsigned int)val; \ + (eve)->user_flag = (eve)->user_flag | (uint)val; \ } \ (void)0 #if 0 @@ -130,7 +130,7 @@ static int edge_isect_ls_sort_cb(void *thunk, const void *def_a_ptr, const void } static ScanFillEdge *edge_step(PolyInfo *poly_info, - const unsigned short poly_nr, + const ushort poly_nr, ScanFillVert *v_prev, ScanFillVert *v_curr, ScanFillEdge *e_curr) @@ -158,7 +158,7 @@ static ScanFillEdge *edge_step(PolyInfo *poly_info, static bool scanfill_preprocess_self_isect(ScanFillContext *sf_ctx, PolyInfo *poly_info, - const unsigned short poly_nr, + const ushort poly_nr, ListBase *filledgebase) { PolyInfo *pi = &poly_info[poly_nr]; diff --git a/source/blender/blenlib/intern/stack.c b/source/blender/blenlib/intern/stack.c index ff34cfe41cb..a7bc57ab95f 100644 --- a/source/blender/blenlib/intern/stack.c +++ b/source/blender/blenlib/intern/stack.c @@ -141,7 +141,7 @@ void BLI_stack_pop(BLI_Stack *stack, void *dst) BLI_stack_discard(stack); } -void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n) +void BLI_stack_pop_n(BLI_Stack *stack, void *dst, uint n) { BLI_assert(n <= BLI_stack_count(stack)); diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 17fb451e422..4fb8311048f 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -55,11 +55,11 @@ ptrdiff_t BLI_str_utf8_invalid_byte(const char *str, size_t length) * length is in bytes, since without knowing whether the string is valid * it's hard to know how many characters there are! */ - const unsigned char *p, *perr, *pend = (const unsigned char *)str + length; - unsigned char c; + const uchar *p, *perr, *pend = (const uchar *)str + length; + uchar c; int ab; - for (p = (const unsigned char *)str; p < pend; p++, length--) { + for (p = (const uchar *)str; p < pend; p++, length--) { c = *p; perr = p; /* Erroneous char is always the first of an invalid utf8 sequence... */ if (ELEM(c, 0xfe, 0xff, 0x00)) { diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc index 37fccf6f4fe..e7470ed86f8 100644 --- a/source/blender/blenlib/intern/threads.cc +++ b/source/blender/blenlib/intern/threads.cc @@ -108,7 +108,7 @@ static pthread_mutex_t _colormanage_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _fftw_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _view3d_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_t mainid; -static unsigned int thread_levels = 0; /* threads can be invoked inside threads */ +static uint thread_levels = 0; /* threads can be invoked inside threads */ static int threads_override_num = 0; /* just a max for security reasons */ @@ -153,7 +153,7 @@ void BLI_threadpool_init(ListBase *threadbase, void *(*do_thread)(void *), int t } } - unsigned int level = atomic_fetch_and_add_u(&thread_levels, 1); + uint level = atomic_fetch_and_add_u(&thread_levels, 1); if (level == 0) { #ifdef USE_APPLE_OMP_FIX /* Workaround for Apple gcc 4.2.1 OMP vs background thread bug, @@ -524,7 +524,7 @@ void BLI_rw_mutex_free(ThreadRWMutex *mutex) struct TicketMutex { pthread_cond_t cond; pthread_mutex_t mutex; - unsigned int queue_head, queue_tail; + uint queue_head, queue_tail; }; TicketMutex *BLI_ticket_mutex_alloc() @@ -547,7 +547,7 @@ void BLI_ticket_mutex_free(TicketMutex *ticket) void BLI_ticket_mutex_lock(TicketMutex *ticket) { - unsigned int queue_me; + uint queue_me; pthread_mutex_lock(&ticket->mutex); queue_me = ticket->queue_tail++; diff --git a/source/blender/blenlib/tests/BLI_array_store_test.cc b/source/blender/blenlib/tests/BLI_array_store_test.cc index 8e95557466e..c52d439308f 100644 --- a/source/blender/blenlib/tests/BLI_array_store_test.cc +++ b/source/blender/blenlib/tests/BLI_array_store_test.cc @@ -168,7 +168,7 @@ static void testbuffer_list_state_from_data__stride_expand(ListBase *lb, #define testbuffer_list_state_from_string_array(lb, data_array) \ { \ - unsigned int i_ = 0; \ + uint i_ = 0; \ const char *data; \ while ((data = data_array[i_++])) { \ testbuffer_list_state_from_data(lb, data, strlen(data)); \ @@ -224,7 +224,7 @@ static bool testbuffer_list_validate(const ListBase *lb) return true; } -static void testbuffer_list_data_randomize(ListBase *lb, unsigned int random_seed) +static void testbuffer_list_data_randomize(ListBase *lb, uint random_seed) { for (TestBuffer *tb = (TestBuffer *)lb->first; tb; tb = tb->next) { BLI_array_randomize((void *)tb->data, 1, tb->data_len, random_seed++); @@ -301,7 +301,7 @@ TEST(array_store, Nop) TEST(array_store, NopState) { BArrayStore *bs = BLI_array_store_create(1, 32); - const unsigned char data[] = "test"; + const uchar data[] = "test"; BArrayState *state = BLI_array_store_state_add(bs, data, sizeof(data) - 1, nullptr); EXPECT_EQ(BLI_array_store_state_size_get(state), sizeof(data) - 1); BLI_array_store_state_remove(bs, state); @@ -556,18 +556,15 @@ TEST(array_store, TextSentencesRandom_Stride128_Chunk6) /* -------------------------------------------------------------------- */ /* Random Data Tests */ -static unsigned int rand_range_i(RNG *rng, - unsigned int min_i, - unsigned int max_i, - unsigned int step) +static uint rand_range_i(RNG *rng, uint min_i, uint max_i, uint step) { if (min_i == max_i) { return min_i; } BLI_assert(min_i <= max_i); BLI_assert(((min_i % step) == 0) && ((max_i % step) == 0)); - unsigned int range = (max_i - min_i); - unsigned int value = BLI_rng_get_uint(rng) % range; + uint range = (max_i - min_i); + uint value = BLI_rng_get_uint(rng) % range; value = (value / step) * step; return min_i + value; } @@ -577,7 +574,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, const size_t data_min_len, const size_t data_max_len, - const unsigned int mutate, + const uint mutate, RNG *rng) { size_t data_len = rand_range_i(rng, data_min_len, data_max_len + stride, stride); @@ -612,7 +609,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, break; } case MUTATE_ADD: { - const unsigned int offset = rand_range_i(rng, 0, data_len, stride); + const uint offset = rand_range_i(rng, 0, data_len, stride); if (data_len < data_max_len) { data_len += stride; data = (char *)MEM_reallocN((void *)data, data_len); @@ -622,7 +619,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, break; } case MUTATE_REMOVE: { - const unsigned int offset = rand_range_i(rng, 0, data_len, stride); + const uint offset = rand_range_i(rng, 0, data_len, stride); if (data_len > data_min_len) { memmove(&data[offset], &data[offset + stride], data_len - (offset + stride)); data_len -= stride; @@ -638,7 +635,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, } case MUTATE_RANDOMIZE: { if (data_len > 0) { - const unsigned int offset = rand_range_i(rng, 0, data_len - stride, stride); + const uint offset = rand_range_i(rng, 0, data_len - stride, stride); BLI_rng_get_char_n(rng, &data[offset], stride); } break; diff --git a/source/blender/blenlib/tests/BLI_ghash_test.cc b/source/blender/blenlib/tests/BLI_ghash_test.cc index da5207cb3f8..5e763dc928f 100644 --- a/source/blender/blenlib/tests/BLI_ghash_test.cc +++ b/source/blender/blenlib/tests/BLI_ghash_test.cc @@ -34,10 +34,10 @@ /* NOTE: for pure-ghash testing, nature of the keys and data have absolutely no importance! So here * we just use mere random integers stored in pointers. */ -static void init_keys(unsigned int keys[TESTCASE_SIZE], const int seed) +static void init_keys(uint keys[TESTCASE_SIZE], const int seed) { RNG *rng = BLI_rng_new(seed); - unsigned int *k; + uint *k; int i; for (i = 0, k = keys; i < TESTCASE_SIZE;) { @@ -61,7 +61,7 @@ static void init_keys(unsigned int keys[TESTCASE_SIZE], const int seed) TEST(ghash, InsertLookup) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i; init_keys(keys, 0); @@ -85,7 +85,7 @@ TEST(ghash, InsertLookup) TEST(ghash, InsertRemove) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i, bkt_size; init_keys(keys, 10); @@ -112,7 +112,7 @@ TEST(ghash, InsertRemove) TEST(ghash, InsertRemoveShrink) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i, bkt_size; BLI_ghash_flag_set(ghash, GHASH_FLAG_ALLOW_SHRINK); @@ -141,7 +141,7 @@ TEST(ghash, Copy) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); GHash *ghash_copy; - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i; init_keys(keys, 30); @@ -170,7 +170,7 @@ TEST(ghash, Copy) TEST(ghash, Pop) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i; BLI_ghash_flag_set(ghash, GHASH_FLAG_ALLOW_SHRINK); diff --git a/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc b/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc index 99bb107840f..90f5aa6189f 100644 --- a/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc +++ b/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc @@ -16,7 +16,7 @@ TEST(hash_mm2a, MM2ABasic) const char *data = "Blender"; BLI_hash_mm2a_init(&mm2, 0); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data, strlen(data)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data, strlen(data)); #ifdef __LITTLE_ENDIAN__ EXPECT_EQ(BLI_hash_mm2a_end(&mm2), 1633988145); #else @@ -35,12 +35,12 @@ TEST(hash_mm2a, MM2AConcatenateStrings) const char *data123 = "Blender is FaNtAsTiC"; BLI_hash_mm2a_init(&mm2, 0); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data1, strlen(data1)); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data2, strlen(data2)); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data3, strlen(data3)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data1, strlen(data1)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data2, strlen(data2)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data3, strlen(data3)); hash = BLI_hash_mm2a_end(&mm2); BLI_hash_mm2a_init(&mm2, 0); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data123, strlen(data123)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data123, strlen(data123)); #ifdef __LITTLE_ENDIAN__ EXPECT_EQ(hash, 1545105348); #else @@ -63,7 +63,7 @@ TEST(hash_mm2a, MM2AIntegers) BLI_hash_mm2a_add_int(&mm2, ints[3]); hash = BLI_hash_mm2a_end(&mm2); BLI_hash_mm2a_init(&mm2, 0); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)ints, sizeof(ints)); + BLI_hash_mm2a_add(&mm2, (const uchar *)ints, sizeof(ints)); /* Yes, same hash here on little and big endian. */ #ifdef __LITTLE_ENDIAN__ EXPECT_EQ(hash, 405493096); diff --git a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc index db2fb1ba671..69c60c5bdb9 100644 --- a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc @@ -29,20 +29,20 @@ static void polyfill_to_obj(const char *id, const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num); + const uint poly_num, + const uint tris[][3], + const uint tris_num); /* -------------------------------------------------------------------- */ /* test utility functions */ -#define TRI_ERROR_VALUE (unsigned int)-1 +#define TRI_ERROR_VALUE (uint) - 1 -static void test_valid_polyfill_prepare(unsigned int tris[][3], unsigned int tris_num) +static void test_valid_polyfill_prepare(uint tris[][3], uint tris_num) { - unsigned int i; + uint i; for (i = 0; i < tris_num; i++) { - unsigned int j; + uint j; for (j = 0; j < 3; j++) { tris[i][j] = TRI_ERROR_VALUE; } @@ -57,14 +57,14 @@ static void test_valid_polyfill_prepare(unsigned int tris[][3], unsigned int tri * - all verts used at least once. */ static void test_polyfill_simple(const float /*poly*/[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { - unsigned int i; + uint i; int *used_num = (int *)MEM_callocN(poly_num * sizeof(int), __func__); for (i = 0; i < tris_num; i++) { - unsigned int j; + uint j; for (j = 0; j < 3; j++) { EXPECT_NE(TRI_ERROR_VALUE, tris[i][j]); used_num[tris[i][j]] += 1; @@ -80,18 +80,18 @@ static void test_polyfill_simple(const float /*poly*/[][2], } static void test_polyfill_topology(const float /*poly*/[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { EdgeHash *edgehash = BLI_edgehash_new(__func__); EdgeHashIterator *ehi; - unsigned int i; + uint i; for (i = 0; i < tris_num; i++) { - unsigned int j; + uint j; for (j = 0; j < 3; j++) { - const unsigned int v1 = tris[i][j]; - const unsigned int v2 = tris[i][(j + 1) % 3]; + const uint v1 = tris[i][j]; + const uint v2 = tris[i][(j + 1) % 3]; void **p = BLI_edgehash_lookup_p(edgehash, v1, v2); if (p) { *p = (void *)((intptr_t)*p + (intptr_t)1); @@ -104,8 +104,8 @@ static void test_polyfill_topology(const float /*poly*/[][2], EXPECT_EQ(BLI_edgehash_len(edgehash), poly_num + (poly_num - 3)); for (i = 0; i < poly_num; i++) { - const unsigned int v1 = i; - const unsigned int v2 = (i + 1) % poly_num; + const uint v1 = i; + const uint v2 = (i + 1) % poly_num; void **p = BLI_edgehash_lookup_p(edgehash, v1, v2); EXPECT_NE((void *)p, nullptr); EXPECT_EQ((intptr_t)*p, 1); @@ -125,12 +125,12 @@ static void test_polyfill_topology(const float /*poly*/[][2], * Check all faces are flipped the same way */ static void test_polyfill_winding(const float poly[][2], - const unsigned int /*poly_num*/, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint /*poly_num*/, + const uint tris[][3], + const uint tris_num) { - unsigned int i; - unsigned int count[2] = {0, 0}; + uint i; + uint count[2] = {0, 0}; for (i = 0; i < tris_num; i++) { float winding_test = cross_tri_v2(poly[tris[i][0]], poly[tris[i][1]], poly[tris[i][2]]); if (fabsf(winding_test) > FLT_EPSILON) { @@ -144,11 +144,11 @@ static void test_polyfill_winding(const float poly[][2], * Check the accumulated triangle area is close to the original area. */ static void test_polyfill_area(const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { - unsigned int i; + uint i; const float area_total = area_poly_v2(poly, poly_num); float area_total_tris = 0.0f; const float eps_abs = 0.00001f; @@ -167,9 +167,9 @@ static void test_polyfill_area(const float poly[][2], static void test_polyfill_template_check(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { test_polyfill_simple(poly, poly_num, tris, tris_num); test_polyfill_topology(poly, poly_num, tris, tris_num); @@ -184,9 +184,9 @@ static void test_polyfill_template_check(const char *id, static void test_polyfill_template(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + uint tris[][3], + const uint tris_num) { test_valid_polyfill_prepare(tris, tris_num); BLI_polyfill_calc(poly, poly_num, 0, tris); @@ -213,9 +213,9 @@ static void test_polyfill_template(const char *id, static void test_polyfill_template_flip_sign(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + uint tris[][3], + const uint tris_num) { float(*poly_copy)[2] = (float(*)[2])MEM_mallocN(sizeof(float[2]) * poly_num, id); for (int flip_x = 0; flip_x < 2; flip_x++) { @@ -236,19 +236,19 @@ static void test_polyfill_template_flip_sign(const char *id, static void test_polyfill_template_main(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + uint tris[][3], + const uint tris_num) { /* overkill? - try at _every_ offset & reverse */ - unsigned int poly_reverse; + uint poly_reverse; float(*poly_copy)[2] = (float(*)[2])MEM_mallocN(sizeof(float[2]) * poly_num, id); float tmp[2]; memcpy(poly_copy, poly, sizeof(float[2]) * poly_num); for (poly_reverse = 0; poly_reverse < 2; poly_reverse++) { - unsigned int poly_cycle; + uint poly_cycle; if (poly_reverse) { BLI_array_reverse(poly_copy, poly_num); @@ -271,9 +271,9 @@ static void test_polyfill_template_main(const char *id, static void test_polyfill_template_main(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + uint tris[][3], + const uint tris_num) { test_polyfill_template_flip_sign(id, is_degenerate, poly, poly_num, tris, tris_num); } @@ -281,9 +281,9 @@ static void test_polyfill_template_main(const char *id, #define TEST_POLYFILL_TEMPLATE_STATIC(poly, is_degenerate) \ { \ - unsigned int tris[POLY_TRI_COUNT(ARRAY_SIZE(poly))][3]; \ - const unsigned int poly_num = ARRAY_SIZE(poly); \ - const unsigned int tris_num = ARRAY_SIZE(tris); \ + uint tris[POLY_TRI_COUNT(ARRAY_SIZE(poly))][3]; \ + const uint poly_num = ARRAY_SIZE(poly); \ + const uint tris_num = ARRAY_SIZE(tris); \ const char *id = typeid(*this).name(); \ \ test_polyfill_template_main(id, is_degenerate, poly, poly_num, tris, tris_num); \ @@ -296,13 +296,13 @@ static void test_polyfill_template_main(const char *id, #ifdef USE_OBJ_PREVIEW static void polyfill_to_obj(const char *id, const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { char path[1024]; FILE *f; - unsigned int i; + uint i; BLI_snprintf(path, sizeof(path), "%s.obj", id); @@ -324,9 +324,9 @@ static void polyfill_to_obj(const char *id, #else static void polyfill_to_obj(const char *id, const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { (void)id; (void)poly, (void)poly_num; diff --git a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc index 0707759666d..5c7f1106993 100644 --- a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc +++ b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc @@ -118,19 +118,19 @@ TEST(stack, PushPopMany) Stack<int> stack; for (int i = 0; i < 1000; i++) { stack.push(i); - EXPECT_EQ(stack.size(), static_cast<unsigned int>(i + 1)); + EXPECT_EQ(stack.size(), static_cast<uint>(i + 1)); } for (int i = 999; i > 50; i--) { EXPECT_EQ(stack.pop(), i); - EXPECT_EQ(stack.size(), static_cast<unsigned int>(i)); + EXPECT_EQ(stack.size(), static_cast<uint>(i)); } for (int i = 51; i < 5000; i++) { stack.push(i); - EXPECT_EQ(stack.size(), static_cast<unsigned int>(i + 1)); + EXPECT_EQ(stack.size(), static_cast<uint>(i + 1)); } for (int i = 4999; i >= 0; i--) { EXPECT_EQ(stack.pop(), i); - EXPECT_EQ(stack.size(), static_cast<unsigned int>(i)); + EXPECT_EQ(stack.size(), static_cast<uint>(i)); } } diff --git a/source/blender/blenlib/tests/BLI_stack_test.cc b/source/blender/blenlib/tests/BLI_stack_test.cc index 216c8bd6d55..5f361a78929 100644 --- a/source/blender/blenlib/tests/BLI_stack_test.cc +++ b/source/blender/blenlib/tests/BLI_stack_test.cc @@ -28,7 +28,7 @@ TEST(stack, Empty) TEST(stack, One) { BLI_Stack *stack; - unsigned int in = -1, out = 1; + uint in = -1, out = 1; stack = BLI_stack_new(sizeof(in), __func__); diff --git a/source/blender/blenlib/tests/BLI_string_test.cc b/source/blender/blenlib/tests/BLI_string_test.cc index eaaa65dd39f..9bdf6075c70 100644 --- a/source/blender/blenlib/tests/BLI_string_test.cc +++ b/source/blender/blenlib/tests/BLI_string_test.cc @@ -174,7 +174,7 @@ TEST(string, StrPartitionEx) /* BLI_str_partition_utf8 */ TEST(string, StrPartitionUtf8) { - const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; + const uint delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; const char *sep, *suf; size_t pre_len; @@ -233,7 +233,7 @@ TEST(string, StrPartitionUtf8) /* BLI_str_rpartition_utf8 */ TEST(string, StrRPartitionUtf8) { - const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; + const uint delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; const char *sep, *suf; size_t pre_len; @@ -292,7 +292,7 @@ TEST(string, StrRPartitionUtf8) /* BLI_str_partition_ex_utf8 */ TEST(string, StrPartitionExUtf8) { - const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; + const uint delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; const char *sep, *suf; size_t pre_len; diff --git a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc index 09bb1e7239f..e1d3adc6e78 100644 --- a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc +++ b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc @@ -177,12 +177,12 @@ TEST(ghash, TextMurmur2a) /* Int: uniform 100M first integers. */ -static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int count) +static void int_ghash_tests(GHash *ghash, const char *id, const uint count) { printf("\n========== STARTING %s ==========\n", id); { - unsigned int i = count; + uint i = count; TIMEIT_START(int_insert); @@ -200,7 +200,7 @@ static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int cou PRINTF_GHASH_STATS(ghash); { - unsigned int i = count; + uint i = count; TIMEIT_START(int_lookup); @@ -266,13 +266,13 @@ TEST(ghash, IntMurmur2a100000000) /* Int: random 50M integers. */ -static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int count) +static void randint_ghash_tests(GHash *ghash, const char *id, const uint count) { printf("\n========== STARTING %s ==========\n", id); - unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__); - unsigned int *dt; - unsigned int i; + uint *data = (uint *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__); + uint *dt; + uint i; { RNG *rng = BLI_rng_new(1); @@ -347,7 +347,7 @@ TEST(ghash, IntRandMurmur2a50000000) } #endif -static unsigned int ghashutil_tests_nohash_p(const void *p) +static uint ghashutil_tests_nohash_p(const void *p) { return POINTER_AS_UINT(p); } @@ -375,14 +375,14 @@ TEST(ghash, Int4NoHash50000000) /* Int_v4: 20M of randomly-generated integer vectors. */ -static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int count) +static void int4_ghash_tests(GHash *ghash, const char *id, const uint count) { printf("\n========== STARTING %s ==========\n", id); - void *data_v = MEM_mallocN(sizeof(unsigned int[4]) * (size_t)count, __func__); - unsigned int(*data)[4] = (unsigned int(*)[4])data_v; - unsigned int(*dt)[4]; - unsigned int i, j; + void *data_v = MEM_mallocN(sizeof(uint[4]) * (size_t)count, __func__); + uint(*data)[4] = (uint(*)[4])data_v; + uint(*dt)[4]; + uint i, j; { RNG *rng = BLI_rng_new(1); @@ -483,11 +483,11 @@ TEST(ghash, Int2NoHash50000000) /* MultiSmall: create and manipulate a lot of very small ghash's * (90% < 10 items, 9% < 100 items, 1% < 1000 items). */ -static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned int count) +static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const uint count) { - unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__); - unsigned int *dt; - unsigned int i; + uint *data = (uint *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__); + uint *dt; + uint i; for (i = count, dt = data; i--; dt++) { *dt = BLI_rng_get_uint(rng); @@ -510,7 +510,7 @@ static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned i MEM_freeN(data); } -static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned int count) +static void multi_small_ghash_tests(GHash *ghash, const char *id, const uint count) { printf("\n========== STARTING %s ==========\n", id); @@ -518,7 +518,7 @@ static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned TIMEIT_START(multi_small_ghash); - unsigned int i = count; + uint i = count; while (i--) { const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) * (!(i % 100) ? 100 : (!(i % 10) ? 10 : 1)); @@ -529,7 +529,7 @@ static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned TIMEIT_START(multi_small2_ghash); - unsigned int i = count; + uint i = count; while (i--) { const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) / 2 * (!(i % 100) ? 100 : (!(i % 10) ? 10 : 1)); diff --git a/source/blender/blenloader/intern/versioning_300.cc b/source/blender/blenloader/intern/versioning_300.cc index 7f450cb2cff..02b83d73d1f 100644 --- a/source/blender/blenloader/intern/versioning_300.cc +++ b/source/blender/blenloader/intern/versioning_300.cc @@ -2184,7 +2184,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) if (smd->bind_verts_num && smd->verts) { smd->mesh_verts_num = smd->bind_verts_num; - for (unsigned int i = 0; i < smd->bind_verts_num; i++) { + for (uint i = 0; i < smd->bind_verts_num; i++) { smd->verts[i].vertex_idx = i; } } diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc index a97c7d1ea20..9e3d0b66556 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc @@ -1232,7 +1232,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks * MutableSpan<MPoly> mpoly = me->polys_for_write(); MutableSpan<MLoop> loops = me->loops_for_write(); MLoop *mloop = loops.data(); - unsigned int i, j; + uint i, j; /* Clear normals on the mesh completely, since the original vertex and polygon count might be * different than the BMesh's. */ diff --git a/source/blender/compositor/intern/COM_CPUDevice.cc b/source/blender/compositor/intern/COM_CPUDevice.cc index 93c0b233752..916c7e1a411 100644 --- a/source/blender/compositor/intern/COM_CPUDevice.cc +++ b/source/blender/compositor/intern/COM_CPUDevice.cc @@ -16,7 +16,7 @@ void CPUDevice::execute(WorkPackage *work_package) { switch (work_package->type) { case eWorkPackageType::Tile: { - const unsigned int chunk_number = work_package->chunk_number; + const uint chunk_number = work_package->chunk_number; ExecutionGroup *execution_group = work_package->execution_group; execution_group->get_output_operation()->execute_region(&work_package->rect, chunk_number); diff --git a/source/blender/compositor/intern/COM_ChunkOrder.cc b/source/blender/compositor/intern/COM_ChunkOrder.cc index 38298840bf0..acc19155049 100644 --- a/source/blender/compositor/intern/COM_ChunkOrder.cc +++ b/source/blender/compositor/intern/COM_ChunkOrder.cc @@ -7,7 +7,7 @@ namespace blender::compositor { -void ChunkOrder::update_distance(ChunkOrderHotspot *hotspots, unsigned int len_hotspots) +void ChunkOrder::update_distance(ChunkOrderHotspot *hotspots, uint len_hotspots) { double new_distance = DBL_MAX; for (int index = 0; index < len_hotspots; index++) { diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index 6f2d4faffb1..9b4c46654f2 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -126,7 +126,7 @@ void ExecutionGroup::init_work_packages() work_packages_.clear(); if (chunks_len_ != 0) { work_packages_.resize(chunks_len_); - for (unsigned int index = 0; index < chunks_len_; index++) { + for (uint index = 0; index < chunks_len_; index++) { work_packages_[index].type = eWorkPackageType::Tile; work_packages_[index].state = eWorkPackageState::NotScheduled; work_packages_[index].execution_group = this; @@ -138,7 +138,7 @@ void ExecutionGroup::init_work_packages() void ExecutionGroup::init_read_buffer_operations() { - unsigned int max_offset = 0; + uint max_offset = 0; for (NodeOperation *operation : operations_) { if (operation->get_flags().is_read_buffer_operation) { ReadBufferOperation *read_operation = static_cast<ReadBufferOperation *>(operation); @@ -167,7 +167,7 @@ void ExecutionGroup::deinit_execution() bTree_ = nullptr; } -void ExecutionGroup::determine_resolution(unsigned int resolution[2]) +void ExecutionGroup::determine_resolution(uint resolution[2]) { NodeOperation *operation = this->get_output_operation(); resolution[0] = operation->get_width(); @@ -193,9 +193,9 @@ void ExecutionGroup::init_number_of_chunks() } } -blender::Array<unsigned int> ExecutionGroup::get_execution_order() const +blender::Array<uint> ExecutionGroup::get_execution_order() const { - blender::Array<unsigned int> chunk_order(chunks_len_); + blender::Array<uint> chunk_order(chunks_len_); for (int chunk_index = 0; chunk_index < chunks_len_; chunk_index++) { chunk_order[chunk_index] = chunk_index; } @@ -218,7 +218,7 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const switch (order_type) { case ChunkOrdering::Random: { static blender::RandomNumberGenerator rng; - blender::MutableSpan<unsigned int> span = chunk_order.as_mutable_span(); + blender::MutableSpan<uint> span = chunk_order.as_mutable_span(); /* Shuffle twice to make it more random. */ rng.shuffle(span); rng.shuffle(span); @@ -243,12 +243,12 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const break; } case ChunkOrdering::RuleOfThirds: { - unsigned int tx = border_width / 6; - unsigned int ty = border_height / 6; - unsigned int mx = border_width / 2; - unsigned int my = border_height / 2; - unsigned int bx = mx + 2 * tx; - unsigned int by = my + 2 * ty; + uint tx = border_width / 6; + uint ty = border_height / 6; + uint mx = border_width / 2; + uint my = border_height / 2; + uint bx = mx + 2 * tx; + uint by = my + 2 * ty; float addition = chunks_len_ / COM_RULE_OF_THIRDS_DIVIDER; ChunkOrderHotspot hotspots[9]{ @@ -300,21 +300,21 @@ void ExecutionGroup::execute(ExecutionSystem *graph) if (chunks_len_ == 0) { return; } /** \note Early break out. */ - unsigned int chunk_index; + uint chunk_index; execution_start_time_ = PIL_check_seconds_timer(); chunks_finished_ = 0; bTree_ = bTree; - blender::Array<unsigned int> chunk_order = get_execution_order(); + blender::Array<uint> chunk_order = get_execution_order(); DebugInfo::execution_group_started(this); DebugInfo::graphviz(graph); bool breaked = false; bool finished = false; - unsigned int start_index = 0; + uint start_index = 0; const int max_number_evaluated = BLI_system_thread_count() * 2; while (!finished && !breaked) { @@ -399,7 +399,7 @@ void ExecutionGroup::finalize_chunk_execution(int chunk_number, MemoryBuffer **m atomic_add_and_fetch_u(&chunks_finished_, 1); if (memory_buffers) { - for (unsigned int index = 0; index < max_read_buffer_offset_; index++) { + for (uint index = 0; index < max_read_buffer_offset_; index++) { MemoryBuffer *buffer = memory_buffers[index]; if (buffer) { if (buffer->is_temporarily()) { @@ -424,8 +424,8 @@ void ExecutionGroup::finalize_chunk_execution(int chunk_number, MemoryBuffer **m } inline void ExecutionGroup::determine_chunk_rect(rcti *r_rect, - const unsigned int x_chunk, - const unsigned int y_chunk) const + const uint x_chunk, + const uint y_chunk) const { const int border_width = BLI_rcti_size_x(&viewer_border_); const int border_height = BLI_rcti_size_y(&viewer_border_); @@ -434,10 +434,10 @@ inline void ExecutionGroup::determine_chunk_rect(rcti *r_rect, BLI_rcti_init(r_rect, viewer_border_.xmin, border_width, viewer_border_.ymin, border_height); } else { - const unsigned int minx = x_chunk * chunk_size_ + viewer_border_.xmin; - const unsigned int miny = y_chunk * chunk_size_ + viewer_border_.ymin; - const unsigned int width = MIN2((unsigned int)viewer_border_.xmax, width_); - const unsigned int height = MIN2((unsigned int)viewer_border_.ymax, height_); + const uint minx = x_chunk * chunk_size_ + viewer_border_.xmin; + const uint miny = y_chunk * chunk_size_ + viewer_border_.ymin; + const uint width = MIN2((uint)viewer_border_.xmax, width_); + const uint height = MIN2((uint)viewer_border_.ymax, height_); BLI_rcti_init(r_rect, MIN2(minx, width_), MIN2(minx + chunk_size_, width), @@ -446,10 +446,10 @@ inline void ExecutionGroup::determine_chunk_rect(rcti *r_rect, } } -void ExecutionGroup::determine_chunk_rect(rcti *r_rect, const unsigned int chunk_number) const +void ExecutionGroup::determine_chunk_rect(rcti *r_rect, const uint chunk_number) const { - const unsigned int y_chunk = chunk_number / x_chunks_len_; - const unsigned int x_chunk = chunk_number - (y_chunk * x_chunks_len_); + const uint y_chunk = chunk_number / x_chunks_len_; + const uint x_chunk = chunk_number - (y_chunk * x_chunks_len_); determine_chunk_rect(r_rect, x_chunk, y_chunk); } @@ -501,7 +501,7 @@ bool ExecutionGroup::schedule_area_when_possible(ExecutionSystem *graph, rcti *a return result; } -bool ExecutionGroup::schedule_chunk(unsigned int chunk_number) +bool ExecutionGroup::schedule_chunk(uint chunk_number) { WorkPackage &work_package = work_packages_[chunk_number]; if (work_package.state == eWorkPackageState::NotScheduled) { diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index ea2a85e8ea9..95bb233ff6c 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -133,8 +133,8 @@ MemoryBuffer *MemoryBuffer::inflate() const float MemoryBuffer::get_max_value() const { float result = buffer_[0]; - const unsigned int size = this->buffer_len(); - unsigned int i; + const uint size = this->buffer_len(); + uint i; const float *fp_src = buffer_; diff --git a/source/blender/compositor/intern/COM_MemoryProxy.cc b/source/blender/compositor/intern/COM_MemoryProxy.cc index 42d0f86843d..723e8b3ab9b 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.cc +++ b/source/blender/compositor/intern/COM_MemoryProxy.cc @@ -14,7 +14,7 @@ MemoryProxy::MemoryProxy(DataType datatype) datatype_ = datatype; } -void MemoryProxy::allocate(unsigned int width, unsigned int height) +void MemoryProxy::allocate(uint width, uint height) { rcti result; result.xmin = 0; diff --git a/source/blender/compositor/intern/COM_Node.cc b/source/blender/compositor/intern/COM_Node.cc index a71c7868518..471bb29d263 100644 --- a/source/blender/compositor/intern/COM_Node.cc +++ b/source/blender/compositor/intern/COM_Node.cc @@ -81,12 +81,12 @@ void Node::add_output_socket(DataType datatype, bNodeSocket *bSocket) outputs_.append(socket); } -NodeOutput *Node::get_output_socket(unsigned int index) const +NodeOutput *Node::get_output_socket(uint index) const { return outputs_[index]; } -NodeInput *Node::get_input_socket(unsigned int index) const +NodeInput *Node::get_input_socket(uint index) const { return inputs_[index]; } diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc index 3867b1d5c10..ab9b5ad1ad6 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cc +++ b/source/blender/compositor/intern/COM_NodeOperation.cc @@ -84,12 +84,12 @@ std::optional<NodeOperationHash> NodeOperation::generate_hash() return hash; } -NodeOperationOutput *NodeOperation::get_output_socket(unsigned int index) +NodeOperationOutput *NodeOperation::get_output_socket(uint index) { return &outputs_[index]; } -NodeOperationInput *NodeOperation::get_input_socket(unsigned int index) +NodeOperationInput *NodeOperation::get_input_socket(uint index) { return &inputs_[index]; } @@ -106,7 +106,7 @@ void NodeOperation::add_output_socket(DataType datatype) void NodeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { - unsigned int used_canvas_index = 0; + uint used_canvas_index = 0; if (canvas_input_index_ == RESOLUTION_INPUT_ANY) { for (NodeOperationInput &input : inputs_) { rcti any_area = COM_AREA_NONE; @@ -130,7 +130,7 @@ void NodeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) rcti unused_area = COM_AREA_NONE; const rcti &local_preferred_area = r_area; - for (unsigned int index = 0; index < inputs_.size(); index++) { + for (uint index = 0; index < inputs_.size(); index++) { if (index == used_canvas_index) { continue; } @@ -141,7 +141,7 @@ void NodeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) } } -void NodeOperation::set_canvas_input_index(unsigned int index) +void NodeOperation::set_canvas_input_index(uint index) { this->canvas_input_index_ = index; } @@ -197,7 +197,7 @@ void NodeOperation::unset_canvas() flags_.is_canvas_set = false; } -SocketReader *NodeOperation::get_input_socket_reader(unsigned int index) +SocketReader *NodeOperation::get_input_socket_reader(uint index) { return this->get_input_socket(index)->get_reader(); } diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cc b/source/blender/compositor/intern/COM_OpenCLDevice.cc index d951ebef172..5d5751944b2 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cc +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cc @@ -56,7 +56,7 @@ OpenCLDevice::~OpenCLDevice() void OpenCLDevice::execute(WorkPackage *work_package) { - const unsigned int chunk_number = work_package->chunk_number; + const uint chunk_number = work_package->chunk_number; ExecutionGroup *execution_group = work_package->execution_group; MemoryBuffer **input_buffers = execution_group->get_input_buffers_opencl(chunk_number); diff --git a/source/blender/compositor/intern/COM_TiledExecutionModel.cc b/source/blender/compositor/intern/COM_TiledExecutionModel.cc index cf8d3e9a084..54e8e8f315a 100644 --- a/source/blender/compositor/intern/COM_TiledExecutionModel.cc +++ b/source/blender/compositor/intern/COM_TiledExecutionModel.cc @@ -23,7 +23,7 @@ TiledExecutionModel::TiledExecutionModel(CompositorContext &context, const bNodeTree *node_tree = context.get_bnodetree(); node_tree->stats_draw(node_tree->sdh, TIP_("Compositing | Determining resolution")); - unsigned int resolution[2]; + uint resolution[2]; for (ExecutionGroup *group : groups_) { resolution[0] = 0; resolution[1] = 0; @@ -45,7 +45,7 @@ TiledExecutionModel::TiledExecutionModel(CompositorContext &context, static void update_read_buffer_offset(Span<NodeOperation *> operations) { - unsigned int order = 0; + uint order = 0; for (NodeOperation *operation : operations) { if (operation->get_flags().is_read_buffer_operation) { ReadBufferOperation *read_operation = (ReadBufferOperation *)operation; diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cc b/source/blender/compositor/intern/COM_WorkScheduler.cc index 1f93a3d9bfa..9414d7d7afa 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cc +++ b/source/blender/compositor/intern/COM_WorkScheduler.cc @@ -185,7 +185,7 @@ static void opencl_initialize(const bool use_opencl) cl_platform_id *platforms = (cl_platform_id *)MEM_mallocN( sizeof(cl_platform_id) * number_of_platforms, __func__); error = clGetPlatformIDs(number_of_platforms, platforms, nullptr); - unsigned int index_platform; + uint index_platform; for (index_platform = 0; index_platform < number_of_platforms; index_platform++) { cl_platform_id platform = platforms[index_platform]; cl_uint number_of_devices = 0; @@ -240,7 +240,7 @@ static void opencl_initialize(const bool use_opencl) MEM_freeN(build_log); } else { - unsigned int index_devices; + uint index_devices; for (index_devices = 0; index_devices < number_of_devices; index_devices++) { cl_device_id device = cldevices[index_devices]; cl_int vendorID = 0; diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cc b/source/blender/compositor/operations/COM_AntiAliasOperation.cc index 0c297c20eef..de01d0c8bf7 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cc +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cc @@ -144,12 +144,12 @@ void AntiAliasOperation::execute_pixel(float output[4], int x, int y, void *data /* Some rounding magic to so make weighting correct with the * original coefficients. */ - unsigned char result = ((3 * ninepix[0] + 5 * ninepix[1] + 3 * ninepix[2] + 5 * ninepix[3] + - 6 * ninepix[4] + 5 * ninepix[5] + 3 * ninepix[6] + 5 * ninepix[7] + - 3 * ninepix[8]) * - 255.0f + - 19.0f) / - 38.0f; + uchar result = ((3 * ninepix[0] + 5 * ninepix[1] + 3 * ninepix[2] + 5 * ninepix[3] + + 6 * ninepix[4] + 5 * ninepix[5] + 3 * ninepix[6] + 5 * ninepix[7] + + 3 * ninepix[8]) * + 255.0f + + 19.0f) / + 38.0f; output[0] = result / 255.0f; } else { @@ -234,12 +234,12 @@ void AntiAliasOperation::update_memory_buffer_partial(MemoryBuffer *output, &row_next[x_offset + input->elem_stride])) { /* Some rounding magic to make weighting correct with the * original coefficients. */ - unsigned char result = ((3 * ninepix[0] + 5 * ninepix[1] + 3 * ninepix[2] + - 5 * ninepix[3] + 6 * ninepix[4] + 5 * ninepix[5] + - 3 * ninepix[6] + 5 * ninepix[7] + 3 * ninepix[8]) * - 255.0f + - 19.0f) / - 38.0f; + uchar result = ((3 * ninepix[0] + 5 * ninepix[1] + 3 * ninepix[2] + 5 * ninepix[3] + + 6 * ninepix[4] + 5 * ninepix[5] + 3 * ninepix[6] + 5 * ninepix[7] + + 3 * ninepix[8]) * + 255.0f + + 19.0f) / + 38.0f; out[0] = result / 255.0f; } else { diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cc b/source/blender/compositor/operations/COM_CompositorOperation.cc index c0cc3fa1ba4..039a2538427 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cc +++ b/source/blender/compositor/operations/COM_CompositorOperation.cc @@ -113,7 +113,7 @@ void CompositorOperation::deinit_execution() depth_input_ = nullptr; } -void CompositorOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) +void CompositorOperation::execute_region(rcti *rect, uint /*tile_number*/) { float color[8]; /* 7 is enough. */ float *buffer = output_buffer_; diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc index fed11d59b50..863171f105e 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc @@ -8,18 +8,13 @@ namespace blender::compositor { /* This part has been copied from the double edge mask. */ -static void do_adjacentKeepBorders(unsigned int t, - unsigned int rw, - const unsigned int *limask, - const unsigned int *lomask, - unsigned int *lres, - float *res, - unsigned int *rsize) +static void do_adjacentKeepBorders( + uint t, uint rw, const uint *limask, const uint *lomask, uint *lres, float *res, uint *rsize) { int x; - unsigned int isz = 0; /* Inner edge size. */ - unsigned int osz = 0; /* Outer edge size. */ - unsigned int gsz = 0; /* Gradient fill area size. */ + uint isz = 0; /* Inner edge size. */ + uint osz = 0; /* Outer edge size. */ + uint gsz = 0; /* Gradient fill area size. */ /* Test the four corners */ /* Upper left corner. */ x = t - rw + 1; @@ -178,18 +173,13 @@ static void do_adjacentKeepBorders(unsigned int t, rsize[2] = gsz; } -static void do_adjacentBleedBorders(unsigned int t, - unsigned int rw, - const unsigned int *limask, - const unsigned int *lomask, - unsigned int *lres, - float *res, - unsigned int *rsize) +static void do_adjacentBleedBorders( + uint t, uint rw, const uint *limask, const uint *lomask, uint *lres, float *res, uint *rsize) { int x; - unsigned int isz = 0; /* Inner edge size. */ - unsigned int osz = 0; /* Outer edge size. */ - unsigned int gsz = 0; /* Gradient fill area size. */ + uint isz = 0; /* Inner edge size. */ + uint osz = 0; /* Outer edge size. */ + uint gsz = 0; /* Gradient fill area size. */ /* Test the four corners */ /* Upper left corner. */ x = t - rw + 1; @@ -403,18 +393,13 @@ static void do_adjacentBleedBorders(unsigned int t, rsize[2] = gsz; } -static void do_allKeepBorders(unsigned int t, - unsigned int rw, - const unsigned int *limask, - const unsigned int *lomask, - unsigned int *lres, - float *res, - unsigned int *rsize) +static void do_allKeepBorders( + uint t, uint rw, const uint *limask, const uint *lomask, uint *lres, float *res, uint *rsize) { int x; - unsigned int isz = 0; /* Inner edge size. */ - unsigned int osz = 0; /* Outer edge size. */ - unsigned int gsz = 0; /* Gradient fill area size. */ + uint isz = 0; /* Inner edge size. */ + uint osz = 0; /* Outer edge size. */ + uint gsz = 0; /* Gradient fill area size. */ /* Test the four corners. */ /* Upper left corner. */ x = t - rw + 1; @@ -565,18 +550,13 @@ static void do_allKeepBorders(unsigned int t, rsize[2] = gsz; } -static void do_allBleedBorders(unsigned int t, - unsigned int rw, - const unsigned int *limask, - const unsigned int *lomask, - unsigned int *lres, - float *res, - unsigned int *rsize) +static void do_allBleedBorders( + uint t, uint rw, const uint *limask, const uint *lomask, uint *lres, float *res, uint *rsize) { int x; - unsigned int isz = 0; /* Inner edge size. */ - unsigned int osz = 0; /* Outer edge size. */ - unsigned int gsz = 0; /* Gradient fill area size. */ + uint isz = 0; /* Inner edge size. */ + uint osz = 0; /* Outer edge size. */ + uint gsz = 0; /* Gradient fill area size. */ /* Test the four corners */ /* Upper left corner. */ x = t - rw + 1; @@ -782,16 +762,16 @@ static void do_allBleedBorders(unsigned int t, rsize[2] = gsz; } -static void do_allEdgeDetection(unsigned int t, - unsigned int rw, - const unsigned int *limask, - const unsigned int *lomask, - unsigned int *lres, +static void do_allEdgeDetection(uint t, + uint rw, + const uint *limask, + const uint *lomask, + uint *lres, float *res, - unsigned int *rsize, - unsigned int in_isz, - unsigned int in_osz, - unsigned int in_gsz) + uint *rsize, + uint in_isz, + uint in_osz, + uint in_gsz) { int x; /* Pixel loop counter. */ int a; /* Pixel loop counter. */ @@ -853,16 +833,16 @@ static void do_allEdgeDetection(unsigned int t, rsize[2] = in_gsz; } -static void do_adjacentEdgeDetection(unsigned int t, - unsigned int rw, - const unsigned int *limask, - const unsigned int *lomask, - unsigned int *lres, +static void do_adjacentEdgeDetection(uint t, + uint rw, + const uint *limask, + const uint *lomask, + uint *lres, float *res, - unsigned int *rsize, - unsigned int in_isz, - unsigned int in_osz, - unsigned int in_gsz) + uint *rsize, + uint in_isz, + uint in_osz, + uint in_gsz) { int x; /* Pixel loop counter. */ int a; /* Pixel loop counter. */ @@ -925,30 +905,30 @@ static void do_adjacentEdgeDetection(unsigned int t, rsize[2] = in_gsz; } -static void do_createEdgeLocationBuffer(unsigned int t, - unsigned int rw, - const unsigned int *lres, +static void do_createEdgeLocationBuffer(uint t, + uint rw, + const uint *lres, float *res, - unsigned short *gbuf, - unsigned int *inner_edge_offset, - unsigned int *outer_edge_offset, - unsigned int isz, - unsigned int gsz) + ushort *gbuf, + uint *inner_edge_offset, + uint *outer_edge_offset, + uint isz, + uint gsz) { - int x; /* Pixel loop counter. */ - int a; /* Temporary pixel index buffer loop counter. */ - unsigned int ud; /* Unscaled edge distance. */ - unsigned int dmin; /* Minimum edge distance. */ + int x; /* Pixel loop counter. */ + int a; /* Temporary pixel index buffer loop counter. */ + uint ud; /* Unscaled edge distance. */ + uint dmin; /* Minimum edge distance. */ - unsigned int rsl; /* Long used for finding fast `1.0/sqrt`. */ - unsigned int gradient_fill_offset; + uint rsl; /* Long used for finding fast `1.0/sqrt`. */ + uint gradient_fill_offset; /* For looping inner edge pixel indexes, represents current position from offset. */ - unsigned int inner_accum = 0; + uint inner_accum = 0; /* For looping outer edge pixel indexes, represents current position from offset. */ - unsigned int outer_accum = 0; + uint outer_accum = 0; /* For looping gradient pixel indexes, represents current position from offset. */ - unsigned int gradient_accum = 0; + uint gradient_accum = 0; /* Disable clang-format to prevent line-wrapping. */ /* clang-format off */ @@ -958,12 +938,12 @@ static void do_createEdgeLocationBuffer(unsigned int t, * or outer edge. * * Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even - * though gbuf[] is declared as (unsigned short *) (2 bytes) because we don't + * though gbuf[] is declared as `(ushort *)` (2 bytes) because we don't * store the pixel indexes, we only store x,y location of pixel in buffer. * * This does make the assumption that x and y can fit in 16 unsigned bits * so if Blender starts doing renders greater than 65536 in either direction - * this will need to allocate gbuf[] as unsigned int *and allocate 8 bytes + * this will need to allocate gbuf[] as uint *and allocate 8 bytes * per flagged pixel. * * In general, the buffer on-screen: @@ -1028,20 +1008,20 @@ static void do_createEdgeLocationBuffer(unsigned int t, for (rsl = 0; rsl < rw; rsl++) { a = x + rsl; if (lres[a] == 2) { /* It is a gradient pixel flagged by 2. */ - ud = gradient_accum << 1; /* Double the index to reach correct unsigned short location. */ + ud = gradient_accum << 1; /* Double the index to reach correct ushort location. */ gbuf[ud] = dmin; /* Insert pixel's row into gradient pixel location buffer. */ gbuf[ud + 1] = rsl; /* Insert pixel's column into gradient pixel location buffer. */ gradient_accum++; /* Increment gradient index buffer pointer. */ } else if (lres[a] == 3) { /* It is an outer edge pixel flagged by 3. */ - ud = outer_accum << 1; /* Double the index to reach correct unsigned short location. */ + ud = outer_accum << 1; /* Double the index to reach correct ushort location. */ gbuf[ud] = dmin; /* Insert pixel's row into outer edge pixel location buffer. */ gbuf[ud + 1] = rsl; /* Insert pixel's column into outer edge pixel location buffer. */ outer_accum++; /* Increment outer edge index buffer pointer. */ res[a] = 0.0f; /* Set output pixel intensity now since it won't change later. */ } else if (lres[a] == 4) { /* It is an inner edge pixel flagged by 4. */ - ud = inner_accum << 1; /* Double int index to reach correct unsigned short location. */ + ud = inner_accum << 1; /* Double int index to reach correct ushort location. */ gbuf[ud] = dmin; /* Insert pixel's row into inner edge pixel location buffer. */ gbuf[ud + 1] = rsl; /* Insert pixel's column into inner edge pixel location buffer. */ inner_accum++; /* Increment inner edge index buffer pointer. */ @@ -1051,30 +1031,30 @@ static void do_createEdgeLocationBuffer(unsigned int t, } } -static void do_fillGradientBuffer(unsigned int rw, +static void do_fillGradientBuffer(uint rw, float *res, - const unsigned short *gbuf, - unsigned int isz, - unsigned int osz, - unsigned int gsz, - unsigned int inner_edge_offset, - unsigned int outer_edge_offset) + const ushort *gbuf, + uint isz, + uint osz, + uint gsz, + uint inner_edge_offset, + uint outer_edge_offset) { int x; /* Pixel loop counter. */ int a; /* Temporary pixel index buffer loop counter. */ int fsz; /* Size of the frame. */ - unsigned int rsl; /* Long used for finding fast `1.0/sqrt`. */ + uint rsl; /* Long used for finding fast `1.0/sqrt`. */ float rsf; /* Float used for finding fast `1.0/sqrt`. */ const float rsopf = 1.5f; /* Constant float used for finding fast `1.0/sqrt`. */ - unsigned int gradient_fill_offset; - unsigned int t; - unsigned int ud; /* Unscaled edge distance. */ - unsigned int dmin; /* Minimum edge distance. */ - float odist; /* Current outer edge distance. */ - float idist; /* Current inner edge distance. */ - int dx; /* X-delta (used for distance proportion calculation) */ - int dy; /* Y-delta (used for distance proportion calculation) */ + uint gradient_fill_offset; + uint t; + uint ud; /* Unscaled edge distance. */ + uint dmin; /* Minimum edge distance. */ + float odist; /* Current outer edge distance. */ + float idist; /* Current inner edge distance. */ + int dx; /* X-delta (used for distance proportion calculation) */ + int dy; /* Y-delta (used for distance proportion calculation) */ /* * The general algorithm used to color each gradient pixel is: @@ -1152,8 +1132,8 @@ static void do_fillGradientBuffer(unsigned int rw, } odist = (float)(dmin); /* Cast outer min to a float. */ rsf = odist * 0.5f; - rsl = *(unsigned int *)&odist; /* Use some peculiar properties of the way bits are stored. */ - rsl = 0x5f3759df - (rsl >> 1); /* In floats vs. unsigned ints to compute an approximate. */ + rsl = *(uint *)&odist; /* Use some peculiar properties of the way bits are stored. */ + rsl = 0x5f3759df - (rsl >> 1); /* In floats vs. uints to compute an approximate. */ odist = *(float *)&rsl; /* Reciprocal square root. */ odist = odist * (rsopf - (rsf * odist * odist)); /* -- This line can be iterated for more accuracy. -- */ @@ -1173,7 +1153,7 @@ static void do_fillGradientBuffer(unsigned int rw, /* Cast inner min to a float. */ idist = (float)(dmin); rsf = idist * 0.5f; - rsl = *(unsigned int *)&idist; + rsl = *(uint *)&idist; /* See notes above. */ rsl = 0x5f3759df - (rsl >> 1); @@ -1195,24 +1175,22 @@ static void do_fillGradientBuffer(unsigned int rw, void DoubleEdgeMaskOperation::do_double_edge_mask(float *imask, float *omask, float *res) { - unsigned int *lres; /* Pointer to output pixel buffer (for bit operations). */ - unsigned int *limask; /* Pointer to inner mask (for bit operations). */ - unsigned int *lomask; /* Pointer to outer mask (for bit operations). */ + uint *lres; /* Pointer to output pixel buffer (for bit operations). */ + uint *limask; /* Pointer to inner mask (for bit operations). */ + uint *lomask; /* Pointer to outer mask (for bit operations). */ int rw; /* Pixel row width. */ int t; /* Total number of pixels in buffer - 1 (used for loop starts). */ int fsz; /* Size of the frame. */ - unsigned int isz = 0; /* Size (in pixels) of inside edge pixel index buffer. */ - unsigned int osz = 0; /* Size (in pixels) of outside edge pixel index buffer. */ - unsigned int gsz = 0; /* Size (in pixels) of gradient pixel index buffer. */ - unsigned int rsize[3]; /* Size storage to pass to helper functions. */ - unsigned int inner_edge_offset = - 0; /* Offset into final buffer where inner edge pixel indexes start. */ - unsigned int outer_edge_offset = - 0; /* Offset into final buffer where outer edge pixel indexes start. */ + uint isz = 0; /* Size (in pixels) of inside edge pixel index buffer. */ + uint osz = 0; /* Size (in pixels) of outside edge pixel index buffer. */ + uint gsz = 0; /* Size (in pixels) of gradient pixel index buffer. */ + uint rsize[3]; /* Size storage to pass to helper functions. */ + uint inner_edge_offset = 0; /* Offset into final buffer where inner edge pixel indexes start. */ + uint outer_edge_offset = 0; /* Offset into final buffer where outer edge pixel indexes start. */ - unsigned short *gbuf; /* Gradient/inner/outer pixel location index buffer. */ + ushort *gbuf; /* Gradient/inner/outer pixel location index buffer. */ if (true) { /* If both input sockets have some data coming in... */ @@ -1223,9 +1201,9 @@ void DoubleEdgeMaskOperation::do_double_edge_mask(float *imask, float *omask, fl sizeof(float) * (t + 1)); /* Clear output buffer (not all pixels will be written later). */ - lres = (unsigned int *)res; /* Pointer to output buffer (for bit level ops).. */ - limask = (unsigned int *)imask; /* Pointer to input mask (for bit level ops).. */ - lomask = (unsigned int *)omask; /* Pointer to output mask (for bit level ops).. */ + lres = (uint *)res; /* Pointer to output buffer (for bit level ops).. */ + limask = (uint *)imask; /* Pointer to input mask (for bit level ops).. */ + lomask = (uint *)omask; /* Pointer to output mask (for bit level ops).. */ /* * The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the @@ -1291,7 +1269,7 @@ void DoubleEdgeMaskOperation::do_double_edge_mask(float *imask, float *omask, fl /* Calculate size of pixel index buffer needed. */ fsz = gsz + isz + osz; /* Allocate edge/gradient pixel index buffer. */ - gbuf = (unsigned short *)MEM_callocN(sizeof(unsigned short) * fsz * 2, "DEM"); + gbuf = (ushort *)MEM_callocN(sizeof(ushort) * fsz * 2, "DEM"); do_createEdgeLocationBuffer( t, rw, lres, res, gbuf, &inner_edge_offset, &outer_edge_offset, isz, gsz); diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc index 725751d15af..1d38e4e60a9 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc @@ -102,18 +102,15 @@ void *FastGaussianBlurOperation::initialize_tile_data(rcti *rect) return iirgaus_; } -void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, - float sigma, - unsigned int chan, - unsigned int xy) +void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, uint chan, uint xy) { BLI_assert(!src->is_a_single_elem()); double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3]; double *X, *Y, *W; - const unsigned int src_width = src->get_width(); - const unsigned int src_height = src->get_height(); - unsigned int x, y, src_dim_max; - unsigned int i; + const uint src_width = src->get_width(); + const uint src_height = src->get_height(); + uint x, y, src_dim_max; + uint i; float *buffer = src->get_buffer(); const uint8_t num_channels = src->get_num_channels(); diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc index ade3f11a8b3..5c4d470bc35 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc @@ -12,9 +12,9 @@ namespace blender::compositor { using fREAL = float; /* Returns next highest power of 2 of x, as well its log2 in L2. */ -static unsigned int next_pow2(unsigned int x, unsigned int *L2) +static uint next_pow2(uint x, uint *L2) { - unsigned int pw, x_notpow2 = x & (x - 1); + uint pw, x_notpow2 = x & (x - 1); *L2 = 0; while (x >>= 1) { ++(*L2); @@ -31,7 +31,7 @@ static unsigned int next_pow2(unsigned int x, unsigned int *L2) /* From FXT library by Joerg Arndt, faster in order bit-reversal * use: `r = revbin_upd(r, h)` where `h = N>>1`. */ -static unsigned int revbin_upd(unsigned int r, unsigned int h) +static uint revbin_upd(uint r, uint h) { while (!((r ^= h) & h)) { h >>= 1; @@ -39,14 +39,14 @@ static unsigned int revbin_upd(unsigned int r, unsigned int h) return r; } //------------------------------------------------------------------------------ -static void FHT(fREAL *data, unsigned int M, unsigned int inverse) +static void FHT(fREAL *data, uint M, uint inverse) { double tt, fc, dc, fs, ds, a = M_PI; fREAL t1, t2; int n2, bd, bl, istep, k, len = 1 << M, n = 1; int i, j = 0; - unsigned int Nh = len >> 1; + uint Nh = len >> 1; for (i = 1; i < (len - 1); i++) { j = revbin_upd(j, Nh); if (j > i) { @@ -112,10 +112,9 @@ static void FHT(fREAL *data, unsigned int M, unsigned int inverse) /* 2D Fast Hartley Transform, Mx/My -> log2 of width/height, * nzp -> the row where zero pad data starts, * inverse -> see above. */ -static void FHT2D( - fREAL *data, unsigned int Mx, unsigned int My, unsigned int nzp, unsigned int inverse) +static void FHT2D(fREAL *data, uint Mx, uint My, uint nzp, uint inverse) { - unsigned int i, j, Nx, Ny, maxy; + uint i, j, Nx, Ny, maxy; Nx = 1 << Mx; Ny = 1 << My; @@ -130,13 +129,13 @@ static void FHT2D( if (Nx == Ny) { /* Square. */ for (j = 0; j < Ny; j++) { for (i = j + 1; i < Nx; i++) { - unsigned int op = i + (j << Mx), np = j + (i << My); + uint op = i + (j << Mx), np = j + (i << My); SWAP(fREAL, data[op], data[np]); } } } else { /* Rectangular. */ - unsigned int k, Nym = Ny - 1, stm = 1 << (Mx + My); + uint k, Nym = Ny - 1, stm = 1 << (Mx + My); for (i = 0; stm > 0; i++) { #define PRED(k) (((k & Nym) << Mx) + (k >> My)) for (j = PRED(i); j > i; j = PRED(j)) { @@ -153,8 +152,8 @@ static void FHT2D( } } - SWAP(unsigned int, Nx, Ny); - SWAP(unsigned int, Mx, My); + SWAP(uint, Nx, Ny); + SWAP(uint, Mx, My); /* Now columns == transposed rows. */ for (j = 0; j < Ny; j++) { @@ -163,11 +162,11 @@ static void FHT2D( /* Finalize. */ for (j = 0; j <= (Ny >> 1); j++) { - unsigned int jm = (Ny - j) & (Ny - 1); - unsigned int ji = j << Mx; - unsigned int jmi = jm << Mx; + uint jm = (Ny - j) & (Ny - 1); + uint ji = j << Mx; + uint jmi = jm << Mx; for (i = 0; i <= (Nx >> 1); i++) { - unsigned int im = (Nx - i) & (Nx - 1); + uint im = (Nx - i) & (Nx - 1); fREAL A = data[ji + i]; fREAL B = data[jmi + i]; fREAL C = data[ji + im]; @@ -184,13 +183,13 @@ static void FHT2D( //------------------------------------------------------------------------------ /* 2D convolution calc, d1 *= d2, M/N - > log2 of width/height. */ -static void fht_convolve(fREAL *d1, const fREAL *d2, unsigned int M, unsigned int N) +static void fht_convolve(fREAL *d1, const fREAL *d2, uint M, uint N) { fREAL a, b; - unsigned int i, j, k, L, mj, mL; - unsigned int m = 1 << M, n = 1 << N; - unsigned int m2 = 1 << (M - 1), n2 = 1 << (N - 1); - unsigned int mn2 = m << (N - 1); + uint i, j, k, L, mj, mL; + uint m = 1 << M, n = 1 << N; + uint m2 = 1 << (M - 1), n2 = 1 << (N - 1); + uint mn2 = m << (N - 1); d1[0] *= d2[0]; d1[mn2] *= d2[mn2]; @@ -242,15 +241,15 @@ static void fht_convolve(fREAL *d1, const fREAL *d2, unsigned int M, unsigned in static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) { fREAL *data1, *data2, *fp; - unsigned int w2, h2, hw, hh, log2_w, log2_h; + uint w2, h2, hw, hh, log2_w, log2_h; fRGB wt, *colp; int x, y, ch; int xbl, ybl, nxb, nyb, xbsz, ybsz; bool in2done = false; - const unsigned int kernel_width = in2->get_width(); - const unsigned int kernel_height = in2->get_height(); - const unsigned int image_width = in1->get_width(); - const unsigned int image_height = in1->get_height(); + const uint kernel_width = in2->get_width(); + const uint kernel_height = in2->get_height(); + const uint image_width = in1->get_width(); + const uint image_height = in1->get_height(); float *kernel_buffer = in2->get_buffer(); float *image_buffer = in1->get_buffer(); @@ -397,7 +396,7 @@ void GlareFogGlowOperation::generate_glare(float *data, float scale, u, v, r, w, d; fRGB fcol; MemoryBuffer *ckrn; - unsigned int sz = 1 << settings->size; + uint sz = 1 << settings->size; const float cs_r = 1.0f, cs_g = 1.0f, cs_b = 1.0f; /* Temp. src image diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc index e4f06eb0e50..8c303ab6332 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc @@ -10,7 +10,7 @@ void GlareStreaksOperation::generate_glare(float *data, const NodeGlare *settings) { int x, y, n; - unsigned int nump = 0; + uint nump = 0; float c1[4], c2[4], c3[4], c4[4]; float a, ang = DEG2RADF(360.0f) / (float)settings->streaks; diff --git a/source/blender/compositor/operations/COM_ImageOperation.cc b/source/blender/compositor/operations/COM_ImageOperation.cc index a9ab414670f..0d0b699eefc 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cc +++ b/source/blender/compositor/operations/COM_ImageOperation.cc @@ -120,7 +120,7 @@ static void sample_image_at_location( } } else { - unsigned char byte_color[4]; + uchar byte_color[4]; switch (sampler) { case PixelSampler::Nearest: nearest_interpolation_color(ibuf, byte_color, nullptr, x, y); diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc index 0db9b7e6a04..c037a1e0330 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc @@ -150,7 +150,7 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::build_voronoi_t add_v3_v3(site->color, &pattern_ibuf->rect_float[4 * j]); } else { - unsigned char *rrgb = (unsigned char *)pattern_ibuf->rect; + uchar *rrgb = (uchar *)pattern_ibuf->rect; site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f); site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f); diff --git a/source/blender/compositor/operations/COM_MaskOperation.cc b/source/blender/compositor/operations/COM_MaskOperation.cc index 29d0c0c2b9c..5517306f1af 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cc +++ b/source/blender/compositor/operations/COM_MaskOperation.cc @@ -52,7 +52,7 @@ void MaskOperation::init_execution() } } - for (unsigned int i = 0; i < raster_mask_handle_tot_; i++) { + for (uint i = 0; i < raster_mask_handle_tot_; i++) { raster_mask_handles_[i] = BKE_maskrasterize_handle_new(); /* re-eval frame info */ @@ -76,7 +76,7 @@ void MaskOperation::init_execution() void MaskOperation::deinit_execution() { - for (unsigned int i = 0; i < raster_mask_handle_tot_; i++) { + for (uint i = 0; i < raster_mask_handle_tot_; i++) { if (raster_mask_handles_[i]) { BKE_maskrasterize_handle_free(raster_mask_handles_[i]); raster_mask_handles_[i] = nullptr; @@ -118,7 +118,7 @@ void MaskOperation::execute_pixel_sampled(float output[4], /* In case loop below fails. */ output[0] = 0.0f; - for (unsigned int i = 0; i < raster_mask_handle_tot_; i++) { + for (uint i = 0; i < raster_mask_handle_tot_; i++) { if (raster_mask_handles_[i]) { output[0] += BKE_maskrasterize_handle_sample(raster_mask_handles_[i], xy); } diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc index 11f80c16c2f..fec7c1972f3 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc @@ -93,8 +93,7 @@ void MultilayerColorOperation::execute_pixel_sampled(float output[4], else { int yi = y; int xi = x; - if (xi < 0 || yi < 0 || (unsigned int)xi >= this->get_width() || - (unsigned int)yi >= this->get_height()) { + if (xi < 0 || yi < 0 || (uint)xi >= this->get_width() || (uint)yi >= this->get_height()) { zero_v4(output); } else { @@ -116,8 +115,7 @@ void MultilayerValueOperation::execute_pixel_sampled(float output[4], else { int yi = y; int xi = x; - if (xi < 0 || yi < 0 || (unsigned int)xi >= this->get_width() || - (unsigned int)yi >= this->get_height()) { + if (xi < 0 || yi < 0 || (uint)xi >= this->get_width() || (uint)yi >= this->get_height()) { output[0] = 0.0f; } else { @@ -138,8 +136,7 @@ void MultilayerVectorOperation::execute_pixel_sampled(float output[4], else { int yi = y; int xi = x; - if (xi < 0 || yi < 0 || (unsigned int)xi >= this->get_width() || - (unsigned int)yi >= this->get_height()) { + if (xi < 0 || yi < 0 || (uint)xi >= this->get_width() || (uint)yi >= this->get_height()) { output[0] = 0.0f; } else { diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc index 760ed94f882..7650746e3ed 100644 --- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc +++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc @@ -74,8 +74,8 @@ void *OutputOpenExrSingleLayerMultiViewOperation::get_handle(const char *filenam void OutputOpenExrSingleLayerMultiViewOperation::deinit_execution() { - unsigned int width = this->get_width(); - unsigned int height = this->get_height(); + uint width = this->get_width(); + uint height = this->get_height(); if (width != 0 && height != 0) { void *exrhandle; @@ -132,8 +132,8 @@ OutputOpenExrMultiLayerMultiViewOperation::OutputOpenExrMultiLayerMultiViewOpera void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename) { - unsigned int width = this->get_width(); - unsigned int height = this->get_height(); + uint width = this->get_width(); + uint height = this->get_height(); if (width != 0 && height != 0) { @@ -158,7 +158,7 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename IMB_exr_add_view(exrhandle, srv->name); - for (unsigned int i = 0; i < layers_.size(); i++) { + for (uint i = 0; i < layers_.size(); i++) { add_exr_channels(exrhandle, layers_[i].name, layers_[i].datatype, @@ -189,8 +189,8 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename void OutputOpenExrMultiLayerMultiViewOperation::deinit_execution() { - unsigned int width = this->get_width(); - unsigned int height = this->get_height(); + uint width = this->get_width(); + uint height = this->get_height(); if (width != 0 && height != 0) { void *exrhandle; @@ -207,7 +207,7 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinit_execution() exrhandle = this->get_handle(filename); - for (unsigned int i = 0; i < layers_.size(); i++) { + for (uint i = 0; i < layers_.size(); i++) { add_exr_channels(exrhandle, layers_[i].name, layers_[i].datatype, @@ -217,7 +217,7 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinit_execution() layers_[i].output_buffer); } - for (unsigned int i = 0; i < layers_.size(); i++) { + for (uint i = 0; i < layers_.size(); i++) { /* memory can only be freed after we write all views to the file */ layers_[i].output_buffer = nullptr; layers_[i].image_input = nullptr; @@ -228,7 +228,7 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinit_execution() IMB_exr_write_channels(exrhandle); /* free buffer memory for all the views */ - for (unsigned int i = 0; i < layers_.size(); i++) { + for (uint i = 0; i < layers_.size(); i++) { free_exr_channels(exrhandle, rd_, layers_[i].name, layers_[i].datatype); } @@ -284,8 +284,8 @@ void *OutputStereoOperation::get_handle(const char *filename) void OutputStereoOperation::deinit_execution() { - unsigned int width = this->get_width(); - unsigned int height = this->get_height(); + uint width = this->get_width(); + uint height = this->get_height(); if (width != 0 && height != 0) { void *exrhandle; diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cc b/source/blender/compositor/operations/COM_OutputFileOperation.cc index 1d22f3e8cd2..6c7333c007a 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cc +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cc @@ -150,7 +150,7 @@ int get_datatype_size(DataType datatype) } } -static float *init_buffer(unsigned int width, unsigned int height, DataType datatype) +static float *init_buffer(uint width, uint height, DataType datatype) { /* When initializing the tree during initial load the width and height can be zero. */ if (width != 0 && height != 0) { @@ -165,7 +165,7 @@ static void write_buffer_rect(rcti *rect, const bNodeTree *tree, SocketReader *reader, float *buffer, - unsigned int width, + uint width, DataType datatype) { float color[4]; @@ -242,7 +242,7 @@ void OutputSingleLayerOperation::init_execution() output_buffer_ = init_buffer(this->get_width(), this->get_height(), datatype_); } -void OutputSingleLayerOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) +void OutputSingleLayerOperation::execute_region(rcti *rect, uint /*tile_number*/) { write_buffer_rect(rect, tree_, image_input_, output_buffer_, this->get_width(), datatype_); } @@ -369,7 +369,7 @@ StampData *OutputOpenExrMultiLayerOperation::create_stamp_data() const void OutputOpenExrMultiLayerOperation::init_execution() { - for (unsigned int i = 0; i < layers_.size(); i++) { + for (uint i = 0; i < layers_.size(); i++) { if (layers_[i].use_layer) { SocketReader *reader = get_input_socket_reader(i); layers_[i].image_input = reader; @@ -379,9 +379,9 @@ void OutputOpenExrMultiLayerOperation::init_execution() } } -void OutputOpenExrMultiLayerOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) +void OutputOpenExrMultiLayerOperation::execute_region(rcti *rect, uint /*tile_number*/) { - for (unsigned int i = 0; i < layers_.size(); i++) { + for (uint i = 0; i < layers_.size(); i++) { OutputOpenExrLayer &layer = layers_[i]; if (layer.image_input) { write_buffer_rect( @@ -392,8 +392,8 @@ void OutputOpenExrMultiLayerOperation::execute_region(rcti *rect, unsigned int / void OutputOpenExrMultiLayerOperation::deinit_execution() { - unsigned int width = this->get_width(); - unsigned int height = this->get_height(); + uint width = this->get_width(); + uint height = this->get_height(); if (width != 0 && height != 0) { char filename[FILE_MAX]; const char *suffix; @@ -410,7 +410,7 @@ void OutputOpenExrMultiLayerOperation::deinit_execution() suffix); BLI_make_existing_file(filename); - for (unsigned int i = 0; i < layers_.size(); i++) { + for (uint i = 0; i < layers_.size(); i++) { OutputOpenExrLayer &layer = layers_[i]; if (!layer.image_input) { continue; /* skip unconnected sockets */ @@ -437,7 +437,7 @@ void OutputOpenExrMultiLayerOperation::deinit_execution() } IMB_exr_close(exrhandle); - for (unsigned int i = 0; i < layers_.size(); i++) { + for (uint i = 0; i < layers_.size(); i++) { if (layers_[i].output_buffer) { MEM_freeN(layers_[i].output_buffer); layers_[i].output_buffer = nullptr; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cc b/source/blender/compositor/operations/COM_PreviewOperation.cc index dbc544896e3..2a6d858f91c 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cc +++ b/source/blender/compositor/operations/COM_PreviewOperation.cc @@ -10,8 +10,8 @@ namespace blender::compositor { PreviewOperation::PreviewOperation(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, - const unsigned int default_width, - const unsigned int default_height) + const uint default_width, + const uint default_height) { this->add_input_socket(DataType::Color, ResizeMode::Align); @@ -39,14 +39,13 @@ void PreviewOperation::init_execution() { input_ = get_input_socket_reader(0); - if (this->get_width() == (unsigned int)preview_->xsize && - this->get_height() == (unsigned int)preview_->ysize) { + if (this->get_width() == (uint)preview_->xsize && this->get_height() == (uint)preview_->ysize) { output_buffer_ = preview_->rect; } if (output_buffer_ == nullptr) { - output_buffer_ = (unsigned char *)MEM_callocN( - sizeof(unsigned char) * 4 * get_width() * get_height(), "PreviewOperation"); + output_buffer_ = (uchar *)MEM_callocN(sizeof(uchar) * 4 * get_width() * get_height(), + "PreviewOperation"); if (preview_->rect) { MEM_freeN(preview_->rect); } @@ -62,7 +61,7 @@ void PreviewOperation::deinit_execution() input_ = nullptr; } -void PreviewOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) +void PreviewOperation::execute_region(rcti *rect, uint /*tile_number*/) { int offset; float color[4]; diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cc b/source/blender/compositor/operations/COM_RenderLayersProg.cc index 40f2187b27b..fa9efbe15be 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cc +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cc @@ -52,7 +52,7 @@ void RenderLayersProg::init_execution() void RenderLayersProg::do_interpolation(float output[4], float x, float y, PixelSampler sampler) { - unsigned int offset; + uint offset; int width = this->get_width(), height = this->get_height(); int ix = x, iy = y; @@ -328,7 +328,7 @@ void RenderLayersDepthProg::execute_pixel_sampled(float output[4], output[0] = 10e10f; } else { - unsigned int offset = (iy * this->get_width() + ix); + uint offset = (iy * this->get_width() + ix); output[0] = input_buffer[offset]; } } diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc index d4365af4860..451c76bb36a 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc @@ -510,8 +510,8 @@ void InverseSearchRadiusOperation::deinit_execution() input_radius_ = nullptr; } -void InverseSearchRadiusOperation::determine_resolution(unsigned int resolution[2], - unsigned int preferred_resolution[2]) +void InverseSearchRadiusOperation::determine_resolution(uint resolution[2], + uint preferred_resolution[2]) { NodeOperation::determine_resolution(resolution, preferred_resolution); resolution[0] = resolution[0] / DIVIDER; diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index 3bd5fa4ad14..c1874bb51db 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -60,7 +60,7 @@ void ViewerOperation::deinit_execution() output_buffer_ = nullptr; } -void ViewerOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) +void ViewerOperation::execute_region(rcti *rect, uint /*tile_number*/) { float *buffer = output_buffer_; float *depthbuffer = depth_buffer_; diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cc b/source/blender/compositor/operations/COM_WriteBufferOperation.cc index 9073c92b154..56261bfc660 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cc +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cc @@ -42,7 +42,7 @@ void WriteBufferOperation::deinit_execution() memory_proxy_->free(); } -void WriteBufferOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) +void WriteBufferOperation::execute_region(rcti *rect, uint /*tile_number*/) { MemoryBuffer *memory_buffer = memory_proxy_->get_buffer(); float *buffer = memory_buffer->get_buffer(); @@ -95,7 +95,7 @@ void WriteBufferOperation::execute_region(rcti *rect, unsigned int /*tile_number void WriteBufferOperation::execute_opencl_region(OpenCLDevice *device, rcti * /*rect*/, - unsigned int /*chunk_number*/, + uint /*chunk_number*/, MemoryBuffer **input_memory_buffers, MemoryBuffer *output_buffer) { @@ -110,8 +110,8 @@ void WriteBufferOperation::execute_opencl_region(OpenCLDevice *device, * NOTE: list of cl_mem will be filled by 2, and needs to be cleaned up by 4 */ /* STEP 1 */ - const unsigned int output_buffer_width = output_buffer->get_width(); - const unsigned int output_buffer_height = output_buffer->get_height(); + const uint output_buffer_width = output_buffer->get_width(); + const uint output_buffer_height = output_buffer->get_height(); const cl_image_format *image_format = OpenCLDevice::determine_image_format(output_buffer); diff --git a/source/blender/compositor/realtime_compositor/intern/shader_operation.cc b/source/blender/compositor/realtime_compositor/intern/shader_operation.cc index 8e52baf63ec..88efdae1872 100644 --- a/source/blender/compositor/realtime_compositor/intern/shader_operation.cc +++ b/source/blender/compositor/realtime_compositor/intern/shader_operation.cc @@ -273,7 +273,7 @@ static const char *get_store_function_name(ResultType type) void ShaderOperation::populate_operation_result(DOutputSocket output_socket, GPUMaterial *material) { - const unsigned int output_id = output_sockets_to_output_identifiers_map_.size(); + const uint output_id = output_sockets_to_output_identifiers_map_.size(); std::string output_identifier = "output" + std::to_string(output_id); const ResultType result_type = get_node_socket_result_type(output_socket.bsocket()); diff --git a/source/blender/datatoc/datatoc_icon.c b/source/blender/datatoc/datatoc_icon.c index fd892ac2f31..2a87cf62d3a 100644 --- a/source/blender/datatoc/datatoc_icon.c +++ b/source/blender/datatoc/datatoc_icon.c @@ -158,9 +158,8 @@ static bool write_png(const char *name, const uint *pixels, const int width, con /* set the individual row-pointers to point at the correct offsets */ for (i = 0; i < height; i++) { - row_pointers[height - 1 - i] = (png_bytep)(((const unsigned char *)pixels) + - (i * width) * bytesperpixel * - sizeof(unsigned char)); + row_pointers[height - 1 - i] = (png_bytep)(((const uchar *)pixels) + + (i * width) * bytesperpixel * sizeof(uchar)); } /* write out the entire image data in one call */ diff --git a/source/blender/depsgraph/intern/depsgraph_physics.cc b/source/blender/depsgraph/intern/depsgraph_physics.cc index cf5cccac580..d7d03ec3261 100644 --- a/source/blender/depsgraph/intern/depsgraph_physics.cc +++ b/source/blender/depsgraph/intern/depsgraph_physics.cc @@ -32,7 +32,7 @@ namespace deg = blender::deg; /*************************** Evaluation Query API *****************************/ -static ePhysicsRelationType modifier_to_relation_type(unsigned int modifier_type) +static ePhysicsRelationType modifier_to_relation_type(uint modifier_type) { switch (modifier_type) { case eModifierType_Collision: @@ -72,7 +72,7 @@ ListBase *DEG_get_effector_relations(const Depsgraph *graph, Collection *collect ListBase *DEG_get_collision_relations(const Depsgraph *graph, Collection *collection, - unsigned int modifier_type) + uint modifier_type) { const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph); const ePhysicsRelationType type = modifier_to_relation_type(modifier_type); @@ -91,7 +91,7 @@ ListBase *DEG_get_collision_relations(const Depsgraph *graph, void DEG_add_collision_relations(DepsNodeHandle *handle, Object *object, Collection *collection, - unsigned int modifier_type, + uint modifier_type, DEG_CollobjFilterFunction filter_function, const char *name) { @@ -178,9 +178,7 @@ ListBase *build_effector_relations(Depsgraph *graph, Collection *collection) }); } -ListBase *build_collision_relations(Depsgraph *graph, - Collection *collection, - unsigned int modifier_type) +ListBase *build_collision_relations(Depsgraph *graph, Collection *collection, uint modifier_type) { const ePhysicsRelationType type = modifier_to_relation_type(modifier_type); Map<const ID *, ListBase *> *hash = graph->physics_relations[type]; diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index cc742b98866..0c003cf23b2 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -235,7 +235,7 @@ void depsgraph_tag_to_component_opcode(const ID *id, } void id_tag_update_ntree_special( - Main *bmain, Depsgraph *graph, ID *id, unsigned int flags, eUpdateSource update_source) + Main *bmain, Depsgraph *graph, ID *id, uint flags, eUpdateSource update_source) { bNodeTree *ntree = ntreeFromID(id); if (ntree == nullptr) { @@ -418,13 +418,13 @@ string stringify_append_bit(const string &str, IDRecalcFlag tag) return result; } -string stringify_update_bitfield(unsigned int flags) +string stringify_update_bitfield(uint flags) { if (flags == 0) { return "LEGACY_0"; } string result; - unsigned int current_flag = flags; + uint current_flag = flags; /* Special cases to avoid ALL flags form being split into * individual bits. */ if ((current_flag & ID_RECALC_PSYS_ALL) == ID_RECALC_PSYS_ALL) { @@ -460,7 +460,7 @@ int deg_recalc_flags_for_legacy_zero() ID_RECALC_SOURCE | ID_RECALC_EDITORS); } -int deg_recalc_flags_effective(Depsgraph *graph, unsigned int flags) +int deg_recalc_flags_effective(Depsgraph *graph, uint flags) { if (graph != nullptr) { if (!graph->is_active) { @@ -531,7 +531,7 @@ void graph_tag_ids_for_visible_update(Depsgraph *graph) * No need bother with it to tag or anything. */ continue; } - unsigned int flags = 0; + uint flags = 0; if (!deg::deg_copy_on_write_is_expanded(id_node->id_cow)) { flags |= ID_RECALC_COPY_ON_WRITE; if (do_time) { @@ -625,7 +625,7 @@ NodeType geometry_tag_to_component(const ID *id) return NodeType::UNDEFINED; } -void id_tag_update(Main *bmain, ID *id, unsigned int flags, eUpdateSource update_source) +void id_tag_update(Main *bmain, ID *id, uint flags, eUpdateSource update_source) { graph_id_tag_update(bmain, nullptr, id, flags, update_source); for (deg::Depsgraph *depsgraph : deg::get_all_registered_graphs(bmain)) { @@ -638,7 +638,7 @@ void id_tag_update(Main *bmain, ID *id, unsigned int flags, eUpdateSource update } void graph_id_tag_update( - Main *bmain, Depsgraph *graph, ID *id, unsigned int flags, eUpdateSource update_source) + Main *bmain, Depsgraph *graph, ID *id, uint flags, eUpdateSource update_source) { const int debug_flags = (graph != nullptr) ? DEG_debug_flags_get((::Depsgraph *)graph) : G.debug; if (graph != nullptr && graph->is_evaluating) { @@ -676,7 +676,7 @@ void graph_id_tag_update( if (update_source == DEG_UPDATE_SOURCE_USER_EDIT) { id->recalc |= deg_recalc_flags_effective(graph, flags); } - unsigned int current_flag = flags; + uint current_flag = flags; while (current_flag != 0) { IDRecalcFlag tag = (IDRecalcFlag)(1 << bitscan_forward_clear_uint(¤t_flag)); graph_id_tag_update_single_flag(bmain, graph, id, id_node, tag, update_source); @@ -770,12 +770,12 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag) /* Data-Based Tagging. */ -void DEG_id_tag_update(ID *id, unsigned int flags) +void DEG_id_tag_update(ID *id, uint flags) { DEG_id_tag_update_ex(G.main, id, flags); } -void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags) +void DEG_id_tag_update_ex(Main *bmain, ID *id, uint flags) { if (id == nullptr) { /* Ideally should not happen, but old depsgraph allowed this. */ @@ -787,7 +787,7 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags) void DEG_graph_id_tag_update(struct Main *bmain, struct Depsgraph *depsgraph, struct ID *id, - unsigned int flags) + uint flags) { deg::Depsgraph *graph = (deg::Depsgraph *)depsgraph; deg::graph_id_tag_update(bmain, graph, id, flags, deg::DEG_UPDATE_SOURCE_USER_EDIT); diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index 09981eb32c5..08ce7bed83b 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -235,7 +235,7 @@ void flush_editors_id_update(Depsgraph *graph, const DEGEditorUpdateContext *upd EVAL, "Accumulated recalc bits for %s: %u\n", id_orig->name, - (unsigned int)id_cow->recalc); + (uint)id_cow->recalc); /* Inform editors. Only if the data-block is being evaluated a second * time, to distinguish between user edits and initial evaluation when diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index d4b3e392113..8492804775e 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -361,14 +361,14 @@ static GPUVertFormat *get_subdiv_vertex_format() struct CompressedPatchCoord { int ptex_face_index; /* UV coordinate encoded as u << 16 | v, where u and v are quantized on 16-bits. */ - unsigned int encoded_uv; + uint encoded_uv; }; MINLINE CompressedPatchCoord make_patch_coord(int ptex_face_index, float u, float v) { CompressedPatchCoord patch_coord = { ptex_face_index, - (static_cast<unsigned int>(u * 65535.0f) << 16) | static_cast<unsigned int>(v * 65535.0f), + (static_cast<uint>(u * 65535.0f) << 16) | static_cast<uint>(v * 65535.0f), }; return patch_coord; } diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c index ac2aea4524d..7ed5ca7c983 100644 --- a/source/blender/draw/intern/draw_instance_data.c +++ b/source/blender/draw/intern/draw_instance_data.c @@ -410,12 +410,12 @@ typedef struct DRWSparseUniformBuf { BLI_bitmap *chunk_used; int num_chunks; - unsigned int item_size, chunk_size, chunk_bytes; + uint item_size, chunk_size, chunk_bytes; } DRWSparseUniformBuf; static void drw_sparse_uniform_buffer_init(DRWSparseUniformBuf *buffer, - unsigned int item_size, - unsigned int chunk_size) + uint item_size, + uint chunk_size) { buffer->chunk_buffers = NULL; buffer->chunk_used = NULL; @@ -426,7 +426,7 @@ static void drw_sparse_uniform_buffer_init(DRWSparseUniformBuf *buffer, buffer->chunk_bytes = item_size * chunk_size; } -DRWSparseUniformBuf *DRW_sparse_uniform_buffer_new(unsigned int item_size, unsigned int chunk_size) +DRWSparseUniformBuf *DRW_sparse_uniform_buffer_new(uint item_size, uint chunk_size) { DRWSparseUniformBuf *buf = MEM_mallocN(sizeof(DRWSparseUniformBuf), __func__); drw_sparse_uniform_buffer_init(buf, item_size, chunk_size); diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 95f43733a36..5c3724e6ea4 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -576,7 +576,7 @@ static int gpencil_select_random_exec(bContext *C, wmOperator *op) if (selectmode == GP_SELECTMODE_STROKE) { RNG *rng = BLI_rng_new(seed_iter); - const unsigned int j = BLI_rng_get_uint(rng) % gps->totpoints; + const uint j = BLI_rng_get_uint(rng) % gps->totpoints; bool select_stroke = ((gps->totpoints * randfac) <= j) ? true : false; select_stroke ^= select; /* Curve function has select parameter inverted. */ @@ -647,7 +647,7 @@ static int gpencil_select_random_exec(bContext *C, wmOperator *op) if (selectmode == GP_SELECTMODE_STROKE) { RNG *rng = BLI_rng_new(seed_iter); - const unsigned int j = BLI_rng_get_uint(rng) % gps->totpoints; + const uint j = BLI_rng_get_uint(rng) % gps->totpoints; bool select_stroke = ((gps->totpoints * randfac) <= j) ? true : false; select_stroke ^= select; select_all_stroke_points(gpd, gps, select_stroke); diff --git a/source/blender/editors/gpencil/gpencil_trace_utils.c b/source/blender/editors/gpencil/gpencil_trace_utils.c index 735759d40ec..aa9a2a653bb 100644 --- a/source/blender/editors/gpencil/gpencil_trace_utils.c +++ b/source/blender/editors/gpencil/gpencil_trace_utils.c @@ -119,7 +119,7 @@ static void pixel_at_index(const ImBuf *ibuf, const int32_t idx, float r_col[4]) copy_v4_v4(r_col, frgba); } else { - unsigned char *cp = (unsigned char *)(ibuf->rect + idx); + uchar *cp = (uchar *)(ibuf->rect + idx); r_col[0] = (float)cp[0] / 255.0f; r_col[1] = (float)cp[1] / 255.0f; r_col[2] = (float)cp[2] / 255.0f; diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 5c8ff930eb8..4fc44f01ea0 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -619,7 +619,7 @@ struct UvElement **BM_uv_element_map_ensure_head_table(struct UvElementMap *elem return element_map->head_table; } -#define INVALID_ISLAND ((unsigned int)-1) +#define INVALID_ISLAND ((uint)-1) static void bm_uv_assign_island(UvElementMap *element_map, UvElement *element, diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index bdaa3523402..781866db6a0 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -1047,8 +1047,8 @@ static void bake_targets_populate_pixels_color_attributes(BakeTargets *targets, const MLoopTri *lt = &looptri[i]; for (int j = 0; j < 3; j++) { - unsigned int l = lt->tri[j]; - unsigned int v = loops[l].v; + uint l = lt->tri[j]; + uint v = loops[l].v; /* Map back to original loop if there are modifiers. */ if (vert_origindex != NULL && poly_origindex != NULL) { diff --git a/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc b/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc index f5657b004e2..dc45a7ec51c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc +++ b/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc @@ -55,7 +55,7 @@ static void update_curve_mask(CurveMaskCache *curve_mask_cache, int offset = (int)floorf(diameter / 2.0f); int clamped_radius = max_ff(radius, 1.0); - unsigned short *m = curve_mask_cache->curve_mask; + ushort *m = curve_mask_cache->curve_mask; const int aa_samples = aa_samples_per_texel_axis(brush, radius); const float aa_offset = 1.0f / (2.0f * (float)aa_samples); @@ -87,7 +87,7 @@ static void update_curve_mask(CurveMaskCache *curve_mask_cache, } pixel_xy[0] += aa_step; } - *m = (unsigned short)(total_weight * weight_factor); + *m = (ushort)(total_weight * weight_factor); } } } @@ -140,8 +140,7 @@ static void curve_mask_free(CurveMaskCache *curve_mask_cache) static void curve_mask_allocate(CurveMaskCache *curve_mask_cache, const int diameter) { const size_t curve_mask_size = diameter_to_curve_mask_size(diameter); - curve_mask_cache->curve_mask = static_cast<unsigned short *>( - MEM_mallocN(curve_mask_size, __func__)); + curve_mask_cache->curve_mask = static_cast<ushort *>(MEM_mallocN(curve_mask_size, __func__)); curve_mask_cache->curve_mask_size = curve_mask_size; } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 71804d29e6b..ce12629f9d6 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1198,7 +1198,7 @@ static void fcurve_batch_add_verts(GPUVertBuf *vbo, float y_height, int timeline_frame, float curve_val, - unsigned int *vert_count) + uint *vert_count) { float vert_pos[2][2]; diff --git a/source/blender/editors/util/ed_util_imbuf.c b/source/blender/editors/util/ed_util_imbuf.c index f222f93d2b6..b1c8fc42d08 100644 --- a/source/blender/editors/util/ed_util_imbuf.c +++ b/source/blender/editors/util/ed_util_imbuf.c @@ -52,13 +52,13 @@ typedef struct ImageSampleInfo { int width, height; int sample_size; - unsigned char col[4]; + uchar col[4]; float colf[4]; float linearcol[4]; int z; float zf; - unsigned char *colp; + uchar *colp; const float *colfp; int *zp; float *zfp; @@ -79,7 +79,7 @@ static void image_sample_pixel_color_ubyte(const ImBuf *ibuf, uchar r_col[4], float r_col_linear[4]) { - const uchar *cp = (unsigned char *)(ibuf->rect + coord[1] * ibuf->x + coord[0]); + const uchar *cp = (uchar *)(ibuf->rect + coord[1] * ibuf->x + coord[0]); copy_v4_v4_uchar(r_col, cp); rgba_uchar_to_float(r_col_linear, r_col); IMB_colormanagement_colorspace_to_scene_linear_v4(r_col_linear, false, ibuf->rect_colorspace); @@ -311,7 +311,7 @@ static void sequencer_sample_apply(bContext *C, wmOperator *op, const wmEvent *e if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) { const float *fp; - unsigned char *cp; + uchar *cp; int x = (int)fx, y = (int)fy; info->x = x; @@ -323,7 +323,7 @@ static void sequencer_sample_apply(bContext *C, wmOperator *op, const wmEvent *e info->colfp = NULL; if (ibuf->rect) { - cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x); + cp = (uchar *)(ibuf->rect + y * ibuf->x + x); info->col[0] = cp[0]; info->col[1] = cp[1]; diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp index ee316bbf220..0367f5c1d6d 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.cpp +++ b/source/blender/freestyle/intern/application/AppCanvas.cpp @@ -89,7 +89,7 @@ void AppCanvas::init() void AppCanvas::postDraw() { - for (unsigned int i = 0; i < _StyleModules.size(); i++) { + for (uint i = 0; i < _StyleModules.size(); i++) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index cc815b5317f..08480533937 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -1051,7 +1051,7 @@ void Controller::displayDensityCurves(int x, int y) return; } - unsigned int i, j; + uint i, j; using densityCurve = vector<Vec3r>; vector<densityCurve> curves(svm->getNumberOfOrientations() + 1); vector<densityCurve> curvesDirection(svm->getNumberOfPyramidLevels()); diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index 82fec9bd802..27c4bbe9bc4 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -273,7 +273,7 @@ void BlenderFileLoader::addTriangle(struct LoaderState *ls, #if 0 float len; #endif - unsigned int i, j; + uint i, j; IndexedFaceSet::FaceEdgeMark marks = 0; // initialize the bounding box by the first vertex @@ -549,7 +549,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) copy_v3_v3(n3, facenormal); } - unsigned int numTris = countClippedFaces(v1, v2, v3, clip); + uint numTris = countClippedFaces(v1, v2, v3, clip); if (numTris == 0) { continue; } @@ -578,7 +578,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) } else { // find if the Blender material is already in the list - unsigned int i = 0; + uint i = 0; bool found = false; for (vector<Material *>::iterator it = meshMaterials.begin(), itend = meshMaterials.end(); @@ -624,22 +624,22 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // We might have several times the same vertex. We want a clean // shape with no real-vertex. Here, we are making a cleaning pass. float *cleanVertices = nullptr; - unsigned int cvSize; - unsigned int *cleanVIndices = nullptr; + uint cvSize; + uint *cleanVIndices = nullptr; GeomCleaner::CleanIndexedVertexArray( vertices, vSize, VIndices, viSize, &cleanVertices, &cvSize, &cleanVIndices); float *cleanNormals = nullptr; - unsigned int cnSize; - unsigned int *cleanNIndices = nullptr; + uint cnSize; + uint *cleanNIndices = nullptr; GeomCleaner::CleanIndexedVertexArray( normals, nSize, NIndices, niSize, &cleanNormals, &cnSize, &cleanNIndices); // format materials array FrsMaterial **marray = new FrsMaterial *[meshFrsMaterials.size()]; - unsigned int mindex = 0; + uint mindex = 0; for (vector<FrsMaterial>::iterator m = meshFrsMaterials.begin(), mend = meshFrsMaterials.end(); m != mend; ++m) { @@ -695,7 +695,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) detri.v = zero; detri.n = 0; - for (unsigned int j = 0; j < viSize; j += 3) { + for (uint j = 0; j < viSize; j += 3) { if (i == j) { continue; } @@ -754,7 +754,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) if (G.debug & G_DEBUG_FREESTYLE) { printf("Warning: Object %s contains %lu degenerated triangle%s (strokes may be incorrect)\n", name, - (long unsigned int)detriList.size(), + (ulong)detriList.size(), (detriList.size() > 1) ? "s" : ""); } } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index a3085768ea3..ba583ecb2e1 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -187,7 +187,7 @@ float BlenderStrokeRenderer::get_stroke_vertex_z() const return -z; } -unsigned int BlenderStrokeRenderer::get_stroke_mesh_id() const +uint BlenderStrokeRenderer::get_stroke_mesh_id() const { unsigned mesh_id = _mesh_id; BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this); @@ -812,7 +812,7 @@ Object *BlenderStrokeRenderer::NewMesh() const { Object *ob; char name[MAX_ID_NAME]; - unsigned int mesh_id = get_stroke_mesh_id(); + uint mesh_id = get_stroke_mesh_id(); BLI_snprintf(name, MAX_ID_NAME, "0%08xOB", mesh_id); ob = BKE_object_add_only_object(freestyle_bmain, OB_MESH, name); diff --git a/source/blender/freestyle/intern/geometry/FastGrid.cpp b/source/blender/freestyle/intern/geometry/FastGrid.cpp index 442087040bc..f87b25ebc71 100644 --- a/source/blender/freestyle/intern/geometry/FastGrid.cpp +++ b/source/blender/freestyle/intern/geometry/FastGrid.cpp @@ -20,7 +20,7 @@ void FastGrid::clear() return; } - for (unsigned int i = 0; i < _cells_size; i++) { + for (uint i = 0; i < _cells_size; i++) { if (_cells[i]) { delete _cells[i]; } diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp index 605601af7cc..736191da87e 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp @@ -172,9 +172,9 @@ struct GeomCleanerHasher { #define _MOD 2147483647UL inline size_t operator()(const Vec3r &p) const { - size_t res = ((unsigned long)(p[0] * _MUL)) % _MOD; - res = (res + (unsigned long)(p[1]) * _MUL) % _MOD; - return (res + (unsigned long)(p[2]) * _MUL) % _MOD; + size_t res = ((ulong)(p[0] * _MUL)) % _MOD; + res = (res + (ulong)(p[1]) * _MUL) % _MOD; + return (res + (ulong)(p[2]) * _MUL) % _MOD; } #undef _MUL #undef _MOD diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp index ca1fb63ec64..742d5f2fd02 100644 --- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp +++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp @@ -607,9 +607,9 @@ void transformVertex(const Vec3r &vert, const Matrix44r &matrix, Vec3r &res) { HVec3r hvert(vert), res_tmp; real scale; - for (unsigned int j = 0; j < 4; j++) { + for (uint j = 0; j < 4; j++) { scale = hvert[j]; - for (unsigned int i = 0; i < 4; i++) { + for (uint i = 0; i < 4; i++) { res_tmp[i] += matrix(i, j) * scale; } } @@ -631,9 +631,9 @@ void transformVertices(const vector<Vec3r> &vertices, const Matrix44r &trans, ve Vec3r rotateVector(const Matrix44r &mat, const Vec3r &v) { Vec3r res; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { res[i] = 0; - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { res[i] += mat(i, j) * v[j]; } } @@ -718,9 +718,9 @@ void fromCameraToWorld(const Vec3r &p, Vec3r &q, const real model_view_matrix[4] model_view_matrix[1][3], model_view_matrix[2][3], }; - for (unsigned short i = 0; i < 3; i++) { + for (ushort i = 0; i < 3; i++) { q[i] = 0.0; - for (unsigned short j = 0; j < 3; j++) { + for (ushort j = 0; j < 3; j++) { q[i] += model_view_matrix[j][i] * (p[j] - translation[j]); } } @@ -751,7 +751,7 @@ inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n) Vec2r dseg = seg[1] - seg[0]; // the segment direction vector Vec2r e; // edge vector - for (unsigned int i = 0; i < n; i++) { // process polygon edge poly[i]poly[i+1] + for (uint i = 0; i < n; i++) { // process polygon edge poly[i]poly[i+1] e = poly[i + 1] - poly[i]; N = PERP(e, seg[0] - poly[i]); D = -PERP(e, dseg); @@ -790,7 +790,7 @@ inline bool overlapPlaneBox(Vec3r &normal, real d, Vec3r &maxbox) { Vec3r vmin, vmax; - for (unsigned int q = X; q <= Z; q++) { + for (uint q = X; q <= Z; q++) { if (normal[q] > 0.0f) { vmin[q] = -maxbox[q]; vmax[q] = maxbox[q]; @@ -814,8 +814,8 @@ inline void fromCoordAToCoordB(const Vec3r &p, Vec3r &q, const real transform[4] HVec3r hp(p); HVec3r hq(0, 0, 0, 0); - for (unsigned int i = 0; i < 4; i++) { - for (unsigned int j = 0; j < 4; j++) { + for (uint i = 0; i < 4; i++) { + for (uint j = 0; j < 4; j++) { hq[i] += transform[i][j] * hp[j]; } } @@ -825,7 +825,7 @@ inline void fromCoordAToCoordB(const Vec3r &p, Vec3r &q, const real transform[4] return; } - for (unsigned int k = 0; k < 3; k++) { + for (uint k = 0; k < 3; k++) { q[k] = hq[k] / hq[3]; } } diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp index 2b2272959e4..33c7d04cb4c 100644 --- a/source/blender/freestyle/intern/geometry/Grid.cpp +++ b/source/blender/freestyle/intern/geometry/Grid.cpp @@ -354,8 +354,8 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta Vec3r boxMax(_orig + _size); BBox<Vec3r> box(boxMin, boxMax); if (box.inside(orig)) { - for (unsigned int i = 0; i < 3; i++) { - _current_cell[i] = (unsigned int)floor((orig[i] - _orig[i]) / _cell_size[i]); + for (uint i = 0; i < 3; i++) { + _current_cell[i] = (uint)floor((orig[i] - _orig[i]) / _cell_size[i]); // soc unused - unsigned u = _current_cell[i]; _pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i]; } @@ -366,7 +366,7 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta if (GeomUtils::intersectRayBBox(orig, _ray_dir, boxMin, boxMax, 0, _t_end, tmin, tmax)) { BLI_assert(tmin != -1.0); Vec3r newOrig = orig + tmin * _ray_dir; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { _current_cell[i] = (unsigned)floor((newOrig[i] - _orig[i]) / _cell_size[i]); if (_current_cell[i] == _cells_nb[i]) { _current_cell[i] = _cells_nb[i] - 1; diff --git a/source/blender/freestyle/intern/image/ImagePyramid.cpp b/source/blender/freestyle/intern/image/ImagePyramid.cpp index 2a555a22915..f595efabe0b 100644 --- a/source/blender/freestyle/intern/image/ImagePyramid.cpp +++ b/source/blender/freestyle/intern/image/ImagePyramid.cpp @@ -54,9 +54,9 @@ float ImagePyramid::pixel(int x, int y, int level) if (0 == level) { return img->pixel(x, y); } - unsigned int i = 1 << level; - unsigned int sx = x >> level; - unsigned int sy = y >> level; + uint i = 1 << level; + uint sx = x >> level; + uint sy = y >> level; if (sx >= img->width()) { sx = img->width() - 1; } @@ -141,12 +141,12 @@ void GaussianPyramid::BuildPyramid(GrayImage *level0, unsigned nbLevels) unsigned w = pLevel->width(); unsigned h = pLevel->height(); if (nbLevels != 0) { - for (unsigned int i = 0; i < nbLevels; ++i) { // soc + for (uint i = 0; i < nbLevels; ++i) { // soc w = pLevel->width() >> 1; h = pLevel->height() >> 1; GrayImage *img = new GrayImage(w, h); - for (unsigned int y = 0; y < h; ++y) { - for (unsigned int x = 0; x < w; ++x) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x) { float v = gf.getSmoothedPixel<GrayImage>(pLevel, 2 * x, 2 * y); img->setPixel(x, y, v); } @@ -160,8 +160,8 @@ void GaussianPyramid::BuildPyramid(GrayImage *level0, unsigned nbLevels) w = pLevel->width() >> 1; h = pLevel->height() >> 1; GrayImage *img = new GrayImage(w, h); - for (unsigned int y = 0; y < h; ++y) { - for (unsigned int x = 0; x < w; ++x) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x) { float v = gf.getSmoothedPixel<GrayImage>(pLevel, 2 * x, 2 * y); img->setPixel(x, y, v); } diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index 02ed3f463c7..0701b1c4ef3 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -236,7 +236,7 @@ PyObject *BPy_FEdge_from_FEdge(FEdge &fe) return py_fe; } -PyObject *BPy_Nature_from_Nature(unsigned short n) +PyObject *BPy_Nature_from_Nature(ushort n) { PyObject *args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index bd37e84761e..7eccf0403ae 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -282,7 +282,7 @@ static Mathutils_Callback FrsMaterial_mathutils_cb = { FrsMaterial_mathutils_set_index, }; -static unsigned char FrsMaterial_mathutils_cb_index = -1; +static uchar FrsMaterial_mathutils_cb_index = -1; void FrsMaterial_mathutils_register_callback() { @@ -517,7 +517,7 @@ static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, static Py_hash_t FrsMaterial_hash(PyObject *self) { - return (Py_uhash_t)BLI_hash_mm2((const unsigned char *)self, sizeof(*self), 0); + return (Py_uhash_t)BLI_hash_mm2((const uchar *)self, sizeof(*self), 0); } /*-----------------------BPy_FrsMaterial type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index 5bdc8ce16e8..218749b2672 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -121,7 +121,7 @@ static PyObject *FrsNoise_turbulence1(BPy_FrsNoise *self, PyObject *args, PyObje { static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; float f1, f2, f3; - unsigned int i = 4; + uint i = 4; if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|I", (char **)kwlist, &f1, &f2, &f3, &i)) { return nullptr; @@ -150,7 +150,7 @@ static PyObject *FrsNoise_turbulence2(BPy_FrsNoise *self, PyObject *args, PyObje static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; - unsigned int i = 4; + uint i = 4; Vec2f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { @@ -186,7 +186,7 @@ static PyObject *FrsNoise_turbulence3(BPy_FrsNoise *self, PyObject *args, PyObje static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; - unsigned int i = 4; + uint i = 4; Vec3f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index fc7581a93c0..d88d3edecc0 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -82,8 +82,8 @@ static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObj return PyFloat_FromDouble(res); } if (BPy_UnaryFunction0DUnsigned_Check(obj1)) { - UnaryFunction0D<unsigned int> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; - unsigned int res = integrate(*fun, it, it_end, t); + UnaryFunction0D<uint> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; + uint res = integrate(*fun, it, it_end, t); return PyLong_FromLong(res); } diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 20fd091c249..1c5e90474ab 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -585,7 +585,7 @@ static PyObject *Operators_get_viewedge_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; @@ -612,7 +612,7 @@ static PyObject *Operators_get_chain_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; @@ -639,7 +639,7 @@ static PyObject *Operators_get_stroke_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index fb72ed0ca62..5e504772786 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -224,7 +224,7 @@ static PyObject *SShape_vertices_get(BPy_SShape *self, void *UNUSED(closure)) vector<SVertex *> vertices = self->ss->getVertexList(); vector<SVertex *>::iterator it; PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; + uint i = 0; for (it = vertices.begin(); it != vertices.end(); it++) { PyList_SET_ITEM(py_vertices, i++, BPy_SVertex_from_SVertex(*(*it))); @@ -244,7 +244,7 @@ static PyObject *SShape_edges_get(BPy_SShape *self, void *UNUSED(closure)) vector<FEdge *> edges = self->ss->getEdgeList(); vector<FEdge *>::iterator it; PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; + uint i = 0; for (it = edges.begin(); it != edges.end(); it++) { PyList_SET_ITEM(py_edges, i++, Any_BPy_FEdge_from_FEdge(*(*it))); diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 7dddf90f2b3..86d7a726883 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -531,7 +531,7 @@ static Mathutils_Callback StrokeAttribute_mathutils_cb = { StrokeAttribute_mathutils_set_index, }; -static unsigned char StrokeAttribute_mathutils_cb_index = -1; +static uchar StrokeAttribute_mathutils_cb_index = -1; void StrokeAttribute_mathutils_register_callback() { diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 806739239de..319058ea719 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -200,7 +200,7 @@ static PyObject *ViewShape_vertices_get(BPy_ViewShape *self, void *UNUSED(closur vector<ViewVertex *> vertices = self->vs->vertices(); vector<ViewVertex *>::iterator it; PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; + uint i = 0; for (it = vertices.begin(); it != vertices.end(); it++) { PyList_SET_ITEM(py_vertices, i++, Any_BPy_ViewVertex_from_ViewVertex(*(*it))); @@ -219,7 +219,7 @@ static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UN } v.reserve(PyList_GET_SIZE(value)); - for (unsigned int i = 0; i < PyList_GET_SIZE(value); i++) { + for (uint i = 0; i < PyList_GET_SIZE(value); i++) { item = PyList_GET_ITEM(value, i); if (BPy_ViewVertex_Check(item)) { v.push_back(((BPy_ViewVertex *)item)->vv); @@ -243,7 +243,7 @@ static PyObject *ViewShape_edges_get(BPy_ViewShape *self, void *UNUSED(closure)) vector<ViewEdge *> edges = self->vs->edges(); vector<ViewEdge *>::iterator it; PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; + uint i = 0; for (it = edges.begin(); it != edges.end(); it++) { PyList_SET_ITEM(py_edges, i++, BPy_ViewEdge_from_ViewEdge(*(*it))); diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index ff59e5b1a10..09202127ad2 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -251,7 +251,7 @@ static Mathutils_Callback SVertex_mathutils_cb = { SVertex_mathutils_set_index, }; -static unsigned char SVertex_mathutils_cb_index = -1; +static uchar SVertex_mathutils_cb_index = -1; void SVertex_mathutils_register_callback() { @@ -338,7 +338,7 @@ static PyObject *SVertex_normals_get(BPy_SVertex *self, void *UNUSED(closure)) set<Vec3r> normals = self->sv->normals(); set<Vec3r>::iterator it; py_normals = PyList_New(normals.size()); - unsigned int i = 0; + uint i = 0; for (it = normals.begin(); it != normals.end(); it++) { Vec3r v(*it); diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 1c1d8bf032a..54996067e72 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -206,7 +206,7 @@ static Mathutils_Callback StrokeVertex_mathutils_cb = { StrokeVertex_mathutils_set_index, }; -static unsigned char StrokeVertex_mathutils_cb_index = -1; +static uchar StrokeVertex_mathutils_cb_index = -1; void StrokeVertex_mathutils_register_callback() { diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 57c00ab1b99..1c1136bbae7 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -378,7 +378,7 @@ static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void *UNUSED(closure)) static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index 840f49ff345..e32910cf53d 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -178,7 +178,7 @@ static Mathutils_Callback FEdgeSharp_mathutils_cb = { FEdgeSharp_mathutils_set_index, }; -static unsigned char FEdgeSharp_mathutils_cb_index = -1; +static uchar FEdgeSharp_mathutils_cb_index = -1; void FEdgeSharp_mathutils_register_callback() { @@ -250,7 +250,7 @@ static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } @@ -272,7 +272,7 @@ static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index bf62d5bd31d..93943dcda05 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -129,7 +129,7 @@ static Mathutils_Callback FEdgeSmooth_mathutils_cb = { FEdgeSmooth_mathutils_set_index, }; -static unsigned char FEdgeSmooth_mathutils_cb_index = -1; +static uchar FEdgeSmooth_mathutils_cb_index = -1; void FEdgeSmooth_mathutils_register_callback() { @@ -173,7 +173,7 @@ static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index be1b9f42ce4..29e1a1d3525 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -64,7 +64,7 @@ static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; } - self->uf0D_unsigned = new UnaryFunction0D<unsigned int>(); + self->uf0D_unsigned = new UnaryFunction0D<uint>(); self->uf0D_unsigned->py_uf0D = (PyObject *)self; return 0; } @@ -93,7 +93,7 @@ static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *s return nullptr; } - if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<unsigned int>)) { + if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<uint>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return nullptr; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 6d17f6debdf..e0aa5af2adb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -106,9 +106,9 @@ static PyObject *UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVect return nullptr; } - const unsigned int list_len = self->uf0D_vectorviewshape->result.size(); + const uint list_len = self->uf0D_vectorviewshape->result.size(); PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { + for (uint i = 0; i < list_len; i++) { ViewShape *v = self->uf0D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index f0435ea1294..3a2c9868014 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -47,7 +47,7 @@ static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0 PyObject *kwds) { static const char *kwlist[] = {"orientation", "level", nullptr}; - unsigned int u; + uint u; int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ii", (char **)kwlist, &u, &i)) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index e9023d90b42..8929e9e4024 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -74,11 +74,10 @@ static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self, } if (!obj) { - self->uf1D_unsigned = new UnaryFunction1D<unsigned int>(); + self->uf1D_unsigned = new UnaryFunction1D<uint>(); } else { - self->uf1D_unsigned = new UnaryFunction1D<unsigned int>( - IntegrationType_from_BPy_IntegrationType(obj)); + self->uf1D_unsigned = new UnaryFunction1D<uint>(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_unsigned->py_uf1D = (PyObject *)self; @@ -109,7 +108,7 @@ static PyObject *UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *s return nullptr; } - if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<unsigned int>)) { + if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<uint>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return nullptr; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index df504b1cdaa..44f12c9e307 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -136,9 +136,9 @@ static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVect return nullptr; } - const unsigned int list_len = self->uf1D_vectorviewshape->result.size(); + const uint list_len = self->uf1D_vectorviewshape->result.size(); PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { + for (uint i = 0; i < list_len; i++) { ViewShape *v = self->uf1D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp index c4d4aedc954..b513686524e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -67,7 +67,7 @@ static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDen { static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", nullptr}; PyObject *obj = nullptr; - unsigned int u1, u2; + uint u1, u2; float f = 2.0; if (!PyArg_ParseTupleAndKeywords( diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp index d02ff6990a5..c3559fe6e15 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp @@ -68,7 +68,7 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, _FrsMaterials = nullptr; if (iMaterials) { _FrsMaterials = new FrsMaterial *[_MSize]; - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { _FrsMaterials[i] = new FrsMaterial(*(iMaterials[i])); } } @@ -161,7 +161,7 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) _MSize = iBrother.msize(); if (_MSize) { _FrsMaterials = new FrsMaterial *[_MSize]; - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { _FrsMaterials[i] = new FrsMaterial(*(iBrother._FrsMaterials[i])); } } @@ -224,7 +224,7 @@ IndexedFaceSet::~IndexedFaceSet() } if (nullptr != _FrsMaterials) { - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { delete _FrsMaterials[i]; } delete[] _FrsMaterials; @@ -290,7 +290,7 @@ void IndexedFaceSet::ComputeBBox() // parse all the coordinates to find the Xmax, YMax, ZMax float *v = _Vertices; - for (unsigned int i = 0; i < (_VSize / 3); ++i) { + for (uint i = 0; i < (_VSize / 3); ++i) { if (*v > XMax) { XMax = *v; } diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp index 31101e988e5..97fa07df4c9 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp +++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp @@ -122,7 +122,7 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) // Computes the transform iBBox HVec3r tbox[8]; - unsigned int i; + uint i; for (i = 0; i < 8; i++) { tbox[i] = _Matrix * box[i]; } @@ -130,7 +130,7 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) Vec3r newMin(tbox[0]); Vec3r newMax(tbox[0]); for (i = 0; i < 8; i++) { - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { if (newMin[j] > tbox[i][j]) { newMin[j] = tbox[i][j]; } @@ -147,9 +147,9 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) bool NodeTransform::isScaled(const Matrix44r &M) { - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { real norm = 0; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { norm += M(i, j) * M(i, j); } if ((norm > 1.01) || (norm < 0.99)) { diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp index af41421fa72..3e6c8f924a1 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp @@ -20,22 +20,22 @@ string SceneHash::toString() void SceneHash::visitNodeViewLayer(NodeViewLayer &node) { struct RenderData *r = &node.scene().r; - adler32((unsigned char *)&r->xsch, sizeof(r->xsch)); // resolution_x - adler32((unsigned char *)&r->ysch, sizeof(r->ysch)); // resolution_y - adler32((unsigned char *)&r->size, sizeof(r->size)); // resolution_percentage + adler32((uchar *)&r->xsch, sizeof(r->xsch)); // resolution_x + adler32((uchar *)&r->ysch, sizeof(r->ysch)); // resolution_y + adler32((uchar *)&r->size, sizeof(r->size)); // resolution_percentage struct FreestyleConfig *config = &node.sceneLayer().freestyle_config; - adler32((unsigned char *)&config->flags, sizeof(config->flags)); - adler32((unsigned char *)&config->crease_angle, sizeof(config->crease_angle)); - adler32((unsigned char *)&config->sphere_radius, sizeof(config->sphere_radius)); - adler32((unsigned char *)&config->dkr_epsilon, sizeof(config->dkr_epsilon)); + adler32((uchar *)&config->flags, sizeof(config->flags)); + adler32((uchar *)&config->crease_angle, sizeof(config->crease_angle)); + adler32((uchar *)&config->sphere_radius, sizeof(config->sphere_radius)); + adler32((uchar *)&config->dkr_epsilon, sizeof(config->dkr_epsilon)); } void SceneHash::visitNodeCamera(NodeCamera &cam) { double *proj = cam.projectionMatrix(); for (int i = 0; i < 16; i++) { - adler32((unsigned char *)&proj[i], sizeof(double)); + adler32((uchar *)&proj[i], sizeof(double)); } } @@ -45,13 +45,13 @@ void SceneHash::visitIndexedFaceSet(IndexedFaceSet &ifs) const unsigned n = ifs.vsize(); for (unsigned i = 0; i < n; i++) { - adler32((unsigned char *)&v[i], sizeof(v[i])); + adler32((uchar *)&v[i], sizeof(v[i])); } } static const int MOD_ADLER = 65521; -void SceneHash::adler32(const unsigned char *data, int size) +void SceneHash::adler32(const uchar *data, int size) { uint32_t sum1 = _sum & 0xffff; uint32_t sum2 = (_sum >> 16) & 0xffff; diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp index 623b6b0e2bf..5ac41b6f234 100644 --- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp +++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp @@ -77,7 +77,7 @@ void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet &ifs) _ofs << _space << "IndexedFaceSet" << endl; const float *p = vertices; - for (unsigned int i = 0; i < vsize / 3; i++) { + for (uint i = 0; i < vsize / 3; i++) { _ofs << _space << " " << setw(3) << setfill('0') << i << ": " << p[0] << ", " << p[1] << ", " << p[2] << endl; p += 3; diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index 68a18323621..46620bbcac2 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -91,7 +91,7 @@ void Canvas::Draw() preDraw(); TimeStamp *timestamp = TimeStamp::instance(); - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { _current_sm = _StyleModules[i]; if (i < _Layers.size() && _Layers[i]) { @@ -184,7 +184,7 @@ void Canvas::InsertStyleModule(unsigned index, StyleModule *iStyleModule) void Canvas::RemoveStyleModule(unsigned index) { - unsigned int i = 0; + uint i = 0; if (!_StyleModules.empty()) { for (deque<StyleModule *>::iterator s = _StyleModules.begin(), send = _StyleModules.end(); s != send; @@ -257,17 +257,17 @@ void Canvas::setModified(unsigned index, bool iMod) void Canvas::resetModified(bool iMod /* = false */) { - unsigned int size = _StyleModules.size(); - for (unsigned int i = 0; i < size; ++i) { + uint size = _StyleModules.size(); + for (uint i = 0; i < size; ++i) { setModified(i, iMod); } } void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index) { - unsigned int size = _StyleModules.size(); + uint size = _StyleModules.size(); - for (unsigned int i = index; i < size; ++i) { + for (uint i = index; i < size; ++i) { if (_StyleModules[i]->getCausal()) { vec.push_back(i); } @@ -276,7 +276,7 @@ void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index) void Canvas::Render(const StrokeRenderer *iRenderer) { - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } @@ -286,7 +286,7 @@ void Canvas::Render(const StrokeRenderer *iRenderer) void Canvas::RenderBasic(const StrokeRenderer *iRenderer) { - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } @@ -294,10 +294,7 @@ void Canvas::RenderBasic(const StrokeRenderer *iRenderer) } } -void Canvas::loadMap(const char *iFileName, - const char *iMapName, - unsigned int iNbLevels, - float iSigma) +void Canvas::loadMap(const char *iFileName, const char *iMapName, uint iNbLevels, float iSigma) { // check whether this map was already loaded: if (!_maps.empty()) { diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp index ad2950c73a9..354aef13115 100644 --- a/source/blender/freestyle/intern/system/PseudoNoise.cpp +++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp @@ -11,7 +11,7 @@ #include "PseudoNoise.h" #include "RandGen.h" -static int modf_to_index(Freestyle::real x, unsigned int range) +static int modf_to_index(Freestyle::real x, uint range) { if (isfinite(x)) { Freestyle::real tmp; @@ -30,7 +30,7 @@ real PseudoNoise::_values[]; void PseudoNoise::init(long seed) { RandGen::srand48(seed); - for (unsigned int i = 0; i < NB_VALUE_NOISE; i++) { + for (uint i = 0; i < NB_VALUE_NOISE; i++) { _values[i] = -1.0 + 2.0 * RandGen::drand48(); } } @@ -83,7 +83,7 @@ real PseudoNoise::turbulenceSmooth(real x, unsigned nbOctave) { real y = 0; real k = 1.0; - for (unsigned int i = 0; i < nbOctave; i++) { + for (uint i = 0; i < nbOctave; i++) { y = y + k * smoothNoise(x * k); k = k / 2.0; } @@ -94,7 +94,7 @@ real PseudoNoise::turbulenceLinear(real x, unsigned nbOctave) { real y = 0; real k = 1.0; - for (unsigned int i = 0; i < nbOctave; i++) { + for (uint i = 0; i < nbOctave; i++) { y = y + k * linearNoise(x * k); k = k / 2.0; } diff --git a/source/blender/freestyle/intern/system/RandGen.cpp b/source/blender/freestyle/intern/system/RandGen.cpp index d18d53c767f..c5559f39147 100644 --- a/source/blender/freestyle/intern/system/RandGen.cpp +++ b/source/blender/freestyle/intern/system/RandGen.cpp @@ -38,7 +38,7 @@ namespace Freestyle { } \ ((void)0) -#define CARRY(x, y) ((unsigned long)((long)(x) + (long)(y)) > MASK) +#define CARRY(x, y) ((ulong)((long)(x) + (long)(y)) > MASK) #define ADDEQU(x, y, z) (z = CARRY(x, (y)), x = LOW(x + (y))) #define SET3(x, x0, x1, x2) ((x)[0] = (x0), (x)[1] = (x1), (x)[2] = (x2)) #if 0 // XXX, unused diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp index 1ecd5a2126d..c4a96ce3305 100644 --- a/source/blender/freestyle/intern/system/StringUtils.cpp +++ b/source/blender/freestyle/intern/system/StringUtils.cpp @@ -21,7 +21,7 @@ void getPathName(const string &path, const string &base, vector<string> &pathnam pathnames.push_back(base); - for (unsigned int pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size; + for (uint pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size; pos = sep + 1, sep = path.find(Config::PATH_SEP, pos)) { if (sep == (unsigned)string::npos) { sep = size; diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp index c8a6f0a0a3e..eac6765da99 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp +++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp @@ -127,7 +127,7 @@ void BoxGrid::assignCells(OccluderSource & /*source*/, ++f) { if ((*f)->isInImage()) { Vec3r point = transform((*f)->center3d()); - unsigned int i, j; + uint i, j; getCellCoordinates(point, i, j); if (_cells[i * _cellsY + j] == nullptr) { // This is an uninitialized cell @@ -149,8 +149,8 @@ void BoxGrid::assignCells(OccluderSource & /*source*/, void BoxGrid::distributePolygons(OccluderSource &source) { - unsigned long nFaces = 0; - unsigned long nKeptFaces = 0; + ulong nFaces = 0; + ulong nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { OccluderData *occluder = nullptr; @@ -194,7 +194,7 @@ void BoxGrid::getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y) BoxGrid::Cell *BoxGrid::findCell(const Vec3r &point) { - unsigned int x, y; + uint x, y; getCellCoordinates(point, x, y); return _cells[x * _cellsY + y]; } diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp index 8ae6bec2fb2..e2886370800 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp @@ -56,7 +56,7 @@ bool CulledOccluderSource::next() void CulledOccluderSource::getOccluderProscenium(real proscenium[4]) { - for (unsigned int i = 0; i < 4; ++i) { + for (uint i = 0; i < 4; ++i) { proscenium[i] = gridSpaceOccluderProscenium[i]; } } diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index cd36e4b0fe9..ffbb13e5df7 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -420,8 +420,8 @@ void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace) WXFaceLayer *flayer = new WXFaceLayer(iFace, Nature::RIDGE | Nature::VALLEY, false); iFace->AddSmoothLayer(flayer); - unsigned int numVertices = iFace->numberOfVertices(); - for (unsigned int i = 0; i < numVertices; ++i) { + uint numVertices = iFace->numberOfVertices(); + for (uint i = 0; i < numVertices; ++i) { WVertex *wv = iFace->GetVertex(i); WXVertex *wxv = dynamic_cast<WXVertex *>(wv); flayer->PushDotP(wxv->curvatures()->K1); @@ -570,8 +570,8 @@ void FEdgeXDetector::ProcessSuggestiveContourFace(WXFace *iFace) WXFaceLayer *faceLayer = new WXFaceLayer(iFace, Nature::SUGGESTIVE_CONTOUR, true); iFace->AddSmoothLayer(faceLayer); - unsigned int numVertices = iFace->numberOfVertices(); - for (unsigned int i = 0; i < numVertices; ++i) { + uint numVertices = iFace->numberOfVertices(); + for (uint i = 0; i < numVertices; ++i) { WVertex *wv = iFace->GetVertex(i); WXVertex *wxv = dynamic_cast<WXVertex *>(wv); faceLayer->PushDotP(wxv->curvatures()->Kr); @@ -626,7 +626,7 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) GeomUtils::intersection_test res; real kr(0), kr1(0), kr2(0), t; - for (unsigned int i = 0; i < vertices_nb; ++i) { + for (uint i = 0; i < vertices_nb; ++i) { v = (WXVertex *)(iFace->GetVertex(i)); // v is a singular vertex, skip it. diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index 24625d39781..b77ccebe1f6 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -319,7 +319,7 @@ int QuantitativeInvisibilityF0D::operator()(Interface0DIterator &iter) { ViewEdge *ve1, *ve2; getViewEdges(iter, ve1, ve2); - unsigned int qi1, qi2; + uint qi1, qi2; qi1 = ve1->qi(); if (ve2 != nullptr) { qi2 = ve2->qi(); diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp index dfe6bfdd0cf..7d9d871f586 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp @@ -66,7 +66,7 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], const int iViewport[4], real iFocal) { - unsigned int i, j; + uint i, j; _translation[0] = iModelViewMatrix[3][0]; _translation[1] = iModelViewMatrix[3][1]; _translation[2] = iModelViewMatrix[3][2]; @@ -88,7 +88,7 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { _transform[i][j] = 0; - for (unsigned int k = 0; k < 4; k++) { + for (uint k = 0; k < 4; k++) { _transform[i][j] += _projectionMatrix[i][k] * _modelViewMatrix[k][j]; } } diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp index 2a7637eb350..70f10058411 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp @@ -146,8 +146,8 @@ void SphericalGrid::assignCells(OccluderSource & /*source*/, void SphericalGrid::distributePolygons(OccluderSource &source) { - unsigned long nFaces = 0; - unsigned long nKeptFaces = 0; + ulong nFaces = 0; + ulong nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { OccluderData *occluder = nullptr; diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index 1211b55e8e1..88f94e152a1 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -26,11 +26,11 @@ namespace Freestyle { using namespace Geometry; -SteerableViewMap::SteerableViewMap(unsigned int nbOrientations) +SteerableViewMap::SteerableViewMap(uint nbOrientations) { _nbOrientations = nbOrientations; _bound = cos(M_PI / (float)_nbOrientations); - for (unsigned int i = 0; i < _nbOrientations; ++i) { + for (uint i = 0; i < _nbOrientations; ++i) { _directions.emplace_back(cos((float)i * M_PI / (float)_nbOrientations), sin((float)i * M_PI / (float)_nbOrientations)); } @@ -47,7 +47,7 @@ void SteerableViewMap::Build() SteerableViewMap::SteerableViewMap(const SteerableViewMap &iBrother) { _nbOrientations = iBrother._nbOrientations; - unsigned int i; + uint i; _bound = iBrother._bound; _directions = iBrother._directions; _mapping = iBrother._mapping; @@ -66,7 +66,7 @@ SteerableViewMap::~SteerableViewMap() void SteerableViewMap::Clear() { - unsigned int i; + uint i; if (_imagesPyramids) { for (i = 0; i <= _nbOrientations; ++i) { if (_imagesPyramids[i]) { @@ -77,8 +77,7 @@ void SteerableViewMap::Clear() _imagesPyramids = nullptr; } if (!_mapping.empty()) { - for (map<unsigned int, double *>::iterator m = _mapping.begin(), mend = _mapping.end(); - m != mend; + for (map<uint, double *>::iterator m = _mapping.begin(), mend = _mapping.end(); m != mend; ++m) { delete[](*m).second; } @@ -109,7 +108,7 @@ double *SteerableViewMap::AddFEdge(FEdge *iFEdge) { unsigned i; unsigned id = iFEdge->getId().getFirst(); - map<unsigned int, double *>::iterator o = _mapping.find(id); + map<uint, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { return (*o).second; } @@ -142,7 +141,7 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) dir /= norm; double maxw = 0.0f; unsigned winner = _nbOrientations + 1; - for (unsigned int i = 0; i < _nbOrientations; ++i) { + for (uint i = 0; i < _nbOrientations; ++i) { double w = ComputeWeight(dir, i); if (w > maxw) { maxw = w; @@ -154,7 +153,7 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) unsigned SteerableViewMap::getSVMNumber(unsigned id) { - map<unsigned int, double *>::iterator o = _mapping.find(id); + map<uint, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { double *wvalues = (*o).second; double maxw = 0.0; @@ -176,7 +175,7 @@ void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases, unsigned iNbLevels, float iSigma) { - for (unsigned int i = 0; i <= _nbOrientations; ++i) { + for (uint i = 0; i <= _nbOrientations; ++i) { ImagePyramid *svm = (_imagesPyramids)[i]; delete svm; if (copy) { @@ -215,7 +214,7 @@ float SteerableViewMap::readCompleteViewMapPixel(int iLevel, int x, int y) return readSteerableViewMapPixel(_nbOrientations, iLevel, x, y); } -unsigned int SteerableViewMap::getNumberOfPyramidLevels() const +uint SteerableViewMap::getNumberOfPyramidLevels() const { if (_imagesPyramids[0]) { return _imagesPyramids[0]->getNumberOfLevels(); @@ -225,7 +224,7 @@ unsigned int SteerableViewMap::getNumberOfPyramidLevels() const void SteerableViewMap::saveSteerableViewMap() const { - for (unsigned int i = 0; i <= _nbOrientations; ++i) { + for (uint i = 0; i <= _nbOrientations; ++i) { if (_imagesPyramids[i] == nullptr) { cerr << "SteerableViewMap warning: orientation " << i << " of steerable View Map whas not been computed yet" << endl; diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 17447ced5e4..bbf9962b0e6 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -1003,11 +1003,11 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) } } -void ViewMapBuilder::BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, unsigned int sceneNumFaces) +void ViewMapBuilder::BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, uint sceneNumFaces) { _Grid->clear(); Vec3r size; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { size[i] = fabs(bbox.getMax()[i] - bbox.getMin()[i]); // let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells // intersections. @@ -1032,7 +1032,7 @@ ViewMap *ViewMapBuilder::BuildViewMap(WingedEdge &we, visibility_algo iAlgo, real epsilon, const BBox<Vec3r> &bbox, - unsigned int sceneNumFaces) + uint sceneNumFaces) { _ViewMap = new ViewMap; _currentId = 1; @@ -1435,7 +1435,7 @@ void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge &we, const BBox<Vec3r> &bbox, - unsigned int sceneNumFaces, + uint sceneNumFaces, visibility_algo iAlgo, real epsilon) { @@ -2270,7 +2270,7 @@ struct less_SVertex2D { { Vec3r A = x->point2D(); Vec3r B = y->point2D(); - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { if (fabs(A[i] - B[i]) < epsilon) { continue; } diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp index 8b9388caa86..8af34d5e0ac 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp @@ -500,7 +500,7 @@ WShape::WShape(WShape &iBrother) for (v = _VertexList.begin(); v != vend; ++v) { const vector<WEdge *> &vedgeList = (*v)->GetEdges(); vector<WEdge *> newvedgelist; - unsigned int i; + uint i; for (i = 0; i < vedgeList.size(); i++) { WEdge *current = vedgeList[i]; edgedata *currentvedata = (edgedata *)current->userdata; @@ -536,11 +536,11 @@ WShape::WShape(WShape &iBrother) fend = _FaceList.end(); for (f = _FaceList.begin(); f != fend; ++f) { - unsigned int i; + uint i; const vector<WOEdge *> &oedgeList = (*f)->getEdgeList(); vector<WOEdge *> newoedgelist; - unsigned int n = oedgeList.size(); + uint n = oedgeList.size(); for (i = 0; i < n; i++) { WOEdge *current = oedgeList[i]; oedgedata *currentoedata = (oedgedata *)current->userdata; diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp index b18d232dbbe..c60088a219f 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp @@ -18,7 +18,7 @@ namespace Freestyle { * * **********************************/ -unsigned int WXFaceLayer::Get0VertexIndex() const +uint WXFaceLayer::Get0VertexIndex() const { int i = 0; int nEdges = _pWXFace->numberOfEdges(); @@ -29,7 +29,7 @@ unsigned int WXFaceLayer::Get0VertexIndex() const } return -1; } -unsigned int WXFaceLayer::GetSmoothEdgeIndex() const +uint WXFaceLayer::GetSmoothEdgeIndex() const { int i = 0; int nEdges = _pWXFace->numberOfEdges(); diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp index 3a5cdbc663c..b1daedb0cd0 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp @@ -30,7 +30,7 @@ void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs) void WXEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, unsigned vsize) { WXVertex *vertex; - for (unsigned int i = 0; i < vsize; i += 3) { + for (uint i = 0; i < vsize; i += 3) { vertex = new WXVertex(Vec3f(vertices[i], vertices[i + 1], vertices[i + 2])); vertex->setId(i / 3); shape.AddVertex(vertex); diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index 0a3ab97717b..d1389ac17c1 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -65,8 +65,8 @@ void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform &UNUSED(transform) bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) { - unsigned int vsize = ifs.vsize(); - unsigned int nsize = ifs.nsize(); + uint vsize = ifs.vsize(); + uint nsize = ifs.nsize(); // soc unused - unsigned tsize = ifs.tsize(); const float *vertices = ifs.vertices(); @@ -117,21 +117,21 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) // create a WVertex for each vertex buildWVertices(shape, new_vertices, vsize); - const unsigned int *vindices = ifs.vindices(); - const unsigned int *nindices = ifs.nindices(); - const unsigned int *tindices = nullptr; + const uint *vindices = ifs.vindices(); + const uint *nindices = ifs.nindices(); + const uint *tindices = nullptr; if (ifs.tsize()) { tindices = ifs.tindices(); } - const unsigned int *mindices = nullptr; + const uint *mindices = nullptr; if (ifs.msize()) { mindices = ifs.mindices(); } - const unsigned int *numVertexPerFace = ifs.numVertexPerFaces(); - const unsigned int numfaces = ifs.numFaces(); + const uint *numVertexPerFace = ifs.numVertexPerFaces(); + const uint numfaces = ifs.numFaces(); - for (unsigned int index = 0; index < numfaces; index++) { + for (uint index = 0; index < numfaces; index++) { switch (faceStyle[index]) { case IndexedFaceSet::TRIANGLE_STRIP: buildTriangleStrip(new_vertices, @@ -231,7 +231,7 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) void WingedEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, unsigned vsize) { WVertex *vertex; - for (unsigned int i = 0; i < vsize; i += 3) { + for (uint i = 0; i < vsize; i += 3) { vertex = new WVertex(Vec3f(vertices[i], vertices[i + 1], vertices[i + 2])); vertex->setId(i / 3); shape.AddVertex(vertex); @@ -367,7 +367,7 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/, vector<bool> triangleFaceEdgeMarks; // Each triplet of vertices is considered as an independent triangle - for (unsigned int i = 0; i < nvertices / 3; i++) { + for (uint i = 0; i < nvertices / 3; i++) { triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i] / 3]); triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 1] / 3]); triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 2] / 3]); @@ -412,10 +412,10 @@ void WingedEdgeBuilder::transformVertices(const float *vertices, const float *v = vertices; float *pv = res; - for (unsigned int i = 0; i < vsize / 3; i++) { + for (uint i = 0; i < vsize / 3; i++) { HVec3r hv_tmp(v[0], v[1], v[2]); HVec3r hv(transform * hv_tmp); - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { pv[j] = hv[j] / hv[3]; } v += 3; @@ -431,10 +431,10 @@ void WingedEdgeBuilder::transformNormals(const float *normals, const float *n = normals; float *pn = res; - for (unsigned int i = 0; i < nsize / 3; i++) { + for (uint i = 0; i < nsize / 3; i++) { Vec3r hn(n[0], n[1], n[2]); hn = GeomUtils::rotateVector(transform, hn); - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { pn[j] = hn[j]; } n += 3; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c index 257184bae1e..e34e6fc43ea 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c @@ -108,8 +108,8 @@ void lineart_register_shadow_cuts(LineartData *ld, LineartEdge *e, LineartEdge * (e->v1->fbcoord[3] - la1 * (e->v1->fbcoord[3] - e->v2->fbcoord[3])); la2 = la2 * e->v2->fbcoord[3] / (e->v1->fbcoord[3] - la2 * (e->v1->fbcoord[3] - e->v2->fbcoord[3])); - unsigned char shadow_bits = (es->occlusion != 0) ? LRT_SHADOW_MASK_SHADED : - LRT_SHADOW_MASK_ILLUMINATED; + uchar shadow_bits = (es->occlusion != 0) ? LRT_SHADOW_MASK_SHADED : + LRT_SHADOW_MASK_ILLUMINATED; if (lineart_contour_viewed_from_dark_side(ld, e) && shadow_bits == LRT_SHADOW_MASK_ILLUMINATED) { diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_util.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_util.c index 95647f2dd75..a2e724d9ebe 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_util.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_util.c @@ -110,7 +110,7 @@ void *lineart_mem_acquire(LineartStaticMemPool *smp, size_t size) smpn = lineart_mem_new_static_pool(smp, size); } - ret = ((unsigned char *)smpn) + smpn->used_byte; + ret = ((uchar *)smpn) + smpn->used_byte; smpn->used_byte += size; @@ -128,7 +128,7 @@ void *lineart_mem_acquire_thread(LineartStaticMemPool *smp, size_t size) smpn = lineart_mem_new_static_pool(smp, size); } - ret = ((unsigned char *)smpn) + smpn->used_byte; + ret = ((uchar *)smpn) + smpn->used_byte; smpn->used_byte += size; diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index 4182ce75eac..62ec6c1b7da 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -148,9 +148,9 @@ void FrameBuffer::load_store_config_array(const GPULoadStore *load_store_actions } } -unsigned int FrameBuffer::get_bits_per_pixel() +uint FrameBuffer::get_bits_per_pixel() { - unsigned int total_bits = 0; + uint total_bits = 0; for (GPUAttachment &attachment : attachments_) { Texture *tex = reinterpret_cast<Texture *>(attachment.tex); if (tex != nullptr) { diff --git a/source/blender/gpu/intern/gpu_node_graph.c b/source/blender/gpu/intern/gpu_node_graph.c index 3ca2399a547..f02633621db 100644 --- a/source/blender/gpu/intern/gpu_node_graph.c +++ b/source/blender/gpu/intern/gpu_node_graph.c @@ -263,7 +263,7 @@ static int uniform_attr_sort_cmp(const void *a, const void *b) return (attr_a->use_dupli && !attr_b->use_dupli); } -static unsigned int uniform_attr_list_hash(const void *key) +static uint uniform_attr_list_hash(const void *key) { const GPUUniformAttrList *attrs = key; return attrs->hash_code; diff --git a/source/blender/gpu/intern/gpu_shader_builder_stubs.cc b/source/blender/gpu/intern/gpu_shader_builder_stubs.cc index db14d7fbeb9..28456e18354 100644 --- a/source/blender/gpu/intern/gpu_shader_builder_stubs.cc +++ b/source/blender/gpu/intern/gpu_shader_builder_stubs.cc @@ -86,7 +86,7 @@ void UI_GetThemeColorBlendShade4fv(int UNUSED(colorid1), void UI_GetThemeColorBlend3ubv(int UNUSED(colorid1), int UNUSED(colorid2), float UNUSED(fac), - unsigned char UNUSED(col[3])) + uchar UNUSED(col[3])) { BLI_assert_unreachable(); } @@ -94,7 +94,7 @@ void UI_GetThemeColorBlend3ubv(int UNUSED(colorid1), void UI_GetThemeColorShadeAlpha4ubv(int UNUSED(colorid), int UNUSED(coloffset), int UNUSED(alphaoffset), - unsigned char UNUSED(col[4])) + uchar UNUSED(col[4])) { BLI_assert_unreachable(); } @@ -149,7 +149,7 @@ void BKE_paint_face_set_overlay_color_get(const int UNUSED(face_set), BLI_assert_unreachable(); } -bool paint_is_grid_face_hidden(const unsigned int *UNUSED(grid_hidden), +bool paint_is_grid_face_hidden(const uint *UNUSED(grid_hidden), int UNUSED(gridsize), int UNUSED(x), int UNUSED(y)) diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index b9f7dd98073..8e3d4e7686f 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -60,7 +60,7 @@ using Vector3 = float[3]; using Vector4 = float[4]; struct IK_Target; using ErrorCallback = void (*)(const iTaSC::ConstraintValues *values, - unsigned int nvalues, + uint nvalues, IK_Target *iktarget); /* one structure for each target in the scene */ @@ -75,7 +75,7 @@ struct IK_Target { ErrorCallback errorCallback; std::string targetName; std::string constraintName; - unsigned short controlType; + ushort controlType; short channel; /* index in IK channel array of channel on which this target is defined */ short ee; /* end effector number */ bool simulation; /* true when simulation mode is used (update feedback) */ @@ -704,7 +704,7 @@ static bool base_callback(const iTaSC::Timestamp ×tamp, static bool copypose_callback(const iTaSC::Timestamp ×tamp, iTaSC::ConstraintValues *const _values, - unsigned int _nvalues, + uint _nvalues, void *_param) { IK_Target *iktarget = (IK_Target *)_param; @@ -749,7 +749,7 @@ static bool copypose_callback(const iTaSC::Timestamp ×tamp, } static void copypose_error(const iTaSC::ConstraintValues *values, - unsigned int nvalues, + uint nvalues, IK_Target *iktarget) { iTaSC::ConstraintSingleValue *value; @@ -776,7 +776,7 @@ static void copypose_error(const iTaSC::ConstraintValues *values, static bool distance_callback(const iTaSC::Timestamp ×tamp, iTaSC::ConstraintValues *const _values, - unsigned int _nvalues, + uint _nvalues, void *_param) { IK_Target *iktarget = (IK_Target *)_param; @@ -826,7 +826,7 @@ static bool distance_callback(const iTaSC::Timestamp ×tamp, } static void distance_error(const iTaSC::ConstraintValues *values, - unsigned int _nvalues, + uint _nvalues, IK_Target *iktarget) { iktarget->blenderConstraint->lin_error = (float)(values->values[0].y - values->values[0].yd); @@ -834,7 +834,7 @@ static void distance_error(const iTaSC::ConstraintValues *values, static bool joint_callback(const iTaSC::Timestamp ×tamp, iTaSC::ConstraintValues *const _values, - unsigned int _nvalues, + uint _nvalues, void *_param) { IK_Channel *ikchan = (IK_Channel *)_param; @@ -909,7 +909,7 @@ static bool joint_callback(const iTaSC::Timestamp ×tamp, break; } if (dof >= 0) { - for (unsigned int i = 0; i < _nvalues; i++, dof++) { + for (uint i = 0; i < _nvalues; i++, dof++) { _values[i].values[0].yd = ikchan->jointValue[dof]; _values[i].alpha = chan->ikrotweight; _values[i].feedback = ikparam->feedback; @@ -1139,7 +1139,7 @@ static IK_Scene *convert_tree( KDL::Frame initPose; Bone *bone; int a, numtarget; - unsigned int t; + uint t; float length; bool ret = true; double *rot; @@ -1512,7 +1512,7 @@ static IK_Scene *convert_tree( iktarget->bldepsgraph = depsgraph; condata = (bKinematicConstraint *)iktarget->blenderConstraint->data; pchan = tree->pchan[iktarget->channel]; - unsigned int controltype, bone_count; + uint controltype, bone_count; double bone_length; float mat[4][4]; diff --git a/source/blender/imbuf/intern/thumbs_font.c b/source/blender/imbuf/intern/thumbs_font.c index 0f18e9dd4cb..c3ed81698d9 100644 --- a/source/blender/imbuf/intern/thumbs_font.c +++ b/source/blender/imbuf/intern/thumbs_font.c @@ -19,7 +19,7 @@ /* Only change if we need to update the previews in the on-disk cache. */ #define FONT_THUMB_VERSION "1.0.0" -struct ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned int y) +struct ImBuf *IMB_thumb_load_font(const char *filename, uint x, uint y) { struct ImBuf *ibuf = IMB_allocImBuf(x, y, 32, IB_rect | IB_metadata); @@ -27,8 +27,7 @@ struct ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned const float col[4] = {1.0f, 1.0f, 1.0f, 0.0f}; IMB_rectfill(ibuf, col); - if (!BLF_thumb_preview( - filename, (unsigned char *)ibuf->rect, ibuf->x, ibuf->y, ibuf->channels)) { + if (!BLF_thumb_preview(filename, (uchar *)ibuf->rect, ibuf->x, ibuf->y, ibuf->channels)) { IMB_freeImBuf(ibuf); ibuf = NULL; } @@ -38,7 +37,7 @@ struct ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned bool IMB_thumb_load_font_get_hash(char *r_hash) { - unsigned char digest[16]; + uchar digest[16]; BLI_hash_md5_buffer(FONT_THUMB_VERSION, sizeof(FONT_THUMB_VERSION), digest); r_hash[0] = '\0'; BLI_hash_md5_to_hexdigest(digest, r_hash); diff --git a/source/blender/io/alembic/exporter/abc_archive.cc b/source/blender/io/alembic/exporter/abc_archive.cc index 9c8a36958d5..c4a4f129ecf 100644 --- a/source/blender/io/alembic/exporter/abc_archive.cc +++ b/source/blender/io/alembic/exporter/abc_archive.cc @@ -136,7 +136,7 @@ static TimeSamplingPtr create_time_sampling(double scene_fps, static void get_frames(double scene_fps, const AlembicExportParams ¶ms, - unsigned int nr_of_samples, + uint nr_of_samples, std::set<double> &r_frames) { /* Get one set of shutter samples, then add those around each frame to export. */ diff --git a/source/blender/io/alembic/exporter/abc_writer_hair.cc b/source/blender/io/alembic/exporter/abc_writer_hair.cc index 4f09aee3ea9..f872943ad5c 100644 --- a/source/blender/io/alembic/exporter/abc_writer_hair.cc +++ b/source/blender/io/alembic/exporter/abc_writer_hair.cc @@ -190,7 +190,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context, for (int n = 0; n < mesh->totface; n++) { MFace *face = &mface[n]; MTFace *tface = mtface + n; - unsigned int vtx[4]; + uint vtx[4]; vtx[0] = face->v1; vtx[1] = face->v2; vtx[2] = face->v3; diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc index 5494bfaa6e8..3349f9fc30b 100644 --- a/source/blender/io/alembic/intern/abc_customdata.cc +++ b/source/blender/io/alembic/intern/abc_customdata.cc @@ -322,14 +322,14 @@ static void read_uvs(const CDStreamConfig &config, MLoop *mloops = config.mloop; MLoopUV *mloopuvs = static_cast<MLoopUV *>(data); - unsigned int uv_index, loop_index, rev_loop_index; + uint uv_index, loop_index, rev_loop_index; BLI_assert(uv_scope != ABC_UV_SCOPE_NONE); const bool do_uvs_per_loop = (uv_scope == ABC_UV_SCOPE_LOOP); for (int i = 0; i < config.totpoly; i++) { MPoly &poly = mpolys[i]; - unsigned int rev_loop_offset = poly.loopstart + poly.totloop - 1; + uint rev_loop_offset = poly.loopstart + poly.totloop - 1; for (int f = 0; f < poly.totloop; f++) { rev_loop_index = rev_loop_offset - f; diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index c9fa307541a..6ddf55109ab 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -188,9 +188,9 @@ static void read_mpolys(CDStreamConfig &config, const AbcMeshData &mesh_data) const bool do_uvs = (mloopuvs && uvs && uvs_indices); const bool do_uvs_per_loop = do_uvs && mesh_data.uv_scope == ABC_UV_SCOPE_LOOP; BLI_assert(!do_uvs || mesh_data.uv_scope != ABC_UV_SCOPE_NONE); - unsigned int loop_index = 0; - unsigned int rev_loop_index = 0; - unsigned int uv_index = 0; + uint loop_index = 0; + uint rev_loop_index = 0; + uint uv_index = 0; bool seen_invalid_geometry = false; for (int i = 0; i < face_counts->size(); i++) { diff --git a/source/blender/io/avi/intern/avi.c b/source/blender/io/avi/intern/avi.c index 8bf4f8124a3..b4438bfb0a8 100644 --- a/source/blender/io/avi/intern/avi.c +++ b/source/blender/io/avi/intern/avi.c @@ -38,14 +38,14 @@ static char DEBUG_FCC[4]; (void)0 /* local functions */ -char *fcc_to_char(unsigned int fcc); -char *tcc_to_char(unsigned int tcc); +char *fcc_to_char(uint fcc); +char *tcc_to_char(uint tcc); /* implementation */ -unsigned int GET_FCC(FILE *fp) +uint GET_FCC(FILE *fp) { - unsigned char tmp[4]; + uchar tmp[4]; tmp[0] = getc(fp); tmp[1] = getc(fp); @@ -55,7 +55,7 @@ unsigned int GET_FCC(FILE *fp) return FCC(tmp); } -unsigned int GET_TCC(FILE *fp) +uint GET_TCC(FILE *fp) { char tmp[5]; @@ -67,7 +67,7 @@ unsigned int GET_TCC(FILE *fp) return FCC(tmp); } -char *fcc_to_char(unsigned int fcc) +char *fcc_to_char(uint fcc) { DEBUG_FCC[0] = (fcc)&127; DEBUG_FCC[1] = (fcc >> 8) & 127; @@ -77,7 +77,7 @@ char *fcc_to_char(unsigned int fcc) return DEBUG_FCC; } -char *tcc_to_char(unsigned int tcc) +char *tcc_to_char(uint tcc) { DEBUG_FCC[0] = (tcc)&127; DEBUG_FCC[1] = (tcc >> 8) & 127; diff --git a/source/blender/io/avi/intern/avi_mjpeg.c b/source/blender/io/avi/intern/avi_mjpeg.c index fb42274fef2..16417fd12f7 100644 --- a/source/blender/io/avi/intern/avi_mjpeg.c +++ b/source/blender/io/avi/intern/avi_mjpeg.c @@ -22,10 +22,8 @@ #include "avi_mjpeg.h" -static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, size_t bufsize); -static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, - const unsigned char *buffer, - size_t bufsize); +static void jpegmemdestmgr_build(j_compress_ptr cinfo, uchar *buffer, size_t bufsize); +static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, const uchar *buffer, size_t bufsize); static size_t numbytes; @@ -215,11 +213,7 @@ static void std_huff_tables(j_decompress_ptr dinfo) sizeof(val_ac_chrominance)); } -static int Decode_JPEG(unsigned char *inBuffer, - unsigned char *outBuffer, - unsigned int width, - unsigned int height, - size_t bufsize) +static int Decode_JPEG(uchar *inBuffer, uchar *outBuffer, uint width, uint height, size_t bufsize) { struct jpeg_decompress_struct dinfo; struct jpeg_error_mgr jerr; @@ -272,16 +266,12 @@ static int Decode_JPEG(unsigned char *inBuffer, return 1; } -static void Compress_JPEG(int quality, - unsigned char *outbuffer, - const unsigned char *inBuffer, - int width, - int height, - size_t bufsize) +static void Compress_JPEG( + int quality, uchar *outbuffer, const uchar *inBuffer, int width, int height, size_t bufsize) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; - unsigned char marker[60]; + uchar marker[60]; cinfo.err = jpeg_std_error(&jerr); jpeg_create_compress(&cinfo); @@ -339,7 +329,7 @@ static void Compress_JPEG(int quality, jpeg_destroy_compress(&cinfo); } -static void interlace(unsigned char *to, unsigned char *from, int width, int height) +static void interlace(uchar *to, uchar *from, int width, int height) { size_t i, rowstride = width * 3; diff --git a/source/blender/io/avi/intern/avi_rgb.c b/source/blender/io/avi/intern/avi_rgb.c index ffc3d0477fa..71022361df1 100644 --- a/source/blender/io/avi/intern/avi_rgb.c +++ b/source/blender/io/avi/intern/avi_rgb.c @@ -21,12 +21,9 @@ /* implementation */ -void *avi_converter_from_avi_rgb(AviMovie *movie, - int stream, - unsigned char *buffer, - const size_t *size) +void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, uchar *buffer, const size_t *size) { - unsigned char *buf; + uchar *buf; AviBitmapInfoHeader *bi; short bits = 32; @@ -38,24 +35,24 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, } if (bits == 16) { - unsigned short *pxl; - unsigned char *to; + ushort *pxl; + uchar *to; #ifdef __BIG_ENDIAN__ - unsigned char *pxla; + uchar *pxla; #endif buf = imb_alloc_pixels( - movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf"); + movie->header->Height, movie->header->Width, 3, sizeof(uchar), "fromavirgbbuf"); if (buf) { size_t y = movie->header->Height; to = buf; while (y--) { - pxl = (unsigned short *)(buffer + y * movie->header->Width * 2); + pxl = (ushort *)(buffer + y * movie->header->Width * 2); #ifdef __BIG_ENDIAN__ - pxla = (unsigned char *)pxl; + pxla = (uchar *)pxl; #endif size_t x = movie->header->Width; @@ -82,7 +79,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, } buf = imb_alloc_pixels( - movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf"); + movie->header->Height, movie->header->Width, 3, sizeof(uchar), "fromavirgbbuf"); if (buf) { size_t rowstride = movie->header->Width * 3; @@ -110,9 +107,9 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, return buf; } -void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) +void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, uchar *buffer, size_t *size) { - unsigned char *buf; + uchar *buf; (void)stream; /* unused */ diff --git a/source/blender/io/avi/intern/avi_rgb32.c b/source/blender/io/avi/intern/avi_rgb32.c index 84ae023fcdd..fcb83ffe47d 100644 --- a/source/blender/io/avi/intern/avi_rgb32.c +++ b/source/blender/io/avi/intern/avi_rgb32.c @@ -17,15 +17,15 @@ #include "AVI_avi.h" #include "avi_rgb32.h" -void *avi_converter_from_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) +void *avi_converter_from_rgb32(AviMovie *movie, int stream, uchar *buffer, size_t *size) { - unsigned char *buf; + uchar *buf; (void)stream; /* unused */ *size = (size_t)movie->header->Height * (size_t)movie->header->Width * 3; buf = imb_alloc_pixels( - movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromrgb32buf"); + movie->header->Height, movie->header->Width, 3, sizeof(uchar), "fromrgb32buf"); if (!buf) { return NULL; } @@ -46,16 +46,16 @@ void *avi_converter_from_rgb32(AviMovie *movie, int stream, unsigned char *buffe return buf; } -void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) +void *avi_converter_to_rgb32(AviMovie *movie, int stream, uchar *buffer, size_t *size) { - unsigned char *buf; - unsigned char *to, *from; + uchar *buf; + uchar *to, *from; (void)stream; /* unused */ *size = (size_t)movie->header->Height * (size_t)movie->header->Width * 4; buf = imb_alloc_pixels( - movie->header->Height, movie->header->Width, 4, sizeof(unsigned char), "torgb32buf"); + movie->header->Height, movie->header->Width, 4, sizeof(uchar), "torgb32buf"); if (!buf) { return NULL; } diff --git a/source/blender/io/collada/AnimationExporter.cpp b/source/blender/io/collada/AnimationExporter.cpp index 7df9df1f460..85e8ccf9f2a 100644 --- a/source/blender/io/collada/AnimationExporter.cpp +++ b/source/blender/io/collada/AnimationExporter.cpp @@ -687,7 +687,7 @@ std::string AnimationExporter::collada_interpolation_source(const BCAnimationCur std::vector<float> frames; curve.get_frames(frames); - for (unsigned int i = 0; i < curve.sample_count(); i++) { + for (uint i = 0; i < curve.sample_count(); i++) { float frame = frames[i]; int ipo = curve.get_interpolation_type(frame); if (ipo == BEZT_IPO_BEZ) { diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp index cc91c3eeac9..094f62e3c13 100644 --- a/source/blender/io/collada/AnimationImporter.cpp +++ b/source/blender/io/collada/AnimationImporter.cpp @@ -74,7 +74,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) float fps = (float)FPS; size_t dim = curve->getOutDimension(); - unsigned int i; + uint i; std::vector<FCurve *> &fcurves = curve_map[curve->getUniqueId()]; @@ -91,7 +91,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) fcu->array_index = 0; fcu->auto_smoothing = U.auto_smoothing_new; - for (unsigned int j = 0; j < curve->getKeyCount(); j++) { + for (uint j = 0; j < curve->getKeyCount(); j++) { BezTriple bez; memset(&bez, 0, sizeof(BezTriple)); @@ -106,7 +106,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) COLLADAFW::FloatOrDoubleArray &outtan = curve->getOutTangentValues(); /* In-tangent. */ - unsigned int index = 2 * (j * dim + i); + uint index = 2 * (j * dim + i); bez.vec[0][0] = bc_get_float_value(intan, index) * fps; bez.vec[0][1] = bc_get_float_value(intan, index + 1); @@ -148,7 +148,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) { - for (unsigned int i = 0; i < cu->totvert; i++) { + for (uint i = 0; i < cu->totvert; i++) { /* TODO: convert handles too. */ cu->bezt[i].vec[1][1] *= DEG2RADF(1.0f); cu->bezt[i].vec[0][1] *= DEG2RADF(1.0f); @@ -158,7 +158,7 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) void AnimationImporter::fcurve_scale(FCurve *cu, int scale) { - for (unsigned int i = 0; i < cu->totvert; i++) { + for (uint i = 0; i < cu->totvert; i++) { /* TODO: convert handles too. */ cu->bezt[i].vec[1][1] *= scale; cu->bezt[i].vec[0][1] *= scale; @@ -484,7 +484,7 @@ void AnimationImporter::find_frames(std::vector<float> *frames, std::vector<FCur for (iter = curves->begin(); iter != curves->end(); iter++) { FCurve *fcu = *iter; - for (unsigned int k = 0; k < fcu->totvert; k++) { + for (uint k = 0; k < fcu->totvert; k++) { /* get frame value from bezTriple */ float fra = fcu->bezt[k].vec[1][0]; /* if frame already not added add frame to frames */ @@ -649,7 +649,7 @@ void AnimationImporter::Assign_color_animations(const COLLADAFW::UniqueId &listi const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings(); /* all the curves belonging to the current binding */ std::vector<FCurve *> animcurves; - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; switch (bindings[j].animationClass) { @@ -699,7 +699,7 @@ void AnimationImporter::Assign_float_animations(const COLLADAFW::UniqueId &listi const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings(); /* all the curves belonging to the current binding */ std::vector<FCurve *> animcurves; - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; BLI_strncpy(rna_path, anim_type, sizeof(rna_path)); @@ -756,7 +756,7 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId &listid const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings(); /* all the curves belonging to the current binding */ std::vector<FCurve *> animcurves; - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; BLI_strncpy(rna_path, anim_type, sizeof(rna_path)); @@ -767,7 +767,7 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId &listid for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { FCurve *fcu = *iter; - for (unsigned int i = 0; i < fcu->totvert; i++) { + for (uint i = 0; i < fcu->totvert; i++) { fcu->bezt[i].vec[0][1] = convert_to_focal_length( fcu->bezt[i].vec[0][1], fov_type, aspect, cam->sensor_x); fcu->bezt[i].vec[1][1] = convert_to_focal_length( @@ -817,7 +817,7 @@ void AnimationImporter::apply_matrix_curves(Object *ob, } /* new curves to assign matrix transform animation */ FCurve *newcu[10]; /* if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale */ - unsigned int totcu = 10; + uint totcu = 10; const char *tm_str = nullptr; char rna_path[200]; for (int i = 0; i < totcu; i++) { @@ -1033,7 +1033,7 @@ void AnimationImporter::translate_Animations( const COLLADAFW::TransformationPointerArray &nodeTransforms = node->getTransformations(); /* for each transformation in node */ - for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) { + for (uint i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; COLLADAFW::Transformation::TransformationType tm_type = transform->getTransformationType(); @@ -1053,7 +1053,7 @@ void AnimationImporter::translate_Animations( animlist->getAnimationBindings(); /* all the curves belonging to the current binding */ std::vector<FCurve *> animcurves; - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; if (is_matrix) { apply_matrix_curves(ob, animcurves, root, node, transform); @@ -1092,7 +1092,7 @@ void AnimationImporter::translate_Animations( ListBase *AnimCurves = &(act->curves); const COLLADAFW::InstanceLightPointerArray &nodeLights = node->getInstanceLights(); - for (unsigned int i = 0; i < nodeLights.getCount(); i++) { + for (uint i = 0; i < nodeLights.getCount(); i++) { const COLLADAFW::Light *light = (COLLADAFW::Light *) FW_object_map[nodeLights[i]->getInstanciatedObjectId()]; @@ -1130,7 +1130,7 @@ void AnimationImporter::translate_Animations( ListBase *AnimCurves = &(act->curves); const COLLADAFW::InstanceCameraPointerArray &nodeCameras = node->getInstanceCameras(); - for (unsigned int i = 0; i < nodeCameras.getCount(); i++) { + for (uint i = 0; i < nodeCameras.getCount(); i++) { const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()]; @@ -1184,9 +1184,9 @@ void AnimationImporter::translate_Animations( } const COLLADAFW::InstanceGeometryPointerArray &nodeGeoms = node->getInstanceGeometries(); - for (unsigned int i = 0; i < nodeGeoms.getCount(); i++) { + for (uint i = 0; i < nodeGeoms.getCount(); i++) { const COLLADAFW::MaterialBindingArray &matBinds = nodeGeoms[i]->getMaterialBindings(); - for (unsigned int j = 0; j < matBinds.getCount(); j++) { + for (uint j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId &matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *)(FW_object_map[matuid]); if (ef != nullptr) { /* can be NULL T28909. */ @@ -1273,7 +1273,7 @@ void AnimationImporter::add_bone_animation_sampled(Object *ob, /* new curves to assign matrix transform animation */ FCurve *newcu[10]; /* if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale. */ - unsigned int totcu = 10; + uint totcu = 10; const char *tm_str = nullptr; char rna_path[200]; for (int i = 0; i < totcu; i++) { @@ -1381,7 +1381,7 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( const COLLADAFW::TransformationPointerArray &nodeTransforms = node->getTransformations(); /* for each transformation in node */ - for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) { + for (uint i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; const COLLADAFW::UniqueId &listid = transform->getAnimationList(); @@ -1395,7 +1395,7 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( } const COLLADAFW::InstanceLightPointerArray &nodeLights = node->getInstanceLights(); - for (unsigned int i = 0; i < nodeLights.getCount(); i++) { + for (uint i = 0; i < nodeLights.getCount(); i++) { const COLLADAFW::Light *light = (COLLADAFW::Light *) FW_object_map[nodeLights[i]->getInstanciatedObjectId()]; types->light = setAnimType(&(light->getColor()), (types->light), LIGHT_COLOR); @@ -1408,7 +1408,7 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( } const COLLADAFW::InstanceCameraPointerArray &nodeCameras = node->getInstanceCameras(); - for (unsigned int i = 0; i < nodeCameras.getCount(); i++) { + for (uint i = 0; i < nodeCameras.getCount(); i++) { const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()]; if (camera == nullptr) { @@ -1440,9 +1440,9 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( } const COLLADAFW::InstanceGeometryPointerArray &nodeGeoms = node->getInstanceGeometries(); - for (unsigned int i = 0; i < nodeGeoms.getCount(); i++) { + for (uint i = 0; i < nodeGeoms.getCount(); i++) { const COLLADAFW::MaterialBindingArray &matBinds = nodeGeoms[i]->getMaterialBindings(); - for (unsigned int j = 0; j < matBinds.getCount(); j++) { + for (uint j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId &matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *)(FW_object_map[matuid]); if (ef != nullptr) { /* can be NULL T28909. */ @@ -1490,7 +1490,7 @@ void AnimationImporter::find_frames_old(std::vector<float> *frames, /* for each <rotate>, <translate>, etc. there is a separate Transformation */ const COLLADAFW::TransformationPointerArray &nodeTransforms = node->getTransformations(); - unsigned int i; + uint i; /* find frames at which to sample plus convert all rotation keys to radians */ for (i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; @@ -1508,7 +1508,7 @@ void AnimationImporter::find_frames_old(std::vector<float> *frames, if (bindings.getCount()) { /* for each AnimationBinding get the fcurves which animate the transform */ - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { std::vector<FCurve *> &curves = curve_map[bindings[j].animation]; bool xyz = ((nodeTmType == COLLADAFW::Transformation::TRANSLATE || nodeTmType == COLLADAFW::Transformation::SCALE) && @@ -1525,7 +1525,7 @@ void AnimationImporter::find_frames_old(std::vector<float> *frames, fcurve_deg_to_rad(fcu); } - for (unsigned int k = 0; k < fcu->totvert; k++) { + for (uint k = 0; k < fcu->totvert; k++) { /* get frame value from bezTriple */ float fra = fcu->bezt[k].vec[1][0]; /* if frame already not added add frame to frames */ @@ -1573,7 +1573,7 @@ Object *AnimationImporter::translate_animation_OLD( find_frames_old(&frames, node, tm_type); - unsigned int i; + uint i; float irest_dae[4][4]; float rest[4][4], irest[4][4]; @@ -1632,7 +1632,7 @@ Object *AnimationImporter::translate_animation_OLD( /* new curves */ FCurve *newcu[10]; /* if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale */ - unsigned int totcu = is_matrix ? 10 : (is_rotation ? 4 : 3); + uint totcu = is_matrix ? 10 : (is_rotation ? 4 : 3); for (i = 0; i < totcu; i++) { @@ -1825,7 +1825,7 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], unit_m4(mat); - for (unsigned int i = 0; i < tms.getCount(); i++) { + for (uint i = 0; i < tms.getCount(); i++) { COLLADAFW::Transformation *tm = tms[i]; COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); float m[4][4]; @@ -1909,7 +1909,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, dae_translate_to_v3(tm, vec); } - for (unsigned int index = 0; index < bindings.getCount(); index++) { + for (uint index = 0; index < bindings.getCount(); index++) { const COLLADAFW::AnimationList::AnimationBinding &binding = bindings[index]; std::vector<FCurve *> &curves = curve_map[binding.animation]; COLLADAFW::AnimationList::AnimationClass animclass = binding.animationClass; @@ -2062,7 +2062,7 @@ bool AnimationImporter::calc_joint_parent_mat_rest(float mat[4][4], } COLLADAFW::NodePointerArray &children = node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { if (calc_joint_parent_mat_rest(mat, m, children[i], end)) { return true; } diff --git a/source/blender/io/collada/ArmatureImporter.cpp b/source/blender/io/collada/ArmatureImporter.cpp index c7db2356d20..a742ee3a1dd 100644 --- a/source/blender/io/collada/ArmatureImporter.cpp +++ b/source/blender/io/collada/ArmatureImporter.cpp @@ -190,7 +190,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::NodePointerArray &children = node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { int cl = create_bone(skin, children[i], bone, children.getCount(), mat, arm, layer_labels); if (cl > chain_length) { chain_length = cl; @@ -719,7 +719,7 @@ void ArmatureImporter::set_pose(Object *ob_arm, #endif COLLADAFW::NodePointerArray &children = root_node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { set_pose(ob_arm, children[i], bone_name, mat); } } @@ -727,7 +727,7 @@ void ArmatureImporter::set_pose(Object *ob_arm, bool ArmatureImporter::node_is_decomposed(const COLLADAFW::Node *node) { const COLLADAFW::TransformationPointerArray &nodeTransforms = node->getTransformations(); - for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) { + for (uint i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; COLLADAFW::Transformation::TransformationType tm_type = transform->getTransformationType(); if (tm_type == COLLADAFW::Transformation::MATRIX) { @@ -879,7 +879,7 @@ bool ArmatureImporter::write_skin_controller_data(const COLLADAFW::SkinControlle /* store join inv bind matrix to use it later in armature construction */ const COLLADAFW::Matrix4Array &inv_bind_mats = data->getInverseBindMatrices(); - for (unsigned int i = 0; i < data->getJointsCount(); i++) { + for (uint i = 0; i < data->getJointsCount(); i++) { skin.add_joint(inv_bind_mats[i]); } diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index 00c69a5fb8a..851e57bb750 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -213,7 +213,7 @@ void DocumentImporter::finish() /* Write nodes to scene */ fprintf(stderr, "+-- Import Scene --------\n"); const COLLADAFW::NodePointerArray &roots = (*sit)->getRootNodes(); - for (unsigned int i = 0; i < roots.getCount(); i++) { + for (uint i = 0; i < roots.getCount(); i++) { std::vector<Object *> *objects_done = write_node(roots[i], nullptr, sce, nullptr, false); objects_to_scale->insert( objects_to_scale->end(), objects_done->begin(), objects_done->end()); @@ -234,7 +234,7 @@ void DocumentImporter::finish() for (const COLLADAFW::VisualScene *vscene : vscenes) { const COLLADAFW::NodePointerArray &roots = vscene->getRootNodes(); - for (unsigned int i = 0; i < roots.getCount(); i++) { + for (uint i = 0; i < roots.getCount(); i++) { translate_anim_recursive(roots[i], nullptr, nullptr); } } @@ -292,7 +292,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, Object *ob; #endif - unsigned int i; + uint i; if (node->getType() == COLLADAFW::Node::JOINT && par == nullptr) { /* For Skeletons without root node we have to simulate the @@ -424,7 +424,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::NodePointerArray &children = source_node->getChildNodes(); if (children.getCount()) { - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { COLLADAFW::Node *child_node = children[i]; const COLLADAFW::UniqueId &child_id = child_node->getUniqueId(); if (object_map.find(child_id) == object_map.end()) { @@ -675,7 +675,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, ob = *objects_done->begin(); } - for (unsigned int i = 0; i < child_nodes.getCount(); i++) { + for (uint i = 0; i < child_nodes.getCount(); i++) { std::vector<Object *> *child_objects; child_objects = write_node(child_nodes[i], node, sce, ob, is_library_node); delete child_objects; @@ -720,7 +720,7 @@ bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryN const COLLADAFW::NodePointerArray &nodes = libraryNodes->getNodes(); fprintf(stderr, "+-- Read Library nodes ----------\n"); - for (unsigned int i = 0; i < nodes.getCount(); i++) { + for (uint i = 0; i < nodes.getCount(); i++) { std::vector<Object *> *child_objects; child_objects = write_node(nodes[i], nullptr, sce, nullptr, true); delete child_objects; @@ -1182,7 +1182,7 @@ bool DocumentImporter::addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *e bool DocumentImporter::is_armature(COLLADAFW::Node *node) { COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes(); - for (unsigned int i = 0; i < child_nodes.getCount(); i++) { + for (uint i = 0; i < child_nodes.getCount(); i++) { if (child_nodes[i]->getType() == COLLADAFW::Node::JOINT) { return true; } diff --git a/source/blender/io/collada/EffectExporter.cpp b/source/blender/io/collada/EffectExporter.cpp index 40ce20617fc..e8a715633e1 100644 --- a/source/blender/io/collada/EffectExporter.cpp +++ b/source/blender/io/collada/EffectExporter.cpp @@ -217,7 +217,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) create_image_samplers(ep, material_image_map, active_uv); #if 0 - unsigned int a, b; + uint a, b; for (a = 0, b = 0; a < tex_indices.size(); a++) { MTex *t = ma->mtex[tex_indices[a]]; Image *ima = t->tex->ima; diff --git a/source/blender/io/collada/ExtraHandler.cpp b/source/blender/io/collada/ExtraHandler.cpp index b281f0e1a0a..d9c193ddbb5 100644 --- a/source/blender/io/collada/ExtraHandler.cpp +++ b/source/blender/io/collada/ExtraHandler.cpp @@ -43,7 +43,7 @@ bool ExtraHandler::textData(const char *text, size_t textLength) } bool ExtraHandler::parseElement(const char *profileName, - const unsigned long &elementHash, + const ulong &elementHash, const COLLADAFW::UniqueId &uniqueId) { /* implement for backwards compatibility, new version added object parameter */ @@ -51,7 +51,7 @@ bool ExtraHandler::parseElement(const char *profileName, } bool ExtraHandler::parseElement(const char *profileName, - const unsigned long &elementHash, + const ulong &elementHash, const COLLADAFW::UniqueId &uniqueId, COLLADAFW::Object *object) { diff --git a/source/blender/io/collada/GeometryExporter.cpp b/source/blender/io/collada/GeometryExporter.cpp index e60900ccdb6..0e74c3ed516 100644 --- a/source/blender/io/collada/GeometryExporter.cpp +++ b/source/blender/io/collada/GeometryExporter.cpp @@ -203,7 +203,7 @@ void GeometryExporter::createLooseEdgeList(Object *ob, Mesh *me, std::string &ge const Span<MEdge> edges = me->edges(); int totedges = me->totedge; int edges_in_linelist = 0; - std::vector<unsigned int> edge_list; + std::vector<uint> edge_list; int index; /* Find all loose edges in Mesh @@ -244,7 +244,7 @@ void GeometryExporter::createLooseEdgeList(Object *ob, Mesh *me, std::string &ge static void prepareToAppendValues(bool is_triangulated, COLLADASW::PrimitivesBase &primitive_list, - std::vector<unsigned long> &vcount_list) + std::vector<ulong> &vcount_list) { /* performs the actual writing */ if (is_triangulated) { @@ -285,7 +285,7 @@ static COLLADASW::PrimitivesBase *create_primitive_list(bool is_triangulated, static bool collect_vertex_counts_per_poly(Mesh *me, int material_index, - std::vector<unsigned long> &vcount_list) + std::vector<ulong> &vcount_list) { const Span<MPoly> polys = me->polys(); const blender::bke::AttributeAccessor attributes = me->attributes(); @@ -325,7 +325,7 @@ void GeometryExporter::create_mesh_primitive_list(short material_index, const Span<MPoly> polys = me->polys(); const Span<MLoop> loops = me->loops(); - std::vector<unsigned long> vcount_list; + std::vector<ulong> vcount_list; bool is_triangulated = collect_vertex_counts_per_poly(me, material_index, vcount_list); int polygon_count = vcount_list.size(); @@ -585,7 +585,7 @@ void GeometryExporter::createNormalsSource(std::string geom_id, Mesh *me, std::v COLLADASW::FloatSourceF source(mSW); source.setId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL)); source.setArrayId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL) + ARRAY_ID_SUFFIX); - source.setAccessorCount((unsigned long)nor.size()); + source.setAccessorCount((ulong)nor.size()); source.setAccessorStride(3); COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); param.push_back("X"); @@ -612,7 +612,7 @@ void GeometryExporter::create_normals(std::vector<Normal> &normals, std::vector<BCPolygonNormalsIndices> &polygons_normals, Mesh *me) { - std::map<Normal, unsigned int> shared_normal_indices; + std::map<Normal, uint> shared_normal_indices; int last_normal_index = -1; const Span<MVert> verts = me->verts(); @@ -645,7 +645,7 @@ void GeometryExporter::create_normals(std::vector<Normal> &normals, BCPolygonNormalsIndices poly_indices; for (int loop_index = 0; loop_index < mpoly->totloop; loop_index++) { - unsigned int loop_idx = mpoly->loopstart + loop_index; + uint loop_idx = mpoly->loopstart + loop_index; if (use_vertex_normals) { float normalized[3]; diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp index 4b7c4275568..fea57698261 100644 --- a/source/blender/io/collada/MeshImporter.cpp +++ b/source/blender/io/collada/MeshImporter.cpp @@ -208,7 +208,7 @@ MeshImporter::MeshImporter(UnitConverter *unitconv, } bool MeshImporter::set_poly_indices( - MPoly *mpoly, MLoop *mloop, int loop_index, const unsigned int *indices, int loop_count) + MPoly *mpoly, MLoop *mloop, int loop_index, const uint *indices, int loop_count) { mpoly->loopstart = loop_index; mpoly->totloop = loop_count; @@ -276,7 +276,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) const std::string &name = bc_get_dae_name(mesh); - for (unsigned int i = 0; i < prim_arr.getCount(); i++) { + for (uint i = 0; i < prim_arr.getCount(); i++) { COLLADAFW::MeshPrimitive *mp = prim_arr[i]; COLLADAFW::MeshPrimitive::PrimitiveType type = mp->getPrimitiveType(); @@ -292,7 +292,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) int hole_count = 0; int nonface_count = 0; - for (unsigned int j = 0; j < vca.getCount(); j++) { + for (uint j = 0; j < vca.getCount(); j++) { int count = vca[j]; if (abs(count) < 3) { nonface_count++; @@ -455,7 +455,7 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) CustomData_add_layer(&me->pdata, CD_MPOLY, CD_SET_DEFAULT, nullptr, me->totpoly); CustomData_add_layer(&me->ldata, CD_MLOOP, CD_SET_DEFAULT, nullptr, me->totloop); - unsigned int totuvset = collada_mesh->getUVCoords().getInputInfosArray().getCount(); + uint totuvset = collada_mesh->getUVCoords().getInputInfosArray().getCount(); for (int i = 0; i < totuvset; i++) { if (collada_mesh->getUVCoords().getLength(i) == 0) { totuvset = 0; @@ -490,7 +490,7 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) } } -unsigned int MeshImporter::get_vertex_count(COLLADAFW::Polygons *mp, int index) +uint MeshImporter::get_vertex_count(COLLADAFW::Polygons *mp, int index) { int type = mp->getPrimitiveType(); int result; @@ -513,7 +513,7 @@ unsigned int MeshImporter::get_vertex_count(COLLADAFW::Polygons *mp, int index) return result; } -unsigned int MeshImporter::get_loose_edge_count(COLLADAFW::Mesh *mesh) +uint MeshImporter::get_loose_edge_count(COLLADAFW::Mesh *mesh) { COLLADAFW::MeshPrimitiveArray &prim_arr = mesh->getMeshPrimitives(); int loose_edge_count = 0; @@ -571,11 +571,11 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len) void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me) { - unsigned int loose_edge_count = get_loose_edge_count(mesh); + uint loose_edge_count = get_loose_edge_count(mesh); if (loose_edge_count > 0) { - unsigned int face_edge_count = me->totedge; - /* unsigned int total_edge_count = loose_edge_count + face_edge_count; */ /* UNUSED */ + uint face_edge_count = me->totedge; + /* uint total_edge_count = loose_edge_count + face_edge_count; */ /* UNUSED */ mesh_add_edges(me, loose_edge_count); MutableSpan<MEdge> edges = me->edges_for_write(); @@ -588,8 +588,8 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me) int type = mp->getPrimitiveType(); if (type == COLLADAFW::MeshPrimitive::LINES) { - unsigned int edge_count = mp->getFaceCount(); - unsigned int *indices = mp->getPositionIndices().getData(); + uint edge_count = mp->getFaceCount(); + uint *indices = mp->getPositionIndices().getData(); for (int j = 0; j < edge_count; j++, med++) { med->flag |= ME_LOOSEEDGE; @@ -605,7 +605,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me, blender::Vector<blender::float3> &loop_normals) { - unsigned int i; + uint i; allocate_poly_data(collada_mesh, me); @@ -632,8 +632,8 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, /* faces */ size_t prim_totpoly = mp->getFaceCount(); - unsigned int *position_indices = mp->getPositionIndices().getData(); - unsigned int *normal_indices = mp->getNormalIndices().getData(); + uint *position_indices = mp->getPositionIndices().getData(); + uint *normal_indices = mp->getNormalIndices().getData(); bool mp_has_normals = primitive_has_useable_normals(mp); bool mp_has_faces = primitive_has_faces(mp); @@ -649,22 +649,21 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, * XXX In particular the handling of the normal_indices is very wrong */ /* TODO: UV, vertex color and custom normal support */ if (collada_meshtype == COLLADAFW::MeshPrimitive::TRIANGLE_FANS) { - unsigned int grouped_vertex_count = mp->getGroupedVertexElementsCount(); - for (unsigned int group_index = 0; group_index < grouped_vertex_count; group_index++) { - unsigned int first_vertex = position_indices[0]; /* Store first trifan vertex */ - unsigned int first_normal = normal_indices[0]; /* Store first trifan vertex normal */ - unsigned int vertex_count = mp->getGroupedVerticesVertexCount(group_index); + uint grouped_vertex_count = mp->getGroupedVertexElementsCount(); + for (uint group_index = 0; group_index < grouped_vertex_count; group_index++) { + uint first_vertex = position_indices[0]; /* Store first trifan vertex */ + uint first_normal = normal_indices[0]; /* Store first trifan vertex normal */ + uint vertex_count = mp->getGroupedVerticesVertexCount(group_index); - for (unsigned int vertex_index = 0; vertex_index < vertex_count - 2; vertex_index++) { + for (uint vertex_index = 0; vertex_index < vertex_count - 2; vertex_index++) { /* For each triangle store indices of its 3 vertices */ - unsigned int triangle_vertex_indices[3] = { + uint triangle_vertex_indices[3] = { first_vertex, position_indices[1], position_indices[2]}; set_poly_indices(mpoly, mloop, loop_index, triangle_vertex_indices, 3); if (mp_has_normals) { /* vertex normals, same implementation as for the triangles */ /* The same for vertices normals. */ - unsigned int vertex_normal_indices[3] = { - first_normal, normal_indices[1], normal_indices[2]}; + uint vertex_normal_indices[3] = {first_normal, normal_indices[1], normal_indices[2]}; if (!is_flat_face(vertex_normal_indices, nor, 3)) { mpoly->flag |= ME_SMOOTH; } @@ -693,13 +692,13 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, collada_meshtype == COLLADAFW::MeshPrimitive::POLYGONS || collada_meshtype == COLLADAFW::MeshPrimitive::TRIANGLES) { COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp; - unsigned int start_index = 0; + uint start_index = 0; COLLADAFW::IndexListArray &index_list_array_uvcoord = mp->getUVCoordIndicesArray(); COLLADAFW::IndexListArray &index_list_array_vcolor = mp->getColorIndicesArray(); int invalid_loop_holes = 0; - for (unsigned int j = 0; j < prim_totpoly; j++) { + for (uint j = 0; j < prim_totpoly; j++) { /* Vertices in polygon: */ int vcount = get_vertex_count(mpvc, j); @@ -712,7 +711,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, invalid_loop_holes += 1; } - for (unsigned int uvset_index = 0; uvset_index < index_list_array_uvcoord.getCount(); + for (uint uvset_index = 0; uvset_index < index_list_array_uvcoord.getCount(); uvset_index++) { /* get mtface by face index and uv set index */ COLLADAFW::IndexList &index_list = *index_list_array_uvcoord[uvset_index]; @@ -743,7 +742,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, if (use_custom_normals) { /* Store the custom normals for later application. */ float vert_normal[3]; - unsigned int *cur_normal = normal_indices; + uint *cur_normal = normal_indices; for (int k = 0; k < vcount; k++, cur_normal++) { get_vector(vert_normal, nor, *cur_normal, 3); normalize_v3(vert_normal); @@ -755,7 +754,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, if (mp->hasColorIndices()) { int vcolor_count = index_list_array_vcolor.getCount(); - for (unsigned int vcolor_index = 0; vcolor_index < vcolor_count; vcolor_index++) { + for (uint vcolor_index = 0; vcolor_index < vcolor_count; vcolor_index++) { COLLADAFW::IndexList &color_index_list = *mp->getColorIndices(vcolor_index); COLLADAFW::String colname = extract_vcolname(color_index_list.getName()); @@ -847,7 +846,7 @@ void MeshImporter::get_vector(float v[3], COLLADAFW::MeshVertexData &arr, int i, } } -bool MeshImporter::is_flat_face(unsigned int *nind, COLLADAFW::MeshVertexData &nor, int count) +bool MeshImporter::is_flat_face(uint *nind, COLLADAFW::MeshVertexData &nor, int count) { float a[3], b[3]; @@ -1107,7 +1106,7 @@ Object *MeshImporter::create_mesh_object( COLLADAFW::MaterialBindingArray &mat_array = geom->getMaterialBindings(); /* loop through geom's materials */ - for (unsigned int i = 0; i < mat_array.getCount(); i++) { + for (uint i = 0; i < mat_array.getCount(); i++) { if (mat_array[i].getReferencedMaterial().isValid()) { assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid, i); diff --git a/source/blender/io/collada/SkinInfo.cpp b/source/blender/io/collada/SkinInfo.cpp index 8144e0a499d..0654bae3730 100644 --- a/source/blender/io/collada/SkinInfo.cpp +++ b/source/blender/io/collada/SkinInfo.cpp @@ -77,7 +77,7 @@ void SkinInfo::transfer_int_array_data_const(const COLLADAFW::IntValuesArray &sr void SkinInfo::transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray &src, COLLADAFW::UIntValuesArray &dest) { - dest.setData((unsigned int *)src.getData(), src.getCount()); + dest.setData((uint *)src.getData(), src.getCount()); dest.yieldOwnerShip(); } @@ -90,7 +90,7 @@ void SkinInfo::borrow_skin_controller_data(const COLLADAFW::SkinControllerData * /* cannot transfer data for FloatOrDoubleArray, copy values manually */ const COLLADAFW::FloatOrDoubleArray &weight = skin->getWeights(); - for (unsigned int i = 0; i < weight.getValuesCount(); i++) { + for (uint i = 0; i < weight.getValuesCount(); i++) { weights.push_back(bc_get_float_value(weight, i)); } @@ -118,7 +118,7 @@ void SkinInfo::set_controller(const COLLADAFW::SkinController *co) /* fill in joint UIDs */ const COLLADAFW::UniqueIdArray &joint_uids = co->getJoints(); - for (unsigned int i = 0; i < joint_uids.getCount(); i++) { + for (uint i = 0; i < joint_uids.getCount(); i++) { joint_data[i].joint_uid = joint_uids[i]; /* store armature pointer */ @@ -181,7 +181,7 @@ bool SkinInfo::uses_joint_or_descendant(COLLADAFW::Node *node) } COLLADAFW::NodePointerArray &children = node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { if (uses_joint_or_descendant(children[i])) { return true; } @@ -254,9 +254,9 @@ void SkinInfo::link_armature(bContext *C, * * get def group by index with BLI_findlink */ - for (unsigned int vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) { + for (uint vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) { - unsigned int limit = weight + joints_per_vertex[vertex]; + uint limit = weight + joints_per_vertex[vertex]; for (; weight < limit; weight++) { int joint = joint_indices[weight], joint_weight = weight_indices[weight]; @@ -319,7 +319,7 @@ bool SkinInfo::find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_ro } COLLADAFW::NodePointerArray &children = tree_root->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { if (find_node_in_tree(node, children[i])) { return true; } diff --git a/source/blender/io/collada/TransformReader.cpp b/source/blender/io/collada/TransformReader.cpp index e5872c28bce..47deddb5feb 100644 --- a/source/blender/io/collada/TransformReader.cpp +++ b/source/blender/io/collada/TransformReader.cpp @@ -33,7 +33,7 @@ void TransformReader::get_node_mat(float mat[4][4], unit_m4(mat); - for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) { + for (uint i = 0; i < node->getTransformations().getCount(); i++) { COLLADAFW::Transformation *tm = node->getTransformations()[i]; COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); diff --git a/source/blender/io/collada/collada_internal.cpp b/source/blender/io/collada/collada_internal.cpp index da9a4cd4a9b..c4f13f1cbd2 100644 --- a/source/blender/io/collada/collada_internal.cpp +++ b/source/blender/io/collada/collada_internal.cpp @@ -153,7 +153,7 @@ void UnitConverter::calculate_scale(Scene &sce) * The COLLADA spec also allows additional chars for member access ('.'), these * must obviously be removed too, otherwise they would be heavily misinterpreted. */ -const unsigned char translate_start_name_map[256] = { +const uchar translate_start_name_map[256] = { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, @@ -172,7 +172,7 @@ const unsigned char translate_start_name_map[256] = { 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, }; -const unsigned char translate_name_map[256] = { +const uchar translate_name_map[256] = { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, @@ -212,16 +212,16 @@ std::string translate_id(const std::string &id) } std::string id_translated = id; - id_translated[0] = translate_start_name_map[(unsigned int)id_translated[0]]; - for (unsigned int i = 1; i < id_translated.size(); i++) { - id_translated[i] = translate_name_map[(unsigned int)id_translated[i]]; + id_translated[0] = translate_start_name_map[(uint)id_translated[0]]; + for (uint i = 1; i < id_translated.size(); i++) { + id_translated[i] = translate_name_map[(uint)id_translated[i]]; } /* It's so much workload now, the if () should speed up things. */ if (id_translated != id) { /* Search duplicates. */ map_string_list::iterator iter = global_id_map.find(id_translated); if (iter != global_id_map.end()) { - unsigned int i = 0; + uint i = 0; bool found = false; for (i = 0; i < iter->second.size(); i++) { if (id == iter->second[i]) { diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index 03bc14c6d13..bfa150faf8b 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -66,7 +66,7 @@ #include "ExportSettings.h" #include "collada_utils.h" -float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray &array, unsigned int index) +float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray &array, uint index) { if (index >= array.getValuesCount()) { return 0.0f; diff --git a/source/blender/io/gpencil/intern/gpencil_io_import_svg.cc b/source/blender/io/gpencil/intern/gpencil_io_import_svg.cc index 06460a1beba..ebad236bada 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_import_svg.cc +++ b/source/blender/io/gpencil/intern/gpencil_io_import_svg.cc @@ -212,9 +212,9 @@ void GpencilImporterSVG::create_stroke(bGPdata *gpd, } /* Unpack internal NanoSVG color. */ -static void unpack_nano_color(const unsigned int pack, float r_col[4]) +static void unpack_nano_color(const uint pack, float r_col[4]) { - unsigned char rgb_u[4]; + uchar rgb_u[4]; rgb_u[0] = ((pack) >> 0) & 0xFF; rgb_u[1] = ((pack) >> 8) & 0xFF; diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc index 7cb4c65f166..e76b9d3283b 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.cc +++ b/source/blender/io/usd/intern/usd_reader_mesh.cc @@ -342,9 +342,9 @@ void USDMeshReader::read_mpolys(Mesh *mesh) void USDMeshReader::read_uvs(Mesh *mesh, const double motionSampleTime, const bool load_uvs) { - unsigned int loop_index = 0; - unsigned int rev_loop_index = 0; - unsigned int uv_index = 0; + uint loop_index = 0; + uint rev_loop_index = 0; + uint uv_index = 0; const CustomData *ldata = &mesh->ldata; diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc index f8c7da75a70..851358f8762 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc @@ -153,7 +153,7 @@ static std::string get_image_filepath(const bNode *tex_node) if (tex_image->source == IMA_SRC_SEQUENCE) { char head[FILE_MAX], tail[FILE_MAX]; - unsigned short numlen; + ushort numlen; int framenr = static_cast<NodeTexImage *>(tex_node->storage)->iuser.framenr; BLI_path_sequence_decode(path, head, tail, &numlen); BLI_path_sequence_encode(path, head, tail, numlen, framenr); diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc index efa6473b494..56fe81181e3 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc @@ -106,7 +106,7 @@ static void geom_add_mrgb_colors(const char *p, const char *end, GlobalVertices if (ELEM(res.ec, std::errc::invalid_argument, std::errc::result_out_of_range)) { return; } - unsigned char srgb[4]; + uchar srgb[4]; srgb[0] = (value >> 16) & 0xFF; srgb[1] = (value >> 8) & 0xFF; srgb[2] = value & 0xFF; diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 1b424756b0a..42df7912e3a 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -210,7 +210,7 @@ static int dna_struct_find_nr_ex_impl( #endif /* Regular args. */ const char *str, - unsigned int *index_last) + uint *index_last) { if (*index_last < structs_len) { const SDNA_Struct *struct_info = structs[*index_last]; @@ -242,7 +242,7 @@ static int dna_struct_find_nr_ex_impl( return -1; } -int DNA_struct_find_nr_ex(const SDNA *sdna, const char *str, unsigned int *index_last) +int DNA_struct_find_nr_ex(const SDNA *sdna, const char *str, uint *index_last) { return dna_struct_find_nr_ex_impl( /* Expand SDNA. */ @@ -258,7 +258,7 @@ int DNA_struct_find_nr_ex(const SDNA *sdna, const char *str, unsigned int *index index_last); } -int DNA_struct_alias_find_nr_ex(const SDNA *sdna, const char *str, unsigned int *index_last) +int DNA_struct_alias_find_nr_ex(const SDNA *sdna, const char *str, uint *index_last) { #ifdef WITH_DNA_GHASH BLI_assert(sdna->alias.structs_map != NULL); @@ -279,13 +279,13 @@ int DNA_struct_alias_find_nr_ex(const SDNA *sdna, const char *str, unsigned int int DNA_struct_find_nr(const SDNA *sdna, const char *str) { - unsigned int index_last_dummy = UINT_MAX; + uint index_last_dummy = UINT_MAX; return DNA_struct_find_nr_ex(sdna, str, &index_last_dummy); } int DNA_struct_alias_find_nr(const SDNA *sdna, const char *str) { - unsigned int index_last_dummy = UINT_MAX; + uint index_last_dummy = UINT_MAX; return DNA_struct_alias_find_nr_ex(sdna, str, &index_last_dummy); } @@ -741,7 +741,7 @@ static void cast_primitive_type(const eSDNA_Type old_type, break; } case SDNA_TYPE_USHORT: { - const ushort value = *((unsigned short *)old_data); + const ushort value = *((ushort *)old_data); old_value_i = value; old_value_f = (double)value; break; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index a7b8488c371..9cb501a6403 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3904,7 +3904,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr } case PROP_BOOLEAN: { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; - unsigned int i; + uint i; if (prop->arraydimension && prop->totarraylength) { fprintf(f, @@ -3932,7 +3932,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr } case PROP_INT: { IntPropertyRNA *iprop = (IntPropertyRNA *)prop; - unsigned int i; + uint i; if (prop->arraydimension && prop->totarraylength) { fprintf(f, @@ -3960,7 +3960,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr } case PROP_FLOAT: { FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; - unsigned int i; + uint i; if (prop->arraydimension && prop->totarraylength) { fprintf(f, diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index e6135848b85..2609c76f3b1 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -777,10 +777,10 @@ bool RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test) return found; } -unsigned int RNA_struct_count_properties(StructRNA *srna) +uint RNA_struct_count_properties(StructRNA *srna) { PointerRNA struct_ptr; - unsigned int counter = 0; + uint counter = 0; RNA_pointer_create(NULL, srna, NULL, &struct_ptr); @@ -1744,9 +1744,9 @@ int RNA_enum_from_value(const EnumPropertyItem *item, const int value) return -1; } -unsigned int RNA_enum_items_count(const EnumPropertyItem *item) +uint RNA_enum_items_count(const EnumPropertyItem *item) { - unsigned int i = 0; + uint i = 0; while (item->identifier) { item++; diff --git a/source/blender/render/intern/bake.c b/source/blender/render/intern/bake.c index c383d13e4e1..59719fb4590 100644 --- a/source/blender/render/intern/bake.c +++ b/source/blender/render/intern/bake.c @@ -456,7 +456,7 @@ static TriTessFace *mesh_calc_tri_tessface(Mesh *me, bool tangent, Mesh *me_eval TriTessFace *triangles; /* calculate normal for each polygon only once */ - unsigned int mpoly_prev = UINT_MAX; + uint mpoly_prev = UINT_MAX; float no[3]; const MVert *verts = BKE_mesh_verts(me); diff --git a/source/blender/render/intern/pipeline.cc b/source/blender/render/intern/pipeline.cc index 3c9849591f4..74db967885c 100644 --- a/source/blender/render/intern/pipeline.cc +++ b/source/blender/render/intern/pipeline.cc @@ -475,7 +475,7 @@ void RE_ReleaseResultImage(Render *re) } } -void RE_ResultGet32(Render *re, unsigned int *rect) +void RE_ResultGet32(Render *re, uint *rect) { RenderResult rres; const int view_id = BKE_scene_multiview_view_id_get(&re->r, re->viewname); @@ -491,10 +491,7 @@ void RE_ResultGet32(Render *re, unsigned int *rect) RE_ReleaseResultImageViews(re, &rres); } -void RE_AcquiredResultGet32(Render *re, - RenderResult *result, - unsigned int *rect, - const int view_id) +void RE_AcquiredResultGet32(Render *re, RenderResult *result, uint *rect, const int view_id) { render_result_rect_get_pixels(result, rect, @@ -1241,7 +1238,7 @@ static void renderresult_stampinfo(Render *re) BKE_image_stamp_buf(re->scene, ob_camera_eval, (re->r.stamp & R_STAMP_STRIPMETA) ? rres.stamp_data : nullptr, - (unsigned char *)rres.rect32, + (uchar *)rres.rect32, rres.rectf, rres.rectx, rres.recty, diff --git a/source/blender/render/intern/render_result.cc b/source/blender/render/intern/render_result.cc index 8b7a07e2b3f..c628ed8d6fb 100644 --- a/source/blender/render/intern/render_result.cc +++ b/source/blender/render/intern/render_result.cc @@ -654,8 +654,8 @@ static int order_render_passes(const void *a, const void *b) /* 1 if `a` is after `b`. */ RenderPass *rpa = (RenderPass *)a; RenderPass *rpb = (RenderPass *)b; - unsigned int passtype_a = passtype_from_name(rpa->name); - unsigned int passtype_b = passtype_from_name(rpb->name); + uint passtype_a = passtype_from_name(rpa->name); + uint passtype_b = passtype_from_name(rpb->name); /* Render passes with default type always go first. */ if (passtype_b && !passtype_a) { @@ -1026,7 +1026,7 @@ ImBuf *RE_render_result_rect_to_ibuf(RenderResult *rr, RenderView *rv = RE_RenderViewGetById(rr, view_id); /* if not exists, BKE_imbuf_write makes one */ - ibuf->rect = (unsigned int *)rv->rect32; + ibuf->rect = (uint *)rv->rect32; ibuf->rect_float = rv->rectf; ibuf->zbuf_float = rv->rectz; @@ -1112,7 +1112,7 @@ void render_result_rect_fill_zero(RenderResult *rr, const int view_id) } void render_result_rect_get_pixels(RenderResult *rr, - unsigned int *rect, + uint *rect, int rectx, int recty, const ColorManagedViewSettings *view_settings, @@ -1125,14 +1125,8 @@ void render_result_rect_get_pixels(RenderResult *rr, memcpy(rect, rv->rect32, sizeof(int) * rr->rectx * rr->recty); } else if (rv && rv->rectf) { - IMB_display_buffer_transform_apply((unsigned char *)rect, - rv->rectf, - rr->rectx, - rr->recty, - 4, - view_settings, - display_settings, - true); + IMB_display_buffer_transform_apply( + (uchar *)rect, rv->rectf, rr->rectx, rr->recty, 4, view_settings, display_settings, true); } else { /* else fill with black */ diff --git a/source/blender/sequencer/intern/animation.c b/source/blender/sequencer/intern/animation.c index b8b2dda4690..280d2177d89 100644 --- a/source/blender/sequencer/intern/animation.c +++ b/source/blender/sequencer/intern/animation.c @@ -75,7 +75,7 @@ void SEQ_offset_animdata(Scene *scene, Sequence *seq, int ofs) } GSET_FOREACH_BEGIN (FCurve *, fcu, fcurves) { - unsigned int i; + uint i; if (fcu->bezt) { for (i = 0; i < fcu->totvert; i++) { BezTriple *bezt = &fcu->bezt[i]; diff --git a/source/blender/sequencer/intern/disk_cache.c b/source/blender/sequencer/intern/disk_cache.c index 37830205588..1f52d2ea41b 100644 --- a/source/blender/sequencer/intern/disk_cache.c +++ b/source/blender/sequencer/intern/disk_cache.c @@ -69,7 +69,7 @@ #define COLORSPACE_NAME_MAX 64 /* XXX: defined in IMB intern. */ typedef struct DiskCacheHeaderEntry { - unsigned char encoding; + uchar encoding; uint64_t frameno; uint64_t size_compressed; uint64_t size_raw; diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index cab77d93be7..7de18d9b20b 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -71,22 +71,22 @@ static void slice_get_byte_buffers(const SeqRenderData *context, const ImBuf *ibuf3, const ImBuf *out, int start_line, - unsigned char **rect1, - unsigned char **rect2, - unsigned char **rect3, - unsigned char **rect_out) + uchar **rect1, + uchar **rect2, + uchar **rect3, + uchar **rect_out) { int offset = 4 * start_line * context->rectx; - *rect1 = (unsigned char *)ibuf1->rect + offset; - *rect_out = (unsigned char *)out->rect + offset; + *rect1 = (uchar *)ibuf1->rect + offset; + *rect_out = (uchar *)out->rect + offset; if (ibuf2) { - *rect2 = (unsigned char *)ibuf2->rect + offset; + *rect2 = (uchar *)ibuf2->rect + offset; } if (ibuf3) { - *rect3 = (unsigned char *)ibuf3->rect + offset; + *rect3 = (uchar *)ibuf3->rect + offset; } } @@ -205,11 +205,11 @@ static void init_alpha_over_or_under(Sequence *seq) } static void do_alphaover_effect_byte( - float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) + float fac, int x, int y, uchar *rect1, uchar *rect2, uchar *out) { - unsigned char *cp1 = rect1; - unsigned char *cp2 = rect2; - unsigned char *rt = out; + uchar *cp1 = rect1; + uchar *cp2 = rect2; + uchar *rt = out; for (int i = 0; i < y; i++) { for (int j = 0; j < x; j++) { @@ -222,10 +222,10 @@ static void do_alphaover_effect_byte( float mfac = 1.0f - fac * rt1[3]; if (fac <= 0.0f) { - *((unsigned int *)rt) = *((unsigned int *)cp2); + *((uint *)rt) = *((uint *)cp2); } else if (mfac <= 0.0f) { - *((unsigned int *)rt) = *((unsigned int *)cp1); + *((uint *)rt) = *((uint *)cp1); } else { tempc[0] = fac * rt1[0] + mfac * rt2[0]; @@ -294,7 +294,7 @@ static void do_alphaover_effect(const SeqRenderData *context, do_alphaover_effect_float(fac, context->rectx, total_lines, 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); @@ -310,11 +310,11 @@ static void do_alphaover_effect(const SeqRenderData *context, * \{ */ static void do_alphaunder_effect_byte( - float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) + float fac, int x, int y, uchar *rect1, uchar *rect2, uchar *out) { - unsigned char *cp1 = rect1; - unsigned char *cp2 = rect2; - unsigned char *rt = out; + uchar *cp1 = rect1; + uchar *cp2 = rect2; + uchar *rt = out; for (int i = 0; i < y; i++) { for (int j = 0; j < x; j++) { @@ -328,16 +328,16 @@ static void do_alphaunder_effect_byte( * 'skybuf' can be crossed in */ if (rt2[3] <= 0.0f && fac >= 1.0f) { - *((unsigned int *)rt) = *((unsigned int *)cp1); + *((uint *)rt) = *((uint *)cp1); } else if (rt2[3] >= 1.0f) { - *((unsigned int *)rt) = *((unsigned int *)cp2); + *((uint *)rt) = *((uint *)cp2); } else { float temp_fac = (fac * (1.0f - rt2[3])); if (fac <= 0) { - *((unsigned int *)rt) = *((unsigned int *)cp2); + *((uint *)rt) = *((uint *)cp2); } else { tempc[0] = (temp_fac * rt1[0] + rt2[0]); @@ -415,7 +415,7 @@ static void do_alphaunder_effect(const SeqRenderData *context, do_alphaunder_effect_float(fac, context->rectx, total_lines, 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); @@ -430,12 +430,11 @@ static void do_alphaunder_effect(const SeqRenderData *context, /** \name Cross Effect * \{ */ -static void do_cross_effect_byte( - float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) +static void do_cross_effect_byte(float fac, int x, int y, uchar *rect1, uchar *rect2, uchar *out) { - unsigned char *rt1 = rect1; - unsigned char *rt2 = rect2; - unsigned char *rt = out; + uchar *rt1 = rect1; + uchar *rt2 = rect2; + uchar *rt = out; int temp_fac = (int)(256.0f * fac); int temp_mfac = 256 - temp_fac; @@ -496,7 +495,7 @@ static void do_cross_effect(const SeqRenderData *context, do_cross_effect_float(fac, context->rectx, total_lines, 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); @@ -512,8 +511,8 @@ static void do_cross_effect(const SeqRenderData *context, * \{ */ /* copied code from initrender.c */ -static unsigned short gamtab[65536]; -static unsigned short igamtab1[256]; +static ushort gamtab[65536]; +static ushort igamtab1[256]; static bool gamma_tabs_init = false; #define RE_GAMMA_TABLE_SIZE 400 @@ -666,11 +665,11 @@ static void free_gammacross(Sequence *UNUSED(seq), const bool UNUSED(do_id_user) } static void do_gammacross_effect_byte( - float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) + float fac, int x, int y, uchar *rect1, uchar *rect2, uchar *out) { - unsigned char *cp1 = rect1; - unsigned char *cp2 = rect2; - unsigned char *rt = out; + uchar *cp1 = rect1; + uchar *cp2 = rect2; + uchar *rt = out; float mfac = 1.0f - fac; @@ -744,7 +743,7 @@ static void do_gammacross_effect(const SeqRenderData *context, do_gammacross_effect_float(fac, context->rectx, total_lines, 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); @@ -759,12 +758,11 @@ static void do_gammacross_effect(const SeqRenderData *context, /** \name Color Add Effect * \{ */ -static void do_add_effect_byte( - float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) +static void do_add_effect_byte(float fac, int x, int y, uchar *rect1, uchar *rect2, uchar *out) { - unsigned char *cp1 = rect1; - unsigned char *cp2 = rect2; - unsigned char *rt = out; + uchar *cp1 = rect1; + uchar *cp2 = rect2; + uchar *rt = out; int temp_fac = (int)(256.0f * fac); @@ -824,7 +822,7 @@ static void do_add_effect(const SeqRenderData *context, do_add_effect_float(fac, context->rectx, total_lines, 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); @@ -839,12 +837,11 @@ static void do_add_effect(const SeqRenderData *context, /** \name Color Subtract Effect * \{ */ -static void do_sub_effect_byte( - float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) +static void do_sub_effect_byte(float fac, int x, int y, uchar *rect1, uchar *rect2, uchar *out) { - unsigned char *cp1 = rect1; - unsigned char *cp2 = rect2; - unsigned char *rt = out; + uchar *cp1 = rect1; + uchar *cp2 = rect2; + uchar *rt = out; int temp_fac = (int)(256.0f * fac); @@ -906,7 +903,7 @@ static void do_sub_effect(const SeqRenderData *context, do_sub_effect_float(fac, context->rectx, total_lines, 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); @@ -925,17 +922,16 @@ static void do_sub_effect(const SeqRenderData *context, #define XOFF 8 #define YOFF 8 -static void do_drop_effect_byte( - float fac, int x, int y, unsigned char *rect2i, unsigned char *rect1i, unsigned char *outi) +static void do_drop_effect_byte(float fac, int x, int y, uchar *rect2i, uchar *rect1i, uchar *outi) { const int xoff = min_ii(XOFF, x); const int yoff = min_ii(YOFF, y); int temp_fac = (int)(70.0f * fac); - unsigned char *rt2 = rect2i + yoff * 4 * x; - unsigned char *rt1 = rect1i; - unsigned char *out = outi; + uchar *rt2 = rect2i + yoff * 4 * x; + uchar *rt1 = rect1i; + uchar *out = outi; for (int i = 0; i < y - yoff; i++) { memcpy(out, rt1, sizeof(*out) * xoff * 4); rt1 += xoff * 4; @@ -999,12 +995,11 @@ static void do_drop_effect_float( /** \name Multiply Effect * \{ */ -static void do_mul_effect_byte( - float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) +static void do_mul_effect_byte(float fac, int x, int y, uchar *rect1, uchar *rect2, uchar *out) { - unsigned char *rt1 = rect1; - unsigned char *rt2 = rect2; - unsigned char *rt = out; + uchar *rt1 = rect1; + uchar *rt2 = rect2; + uchar *rt = out; int temp_fac = (int)(256.0f * fac); @@ -1069,7 +1064,7 @@ static void do_mul_effect(const SeqRenderData *context, do_mul_effect_float(fac, context->rectx, total_lines, 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); @@ -1084,27 +1079,25 @@ static void do_mul_effect(const SeqRenderData *context, /** \name Blend Mode Effect * \{ */ -typedef void (*IMB_blend_func_byte)(unsigned char *dst, - const unsigned char *src1, - const unsigned char *src2); +typedef void (*IMB_blend_func_byte)(uchar *dst, const uchar *src1, const uchar *src2); typedef void (*IMB_blend_func_float)(float *dst, const float *src1, const float *src2); BLI_INLINE void apply_blend_function_byte(float fac, int x, int y, - unsigned char *rect1, - unsigned char *rect2, - unsigned char *out, + uchar *rect1, + uchar *rect2, + uchar *out, IMB_blend_func_byte blend_function) { - unsigned char *rt1 = rect1; - unsigned char *rt2 = rect2; - unsigned char *rt = out; + uchar *rt1 = rect1; + uchar *rt2 = rect2; + uchar *rt = out; for (int i = 0; i < y; i++) { for (int j = 0; j < x; j++) { - unsigned int achannel = rt2[3]; - rt2[3] = (unsigned int)achannel * fac; + uint achannel = rt2[3]; + rt2[3] = (uint)achannel * fac; blend_function(rt, rt1, rt2); rt2[3] = achannel; rt[3] = rt1[3]; @@ -1213,13 +1206,8 @@ static void do_blend_effect_float( } } -static void do_blend_effect_byte(float fac, - int x, - int y, - unsigned char *rect1, - unsigned char *rect2, - int btype, - unsigned char *out) +static void do_blend_effect_byte( + float fac, int x, int y, uchar *rect1, uchar *rect2, int btype, uchar *out) { switch (btype) { case SEQ_TYPE_ADD: @@ -1309,7 +1297,7 @@ static void do_blend_mode_effect(const SeqRenderData *context, fac, context->rectx, total_lines, rect1, rect2, seq->blend_mode, 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); do_blend_effect_byte( @@ -1360,7 +1348,7 @@ static void do_colormix_effect(const SeqRenderData *context, fac, context->rectx, total_lines, rect1, rect2, data->blend_effect, 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); do_blend_effect_byte( @@ -1665,21 +1653,16 @@ static void copy_wipe_effect(Sequence *dst, Sequence *src, const int UNUSED(flag dst->effectdata = MEM_dupallocN(src->effectdata); } -static void do_wipe_effect_byte(Sequence *seq, - float fac, - int x, - int y, - unsigned char *rect1, - unsigned char *rect2, - unsigned char *out) +static void do_wipe_effect_byte( + Sequence *seq, float fac, int x, int y, uchar *rect1, uchar *rect2, uchar *out) { WipeZone wipezone; WipeVars *wipe = (WipeVars *)seq->effectdata; precalc_wipe_zone(&wipezone, wipe, x, y); - unsigned char *cp1 = rect1; - unsigned char *cp2 = rect2; - unsigned char *rt = out; + uchar *cp1 = rect1; + uchar *cp2 = rect2; + uchar *rt = out; for (int i = 0; i < y; i++) { for (int j = 0; j < x; j++) { @@ -1809,9 +1792,9 @@ static ImBuf *do_wipe_effect(const SeqRenderData *context, fac, context->rectx, context->recty, - (unsigned char *)ibuf1->rect, - (unsigned char *)ibuf2->rect, - (unsigned char *)out->rect); + (uchar *)ibuf1->rect, + (uchar *)ibuf2->rect, + (uchar *)out->rect); } return out; @@ -2212,9 +2195,9 @@ static void do_glow_effect_byte(Sequence *seq, float fac, int x, int y, - unsigned char *rect1, - unsigned char *UNUSED(rect2), - unsigned char *out) + uchar *rect1, + uchar *UNUSED(rect2), + uchar *out) { float *outbuf, *inbuf; GlowVars *glow = (GlowVars *)seq->effectdata; diff --git a/source/blender/sequencer/intern/image_cache.c b/source/blender/sequencer/intern/image_cache.c index 53f076c9681..7d77f781396 100644 --- a/source/blender/sequencer/intern/image_cache.c +++ b/source/blender/sequencer/intern/image_cache.c @@ -98,9 +98,9 @@ static bool seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b) (a->scene->r.views_format != b->scene->r.views_format) || (a->view_id != b->view_id)); } -static unsigned int seq_hash_render_data(const SeqRenderData *a) +static uint seq_hash_render_data(const SeqRenderData *a) { - unsigned int rval = a->rectx + a->recty; + uint rval = a->rectx + a->recty; rval ^= a->preview_render_size; rval ^= ((intptr_t)a->bmain) << 6; @@ -112,12 +112,12 @@ static unsigned int seq_hash_render_data(const SeqRenderData *a) return rval; } -static unsigned int seq_cache_hashhash(const void *key_) +static uint seq_cache_hashhash(const void *key_) { const SeqCacheKey *key = key_; - unsigned int rval = seq_hash_render_data(&key->context); + uint rval = seq_hash_render_data(&key->context); - rval ^= *(const unsigned int *)&key->frame_index; + rval ^= *(const uint *)&key->frame_index; rval += key->type; rval ^= ((intptr_t)key->seq) << 6; diff --git a/source/blender/sequencer/intern/modifier.c b/source/blender/sequencer/intern/modifier.c index 93bdcb59e88..da982913de1 100644 --- a/source/blender/sequencer/intern/modifier.c +++ b/source/blender/sequencer/intern/modifier.c @@ -44,9 +44,9 @@ static bool modifierTypesInit = false; typedef void (*modifier_apply_threaded_cb)(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); @@ -61,7 +61,7 @@ typedef struct ModifierInitData { typedef struct ModifierThread { int width, height; - unsigned char *rect, *mask_rect; + uchar *rect, *mask_rect; float *rect_float, *mask_rect_float; void *user_data; @@ -140,7 +140,7 @@ static void modifier_init_handle(void *handle_v, int start_line, int tot_line, v handle->user_data = init_data->user_data; if (ibuf->rect) { - handle->rect = (unsigned char *)ibuf->rect + offset; + handle->rect = (uchar *)ibuf->rect + offset; } if (ibuf->rect_float) { @@ -149,7 +149,7 @@ static void modifier_init_handle(void *handle_v, int start_line, int tot_line, v if (mask) { if (mask->rect) { - handle->mask_rect = (unsigned char *)mask->rect + offset; + handle->mask_rect = (uchar *)mask->rect + offset; } if (mask->rect_float) { @@ -345,17 +345,13 @@ static void make_cb_table_float_sop( } } -static void color_balance_byte_byte(StripColorBalance *cb_, - unsigned char *rect, - unsigned char *mask_rect, - int width, - int height, - float mul) +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]; - unsigned char *cp = rect; - unsigned char *e = cp + width * 4 * height; - unsigned char *m = mask_rect; + uchar *cp = rect; + uchar *e = cp + width * 4 * height; + uchar *m = mask_rect; StripColorBalance cb = calc_cb(cb_); @@ -394,18 +390,18 @@ static void color_balance_byte_byte(StripColorBalance *cb_, } static void color_balance_byte_float(StripColorBalance *cb_, - unsigned char *rect, + uchar *rect, float *rect_float, - unsigned char *mask_rect, + uchar *mask_rect, int width, int height, float mul) { float cb_tab[4][256]; int c, i; - unsigned char *p = rect; - unsigned char *e = p + width * 4 * height; - unsigned char *m = mask_rect; + uchar *p = rect; + uchar *e = p + width * 4 * height; + uchar *m = mask_rect; float *o; StripColorBalance cb; @@ -501,7 +497,7 @@ typedef struct ColorBalanceThread { int width, height; - unsigned char *rect, *mask_rect; + uchar *rect, *mask_rect; float *rect_float, *mask_rect_float; bool make_float; @@ -528,7 +524,7 @@ static void color_balance_init_handle(void *handle_v, handle->make_float = init_data->make_float; if (ibuf->rect) { - handle->rect = (unsigned char *)ibuf->rect + offset; + handle->rect = (uchar *)ibuf->rect + offset; } if (ibuf->rect_float) { @@ -537,7 +533,7 @@ static void color_balance_init_handle(void *handle_v, if (mask) { if (mask->rect) { - handle->mask_rect = (unsigned char *)mask->rect + offset; + handle->mask_rect = (uchar *)mask->rect + offset; } if (mask->rect_float) { @@ -555,8 +551,8 @@ static void *color_balance_do_thread(void *thread_data_v) ColorBalanceThread *thread_data = (ColorBalanceThread *)thread_data_v; StripColorBalance *cb = thread_data->cb; int width = thread_data->width, height = thread_data->height; - unsigned char *rect = thread_data->rect; - unsigned char *mask_rect = thread_data->mask_rect; + uchar *rect = thread_data->rect; + uchar *mask_rect = thread_data->mask_rect; float *rect_float = thread_data->rect_float; float *mask_rect_float = thread_data->mask_rect_float; float mul = thread_data->mul; @@ -657,9 +653,9 @@ typedef struct WhiteBalanceThreadData { static void whiteBalance_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) { @@ -765,9 +761,9 @@ static void curves_copy_data(SequenceModifierData *target, SequenceModifierData static void curves_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) { @@ -798,7 +794,7 @@ static void curves_apply_threaded(int width, } } if (rect) { - unsigned char *pixel = rect + pixel_index; + uchar *pixel = rect + pixel_index; float result[3], tempc[4]; straight_uchar_to_premul_float(tempc, pixel); @@ -895,9 +891,9 @@ static void hue_correct_copy_data(SequenceModifierData *target, SequenceModifier static void hue_correct_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) { diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index eff0f0b17e9..1e060321bb8 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -123,12 +123,8 @@ void seq_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, bool make_float) * However, this might also have negative effect by adding weird * artifacts which will then not happen in final render. */ - IMB_colormanagement_transform_byte_threaded((unsigned char *)ibuf->rect, - ibuf->x, - ibuf->y, - ibuf->channels, - from_colorspace, - to_colorspace); + IMB_colormanagement_transform_byte_threaded( + (uchar *)ibuf->rect, ibuf->x, ibuf->y, ibuf->channels, from_colorspace, to_colorspace); } else { /* We perform conversion to a float buffer so we don't worry about @@ -136,7 +132,7 @@ void seq_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, bool make_float) */ imb_addrectfloatImBuf(ibuf, 4); IMB_colormanagement_transform_from_byte_threaded(ibuf->rect_float, - (unsigned char *)ibuf->rect, + (uchar *)ibuf->rect, ibuf->x, ibuf->y, ibuf->channels, diff --git a/source/blender/simulation/intern/SIM_mass_spring.cpp b/source/blender/simulation/intern/SIM_mass_spring.cpp index f5a6427a6a4..0d403eeeb3d 100644 --- a/source/blender/simulation/intern/SIM_mass_spring.cpp +++ b/source/blender/simulation/intern/SIM_mass_spring.cpp @@ -65,7 +65,7 @@ static bool cloth_get_pressure_weights(ClothModifierData *clmd, Cloth *cloth = clmd->clothObject; ClothVertex *verts = cloth->verts; - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { r_weights[j] = verts[vt->tri[j]].pressure_factor; /* Skip the entire triangle if it has a zero weight. */ @@ -84,10 +84,10 @@ static void cloth_calc_pressure_gradient(ClothModifierData *clmd, { Cloth *cloth = clmd->clothObject; Implicit_Data *data = cloth->implicit; - unsigned int mvert_num = cloth->mvert_num; + uint mvert_num = cloth->mvert_num; float pt[3]; - for (unsigned int i = 0; i < mvert_num; i++) { + for (uint i = 0; i < mvert_num; i++) { SIM_mass_spring_get_position(data, i, pt); r_vertex_pressure[i] = dot_v3v3(pt, gradient_vector); } @@ -107,7 +107,7 @@ static float cloth_calc_volume(ClothModifierData *clmd) return 0.0f; } - for (unsigned int i = 0; i < cloth->primitive_num; i++) { + for (uint i = 0; i < cloth->primitive_num; i++) { const MVertTri *vt = &tri[i]; if (cloth_get_pressure_weights(clmd, vt, weights)) { @@ -135,7 +135,7 @@ static float cloth_calc_rest_volume(ClothModifierData *clmd) return 0.0f; } - for (unsigned int i = 0; i < cloth->primitive_num; i++) { + for (uint i = 0; i < cloth->primitive_num; i++) { const MVertTri *vt = &tri[i]; if (cloth_get_pressure_weights(clmd, vt, weights)) { @@ -159,7 +159,7 @@ static float cloth_calc_average_pressure(ClothModifierData *clmd, const float *v float total_force = 0; float total_area = 0; - for (unsigned int i = 0; i < cloth->primitive_num; i++) { + for (uint i = 0; i < cloth->primitive_num; i++) { const MVertTri *vt = &tri[i]; if (cloth_get_pressure_weights(clmd, vt, weights)) { @@ -181,7 +181,7 @@ int SIM_cloth_solver_init(Object *UNUSED(ob), ClothModifierData *clmd) ClothVertex *verts = cloth->verts; const float ZERO[3] = {0.0f, 0.0f, 0.0f}; Implicit_Data *id; - unsigned int i, nondiag; + uint i, nondiag; nondiag = cloth_count_nondiag_blocks(cloth); cloth->implicit = id = SIM_mass_spring_solver_create(cloth->mvert_num, nondiag); @@ -216,7 +216,7 @@ void SIM_cloth_solver_set_positions(ClothModifierData *clmd) { Cloth *cloth = clmd->clothObject; ClothVertex *verts = cloth->verts; - unsigned int mvert_num = cloth->mvert_num, i; + uint mvert_num = cloth->mvert_num, i; ClothHairData *cloth_hairdata = clmd->hairdata; Implicit_Data *id = cloth->implicit; @@ -552,7 +552,7 @@ static void hair_get_boundbox(ClothModifierData *clmd, float gmin[3], float gmax { Cloth *cloth = clmd->clothObject; Implicit_Data *data = cloth->implicit; - unsigned int mvert_num = cloth->mvert_num; + uint mvert_num = cloth->mvert_num; int i; INIT_MINMAX(gmin, gmax); @@ -570,11 +570,11 @@ static void cloth_calc_force( Cloth *cloth = clmd->clothObject; ClothSimSettings *parms = clmd->sim_parms; Implicit_Data *data = cloth->implicit; - unsigned int i = 0; + uint i = 0; float drag = clmd->sim_parms->Cvi * 0.01f; /* viscosity of air scaled in percent */ float gravity[3] = {0.0f, 0.0f, 0.0f}; const MVertTri *tri = cloth->tri; - unsigned int mvert_num = cloth->mvert_num; + uint mvert_num = cloth->mvert_num; ClothVertex *vert; #ifdef CLOTH_FORCE_GRAVITY @@ -1263,11 +1263,11 @@ int SIM_cloth_solve( Scene *scene = DEG_get_evaluated_scene(depsgraph); const bool is_hair = (clmd->hairdata != nullptr); - unsigned int i = 0; + uint i = 0; float step = 0.0f, tf = clmd->sim_parms->timescale; Cloth *cloth = clmd->clothObject; ClothVertex *verts = cloth->verts /*, *cv*/; - unsigned int mvert_num = cloth->mvert_num; + uint mvert_num = cloth->mvert_num; float dt = clmd->sim_parms->dt * clmd->sim_parms->timescale; Implicit_Data *id = cloth->implicit; diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp index 43f1ee36cd3..ada357e3595 100644 --- a/source/blender/simulation/intern/hair_volume.cpp +++ b/source/blender/simulation/intern/hair_volume.cpp @@ -1187,7 +1187,7 @@ void SIM_hair_volume_grid_geometry( #if 0 static HairGridVert *hair_volume_create_collision_grid(ClothModifierData *clmd, lfVector *lX, - unsigned int numverts) + uint numverts) { int res = hair_grid_res; int size = hair_grid_size(res); @@ -1197,7 +1197,7 @@ static HairGridVert *hair_volume_create_collision_grid(ClothModifierData *clmd, float gmin[3], gmax[3], scale[3]; /* 2.0f is an experimental value that seems to give good results */ float collfac = 2.0f * clmd->sim_parms->collider_friction; - unsigned int v = 0; + uint v = 0; int i = 0; hair_volume_get_boundbox(lX, numverts, gmin, gmax); diff --git a/source/blender/simulation/intern/implicit_blender.c b/source/blender/simulation/intern/implicit_blender.c index 4193ef2c7c5..5f08bca9875 100644 --- a/source/blender/simulation/intern/implicit_blender.c +++ b/source/blender/simulation/intern/implicit_blender.c @@ -61,12 +61,12 @@ struct Cloth; /* DEFINITIONS */ typedef float lfVector[3]; typedef struct fmatrix3x3 { - float m[3][3]; /* 3x3 matrix */ - unsigned int c, r; /* column and row number */ + float m[3][3]; /* 3x3 matrix */ + uint c, r; /* column and row number */ // int pinned; /* is this vertex allowed to move? */ - float n1, n2, n3; /* three normal vectors for collision constrains */ - unsigned int vcount; /* vertex count */ - unsigned int scount; /* spring count */ + float n1, n2, n3; /* three normal vectors for collision constrains */ + uint vcount; /* vertex count */ + uint scount; /* spring count */ } fmatrix3x3; /////////////////////////// @@ -120,7 +120,7 @@ DO_INLINE void print_lfvector(float (*fLongVector)[3], unsigned int verts) # endif /* create long vector */ -DO_INLINE lfVector *create_lfvector(unsigned int verts) +DO_INLINE lfVector *create_lfvector(uint verts) { /* TODO: check if memory allocation was successful */ return (lfVector *)MEM_callocN(verts * sizeof(lfVector), "cloth_implicit_alloc_vector"); @@ -135,30 +135,27 @@ DO_INLINE void del_lfvector(float (*fLongVector)[3]) } } /* copy long vector */ -DO_INLINE void cp_lfvector(float (*to)[3], float (*from)[3], unsigned int verts) +DO_INLINE void cp_lfvector(float (*to)[3], float (*from)[3], uint verts) { memcpy(to, from, verts * sizeof(lfVector)); } /* init long vector with float[3] */ -DO_INLINE void init_lfvector(float (*fLongVector)[3], const float vector[3], unsigned int verts) +DO_INLINE void init_lfvector(float (*fLongVector)[3], const float vector[3], uint verts) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < verts; i++) { copy_v3_v3(fLongVector[i], vector); } } /* zero long vector with float[3] */ -DO_INLINE void zero_lfvector(float (*to)[3], unsigned int verts) +DO_INLINE void zero_lfvector(float (*to)[3], uint verts) { memset(to, 0.0f, verts * sizeof(lfVector)); } /* Multiply long vector with scalar. */ -DO_INLINE void mul_lfvectorS(float (*to)[3], - float (*fLongVector)[3], - float scalar, - unsigned int verts) +DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scalar, uint verts) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < verts; i++) { mul_fvector_S(to[i], fLongVector[i], scalar); @@ -166,20 +163,15 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], } /* Multiply long vector with scalar. * `A -= B * float` */ -DO_INLINE void submul_lfvectorS(float (*to)[3], - float (*fLongVector)[3], - float scalar, - unsigned int verts) +DO_INLINE void submul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scalar, uint verts) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < verts; i++) { VECSUBMUL(to[i], fLongVector[i], scalar); } } /* dot product for big vector */ -DO_INLINE float dot_lfvector(float (*fLongVectorA)[3], - float (*fLongVectorB)[3], - unsigned int verts) +DO_INLINE float dot_lfvector(float (*fLongVectorA)[3], float (*fLongVectorB)[3], uint verts) { long i = 0; float temp = 0.0; @@ -197,22 +189,19 @@ DO_INLINE float dot_lfvector(float (*fLongVectorA)[3], DO_INLINE void add_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], float (*fLongVectorB)[3], - unsigned int verts) + uint verts) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < verts; i++) { add_v3_v3v3(to[i], fLongVectorA[i], fLongVectorB[i]); } } /* `A = B + C * float` -> for big vector. */ -DO_INLINE void add_lfvector_lfvectorS(float (*to)[3], - float (*fLongVectorA)[3], - float (*fLongVectorB)[3], - float bS, - unsigned int verts) +DO_INLINE void add_lfvector_lfvectorS( + float (*to)[3], float (*fLongVectorA)[3], float (*fLongVectorB)[3], float bS, uint verts) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < verts; i++) { VECADDS(to[i], fLongVectorA[i], fLongVectorB[i], bS); @@ -224,22 +213,19 @@ DO_INLINE void add_lfvectorS_lfvectorS(float (*to)[3], float aS, float (*fLongVectorB)[3], float bS, - unsigned int verts) + uint verts) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < verts; i++) { VECADDSS(to[i], fLongVectorA[i], aS, fLongVectorB[i], bS); } } /* `A = B - C * float` -> for big vector. */ -DO_INLINE void sub_lfvector_lfvectorS(float (*to)[3], - float (*fLongVectorA)[3], - float (*fLongVectorB)[3], - float bS, - unsigned int verts) +DO_INLINE void sub_lfvector_lfvectorS( + float (*to)[3], float (*fLongVectorA)[3], float (*fLongVectorB)[3], float bS, uint verts) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < verts; i++) { VECSUBS(to[i], fLongVectorA[i], fLongVectorB[i], bS); } @@ -248,9 +234,9 @@ DO_INLINE void sub_lfvector_lfvectorS(float (*to)[3], DO_INLINE void sub_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], float (*fLongVectorB)[3], - unsigned int verts) + uint verts) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < verts; i++) { sub_v3_v3v3(to[i], fLongVectorA[i], fLongVectorB[i]); @@ -539,7 +525,7 @@ BLI_INLINE void init_fmatrix(fmatrix3x3 *matrix, int r, int c) } /* create big matrix */ -DO_INLINE fmatrix3x3 *create_bfmatrix(unsigned int verts, unsigned int springs) +DO_INLINE fmatrix3x3 *create_bfmatrix(uint verts, uint springs) { /* TODO: check if memory allocation was successful */ fmatrix3x3 *temp = (fmatrix3x3 *)MEM_callocN(sizeof(fmatrix3x3) * (verts + springs), @@ -575,7 +561,7 @@ DO_INLINE void cp_bfmatrix(fmatrix3x3 *to, fmatrix3x3 *from) /* slow in parallel */ DO_INLINE void init_bfmatrix(fmatrix3x3 *matrix, float m3[3][3]) { - unsigned int i; + uint i; for (i = 0; i < matrix[0].vcount + matrix[0].scount; i++) { cp_fmatrix(matrix[i].m, m3); @@ -586,7 +572,7 @@ DO_INLINE void init_bfmatrix(fmatrix3x3 *matrix, float m3[3][3]) /* slow in parallel */ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3]) { - unsigned int i, j; + uint i, j; float tmatrix[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; for (i = 0; i < matrix[0].vcount; i++) { @@ -601,7 +587,7 @@ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3]) /* STATUS: verified */ DO_INLINE void mul_bfmatrix_lfvector(float (*to)[3], fmatrix3x3 *from, lfVector *fLongVector) { - unsigned int vcount = from[0].vcount; + uint vcount = from[0].vcount; lfVector *temp = create_lfvector(vcount); zero_lfvector(to, vcount); @@ -610,7 +596,7 @@ DO_INLINE void mul_bfmatrix_lfvector(float (*to)[3], fmatrix3x3 *from, lfVector { # pragma omp section { - for (unsigned int i = from[0].vcount; i < from[0].vcount + from[0].scount; i++) { + for (uint i = from[0].vcount; i < from[0].vcount + from[0].scount; i++) { /* This is the lower triangle of the sparse matrix, * therefore multiplication occurs with transposed submatrices. */ muladd_fmatrixT_fvector(to[from[i].c], from[i].m, fLongVector[from[i].r]); @@ -618,7 +604,7 @@ DO_INLINE void mul_bfmatrix_lfvector(float (*to)[3], fmatrix3x3 *from, lfVector } # pragma omp section { - for (unsigned int i = 0; i < from[0].vcount + from[0].scount; i++) { + for (uint i = 0; i < from[0].vcount + from[0].scount; i++) { muladd_fmatrix_fvector(temp[from[i].r], from[i].m, fLongVector[from[i].c]); } } @@ -634,7 +620,7 @@ DO_INLINE void mul_bfmatrix_lfvector(float (*to)[3], fmatrix3x3 *from, lfVector DO_INLINE void subadd_bfmatrixS_bfmatrixS( fmatrix3x3 *to, fmatrix3x3 *from, float aS, fmatrix3x3 *matrix, float bS) { - unsigned int i = 0; + uint i = 0; /* process diagonal elements */ for (i = 0; i < matrix[0].vcount + matrix[0].scount; i++) { @@ -757,7 +743,7 @@ BLI_INLINE void root_to_world_m3(Implicit_Data *data, DO_INLINE void filter(lfVector *V, fmatrix3x3 *S) { - unsigned int i = 0; + uint i = 0; for (i = 0; i < S[0].vcount; i++) { mul_m3_v3(S[i].m, V[S[i].r]); @@ -842,10 +828,10 @@ static int cg_filtered(lfVector *ldV, ImplicitSolverResult *result) { /* 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.01f; - unsigned int numverts = lA[0].vcount; + uint numverts = lA[0].vcount; lfVector *fB = create_lfvector(numverts); lfVector *AdV = create_lfvector(numverts); lfVector *r = create_lfvector(numverts); @@ -1137,7 +1123,7 @@ static int cg_filtered_pre(lfVector *dv, bool SIM_mass_spring_solve_velocities(Implicit_Data *data, float dt, ImplicitSolverResult *result) { - unsigned int numverts = data->dFdV[0].vcount; + uint numverts = data->dFdV[0].vcount; lfVector *dFdXmV = create_lfvector(numverts); zero_lfvector(data->dV, numverts); diff --git a/source/blender/windowmanager/intern/wm_dragdrop.cc b/source/blender/windowmanager/intern/wm_dragdrop.cc index 94bd33a9765..92f7a5b7c42 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.cc +++ b/source/blender/windowmanager/intern/wm_dragdrop.cc @@ -174,8 +174,7 @@ static void wm_dropbox_invoke(bContext *C, wmDrag *drag) } } -wmDrag *WM_drag_data_create( - bContext *C, int icon, int type, void *poin, double value, unsigned int flags) +wmDrag *WM_drag_data_create(bContext *C, int icon, int type, void *poin, double value, uint flags) { wmDrag *drag = MEM_cnew<wmDrag>(__func__); @@ -234,8 +233,7 @@ void WM_event_start_prepared_drag(bContext *C, wmDrag *drag) wm_dropbox_invoke(C, drag); } -void WM_event_start_drag( - bContext *C, int icon, int type, void *poin, double value, unsigned int flags) +void WM_event_start_drag(bContext *C, int icon, int type, void *poin, double value, uint flags) { wmDrag *drag = WM_drag_data_create(C, icon, type, poin, value, flags); WM_event_start_prepared_drag(C, drag); diff --git a/source/blender/windowmanager/intern/wm_event_system.cc b/source/blender/windowmanager/intern/wm_event_system.cc index 2fcb39aeee4..79bf8020caf 100644 --- a/source/blender/windowmanager/intern/wm_event_system.cc +++ b/source/blender/windowmanager/intern/wm_event_system.cc @@ -325,7 +325,7 @@ void WM_event_add_notifier(const bContext *C, uint type, void *reference) WM_event_add_notifier_ex(CTX_wm_manager(C), CTX_wm_window(C), type, reference); } -void WM_main_add_notifier(unsigned int type, void *reference) +void WM_main_add_notifier(uint type, void *reference) { Main *bmain = G_MAIN; wmWindowManager *wm = static_cast<wmWindowManager *>(bmain->wm.first); @@ -5484,7 +5484,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void if (BLI_str_utf8_size(event.utf8_buf) == -1) { CLOG_ERROR(WM_LOG_EVENTS, "ghost detected an invalid unicode character '%d'", - (int)(unsigned char)event.utf8_buf[0]); + (int)(uchar)event.utf8_buf[0]); event.utf8_buf[0] = '\0'; } } diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 2bc1fb1519a..88a292477cf 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -275,14 +275,14 @@ static void wm_gesture_draw_circle(wmGesture *gt) } struct LassoFillData { - unsigned char *px; + uchar *px; int width; }; static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data) { struct LassoFillData *data = user_data; - unsigned char *col = &(data->px[(y * data->width) + x]); + uchar *col = &(data->px[(y * data->width) + x]); memset(col, 0x10, x_end - x); } @@ -310,7 +310,7 @@ static void draw_filled_lasso(wmGesture *gt) if (BLI_rcti_is_empty(&rect) == false) { const int w = BLI_rcti_size_x(&rect); const int h = BLI_rcti_size_y(&rect); - unsigned char *pixel_buf = MEM_callocN(sizeof(*pixel_buf) * w * h, __func__); + uchar *pixel_buf = MEM_callocN(sizeof(*pixel_buf) * w * h, __func__); struct LassoFillData lasso_fill_data = {pixel_buf, w}; BLI_bitmap_draw_2d_poly_v2i_n(rect.xmin, diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index d5c4d07e9ed..5360f327a0a 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -104,7 +104,7 @@ struct wmJob { /** Only start job after specified time delay */ double start_delay_time; /** The notifier event timers should send */ - unsigned int note, endnote; + uint note, endnote; /* internal */ const void *owner; @@ -336,7 +336,7 @@ void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void (*free)(void * } } -void WM_jobs_timer(wmJob *wm_job, double timestep, unsigned int note, unsigned int endnote) +void WM_jobs_timer(wmJob *wm_job, double timestep, uint note, uint endnote) { wm_job->timestep = timestep; wm_job->note = note; diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index 73c7c0a2435..bb19ba4748f 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -659,7 +659,7 @@ static void build_pict_list_ex( int fp_framenr; struct { char head[FILE_MAX], tail[FILE_MAX]; - unsigned short digits; + ushort digits; } fp_decoded; char filepath[FILE_MAX]; diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 436087e1cf3..b7a3538aeb2 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -158,8 +158,8 @@ static bool wm_window_timer(const bContext *C); void wm_get_screensize(int *r_width, int *r_height) { - unsigned int uiwidth; - unsigned int uiheight; + uint uiwidth; + uint uiheight; GHOST_GetMainDisplayDimensions(g_system, &uiwidth, &uiheight); *r_width = uiwidth; @@ -168,8 +168,8 @@ void wm_get_screensize(int *r_width, int *r_height) void wm_get_desktopsize(int *r_width, int *r_height) { - unsigned int uiwidth; - unsigned int uiheight; + uint uiwidth; + uint uiheight; GHOST_GetAllDisplayDimensions(g_system, &uiwidth, &uiheight); *r_width = uiwidth; diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c index 5c745c32d2c..7953efb49fe 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c @@ -29,7 +29,7 @@ BLI_INLINE uint void_hash_uint(const void *key) { size_t y = (size_t)key >> (sizeof(void *)); - return (unsigned int)y; + return (uint)y; } static uint wm_msg_rna_gset_hash(const void *key_p) diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index b3f5d24ee8c..fe2e14e0367 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -1901,7 +1901,7 @@ static int arg_handle_python_exit_code_set(int argc, const char **argv, void *UN return 1; } - app_state.exit_code_on_error.python = (unsigned char)exit_code; + app_state.exit_code_on_error.python = (uchar)exit_code; return 1; } printf("\nError: you must specify an exit code number '%s'.\n", arg_id); |