Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-07 14:04:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-07 14:04:07 +0400
commit8a4fe62843f8aa311226f543d14bd3e5440ffe7d (patch)
treec8dc58cda87f525acb567796c80164ef3a8f8050 /source/blender/editors
parentc9453b1357dcb878dff6efc9dd3597452d6dc762 (diff)
misc fixes found with clang's static checker.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/curve/editcurve.c8
-rw-r--r--source/blender/editors/interface/interface_icons.c24
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/editors/space_logic/logic_window.c6
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c13
-rw-r--r--source/blender/editors/space_view3d/drawobject.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c5
-rw-r--r--source/blender/editors/transform/transform_snap.c4
9 files changed, 41 insertions, 27 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 6193b6eb916..4c869d25869 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -732,7 +732,7 @@ static void calc_shapeKeys(Object *obedit)
int totvert= count_curveverts(&editnurb->nurbs);
float (*ofs)[3] = NULL;
- float *oldkey, *newkey, *fp, *ofp;
+ float *oldkey, *newkey, *ofp;
/* editing the base key should update others */
if(cu->key->type==KEY_RELATIVE) {
@@ -776,7 +776,7 @@ static void calc_shapeKeys(Object *obedit)
for (j= 0; j < 3; ++j) {
VECSUB(ofs[i], bezt->vec[j], oldbezt->vec[j]);
i++;
- fp+= 3;
+ // fp+= 3; // unused
}
ofs[i++][0]= bezt->alfa - oldbezt->alfa;
} else {
@@ -796,7 +796,7 @@ static void calc_shapeKeys(Object *obedit)
}
i += 2;
++bp;
- fp += 4;
+ // fp += 4; //unused
}
}
@@ -809,7 +809,7 @@ static void calc_shapeKeys(Object *obedit)
while(currkey) {
int apply_offset = (ofs && (currkey != actkey) && (editnurb->shapenr-1 == currkey->relative));
- fp= newkey= MEM_callocN(cu->key->elemsize * totvert, "currkey->data");
+ float *fp= newkey= MEM_callocN(cu->key->elemsize * totvert, "currkey->data");
ofp= oldkey = currkey->data;
nu= editnurb->nurbs.first;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 482eece42f6..3fa53b73015 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -622,20 +622,30 @@ static void init_iconfile_list(struct ListBase *list)
char *filename = dir[i].relname;
if(BLI_testextensie(filename, ".png")) {
-
+
/* check to see if the image is the right size, continue if not */
/* copying strings here should go ok, assuming that we never get back
a complete path to file longer than 256 chars */
sprintf(iconfilestr, "%s/%s", icondirstr, filename);
- if(BLI_exists(iconfilestr)) bbuf = IMB_loadiffname(iconfilestr, IB_rect);
-
- ifilex = bbuf->x;
- ifiley = bbuf->y;
- IMB_freeImBuf(bbuf);
+ if(BLI_exists(iconfilestr))
+ bbuf= IMB_loadiffname(iconfilestr, IB_rect);
+ else
+ bbuf= NULL;
+
+
+ if(bbuf) {
+ ifilex = bbuf->x;
+ ifiley = bbuf->y;
+ IMB_freeImBuf(bbuf);
+ }
+ else {
+ ifilex= ifiley= 0;
+ }
+ /* bad size or failed to load */
if ((ifilex != ICON_IMAGE_W) || (ifiley != ICON_IMAGE_H))
continue;
-
+
/* found a potential icon file, so make an entry for it in the cache list */
ifile = MEM_callocN(sizeof(IconFile), "IconFile");
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index ff079a4b9e0..53981f202ed 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1008,7 +1008,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
x2= winx;
}
}
- if(y1 < 0) {
+ if(y1 < 0) { /* XXX butregion NULL check?, there is one above */
int newy1;
UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->y2 + ofsy, 0, &newy1);
newy1 += butregion->winrct.ymin;
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 4b778e80b0e..148bcf1459f 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3712,7 +3712,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
break;
case ACT_ARM_ENABLE:
case ACT_ARM_DISABLE:
- if (&pose_ptr.data) {
+ if (ob->pose) {
uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
@@ -3720,7 +3720,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
}
break;
case ACT_ARM_SETTARGET:
- if (&pose_ptr.data) {
+ if (ob->pose) {
uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
@@ -3731,7 +3731,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "secondary_target", 0, NULL, 0);
break;
case ACT_ARM_SETWEIGHT:
- if (&pose_ptr.data) {
+ if (ob->pose) {
uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 84ced036f75..d96b8a27c99 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -159,7 +159,7 @@ static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect
struct SeqEffectHandle sh;
Sequence *last_seq= seq_active_get(scene);
- if(last_seq && last_seq->type != SEQ_PLUGIN) return;
+ if(last_seq==NULL || last_seq->type != SEQ_PLUGIN) return;
sh = get_sequence_effect(last_seq);
sh.free(last_seq);
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 7a7462433d7..cf511a8ad9b 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -536,12 +536,13 @@ static int draw_em_tf_mapped__set_draw(void *userData, int index)
static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
{
Mesh *me = (Mesh*)userData;
- MTFace *tface = (me->mtface)? &me->mtface[index]: NULL;
- MFace *mface = (me->mface)? &me->mface[index]: NULL;
-
- if ((mface->flag&ME_HIDE) || (tface && (tface->mode&TF_INVISIBLE)))
- return 0;
-
+
+ if ( (me->mface && me->mface[index].flag & ME_HIDE) ||
+ (me->mtface && (me->mtface[index].mode & TF_INVISIBLE))
+ ) {
+ return 0;
+ }
+
*drawSmooth_r = 1;
return 1;
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index aba3d04d960..d28813f7522 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -917,6 +917,9 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
copy_m4_m4(imat, rv3d->viewinv);
normalize_v3(imat[0]);
normalize_v3(imat[1]);
+
+ /* lamp center */
+ copy_v3_v3(vec, ob->obmat[3]);
/* for AA effects */
glGetFloatv(GL_CURRENT_COLOR, curcol);
@@ -931,7 +934,6 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
/* Inner Circle */
- copy_v3_v3(vec, ob->obmat[3]);
glEnable(GL_BLEND);
drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
glDisable(GL_BLEND);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 4cac0e297d1..9f1b55ee2ce 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -2121,14 +2121,11 @@ static int viewpan_exec(bContext *C, wmOperator *op)
pandir = RNA_enum_get(op->ptr, "type");
initgrabz(rv3d, 0.0, 0.0, 0.0);
-
if(pandir == V3D_VIEW_PANRIGHT) window_to_3d_delta(ar, vec, -32, 0);
else if(pandir == V3D_VIEW_PANLEFT) window_to_3d_delta(ar, vec, 32, 0);
else if(pandir == V3D_VIEW_PANUP) window_to_3d_delta(ar, vec, 0, -25);
else if(pandir == V3D_VIEW_PANDOWN) window_to_3d_delta(ar, vec, 0, 25);
- rv3d->ofs[0]+= vec[0];
- rv3d->ofs[1]+= vec[1];
- rv3d->ofs[2]+= vec[2];
+ add_v3_v3(rv3d->ofs, vec);
if(rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(CTX_wm_area(C), ar);
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 93331dd0ee3..5b7bcac65f2 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -784,6 +784,10 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
if (dist != FLT_MAX)
{
VECCOPY(loc, p);
+ /* XXX, is there a correct normal in this case ???, for now just z up */
+ no[0]= 0.0;
+ no[1]= 0.0;
+ no[2]= 1.0;
found = 1;
}