diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-26 17:19:25 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-26 17:19:25 +0300 |
commit | e4b20f0180858aaeec9f057e8cc473a01e1e5280 (patch) | |
tree | fe9e3629ff21435df7027634a91405397c4a9695 /source/blender/editors | |
parent | 63f84cf26d574284a30f2d28c57a6c32823f4425 (diff) |
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).
Diffstat (limited to 'source/blender/editors')
5 files changed, 34 insertions, 28 deletions
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 38f2fe39a8f..696188dada4 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -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; } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 3d45a42fc70..cdc8c88b4d6 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -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) diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index cafe9acb96a..e3a0999ebf5 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -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) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index a1d6a9d13cb..4e042d8ede5 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -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); } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index cb3ccf4b5df..e0b674678a6 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -42,6 +42,8 @@ struct EditFace; struct Nurb; struct BezTriple; struct BPoint; +struct bContext; +struct wmWindowManager; typedef struct ViewDepths { unsigned short w, h; |