diff options
Diffstat (limited to 'source/blender/blenkernel')
47 files changed, 298 insertions, 324 deletions
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 |