diff --git a/source/blender/animrig/intern/bone_collections.cc b/source/blender/animrig/intern/bone_collections.cc index 58f42a5036c..f08c3ffc255 100644 --- a/source/blender/animrig/intern/bone_collections.cc +++ b/source/blender/animrig/intern/bone_collections.cc @@ -353,8 +353,7 @@ bool ANIM_armature_bonecoll_assign_and_move(BoneCollection *bcoll, Bone *bone) return ANIM_armature_bonecoll_assign(bcoll, bone); } -bool ANIM_armature_bonecoll_assign_and_move_editbone(struct BoneCollection *bcoll, - struct EditBone *ebone) +bool ANIM_armature_bonecoll_assign_and_move_editbone(BoneCollection *bcoll, EditBone *ebone) { ANIM_armature_bonecoll_unassign_all_editbone(ebone); return ANIM_armature_bonecoll_assign_editbone(bcoll, ebone); @@ -395,7 +394,7 @@ void ANIM_armature_bonecoll_unassign_all(Bone *bone) } } -void ANIM_armature_bonecoll_unassign_all_editbone(struct EditBone *ebone) +void ANIM_armature_bonecoll_unassign_all_editbone(EditBone *ebone) { LISTBASE_FOREACH_MUTABLE (BoneCollectionReference *, ref, &ebone->bone_collections) { ANIM_armature_bonecoll_unassign_editbone(ref->bcoll, ebone); diff --git a/source/blender/blenfont/intern/blf_glyph.cc b/source/blender/blenfont/intern/blf_glyph.cc index 6939641f06f..370bff3946c 100644 --- a/source/blender/blenfont/intern/blf_glyph.cc +++ b/source/blender/blenfont/intern/blf_glyph.cc @@ -1132,7 +1132,7 @@ GlyphBLF *blf_glyph_ensure_subpixel(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF * } /* Four sub-pixel positions up to 16 point, 2 until 35 points. */ - const uint8_t subpixel = (uint8_t)(pen_x & ((font->size > 16.0f) ? 32L : 48L)); + const uint8_t subpixel = uint8_t(pen_x & ((font->size > 16.0f) ? 32L : 48L)); if (g->subpixel != subpixel) { g = blf_glyph_ensure_ex(font, gc, g->c, subpixel); diff --git a/source/blender/blenkernel/intern/softbody.cc b/source/blender/blenkernel/intern/softbody.cc index 6ef187e711e..8a13568f011 100644 --- a/source/blender/blenkernel/intern/softbody.cc +++ b/source/blender/blenkernel/intern/softbody.cc @@ -70,7 +70,7 @@ static CLG_LogRef LOG = {"bke.softbody"}; /* callbacks for errors and interrupts and some goo */ -static int (*SB_localInterruptCallBack)(void) = NULL; +static int (*SB_localInterruptCallBack)(void) = nullptr; /* ********** soft body engine ******* */ @@ -271,7 +271,7 @@ typedef struct ccd_Mesh { static ccd_Mesh *ccd_mesh_make(Object *ob) { CollisionModifierData *cmd; - ccd_Mesh *pccd_M = NULL; + ccd_Mesh *pccd_M = nullptr; ccdf_minmax *mima; const MVertTri *vt; float hull; @@ -281,10 +281,10 @@ static ccd_Mesh *ccd_mesh_make(Object *ob) /* first some paranoia checks */ if (!cmd) { - return NULL; + return nullptr; } if (!cmd->mvert_num || !cmd->tri_num) { - return NULL; + return nullptr; } pccd_M = static_cast(MEM_mallocN(sizeof(ccd_Mesh), "ccd_Mesh")); @@ -293,7 +293,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob) pccd_M->safety = CCD_SAFETY; pccd_M->bbmin[0] = pccd_M->bbmin[1] = pccd_M->bbmin[2] = 1e30f; pccd_M->bbmax[0] = pccd_M->bbmax[1] = pccd_M->bbmax[2] = -1e30f; - pccd_M->vert_positions_prev = NULL; + pccd_M->vert_positions_prev = nullptr; /* Blow it up with force-field ranges. */ hull = max_ff(ob->pd->pdef_sbift, ob->pd->pdef_sboft); @@ -629,7 +629,7 @@ static void add_2nd_order_roller(Object *ob, float /*stiffness*/, int *counter, /* Assume we have a softbody. */ SoftBody *sb = ob->soft; /* is supposed to be there */ BodyPoint *bp, *bpo; - BodySpring *bs, *bs2, *bs3 = NULL; + BodySpring *bs, *bs2, *bs3 = nullptr; int a, b, c, notthis = 0, v0; if (!sb->bspring) { return; @@ -641,7 +641,7 @@ static void add_2nd_order_roller(Object *ob, float /*stiffness*/, int *counter, } for (a = sb->totpoint, bp = sb->bpoint; a > 0; a--, bp++) { /* Scan for neighborhood. */ - bpo = NULL; + bpo = nullptr; v0 = (sb->totpoint - a); for (b = bp->nofsprings; b > 0; b--) { bs = sb->bspring + bp->springs[b - 1]; @@ -715,7 +715,7 @@ static void add_bp_springlist(BodyPoint *bp, int springID) { int *newlist; - if (bp->springs == NULL) { + if (bp->springs == nullptr) { bp->springs = static_cast(MEM_callocN(sizeof(int), "bpsprings")); bp->springs[0] = springID; bp->nofsprings = 1; @@ -741,7 +741,7 @@ static void build_bps_springlist(Object *ob) BodySpring *bs; int a, b; - if (sb == NULL) { + if (sb == nullptr) { return; /* paranoia check */ } @@ -749,7 +749,7 @@ static void build_bps_springlist(Object *ob) /* throw away old list */ if (bp->springs) { MEM_freeN(bp->springs); - bp->springs = NULL; + bp->springs = nullptr; } /* scan for attached inner springs */ for (b = sb->totspring, bs = sb->bspring; b > 0; b--, bs++) { @@ -771,7 +771,7 @@ static void calculate_collision_balls(Object *ob) int a, b, akku_count; float min, max, akku; - if (sb == NULL) { + if (sb == nullptr) { return; /* paranoia check */ } @@ -797,7 +797,7 @@ static void calculate_collision_balls(Object *ob) bp->colball = sb->colball; } if (sb->sbc_mode == SBC_MODE_AVG) { - bp->colball = akku / (float)akku_count * sb->colball; + bp->colball = akku / float(akku_count) * sb->colball; } if (sb->sbc_mode == SBC_MODE_MIN) { bp->colball = min * sb->colball; @@ -821,7 +821,7 @@ static void renew_softbody(Object *ob, int totpoint, int totspring) SoftBody *sb; int i; short softflag; - if (ob->soft == NULL) { + if (ob->soft == nullptr) { ob->soft = sbNew(); } else { @@ -856,7 +856,7 @@ static void renew_softbody(Object *ob, int totpoint, int totspring) } bp->nofsprings = 0; - bp->springs = NULL; + bp->springs = nullptr; bp->choke = 0.0f; bp->choke2 = 0.0f; bp->frozen = 1.0f; @@ -888,9 +888,9 @@ static void free_scratch(SoftBody *sb) /* TODO: make sure everything is cleaned up nicely. */ if (sb->scratch->colliderhash) { BLI_ghash_free(sb->scratch->colliderhash, - NULL, + nullptr, (GHashValFreeFP)ccd_mesh_free); /* This hopefully will free all caches. */ - sb->scratch->colliderhash = NULL; + sb->scratch->colliderhash = nullptr; } if (sb->scratch->bodyface) { MEM_freeN(sb->scratch->bodyface); @@ -899,7 +899,7 @@ static void free_scratch(SoftBody *sb) MEM_freeN(sb->scratch->Ref.ivert); } MEM_freeN(sb->scratch); - sb->scratch = NULL; + sb->scratch = nullptr; } } @@ -913,7 +913,7 @@ static void free_softbody_intern(SoftBody *sb) if (sb->bpoint) { for (a = sb->totpoint, bp = sb->bpoint; a > 0; a--, bp++) { /* free spring list */ - if (bp->springs != NULL) { + if (bp->springs != nullptr) { MEM_freeN(bp->springs); } } @@ -925,8 +925,8 @@ static void free_softbody_intern(SoftBody *sb) } sb->totpoint = sb->totspring = 0; - sb->bpoint = NULL; - sb->bspring = NULL; + sb->bpoint = nullptr; + sb->bspring = nullptr; free_scratch(sb); free_softbody_baked(sb); @@ -969,7 +969,7 @@ static int query_external_colliders(Depsgraph *depsgraph, Collection *collection { uint numobjects; Object **objects = BKE_collision_objects_create( - depsgraph, NULL, collection, &numobjects, eModifierType_Collision); + depsgraph, nullptr, collection, &numobjects, eModifierType_Collision); BKE_collision_objects_free(objects); return (numobjects != 0); @@ -989,7 +989,7 @@ static int sb_detect_aabb_collisionCached(float /*force*/[3], Object *vertexowne int a; #endif - if ((sb == NULL) || (sb->scratch == NULL)) { + if ((sb == nullptr) || (sb->scratch == nullptr)) { return 0; } copy_v3_v3(aabbmin, sb->scratch->aabbmin); @@ -1071,8 +1071,8 @@ static int sb_detect_face_pointCached(const float face_v1[3], { /* only with deflecting set */ if (ob->pd && ob->pd->deflect) { - const float(*vert_positions)[3] = NULL; - const float(*vert_positions_prev)[3] = NULL; + const float(*vert_positions)[3] = nullptr; + const float(*vert_positions_prev)[3] = nullptr; if (ccdm) { vert_positions = ccdm->vert_positions; a = ccdm->mvert_num; @@ -1164,10 +1164,10 @@ static int sb_detect_face_collisionCached(const float face_v1[3], { /* only with deflecting set */ if (ob->pd && ob->pd->deflect) { - const float(*vert_positions)[3] = NULL; - const float(*vert_positions_prev)[3] = NULL; - const MVertTri *vt = NULL; - const ccdf_minmax *mima = NULL; + const float(*vert_positions)[3] = nullptr; + const float(*vert_positions_prev)[3] = nullptr; + const MVertTri *vt = nullptr; + const ccdf_minmax *mima = nullptr; if (ccdm) { vert_positions = ccdm->vert_positions; @@ -1226,9 +1226,9 @@ static int sb_detect_face_collisionCached(const float face_v1[3], sub_v3_v3v3(edge2, nv3, nv2); cross_v3_v3v3(d_nvect, edge2, edge1); normalize_v3(d_nvect); - if (isect_line_segment_tri_v3(nv1, nv2, face_v1, face_v2, face_v3, &t, NULL) || - isect_line_segment_tri_v3(nv2, nv3, face_v1, face_v2, face_v3, &t, NULL) || - isect_line_segment_tri_v3(nv3, nv1, face_v1, face_v2, face_v3, &t, NULL)) + if (isect_line_segment_tri_v3(nv1, nv2, face_v1, face_v2, face_v3, &t, nullptr) || + isect_line_segment_tri_v3(nv2, nv3, face_v1, face_v2, face_v3, &t, nullptr) || + isect_line_segment_tri_v3(nv3, nv1, face_v1, face_v2, face_v3, &t, nullptr)) { madd_v3_v3fl(force, d_nvect, -0.5f); *damp = tune * ob->pd->pdef_sbdamp; @@ -1345,10 +1345,10 @@ static int sb_detect_edge_collisionCached(const float edge_v1[3], { /* only with deflecting set */ if (ob->pd && ob->pd->deflect) { - const float(*vert_positions)[3] = NULL; - const float(*vert_positions_prev)[3] = NULL; - const MVertTri *vt = NULL; - const ccdf_minmax *mima = NULL; + const float(*vert_positions)[3] = nullptr; + const float(*vert_positions_prev)[3] = nullptr; + const MVertTri *vt = nullptr; + const ccdf_minmax *mima = nullptr; if (ccdm) { vert_positions = ccdm->vert_positions; @@ -1408,7 +1408,7 @@ static int sb_detect_edge_collisionCached(const float edge_v1[3], cross_v3_v3v3(d_nvect, edge2, edge1); normalize_v3(d_nvect); - if (isect_line_segment_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, NULL)) { + if (isect_line_segment_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, nullptr)) { float v1[3], v2[3]; float intrusiondepth, i1, i2; sub_v3_v3v3(v1, edge_v1, nv2); @@ -1475,7 +1475,7 @@ static void _scan_for_ext_spring_forces( mid_v3_v3v3(vel, sb->bpoint[bs->v1].vec, sb->bpoint[bs->v2].vec); pd_point_from_soft(scene, pos, vel, -1, &epoint); BKE_effectors_apply( - effectors, NULL, sb->effector_weights, &epoint, force, NULL, speed); + effectors, nullptr, sb->effector_weights, &epoint, force, nullptr, speed); mul_v3_fl(speed, windfactor); add_v3_v3(vel, speed); @@ -1512,7 +1512,7 @@ static void *exec_scan_for_ext_spring_forces(void *data) SB_thread_context *pctx = (SB_thread_context *)data; _scan_for_ext_spring_forces( pctx->scene, pctx->ob, pctx->timenow, pctx->ifirst, pctx->ilast, pctx->effectors); - return NULL; + return nullptr; } static void sb_sfesf_threads_run(Depsgraph *depsgraph, @@ -1532,7 +1532,7 @@ static void sb_sfesf_threads_run(Depsgraph *depsgraph, int lowsprings = 100; ListBase *effectors = BKE_effectors_create( - depsgraph, ob, NULL, ob->soft->effector_weights, false); + depsgraph, ob, nullptr, ob->soft->effector_weights, false); /* figure the number of threads while preventing pretty pointless threading overhead */ totthread = BKE_scene_num_threads(scene); @@ -1625,7 +1625,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float vel[3], float *intrusion) { - Object *ob = NULL; + Object *ob = nullptr; GHash *hash; GHashIterator *ihash; float nv1[3], nv2[3], nv3[3], edge1[3], edge2[3], d_nvect[3], dv1[3], ve[3], @@ -1648,10 +1648,10 @@ static int sb_detect_vertex_collisionCached(float opco[3], { /* only with deflecting set */ if (ob->pd && ob->pd->deflect) { - const float(*vert_positions)[3] = NULL; - const float(*vert_positions_prev)[3] = NULL; - const MVertTri *vt = NULL; - const ccdf_minmax *mima = NULL; + const float(*vert_positions)[3] = nullptr; + const float(*vert_positions_prev)[3] = nullptr; + const MVertTri *vt = nullptr; + const ccdf_minmax *mima = nullptr; if (ccdm) { vert_positions = ccdm->vert_positions; @@ -1741,9 +1741,9 @@ static int sb_detect_vertex_collisionCached(float opco[3], if ((facedist > innerfacethickness) && (facedist < outerfacethickness)) { if (isect_point_tri_prism_v3(opco, nv1, nv2, nv3)) { - force_mag_norm = (float)exp(double(-ee * facedist)); + force_mag_norm = float(exp(double(-ee * facedist))); if (facedist > outerfacethickness * ff) { - force_mag_norm = (float)force_mag_norm * fa * (facedist - outerfacethickness) * + force_mag_norm = float(force_mag_norm) * fa * (facedist - outerfacethickness) * (facedist - outerfacethickness); } *damp = ob->pd->pdef_sbdamp; @@ -1777,9 +1777,9 @@ static int sb_detect_vertex_collisionCached(float opco[3], } /* while () */ if (deflected == 1) { /* no face but 'outer' edge cylinder sees vert */ - force_mag_norm = (float)exp(double(-ee * mindistedge)); + force_mag_norm = float(exp(double() - ee * mindistedge)); if (mindistedge > outerfacethickness * ff) { - force_mag_norm = (float)force_mag_norm * fa * (mindistedge - outerfacethickness) * + force_mag_norm = float(force_mag_norm) * fa * (mindistedge - outerfacethickness) * (mindistedge - outerfacethickness); } madd_v3_v3fl(force, coledge, force_mag_norm); @@ -1797,7 +1797,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], BLI_ghashIterator_free(ihash); if (cavel) { - mul_v3_fl(avel, 1.0f / (float)cavel); + mul_v3_fl(avel, 1.0f / float(cavel)); } copy_v3_v3(vel, avel); if (ci) { @@ -2106,7 +2106,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, float eval_sb_fric_force_scale = sb_fric_force_scale(ob); pd_point_from_soft(scene, bp->pos, bp->vec, sb->bpoint - bp, &epoint); - BKE_effectors_apply(effectors, NULL, sb->effector_weights, &epoint, force, NULL, speed); + BKE_effectors_apply( + effectors, nullptr, sb->effector_weights, &epoint, force, nullptr, speed); /* Apply force-field. */ mul_v3_fl(force, fieldfactor * eval_sb_fric_force_scale); @@ -2186,12 +2187,12 @@ static void *exec_softbody_calc_forces(void *data) pctx->timenow, pctx->ifirst, pctx->ilast, - NULL, + nullptr, pctx->effectors, pctx->do_deflector, pctx->fieldfactor, pctx->windfactor); - return NULL; + return nullptr; } static void sb_cf_threads_run(Scene *scene, @@ -2293,11 +2294,11 @@ static void softbody_calc_forces( // bproot = sb->bpoint; /* Need this for proper spring addressing. */ /* UNUSED */ if (do_springcollision || do_aero) { - sb_sfesf_threads_run(depsgraph, scene, ob, timenow, sb->totspring, NULL); + sb_sfesf_threads_run(depsgraph, scene, ob, timenow, sb->totspring, nullptr); } /* After spring scan because it uses effectors too. */ - ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, sb->effector_weights, false); + ListBase *effectors = BKE_effectors_create(depsgraph, ob, nullptr, sb->effector_weights, false); if (do_deflector) { float defforce[3]; @@ -2309,7 +2310,7 @@ static void softbody_calc_forces( forcetime, timenow, sb->totpoint, - NULL, + nullptr, effectors, do_deflector, fieldfactor, @@ -2621,7 +2622,7 @@ static void interpolate_exciter(Object *ob, int timescale, int time) float f; int a; - f = (float)time / (float)timescale; + f = float(time) / float(timescale); for (a = sb->totpoint, bp = sb->bpoint; a > 0; a--, bp++) { bp->origT[0] = bp->origS[0] + f * (bp->origE[0] - bp->origS[0]); @@ -2854,7 +2855,7 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff, Object for (v = 0; v < lt->pntsv; v++) { - for (u = 0, bpuc = 0, bpu = NULL; u < lt->pntsu; u++, bp++, bpc++) { + for (u = 0, bpuc = 0, bpu = nullptr; u < lt->pntsu; u++, bp++, bpc++) { if (w) { bs->v1 = bpc; @@ -3120,17 +3121,17 @@ static void sb_new_scratch(SoftBody *sb) } sb->scratch = static_cast(MEM_callocN(sizeof(SBScratch), "SBScratch")); sb->scratch->colliderhash = BLI_ghash_ptr_new("sb_new_scratch gh"); - sb->scratch->bodyface = NULL; + sb->scratch->bodyface = nullptr; sb->scratch->totface = 0; sb->scratch->aabbmax[0] = sb->scratch->aabbmax[1] = sb->scratch->aabbmax[2] = 1.0e30f; sb->scratch->aabbmin[0] = sb->scratch->aabbmin[1] = sb->scratch->aabbmin[2] = -1.0e30f; - sb->scratch->Ref.ivert = NULL; + sb->scratch->Ref.ivert = nullptr; } /* --- ************ maintaining scratch *************** */ /* ************ Object level, exported functions *************** */ -SoftBody *sbNew(void) +SoftBody *sbNew() { SoftBody *sb; @@ -3173,7 +3174,7 @@ SoftBody *sbNew(void) sb->shared->pointcache = BKE_ptcache_add(&sb->shared->ptcaches); if (!sb->effector_weights) { - sb->effector_weights = BKE_effector_add_weights(NULL); + sb->effector_weights = BKE_effector_add_weights(nullptr); } sb->last_frame = MINFRAME - 1; @@ -3184,7 +3185,7 @@ SoftBody *sbNew(void) void sbFree(Object *ob) { SoftBody *sb = ob->soft; - if (sb == NULL) { + if (sb == nullptr) { return; } @@ -3195,7 +3196,7 @@ void sbFree(Object *ob) if (is_orig) { /* Only free shared data on non-CoW copies */ BKE_ptcache_free_list(&sb->shared->ptcaches); - sb->shared->pointcache = NULL; + sb->shared->pointcache = nullptr; MEM_freeN(sb->shared); } if (sb->effector_weights) { @@ -3203,7 +3204,7 @@ void sbFree(Object *ob) } MEM_freeN(sb); - ob->soft = NULL; + ob->soft = nullptr; } void sbFreeSimulation(SoftBody *sb) @@ -3264,7 +3265,7 @@ void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float ls { BodyPoint *bp; ReferenceVert *rp; - SoftBody *sb = NULL; + SoftBody *sb = nullptr; float(*opos)[3]; float(*rpos)[3]; float com[3], rcom[3]; @@ -3285,7 +3286,8 @@ void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float ls copy_v3_v3(opos[a], bp->pos); } - vcloud_estimate_transform_v3(sb->totpoint, opos, NULL, rpos, NULL, com, rcom, lrot, lscale); + vcloud_estimate_transform_v3( + sb->totpoint, opos, nullptr, rpos, nullptr, com, rcom, lrot, lscale); // sub_v3_v3(com, rcom); if (lloc) { copy_v3_v3(lloc, com); @@ -3345,8 +3347,8 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int /* we only need that if we want to reconstruct IPO */ if (1) { reference_to_scratch(ob); - SB_estimate_transform(ob, NULL, NULL, NULL); - SB_estimate_transform(ob, NULL, NULL, NULL); + SB_estimate_transform(ob, nullptr, nullptr, nullptr); + SB_estimate_transform(ob, nullptr, nullptr, nullptr); } switch (ob->type) { case OB_MESH: @@ -3416,13 +3418,13 @@ static void softbody_step( forcetime = forcetimemax; /* hope for integrating in one step */ while ((fabsf(timedone) < fabsf(dtime)) && (loops < 2000)) { /* set goals in time */ - interpolate_exciter(ob, 200, (int)(200.0f * (timedone / dtime))); + interpolate_exciter(ob, 200, int(200.0f * (timedone / dtime))); sb->scratch->flag &= ~SBF_DOFUZZY; /* do predictive euler step */ softbody_calc_forces(depsgraph, scene, ob, forcetime, timedone / dtime); - softbody_apply_forces(ob, forcetime, 1, NULL, mid_flags); + softbody_apply_forces(ob, forcetime, 1, nullptr, mid_flags); /* crop new slope values to do averaged slope step */ softbody_calc_forces(depsgraph, scene, ob, forcetime, timedone / dtime); @@ -3540,7 +3542,7 @@ void sbObjectStep(Depsgraph *depsgraph, int cache_result; cache = sb->shared->pointcache; - framenr = (int)cfra; + framenr = int(cfra); framedelta = framenr - cache->simframe; BKE_ptcache_id_from_softbody(&pid, ob, sb); @@ -3563,7 +3565,7 @@ void sbObjectStep(Depsgraph *depsgraph, } /* verify if we need to create the softbody data */ - if (sb->bpoint == NULL || + if (sb->bpoint == nullptr || ((ob->softflag & OB_SB_EDGES) && !ob->soft->bspring && object_has_edges(ob))) { @@ -3610,7 +3612,7 @@ void sbObjectStep(Depsgraph *depsgraph, bool can_simulate = (framenr == sb->last_frame + 1) && !(cache->flag & PTCACHE_BAKED) && can_write_cache; - cache_result = BKE_ptcache_read(&pid, (float)framenr + scene->r.subframe, can_simulate); + cache_result = BKE_ptcache_read(&pid, float(framenr) + scene->r.subframe, can_simulate); if (cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED || (!can_simulate && cache_result == PTCACHE_READ_OLD)) diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index d8be84761c3..50ce09ea1d7 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -749,7 +749,7 @@ uint BLI_str_utf8_as_unicode_or_error(const char *p) return utf8_char_decode(p, mask, len, BLI_UTF8_ERR); } -unsigned int BLI_str_utf8_as_unicode_safe(const char *p) +uint BLI_str_utf8_as_unicode_safe(const char *p) { const uint result = BLI_str_utf8_as_unicode_or_error(p); if (UNLIKELY(result == BLI_UTF8_ERR)) { diff --git a/source/blender/blenloader/intern/versioning_260.cc b/source/blender/blenloader/intern/versioning_260.cc index ee7fb01cf86..d0b342244c3 100644 --- a/source/blender/blenloader/intern/versioning_260.cc +++ b/source/blender/blenloader/intern/versioning_260.cc @@ -1053,8 +1053,8 @@ static bNodeSocket *version_make_socket_stub(const char *idname, socket->limit = (in_out == SOCK_IN ? 1 : 0xFFF); - BLI_strncpy(socket->identifier, identifier, sizeof(socket->identifier)); - BLI_strncpy(socket->name, name, sizeof(socket->name)); + STRNCPY(socket->identifier, identifier); + STRNCPY(socket->name, name); socket->storage = nullptr; socket->flag |= SOCK_COLLAPSED; diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cc b/source/blender/compositor/operations/COM_CompositorOperation.cc index 114f8c3cf33..7ff1ad5341d 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cc +++ b/source/blender/compositor/operations/COM_CompositorOperation.cc @@ -180,7 +180,7 @@ void CompositorOperation::execute_region(rcti *rect, uint /*tile_number*/) void CompositorOperation::set_scene_name(const char *scene_name) { - BLI_strncpy(scene_name_, scene_name, sizeof(scene_name_)); + STRNCPY(scene_name_, scene_name); } void CompositorOperation::update_memory_buffer_partial(MemoryBuffer * /*output*/, diff --git a/source/blender/editors/interface/interface_region_tooltip.cc b/source/blender/editors/interface/interface_region_tooltip.cc index a558c518ccc..5d4e87f334d 100644 --- a/source/blender/editors/interface/interface_region_tooltip.cc +++ b/source/blender/editors/interface/interface_region_tooltip.cc @@ -130,9 +130,7 @@ void UI_tooltip_text_field_add(uiTooltipData *data, field->text_suffix = suffix; } -void UI_tooltip_image_field_add(uiTooltipData *data, - const struct ImBuf *image, - const short image_size[2]) +void UI_tooltip_image_field_add(uiTooltipData *data, const ImBuf *image, const short image_size[2]) { uiTooltipField *field = text_field_add_only(data); field->format = {}; diff --git a/source/blender/editors/object/object_relations.cc b/source/blender/editors/object/object_relations.cc index 18e37a0b007..e778a5696b6 100644 --- a/source/blender/editors/object/object_relations.cc +++ b/source/blender/editors/object/object_relations.cc @@ -391,7 +391,7 @@ void ED_object_parent_clear(Object *ob, const int type) if (ob->parent == nullptr) { return; } - unsigned int flags = ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION; + uint flags = ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION; switch (type) { case CLEAR_PARENT_ALL: { /* for deformers, remove corresponding modifiers to prevent diff --git a/source/blender/editors/space_graph/graph_select.cc b/source/blender/editors/space_graph/graph_select.cc index a199f3321d9..52a27fb43a2 100644 --- a/source/blender/editors/space_graph/graph_select.cc +++ b/source/blender/editors/space_graph/graph_select.cc @@ -2073,7 +2073,7 @@ static const EnumPropertyItem prop_graphkeys_select_key_handles_actions[] = { {GRAPHKEYS_KEYHANDLESSEL_SELECT, "SELECT", 0, "Select", ""}, {GRAPHKEYS_KEYHANDLESSEL_DESELECT, "DESELECT", 0, "Deselect", ""}, {GRAPHKEYS_KEYHANDLESSEL_KEEP, "KEEP", 0, "Keep", "Leave as is"}, - {0, NULL, 0, NULL, NULL}, + {0, nullptr, 0, nullptr, nullptr}, }; /** @@ -2092,7 +2092,7 @@ static void graphkeys_select_key_handles( const enum eGraphKey_SelectKeyHandles_Action key_action, const enum eGraphKey_SelectKeyHandles_Action right_handle_action) { - ListBase anim_data = {NULL, NULL}; + ListBase anim_data = {nullptr, nullptr}; const eAnimFilter_Flags filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY | ANIMFILTER_NODUPLIS); @@ -2103,7 +2103,7 @@ static void graphkeys_select_key_handles( FCurve *fcu = (FCurve *)ale->key_data; /* Only continue if F-Curve has keyframes. */ - if (fcu->bezt == NULL) { + if (fcu->bezt == nullptr) { continue; } @@ -2174,7 +2174,7 @@ static int graphkeys_select_key_handles_exec(bContext *C, wmOperator *op) graphkeys_select_key_handles(&ac, left_handle_action, key_action, right_handle_action); - WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, nullptr); return OPERATOR_FINISHED; } @@ -2185,11 +2185,11 @@ static void graphkeys_select_key_handles_ui(bContext * /* C */, wmOperator *op) uiLayout *row; row = uiLayoutRow(layout, false); - uiItemR(row, op->ptr, "left_handle_action", UI_ITEM_NONE, NULL, ICON_NONE); + uiItemR(row, op->ptr, "left_handle_action", UI_ITEM_NONE, nullptr, ICON_NONE); row = uiLayoutRow(layout, false); - uiItemR(row, op->ptr, "right_handle_action", UI_ITEM_NONE, NULL, ICON_NONE); + uiItemR(row, op->ptr, "right_handle_action", UI_ITEM_NONE, nullptr, ICON_NONE); row = uiLayoutRow(layout, false); - uiItemR(row, op->ptr, "key_action", UI_ITEM_NONE, NULL, ICON_NONE); + uiItemR(row, op->ptr, "key_action", UI_ITEM_NONE, nullptr, ICON_NONE); } void GRAPH_OT_select_key_handles(wmOperatorType *ot) diff --git a/source/blender/editors/space_graph/graph_slider_ops.cc b/source/blender/editors/space_graph/graph_slider_ops.cc index 334d0b9324d..d3f30174001 100644 --- a/source/blender/editors/space_graph/graph_slider_ops.cc +++ b/source/blender/editors/space_graph/graph_slider_ops.cc @@ -1313,7 +1313,7 @@ static void time_offset_modal_update(bContext *C, wmOperator *op) reset_bezts(gso); const float factor = slider_factor_get_and_remember(op); time_offset_graph_keys(&gso->ac, factor); - WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr); } static int time_offset_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -1350,7 +1350,7 @@ static int time_offset_exec(bContext *C, wmOperator *op) time_offset_graph_keys(&ac, factor); /* Set notifier that keyframes have changed. */ - WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr); return OPERATOR_FINISHED; } @@ -2188,7 +2188,7 @@ static void push_pull_modal_update(bContext *C, wmOperator *op) reset_bezts(gso); const float factor = slider_factor_get_and_remember(op); push_pull_graph_keys(&gso->ac, factor); - WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr); } static int push_pull_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -2223,7 +2223,7 @@ static int push_pull_exec(bContext *C, wmOperator *op) push_pull_graph_keys(&ac, factor); /* Set notifier that keyframes have changed. */ - WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr); return OPERATOR_FINISHED; }