2.5: various warning fixes. There was one actual bug in a few different

places, using sprintf with strings like ID names as the format string
(note that this name can contain a % character).
This commit is contained in:
Brecht Van Lommel 2008-12-26 14:19:25 +00:00
parent 63f84cf26d
commit e4b20f0180
15 changed files with 101 additions and 87 deletions

@ -205,6 +205,7 @@ static BME_Poly *BME_split_face(BME_Mesh *bm, BME_Poly *f, BME_Vert *v1, BME_Ver
}
#if 0
static void BME_data_interp_from_verts(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Vert *v, float fac)
{
void *src[2];
@ -217,6 +218,7 @@ static void BME_data_interp_from_verts(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2,
CustomData_bmesh_interp(&bm->vdata, src, w, NULL, 2, v->data);
}
}
#endif
static void BME_data_facevert_edgesplit(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Vert *v, BME_Edge *e1, float fac){

@ -954,7 +954,7 @@ static Object *find_family_object(Object **obar, char *family, char ch)
Object *ob;
int flen;
if( obar[ch] ) return obar[ch];
if( obar[(int)ch] ) return obar[(int)ch];
flen= strlen(family);
@ -966,7 +966,7 @@ static Object *find_family_object(Object **obar, char *family, char ch)
ob= ob->id.next;
}
obar[ch]= ob;
obar[(int)ch]= ob;
return ob;
}

@ -591,7 +591,9 @@ CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTreeOverlap
ClothModifierData *clmd = ( ClothModifierData * ) md1;
CollisionModifierData *collmd = ( CollisionModifierData * ) md2;
MFace *face1=NULL, *face2 = NULL;
#ifdef WITH_BULLET
ClothVertex *verts1 = clmd->clothObject->verts;
#endif
double distance = 0;
float epsilon1 = clmd->coll_parms->epsilon;
float epsilon2 = BLI_bvhtree_getepsilon ( collmd->bvhtree );

@ -1454,7 +1454,7 @@ void makeDispListCurveTypes(Object *ob, int forOrco)
ListBase dlbev;
float (*originalVerts)[3];
float (*deformedVerts)[3];
int obedit= (G.obedit && G.obedit->data==ob->data && G.obedit->type==OB_CURVE);
//XXX int obedit= (G.obedit && G.obedit->data==ob->data && G.obedit->type==OB_CURVE);
ListBase *nubase= &cu->nurb; //XXX ListBase *nubase = obedit?&editNurb:&cu->nurb;
int numVerts;

