diff options
Diffstat (limited to 'source')
26 files changed, 38 insertions, 53 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index ddbc7e7d1ef..0b843c3a97a 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1521,12 +1521,12 @@ void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys) void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys) { - MVert *mvert = CustomData_duplicate_referenced_layer(&me->vdata, CD_MVERT, me->totvert); + CustomData_duplicate_referenced_layer(&me->vdata, CD_MVERT, me->totvert); /* If the referenced layer has been re-allocated need to update pointers stored in the mesh. */ BKE_mesh_update_customdata_pointers(me, false); int i = me->totvert; - for (mvert = me->mvert; i--; mvert++) { + for (MVert *mvert = me->mvert; i--; mvert++) { add_v3_v3(mvert->co, offset); } diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 345546bc9cf..826094420a7 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -2567,7 +2567,7 @@ bool BKE_mesh_center_median_from_polys(const Mesh *me, float r_cent[3]) const MLoop *mloop = me->mloop; const MVert *mvert = me->mvert; zero_v3(r_cent); - for (mpoly = me->mpoly; i--; mpoly++) { + for (; i--; mpoly++) { int loopend = mpoly->loopstart + mpoly->totloop; for (int j = mpoly->loopstart; j < loopend; j++) { add_v3_v3(r_cent, mvert[mloop[j].v].co); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index a28136f8527..23eccbfba9b 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1879,12 +1879,11 @@ static const MeshElemMap *ccgDM_getPolyMap(Object *ob, DerivedMesh *dm) /* WARNING! *MUST* be called in an 'loops_cache_rwlock' protected thread context! */ static void ccgDM_recalcLoopTri(DerivedMesh *dm) { - MLoopTri *mlooptri = dm->looptris.array; const int tottri = dm->numPolyData * 2; int i, poly_index; DM_ensure_looptri_data(dm); - mlooptri = dm->looptris.array_wip; + MLoopTri *mlooptri = dm->looptris.array_wip; BLI_assert(tottri == 0 || mlooptri != NULL); BLI_assert(poly_to_tri_count(dm->numPolyData, dm->numLoopData) == dm->looptris.num); diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc index 25aeae519c1..c5c830bb4dd 100644 --- a/source/blender/blenlib/intern/mesh_boolean.cc +++ b/source/blender/blenlib/intern/mesh_boolean.cc @@ -1406,9 +1406,9 @@ static int find_cell_for_point_near_edge(mpq3 p, int dummy_index = p_sorted_dummy - sorted_tris.begin(); int prev_tri = (dummy_index == 0) ? sorted_tris[sorted_tris.size() - 1] : sorted_tris[dummy_index - 1]; - int next_tri = (dummy_index == sorted_tris.size() - 1) ? sorted_tris[0] : - sorted_tris[dummy_index + 1]; if (dbg_level > 0) { + int next_tri = (dummy_index == sorted_tris.size() - 1) ? sorted_tris[0] : + sorted_tris[dummy_index + 1]; std::cout << "prev tri to dummy = " << prev_tri << "; next tri to dummy = " << next_tri << "\n"; } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index cf082393803..cf8f45ca227 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -3172,7 +3172,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) bool is_blend = false; { - char tool = tool_init; + char tool; switch (tool_init) { case PAINT_BLEND_MIX: tool = VPAINT_TOOL_DRAW; diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index cef97f20a6a..d39fb5e81f1 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -7361,7 +7361,6 @@ static float geometry_collide_offset(BevelParams *bp, EdgeHalf *eb) static float vertex_collide_offset(BevelParams *bp, EdgeHalf *ea) { float no_collide_offset = bp->offset + 1e6; - float limit = no_collide_offset; if (bp->offset == 0.0f) { return no_collide_offset; } @@ -7373,8 +7372,7 @@ static float vertex_collide_offset(BevelParams *bp, EdgeHalf *ea) if (kab <= 0.0f) { return no_collide_offset; } - limit = la / kab; - return limit; + return la / kab; } /** diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index e5d7bd70214..0d367762b00 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -320,7 +320,6 @@ bool id_copy_inplace_no_main(const ID *id, ID *newid) * is already allocated. */ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene) { - const ID *id_for_copy = &scene->id; if (G.debug & G_DEBUG_DEPSGRAPH_UUID) { SEQ_relations_check_uuids_unique_and_report(scene); @@ -328,9 +327,10 @@ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene) #ifdef NESTED_ID_NASTY_WORKAROUND NestedIDHackTempStorage id_hack_storage; - id_for_copy = nested_id_hack_get_discarded_pointers(&id_hack_storage, &scene->id); + const ID *id_for_copy = nested_id_hack_get_discarded_pointers(&id_hack_storage, &scene->id); +#else + const ID *id_for_copy = &scene->id; #endif - bool result = (BKE_id_copy_ex(nullptr, id_for_copy, (ID **)&new_scene, diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index fbad60ff4ab..2f9ececc198 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -2063,9 +2063,8 @@ static void draw_armature_pose(ArmatureDrawContext *ctx) set_pchan_colorset(ctx, ob, pchan); } - int boneflag = bone->flag; /* catch exception for bone with hidden parent */ - boneflag = bone->flag; + int boneflag = bone->flag; if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG))) { boneflag &= ~BONE_CONNECTED; } diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 535ccaa06fd..2999ac784ba 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -6646,7 +6646,7 @@ void CURVE_OT_dissolve_verts(wmOperatorType *ot) static bool nurb_bezt_flag_any(const Nurb *nu, const char flag_test) { - BezTriple *bezt = nu->bezt; + const BezTriple *bezt; int i; for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) { diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index e4f2de1f741..03c120df28b 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -387,7 +387,6 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), GPU_matrix_translate_3f(selem->location_local[0] - location_prev[0], selem->location_local[1] - location_prev[1], selem->location_local[2] - location_prev[2]); - location_prev = selem->location_local; const float radius = stroke_elem_radius(cdd, selem); diff --git a/source/blender/editors/gpencil/gpencil_trace_utils.c b/source/blender/editors/gpencil/gpencil_trace_utils.c index 482f7015720..12c38fb2744 100644 --- a/source/blender/editors/gpencil/gpencil_trace_utils.c +++ b/source/blender/editors/gpencil/gpencil_trace_utils.c @@ -281,7 +281,6 @@ void ED_gpencil_trace_data_to_strokes(Main *bmain, mat_mask_idx = ob->totcol - 1; } - potrace_path_t *path = st->plist; int n, *tag; potrace_dpoint_t(*c)[3]; @@ -289,7 +288,7 @@ void ED_gpencil_trace_data_to_strokes(Main *bmain, * good results using the Potrace data. */ const float scalef = 0.008f * scale; /* Draw each curve. */ - path = st->plist; + potrace_path_t *path = st->plist; while (path != NULL) { n = path->curve.n; tag = path->curve.tag; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 3450d61337c..f306612f295 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -149,7 +149,7 @@ static void join_mesh_single(Depsgraph *depsgraph, mul_m4_m4m4(cmat, imat, ob_src->obmat); /* transform vertex coordinates into new space */ - for (a = 0, mvert = *mvert_pp; a < me->totvert; a++, mvert++) { + for (a = 0; a < me->totvert; a++, mvert++) { mul_m4_v3(cmat, mvert->co); } diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index b6205db6f45..71166b7c20c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -1189,9 +1189,7 @@ static SculptUndoNode *sculpt_undo_geometry_push(Object *object, SculptUndoType static SculptUndoNode *sculpt_undo_face_sets_push(Object *ob, SculptUndoType type) { UndoSculpt *usculpt = sculpt_undo_get_nodes(); - SculptUndoNode *unode = usculpt->nodes.first; - - unode = MEM_callocN(sizeof(*unode), __func__); + SculptUndoNode *unode = MEM_callocN(sizeof(*unode), __func__); BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname)); unode->type = type; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index cd60ebf3031..369a6e7c944 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -1235,10 +1235,8 @@ static void do_movie_proxy(void *pjv, float *progress) { ProxyJob *pj = pjv; - Scene *scene = pj->scene; MovieClip *clip = pj->clip; struct MovieDistortion *distortion = NULL; - int cfra, sfra = SFRA, efra = EFRA; if (pj->index_context) { IMB_anim_index_rebuild(pj->index_context, stop, do_update, progress); @@ -1252,8 +1250,8 @@ static void do_movie_proxy(void *pjv, return; } - sfra = 1; - efra = clip->len; + const int sfra = 1; + const int efra = clip->len; if (build_undistort_count) { int threads = BLI_system_thread_count(); @@ -1265,7 +1263,7 @@ static void do_movie_proxy(void *pjv, BKE_tracking_distortion_set_threads(distortion, threads); } - for (cfra = sfra; cfra <= efra; cfra++) { + for (int cfra = sfra; cfra <= efra; cfra++) { BKE_movieclip_build_proxy_frame( clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 0e22a2fffe1..068ee177d59 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1805,7 +1805,6 @@ static int graphkeys_mselect_column(bAnimContext *ac, KeyframeEditFunc select_cb, ok_cb; KeyframeEditData ked; tNearestVertInfo *nvi; - float selx = (float)ac->scene->r.cfra; /* find the beztriple that we're selecting, and the handle that was clicked on */ nvi = find_nearest_fcurve_vert(ac, mval); @@ -1817,7 +1816,7 @@ static int graphkeys_mselect_column(bAnimContext *ac, /* get frame number on which elements should be selected */ /* TODO: should we restrict to integer frames only? */ - selx = nvi->frame; + const float selx = nvi->frame; if (select_mode != SELECT_REPLACE) { /* Doesn't need to deselect anything -> Pass. */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 6053253790a..0c34c0cc756 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1311,7 +1311,6 @@ static int image_open_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); ImageUser *iuser = NULL; - ImageOpenData *iod = op->customdata; Image *ima = NULL; int frame_seq_len = 0; int frame_ofs = 1; @@ -1345,7 +1344,7 @@ static int image_open_exec(bContext *C, wmOperator *op) } /* hook into UI */ - iod = op->customdata; + ImageOpenData *iod = op->customdata; if (iod->pprop.prop) { /* when creating new ID blocks, use is already 1, but RNA diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index be3b60d581b..9524c2a1d8a 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -134,14 +134,12 @@ static void report_textview_end(TextViewContext *UNUSED(tvc)) static int report_textview_step(TextViewContext *tvc) { /* simple case, but no newline support */ - const Report *report = tvc->iter; - if (tvc->iter_char_begin <= 0) { tvc->iter = (void *)((Link *)tvc->iter)->prev; if (tvc->iter && report_textview_skip__internal(tvc)) { tvc->iter_tmp++; - report = tvc->iter; + const Report *report = tvc->iter; tvc->iter_char_end = report->len; /* reset start */ report_textview_init__internal(tvc); diff --git a/source/blender/editors/transform/transform_mode_maskshrinkfatten.c b/source/blender/editors/transform/transform_mode_maskshrinkfatten.c index 857ee37f0ad..cfbd6030788 100644 --- a/source/blender/editors/transform/transform_mode_maskshrinkfatten.c +++ b/source/blender/editors/transform/transform_mode_maskshrinkfatten.c @@ -89,7 +89,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) /* apply shrink/fatten */ FOREACH_TRANS_DATA_CONTAINER (t, tc) { - TransData *td = tc->data; + TransData *td; for (td = tc->data, i = 0; i < tc->data_len; i++, td++) { if (td->flag & TD_SKIP) { continue; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 193954fffb6..bebef049718 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1072,7 +1072,7 @@ static void TargetSnapClosest(TransInfo *t) if (t->options & CTX_OBJECT) { int i; FOREACH_TRANS_DATA_CONTAINER (t, tc) { - TransData *td = tc->data; + TransData *td; for (td = tc->data, i = 0; i < tc->data_len && td->flag & TD_SELECTED; i++, td++) { const BoundBox *bb = NULL; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c index 23928b4ccda..25c4e959ac1 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c @@ -198,7 +198,7 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb) * so we assign it based on the first segment we found. */ ec->object_ref = e->object_ref; - LineartEdge *new_e = e; + LineartEdge *new_e; LineartVert *new_vt; float N[3] = {0}; diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index 265dec7c56a..e2eb8953292 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -159,7 +159,7 @@ void Shader::print_log(Span<const char *> sources, char *log, const char *stage, } /* Print line from the source file that is producing the error. */ if ((error_line != -1) && (error_line != last_error_line || error_char != last_error_char)) { - const char *src_line_end = src_line; + const char *src_line_end; found_line_id = false; /* error_line is 1 based in this case. */ int src_line_index = 1; diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 6c88d5f7230..a23c9087ffc 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -1564,9 +1564,8 @@ DNA_ReconstructInfo *DNA_reconstruct_info_create(const SDNA *oldsdna, ReconstructStep *steps = create_reconstruct_steps_for_struct( oldsdna, newsdna, compare_flags, old_struct, new_struct); - int steps_len = new_struct->members_len; /* Comment the line below to skip the compression for debugging purposes. */ - steps_len = compress_reconstruct_steps(steps, new_struct->members_len); + const int steps_len = compress_reconstruct_steps(steps, new_struct->members_len); reconstruct_info->steps[new_struct_nr] = steps; reconstruct_info->step_counts[new_struct_nr] = steps_len; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index be7c938a525..2ccc8fe949c 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1912,10 +1912,9 @@ static void rna_Scene_transform_orientation_slots_begin(CollectionPropertyIterat iter, orient_slot, sizeof(*orient_slot), ARRAY_SIZE(scene->orientation_slots), 0, NULL); } -static int rna_Scene_transform_orientation_slots_length(PointerRNA *ptr) +static int rna_Scene_transform_orientation_slots_length(PointerRNA *UNUSED(ptr)) { - Scene *scene = (Scene *)ptr->owner_id; - return ARRAY_SIZE(scene->orientation_slots); + return ARRAY_SIZE(((Scene *)NULL)->orientation_slots); } static bool rna_Scene_use_audio_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 6005ec96255..4d45d1d6d63 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1072,10 +1072,9 @@ static void rna_UserDef_studiolight_solid_lights_begin(CollectionPropertyIterato rna_iterator_array_begin(iter, sl->light, sizeof(*sl->light), ARRAY_SIZE(sl->light), 0, NULL); } -static int rna_UserDef_studiolight_solid_lights_length(PointerRNA *ptr) +static int rna_UserDef_studiolight_solid_lights_length(PointerRNA *UNUSED(ptr)) { - StudioLight *sl = (StudioLight *)ptr->data; - return ARRAY_SIZE(sl->light); + return ARRAY_SIZE(((StudioLight *)NULL)->light); } /* StudioLight.light_ambient */ diff --git a/source/blender/sequencer/intern/strip_add.c b/source/blender/sequencer/intern/strip_add.c index 9e5afb45f2a..888220b7111 100644 --- a/source/blender/sequencer/intern/strip_add.c +++ b/source/blender/sequencer/intern/strip_add.c @@ -409,7 +409,7 @@ Sequence *SEQ_add_sound_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL Strip *strip = seq->strip; /* We only need 1 element to store the filename. */ - StripElem *se = strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem"); + StripElem *se = strip->stripdata = MEM_callocN(sizeof(StripElem), "stripelem"); BLI_split_dirfile(load_data->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); if (seq != NULL && seq->sound != NULL) { diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index d0ee7075516..0aff2c00644 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -911,7 +911,10 @@ void wm_homefile_read(bContext *C, const char *app_template_override, bool *r_is_factory_startup) { - Main *bmain = G_MAIN; /* Context does not always have valid main pointer here... */ +#if 0 /* UNUSED, keep as this may be needed later & the comment below isn't self evident. */ + /* Context does not always have valid main pointer here. */ + Main *bmain = G_MAIN; +#endif ListBase wmbase; bool success = false; @@ -1170,7 +1173,7 @@ void wm_homefile_read(bContext *C, BLI_strncpy(U.app_template, app_template_override, sizeof(U.app_template)); } - bmain = CTX_data_main(C); + Main *bmain = CTX_data_main(C); if (use_userdef) { /* check userdef before open window, keymaps etc */ @@ -2482,12 +2485,11 @@ static void wm_open_mainfile_ui(bContext *UNUSED(C), wmOperator *op) { struct FileRuntime *file_info = (struct FileRuntime *)&op->customdata; uiLayout *layout = op->layout; - uiLayout *col = op->layout; const char *autoexec_text; uiItemR(layout, op->ptr, "load_ui", 0, NULL, ICON_NONE); - col = uiLayoutColumn(layout, false); + uiLayout *col = uiLayoutColumn(layout, false); if (file_info->is_untrusted) { autoexec_text = IFACE_("Trusted Source [Untrusted Path]"); uiLayoutSetActive(col, false); |