forked from bartvdbraak/blender
misc fixes found with clang's static checker.
This commit is contained in:
parent
c9453b1357
commit
8a4fe62843
@ -648,7 +648,7 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat,
|
||||
|
||||
totfac= data[1]+data[2];
|
||||
if(totfac>FLT_EPSILON) interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
|
||||
else QUATCOPY(q1, p3->quat);
|
||||
else QUATCOPY(q2, p3->quat);
|
||||
|
||||
totfac = data[0]+data[1]+data[2]+data[3];
|
||||
if(totfac>FLT_EPSILON) interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@ -649,11 +650,9 @@ void *copy_libblock(void *rt)
|
||||
|
||||
lb= which_libbase(G.main, GS(id->name));
|
||||
idn= alloc_libblock(lb, GS(id->name), id->name+2);
|
||||
|
||||
if(idn==NULL) {
|
||||
printf("ERROR: Illegal ID name for %s (Crashing now)\n", id->name);
|
||||
}
|
||||
|
||||
|
||||
assert(idn != NULL);
|
||||
|
||||
idn_len= MEM_allocN_len(idn);
|
||||
if(idn_len - sizeof(ID) > 0) {
|
||||
cp= (char *)id;
|
||||
|
@ -63,8 +63,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
|
||||
types_init= 0;
|
||||
}
|
||||
|
||||
if(type >= 0 && type < NUM_MODIFIER_TYPES &&
|
||||
types[type]->name[0] != '\0') {
|
||||
/* type unsigned, no need to chech < 0 */
|
||||
if(type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') {
|
||||
return types[type];
|
||||
}
|
||||
else {
|
||||
|
@ -1082,7 +1082,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
|
||||
|
||||
static int ptcache_path(PTCacheID *pid, char *filename)
|
||||
{
|
||||
Library *lib= (pid)? pid->ob->id.lib: NULL;
|
||||
Library *lib= (pid->ob)? pid->ob->id.lib: NULL;
|
||||
const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce;
|
||||
size_t i;
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
* */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
@ -133,6 +134,8 @@ void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, in
|
||||
cb=(-0.16874f*sr)-(0.33126f*sg)+(0.5f*sb)+128.0f;
|
||||
cr=(0.5f*sr)-(0.41869f*sg)-(0.08131f*sb)+128.0f;
|
||||
break;
|
||||
default:
|
||||
assert(!"invalid colorspace");
|
||||
}
|
||||
|
||||
*ly=y;
|
||||
@ -163,6 +166,8 @@ void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, in
|
||||
g=y-0.34414f*cb - 0.71414f*cr + 135.45984f;
|
||||
b=y+1.772f*cb - 226.816f;
|
||||
break;
|
||||
default:
|
||||
assert(!"invalid colorspace");
|
||||
}
|
||||
*lr=r/255.0f;
|
||||
*lg=g/255.0f;
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -605,7 +605,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
|
||||
Material *ma= shi->mat;
|
||||
GPUMaterial *mat= shi->gpumat;
|
||||
GPUNodeLink *lv, *dist, *visifac, *is, *inp, *i, *vn, *view;
|
||||
GPUNodeLink *outcol, *specfac, *t, *shadfac;
|
||||
GPUNodeLink *outcol, *specfac, *t, *shadfac= NULL;
|
||||
float one = 1.0f;
|
||||
|
||||
if((lamp->mode & LA_ONLYSHADOW) && !(ma->mode & MA_SHADOW))
|
||||
|
@ -161,11 +161,11 @@ void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float as
|
||||
|
||||
{
|
||||
int x, y;
|
||||
int hline, vline;
|
||||
int stride_x= (margin_r - margin_l) - 2;
|
||||
|
||||
for(y=0; y < height; y++) {
|
||||
for(x=0; x < width; x++, px+=4) {
|
||||
int hline= 0, vline= 0;
|
||||
if((x > margin_l && x < margin_r) && (y > margin_b && y < margin_t)) {
|
||||
/* interior. skip */
|
||||
x += stride_x;
|
||||
|
@ -2341,7 +2341,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
|
||||
VertRen *ver;
|
||||
VlakRen *vlr, *vlr1;
|
||||
Material *ma;
|
||||
float *data, *nors, *orco, mat[4][4], imat[3][3], xn, yn, zn;
|
||||
float *data, *nors, *orco=NULL, mat[4][4], imat[3][3], xn, yn, zn;
|
||||
int a, need_orco, vlakindex, *index;
|
||||
ListBase dispbase= {NULL, NULL};
|
||||
|
||||
@ -2375,7 +2375,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
|
||||
}
|
||||
}
|
||||
|
||||
for(a=0; a<dl->nr; a++, data+=3, nors+=3, orco+=3) {
|
||||
for(a=0; a<dl->nr; a++, data+=3, nors+=3) {
|
||||
|
||||
ver= RE_findOrAddVert(obr, obr->totvert++);
|
||||
VECCOPY(ver->co, data);
|
||||
@ -2393,7 +2393,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
|
||||
normalize_v3(ver->n);
|
||||
//if(ob->transflag & OB_NEG_SCALE) negate_v3(ver->n);
|
||||
|
||||
if(need_orco) ver->orco= orco;
|
||||
if(need_orco) ver->orco= orco+=3;
|
||||
}
|
||||
|
||||
index= dl->index;
|
||||
|
Loading…
Reference in New Issue
Block a user