@ -2668,10 +2668,10 @@ static void write_videoscape_mesh(Object *ob, char *str)
}
for(a=0; a<me->totface; a++, mface++) {
if(mface->v4==0) {
fprintf(fp, "3 %d %d %d 0x%x\n", mface->v1, mface->v2, mface->v3, kleur[mface->mat_nr]);
fprintf(fp, "3 %d %d %d 0x%x\n", mface->v1, mface->v2, mface->v3, kleur[(int)mface->mat_nr]);
}
else {
fprintf(fp, "4 %d %d %d %d 0x%x\n", mface->v1, mface->v2, mface->v3, mface->v4, kleur[mface->mat_nr]);
fprintf(fp, "4 %d %d %d %d 0x%x\n", mface->v1, mface->v2, mface->v3, mface->v4, kleur[(int)mface->mat_nr]);
}
}
@ -3255,7 +3255,7 @@ static void write_mesh_dxf(FILE *fp, Mesh *me)
/* Write a face color */
if (me->totcol) {
ma= me->mat[mface->mat_nr];
ma= me->mat[(int)mface->mat_nr];
if(ma) {
sprintf(str,"%d",rgb_to_dxf_col(ma->r,ma->g,ma->b));
write_group(62, str); /* Color index */

@ -583,6 +583,7 @@ void tag_image_time(Image *ima)
ima->lastused = (int)PIL_check_seconds_timer();
}
#if 0
static void tag_all_images_time()
{
Image *ima;
@ -595,6 +596,7 @@ static void tag_all_images_time()
}
}
}
#endif
void free_old_images()
{

@ -6238,52 +6238,55 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (sl->spacetype==SPACE_BUTS) {
SpaceButs *sbuts= (SpaceButs *) sl;
//XXX sbuts->v2d.maxzoom= 1.2f;
//XXX sbuts->align= 1; /* horizontal default */
//XXX
//XXX if(sbuts->mainb==BUTS_LAMP) {
//XXX sbuts->mainb= CONTEXT_SHADING;
//XXX sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
//XXX }
//XXX else if(sbuts->mainb==BUTS_MAT) {
//XXX sbuts->mainb= CONTEXT_SHADING;
//XXX sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
//XXX }
//XXX else if(sbuts->mainb==BUTS_TEX) {
//XXX sbuts->mainb= CONTEXT_SHADING;
//XXX sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
//XXX }
//XXX else if(sbuts->mainb==BUTS_ANIM) {
//XXX sbuts->mainb= CONTEXT_OBJECT;
//XXX }
//XXX else if(sbuts->mainb==BUTS_WORLD) {
//XXX sbuts->mainb= CONTEXT_SCENE;
//XXX sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
//XXX }
//XXX else if(sbuts->mainb==BUTS_RENDER) {
//XXX sbuts->mainb= CONTEXT_SCENE;
//XXX sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
//XXX }
//XXX else if(sbuts->mainb==BUTS_GAME) {
//XXX sbuts->mainb= CONTEXT_LOGIC;
//XXX }
//XXX else if(sbuts->mainb==BUTS_FPAINT) {
//XXX sbuts->mainb= CONTEXT_EDITING;
//XXX }
//XXX else if(sbuts->mainb==BUTS_RADIO) {
//XXX sbuts->mainb= CONTEXT_SHADING;
//XXX sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
//XXX }
//XXX else if(sbuts->mainb==BUTS_CONSTRAINT) {
//XXX sbuts->mainb= CONTEXT_OBJECT;
//XXX }
//XXX else if(sbuts->mainb==BUTS_SCRIPT) {
//XXX sbuts->mainb= CONTEXT_OBJECT;
//XXX }
//XXX else if(sbuts->mainb==BUTS_EDIT) {
//XXX sbuts->mainb= CONTEXT_EDITING;
//XXX }
//XXX else sbuts->mainb= CONTEXT_SCENE;
sbuts->v2d.maxzoom= 1.2f;
sbuts->align= 1; /* horizontal default */
//XXX
#if 0
if(sbuts->mainb==BUTS_LAMP) {
sbuts->mainb= CONTEXT_SHADING;
sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
}
else if(sbuts->mainb==BUTS_MAT) {
sbuts->mainb= CONTEXT_SHADING;
sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
}
else if(sbuts->mainb==BUTS_TEX) {
sbuts->mainb= CONTEXT_SHADING;
sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
}
else if(sbuts->mainb==BUTS_ANIM) {
sbuts->mainb= CONTEXT_OBJECT;
}
else if(sbuts->mainb==BUTS_WORLD) {
sbuts->mainb= CONTEXT_SCENE;
sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
}
else if(sbuts->mainb==BUTS_RENDER) {
sbuts->mainb= CONTEXT_SCENE;
sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
}
else if(sbuts->mainb==BUTS_GAME) {
sbuts->mainb= CONTEXT_LOGIC;
}
else if(sbuts->mainb==BUTS_FPAINT) {
sbuts->mainb= CONTEXT_EDITING;
}
else if(sbuts->mainb==BUTS_RADIO) {
sbuts->mainb= CONTEXT_SHADING;
sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
}
else if(sbuts->mainb==BUTS_CONSTRAINT) {
sbuts->mainb= CONTEXT_OBJECT;
}
else if(sbuts->mainb==BUTS_SCRIPT) {
sbuts->mainb= CONTEXT_OBJECT;
}
else if(sbuts->mainb==BUTS_EDIT) {
sbuts->mainb= CONTEXT_EDITING;
}
else sbuts->mainb= CONTEXT_SCENE;
#endif
}
}
}
@ -8412,7 +8415,6 @@ BlendFileData *blo_read_file_internal(FileData *fd, ReportList *reports)
{
BHead *bhead= blo_firstbhead(fd);
BlendFileData *bfd;
FileGlobal *fg = (FileGlobal *)NULL;
bfd= MEM_callocN(sizeof(BlendFileData), "blendfiledata");
bfd->main= MEM_callocN(sizeof(Main), "main");
@ -9343,9 +9345,9 @@ static void append_named_part(FileData *fd, Main *mainvar, Scene *scene, char *n
else ob= (Object *)id;
/* XXX use context to find view3d->lay */
if((flag & FILE_ACTIVELAY)) {
scene->lay;
}
//if((flag & FILE_ACTIVELAY)) {
// scene->lay;
//}
base->lay= ob->lay;
base->object= ob;
ob->id.us++;

@ -463,7 +463,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
expand= ICON_TRIA_RIGHT;
sel = SEL_OBJC(base);
sprintf(name, ob->id.name+2);
strcpy(name, ob->id.name+2);
}
break;
case ANIMTYPE_FILLACTD: /* action widget */
@ -480,7 +480,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
expand= ICON_TRIA_RIGHT;
sel = SEL_ACTC(act);
sprintf(name, "Action");
strcpy(name, "Action");
}
break;
case ANIMTYPE_FILLIPOD: /* ipo (dopesheet) expand widget */
@ -497,7 +497,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
expand = ICON_TRIA_RIGHT;
//sel = SEL_OBJC(base);
sprintf(name, "IPO Curves");
strcpy(name, "IPO Curves");
}
break;
case ANIMTYPE_FILLCOND: /* constraint channels (dopesheet) expand widget */
@ -514,7 +514,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
expand = ICON_TRIA_RIGHT;
//sel = SEL_OBJC(base);
sprintf(name, "Constraints");
strcpy(name, "Constraints");
}
break;
case ANIMTYPE_FILLMATD: /* object materials (dopesheet) expand widget */
@ -530,7 +530,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
else
expand = ICON_TRIA_RIGHT;
sprintf(name, "Materials");
strcpy(name, "Materials");
}
break;
@ -549,7 +549,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
else
expand = ICON_TRIA_RIGHT;
sprintf(name, ma->id.name+2);
strcpy(name, ma->id.name+2);
}
break;
case ANIMTYPE_DSLAM: /* lamp (dopesheet) expand widget */
@ -565,7 +565,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
else
expand = ICON_TRIA_RIGHT;
sprintf(name, la->id.name+2);
strcpy(name, la->id.name+2);
}
break;
case ANIMTYPE_DSCAM: /* camera (dopesheet) expand widget */
@ -581,7 +581,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
else
expand = ICON_TRIA_RIGHT;
sprintf(name, ca->id.name+2);
strcpy(name, ca->id.name+2);
}
break;
case ANIMTYPE_DSCUR: /* curve (dopesheet) expand widget */
@ -597,7 +597,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
else
expand = ICON_TRIA_RIGHT;
sprintf(name, cu->id.name+2);
strcpy(name, cu->id.name+2);
}
break;
case ANIMTYPE_DSSKEY: /* shapekeys (dopesheet) expand widget */
@ -614,7 +614,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
expand = ICON_TRIA_RIGHT;
//sel = SEL_OBJC(base);
sprintf(name, "Shape Keys");
strcpy(name, "Shape Keys");
}
break;
@ -643,7 +643,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
protect = ICON_LOCKED;
sel = SEL_AGRP(agrp);
sprintf(name, agrp->name);
strcpy(name, agrp->name);
}
break;
case ANIMTYPE_ACHAN: /* action channel */
@ -676,7 +676,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
}
sel = SEL_ACHAN(achan);
sprintf(name, achan->name);
strcpy(name, achan->name);
}
break;
case ANIMTYPE_CONCHAN: /* constraint channel */
@ -717,7 +717,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
}
sel = SEL_CONCHAN(conchan);
sprintf(name, conchan->name);
strcpy(name, conchan->name);
}
break;
case ANIMTYPE_ICU: /* ipo-curve channel */
@ -751,9 +751,9 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
sel = SEL_ICU(icu);
if (saction->pin)
sprintf(name, getname_ipocurve(icu, NULL)); // xxx func to eventually eliminate
strcpy(name, getname_ipocurve(icu, NULL)); // xxx func to eventually eliminate
else
sprintf(name, getname_ipocurve(icu, ac->obact)); // xxx func to eventually eliminate
strcpy(name, getname_ipocurve(icu, ac->obact)); // xxx func to eventually eliminate
}
break;
case ANIMTYPE_FILLIPO: /* ipo expand widget */
@ -774,7 +774,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
expand = ICON_TRIA_RIGHT;
sel = SEL_ACHAN(achan);
sprintf(name, "IPO Curves");
strcpy(name, "IPO Curves");
}
break;
case ANIMTYPE_FILLCON: /* constraint expand widget */
@ -795,7 +795,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
expand = ICON_TRIA_RIGHT;
sel = SEL_ACHAN(achan);
sprintf(name, "Constraint");
strcpy(name, "Constraint");
}
break;
@ -812,7 +812,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
if (kb->name[0] == '\0')
sprintf(name, "Key %d", ale->index);
else
sprintf(name, kb->name);
strcpy(name, kb->name);
}
break;
@ -837,7 +837,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
{
/* this shouldn't cause any overflow... */
//sprintf(name, "3DView:%s", view3d_get_name(sa->spacedata.first)); // XXX missing func..
sprintf(name, "3dView");
strcpy(name, "3dView");
special= ICON_VIEW3D;
}
break;
@ -847,9 +847,9 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
char treetype[12];
if (snode->treetype == 1)
sprintf(treetype, "Composite");
strcpy(treetype, "Composite");
else
sprintf(treetype, "Material");
strcpy(treetype, "Material");
sprintf(name, "Nodes:%s", treetype);
special= ICON_NODE;
@ -880,7 +880,7 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
if (sima->image)
sprintf(name, "Image:%s", sima->image->id.name+2);
else
sprintf(name, "Image:<None>");
strcpy(name, "Image:<None>");
special= ICON_IMAGE_COL;
}

