diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-11-23 07:45:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-11-23 09:40:49 +0300 |
commit | 6e4cb463c44ab57331cda7ded645b4faa573bbb3 (patch) | |
tree | 8da615bcb135c1f52872a9a9b34a888a0ccf064f | |
parent | daa90de3fdb5b9971b713c13a67b9c0a0990b3d7 (diff) |
Cleanup: shadowing (rna, modifiers, *misc*)
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 12 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_260.c | 5 | ||||
-rw-r--r-- | source/blender/ikplugin/intern/iksolver_plugin.c | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 25 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 6 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_array.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_solidify.c | 12 |
8 files changed, 37 insertions, 39 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 39df407b099..482be573a4e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2783,8 +2783,6 @@ static void lib_node_do_versions_group_indices(bNode *gnode) * typedefs */ static void lib_verify_nodetree(Main *main, int UNUSED(open)) { - bNodeTree *ntree; - /* this crashes blender on undo/redo */ #if 0 if (open == 1) { @@ -2811,9 +2809,10 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) * we have set the NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2 flag, so at this point we can do the * actual group node updates. */ - for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next) { - if (ntree->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2) + for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) { + if (ntree->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2) { has_old_groups = 1; + } } if (has_old_groups) { @@ -2830,8 +2829,9 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) } FOREACH_NODETREE_END } - for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next) + for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) { ntree->flag &= ~NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2; + } } { @@ -2937,7 +2937,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) } /* verify all group user nodes */ - for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next) { + for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) { ntreeVerifyNodes(main, &ntree->id); } diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 947f945edcc..9456c286c6f 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -1864,7 +1864,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 5)) { Scene *scene; - Image *image; Tex *tex; for (scene = main->scene.first; scene; scene = scene->id.next) { @@ -1904,7 +1903,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) } } - for (image = main->image.first; image; image = image->id.next) { + for (Image *image = main->image.first; image; image = image->id.next) { if (image->flag & IMA_DO_PREMUL) { image->alpha_mode = IMA_ALPHA_STRAIGHT; } @@ -1915,7 +1914,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) for (tex = main->tex.first; tex; tex = tex->id.next) { if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) { - image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima); + Image *image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima); if (image && (image->flag & IMA_DO_PREMUL) == 0) image->flag |= IMA_IGNORE_ALPHA; diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 5da06ed91ec..b3c83bffb3f 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -242,7 +242,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) float goal[4][4], goalinv[4][4]; float irest_basis[3][3], full_basis[3][3]; float end_pose[4][4], world_pose[4][4]; - float length, basis[3][3], rest_basis[3][3], start[3], *ikstretch = NULL; + float basis[3][3], rest_basis[3][3], start[3], *ikstretch = NULL; float resultinf = 0.0f; int a, flag, hasstretch = 0, resultblend = 0; bPoseChannel *pchan; @@ -258,6 +258,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) iktree = MEM_mallocN(sizeof(void *) * tree->totchannel, "ik tree"); for (a = 0; a < tree->totchannel; a++) { + float length; pchan = tree->pchan[a]; bone = pchan->bone; @@ -335,9 +336,9 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]); if (tree->stretch && (pchan->ikstretch > 0.0f)) { - const float ikstretch = pchan->ikstretch * pchan->ikstretch; + const float ikstretch_sq = SQUARE(pchan->ikstretch); /* this function does its own clamping */ - IK_SetStiffness(seg, IK_TRANS_Y, 1.0f - ikstretch); + IK_SetStiffness(seg, IK_TRANS_Y, 1.0f - ikstretch_sq); IK_SetLimit(seg, IK_TRANS_Y, IK_STRETCH_STIFF_MIN, IK_STRETCH_STIFF_MAX); } } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 3ec649afcc9..5e4ea749b22 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -3396,7 +3396,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro void *inarray, RawPropertyType intype, int inlen, int set) { StructRNA *ptype; - PointerRNA itemptr; + PointerRNA itemptr_base; PropertyRNA *itemprop, *iprop; PropertyType itemtype = 0; RawArray in; @@ -3411,8 +3411,8 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro ptype = RNA_property_pointer_type(ptr, prop); /* try to get item property pointer */ - RNA_pointer_create(NULL, ptype, NULL, &itemptr); - itemprop = RNA_struct_find_property(&itemptr, propname); + RNA_pointer_create(NULL, ptype, NULL, &itemptr_base); + itemprop = RNA_struct_find_property(&itemptr_base, propname); if (itemprop) { /* we have item property pointer */ @@ -3427,7 +3427,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro } /* check item array */ - itemlen = RNA_property_array_length(&itemptr, itemprop); + itemlen = RNA_property_array_length(&itemptr_base, itemprop); /* dynamic array? need to get length per item */ if (itemprop->getlength) { @@ -4222,7 +4222,7 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path, *r_index = index; if (prop_elem && (prop_elem->ptr.data != curptr.data || prop_elem->prop != prop || prop_elem->index != index)) { - PropertyElemRNA *prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__); + prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__); prop_elem->ptr = curptr; prop_elem->prop = prop; prop_elem->index = index; @@ -4505,12 +4505,12 @@ static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *nee break; } else { - int i; + int j; link.name = iter->name; - for (i = 0; i < iter->len; i++, array++) { + for (j = 0; j < iter->len; j++, array++) { PointerRNA child_ptr; - if (RNA_property_collection_lookup_int(ptr, prop, i, &child_ptr)) { - link.index = i; + if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) { + link.index = j; if ((path = rna_idp_path(&child_ptr, array, needle, &link))) { break; } @@ -5459,7 +5459,6 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in { int type = RNA_property_type(prop); int len = RNA_property_array_length(ptr, prop); - int i; DynStr *dynstr = BLI_dynstr_new(); char *cstring; @@ -5481,7 +5480,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in RNA_property_boolean_get_array(ptr, prop, buf); BLI_dynstr_append(dynstr, "("); - for (i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { BLI_dynstr_appendf(dynstr, i ? ", %s" : "%s", bool_as_py_string(buf[i])); } if (len == 1) @@ -5507,7 +5506,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in RNA_property_int_get_array(ptr, prop, buf); BLI_dynstr_append(dynstr, "("); - for (i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { BLI_dynstr_appendf(dynstr, i ? ", %d" : "%d", buf[i]); } if (len == 1) @@ -5533,7 +5532,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in RNA_property_float_get_array(ptr, prop, buf); BLI_dynstr_append(dynstr, "("); - for (i = 0; i < len; i++) { + for (int i = 0; i < len; i++) { BLI_dynstr_appendf(dynstr, i ? ", %g" : "%g", buf[i]); } if (len == 1) diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index bb18871afcd..c418ef3ceb6 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -195,9 +195,8 @@ static char *rna_ColorRamp_path(PointerRNA *ptr) case ID_LS: { - char *path = BKE_linestyle_path_to_color_ramp((FreestyleLineStyle *)id, (ColorBand *)ptr->data); - if (path) - return path; + /* may be NULL */ + path = BKE_linestyle_path_to_color_ramp((FreestyleLineStyle *)id, (ColorBand *)ptr->data); break; } diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 6ace0966b36..76785e1a852 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -164,7 +164,7 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P PointCache *cache = (PointCache *)ptr->data; PTCacheID *pid = NULL, *pid2 = NULL; ListBase pidlist; - int new_name = 1; + bool use_new_name = true; if (!ob) return; @@ -194,11 +194,11 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P else if (cache->name[0] != '\0' && STREQ(cache->name, pid->cache->name)) { /*TODO: report "name exists" to user */ BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name)); - new_name = 0; + use_new_name = false; } } - if (new_name) { + if (use_new_name) { if (pid2 && cache->flag & PTCACHE_DISK_CACHE) { char old_name[80]; char new_name[80]; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 15a7e51e865..bc283e7a086 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -509,8 +509,8 @@ static DerivedMesh *arrayModifier_doArray( #endif if (amd->curve_ob->curve_cache && amd->curve_ob->curve_cache->path) { - float scale = mat4_to_scale(amd->curve_ob->obmat); - length = scale * amd->curve_ob->curve_cache->path->totdist; + float scale_fac = mat4_to_scale(amd->curve_ob->obmat); + length = scale_fac * amd->curve_ob->curve_cache->path->totdist; } } } diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 2695f6675c9..4188e2d03d5 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -694,9 +694,9 @@ static DerivedMesh *applyModifier( INIT_VERT_ARRAY_OFFSETS(false); for (i_orig = 0; i_orig < i_end; i_orig++, mv++) { - const unsigned int i = do_shell_align ? i_orig : new_vert_arr[i_orig]; - if (vert_accum[i]) { /* zero if unselected */ - madd_v3_v3fl(mv->co, vert_nors[i], ofs_new * (vert_angles[i] / vert_accum[i])); + const unsigned int i_other = do_shell_align ? i_orig : new_vert_arr[i_orig]; + if (vert_accum[i_other]) { /* zero if unselected */ + madd_v3_v3fl(mv->co, vert_nors[i_other], ofs_new * (vert_angles[i_other] / vert_accum[i_other])); } } } @@ -709,9 +709,9 @@ static DerivedMesh *applyModifier( INIT_VERT_ARRAY_OFFSETS(true); for (i_orig = 0; i_orig < i_end; i_orig++, mv++) { - const unsigned int i = do_shell_align ? i_orig : new_vert_arr[i_orig]; - if (vert_accum[i]) { /* zero if unselected */ - madd_v3_v3fl(mv->co, vert_nors[i], ofs_orig * (vert_angles[i] / vert_accum[i])); + const unsigned int i_other = do_shell_align ? i_orig : new_vert_arr[i_orig]; + if (vert_accum[i_other]) { /* zero if unselected */ + madd_v3_v3fl(mv->co, vert_nors[i_other], ofs_orig * (vert_angles[i_other] / vert_accum[i_other])); } } } |