@ -103,9 +103,9 @@ extern void ui_draw_tria_icon(float x, float y, float aspect, char dir);
// XXX butspace.h
#define B_NODE_EXEC 3610
#if 0 // XXX
static void snode_drawstring(void *curfont, SpaceNode *snode, char *str, int okwidth)
{
#if 0 // XXX
char drawstr[NODE_MAXSTR];
int width;
@ -126,8 +126,8 @@ static void snode_drawstring(void *curfont, SpaceNode *snode, char *str, int okw
if(len==0) return;
}
UI_DrawString(curfont, drawstr, 0);
#endif
}
#endif
static void node_scaling_widget(int color_id, float aspect, float xmin, float ymin, float xmax, float ymax)
{
@ -503,6 +503,7 @@ static void node_sync_cb(bContext *C, void *snode_v, void *node_v)
/* ************** Socket callbacks *********** */
#if 0
static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v)
{
if(node_v && ntree_v) {
@ -510,6 +511,7 @@ static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v)
// addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+((bNode *)node_v)->nr); XXX
}
}
#endif
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void *socket_v)

@ -2444,6 +2444,7 @@ void outliner_show_hierarchy(Scene *scene, SpaceOops *soops)
BIF_undo_push("Outliner show hierarchy");
}
#if 0
static void do_outliner_select(SpaceOops *soops, ListBase *lb, float y1, float y2, short *selecting)
{
TreeElement *te;
@ -2468,6 +2469,7 @@ static void do_outliner_select(SpaceOops *soops, ListBase *lb, float y1, float y
if((tselem->flag & TSE_CLOSED)==0) do_outliner_select(soops, &te->subtree, y1, y2, selecting);
}
}
#endif
/* its own redraw loop... urm */
void outliner_select(ARegion *ar, SpaceOops *so)

@ -3710,25 +3710,25 @@ static void tekenhandlesN(Nurb *nu, short sel)
if( (bezt->f2 & SELECT)==sel) {
fp= bezt->vec[0];
cpack(col[bezt->h1]);
cpack(col[(int)bezt->h1]);
glVertex3fv(fp);
glVertex3fv(fp+3);
cpack(col[bezt->h2]);
cpack(col[(int)bezt->h2]);
glVertex3fv(fp+3);
glVertex3fv(fp+6);
}
else if( (bezt->f1 & SELECT)==sel) {
fp= bezt->vec[0];
cpack(col[bezt->h1]);
cpack(col[(int)bezt->h1]);
glVertex3fv(fp);
glVertex3fv(fp+3);
}
else if( (bezt->f3 & SELECT)==sel) {
fp= bezt->vec[1];
cpack(col[bezt->h2]);
cpack(col[(int)bezt->h2]);
glVertex3fv(fp);
glVertex3fv(fp+3);
}

@ -42,6 +42,8 @@ struct EditFace;
struct Nurb;
struct BezTriple;
struct BPoint;
struct bContext;
struct wmWindowManager;
typedef struct ViewDepths {
unsigned short w, h;

@ -157,7 +157,7 @@ static void stats_background(RenderStats *rs)
else
spos+= sprintf(spos, "Sce: %s Ve:%d Fa:%d La:%d", G.scene->id.name+2, rs->totvert, rs->totface, rs->totlamp);
}
printf(str); printf("\n");
printf("%s\n", str);
}
void RE_FreeRenderResult(RenderResult *res)

@ -332,7 +332,7 @@ void yafrayFileRender_t::displayImage()
char a = (byte_per_pix==4) ? fgetc(fp) : 255;
int bx = x-xs, by = y-ys;
if ((bx >= 0) && (bx < (int)re->rectx) && (by >= 0) && (by < re->recty)) {
float* bpt = (float*)rres.rectf + (bx + (((re->recty-1) - by)*re->rectx) << 2);
float* bpt = (float*)rres.rectf + ((bx + (((re->recty-1) - by)*re->rectx)) << 2);
bpt[2] = (float)r * btf;
bpt[1] = (float)g * btf;
bpt[0] = (float)b * btf;

@ -188,7 +188,7 @@ bool yafrayPluginRender_t::initExport()
}
}
yafray::yafrayConstructor *constructor;
constructor = (yafray::yafrayConstructor *)PIL_dynlib_find_symbol(handle, YAFRAY_SYMBOL);
constructor = (yafray::yafrayConstructor *)PIL_dynlib_find_symbol(handle, (char*)YAFRAY_SYMBOL);
if (constructor==NULL)
{
cerr << "Error loading yafray plugin: " << PIL_dynlib_get_error_as_string(handle) << endl;