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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-01-11 16:56:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-11 16:56:31 +0400
commitfbc4846a6ee7921ada41aff1341d8e67b0094c1d (patch)
treeb782ec69ca7eac23433619651f782477475f9912 /source
parente10fd04db0bdcdbc326fce6cddc8af1179a5de5c (diff)
dynamicpaint had some incorrect string sizes for layers names, use BLI string functions in more places too.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c3
-rw-r--r--source/blender/editors/space_nla/nla_draw.c10
-rw-r--r--source/blender/editors/space_node/drawnode.c42
-rw-r--r--source/blender/editors/space_node/node_draw.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c4
-rw-r--r--source/blender/editors/space_text/text_draw.c2
-rw-r--r--source/blender/editors/transform/transform.c6
-rw-r--r--source/blender/makesdna/DNA_dynamicpaint_types.h6
9 files changed, 41 insertions, 40 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 89d1534dbf1..108bfe3473b 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -1877,7 +1877,8 @@ struct DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scen
* px,py : origin pixel x and y
* n_index : lookup direction index (use neighX,neighY to get final index)
*/
-static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh *dm, char *uvname, int w, int h, int px, int py, int n_index)
+static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh *dm,
+ const char *uvname, int w, int h, int px, int py, int n_index)
{
/* Note: Current method only uses polygon edges to detect neighbouring pixels.
* -> It doesn't always lead to the optimum pixel but is accurate enough
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index c7defdeb64b..d7a1053f3c1 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -514,7 +514,7 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
{
const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */
const char col[4] = {220, 220, 220, 255}; /* light grey */
- char str[32] = "";
+ char numstr[32] = "";
/* Always draw times above the strip, whereas sequencer drew below + above.
@@ -524,12 +524,12 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
* while also preserving some accuracy, since we do use floats
*/
/* start frame */
- BLI_snprintf(str, sizeof(str), "%.1f", strip->start);
- UI_view2d_text_cache_add(v2d, strip->start-1.0f, ymaxc+ytol, str, col);
+ BLI_snprintf(numstr, sizeof(numstr), "%.1f", strip->start);
+ UI_view2d_text_cache_add(v2d, strip->start-1.0f, ymaxc+ytol, numstr, col);
/* end frame */
- BLI_snprintf(str, sizeof(str), "%.1f", strip->end);
- UI_view2d_text_cache_add(v2d, strip->end, ymaxc+ytol, str, col);
+ BLI_snprintf(numstr, sizeof(numstr), "%.1f", strip->end);
+ UI_view2d_text_cache_add(v2d, strip->end, ymaxc+ytol, numstr, col);
}
/* ---------------------- */
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 1f1eb9b7e00..3f8d9a75244 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2308,7 +2308,7 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
BLF_size(blf_mono_font, 11, 72);
glColor3ub(255, 255, 255);
- sprintf(str, "X:%-4d Y:%-4d |", x, y);
+ BLI_snprintf(str, sizeof(str), "X:%-4d Y:%-4d |", x, y);
// UI_DrawString(6, 6, str); // works ok but fixed width is nicer.
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
@@ -2317,14 +2317,14 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
#if 0 /* XXX no Z value in compo backdrop atm */
if(zp) {
glColor3ub(255, 255, 255);
- sprintf(str, " Z:%-.4f |", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff));
+ BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff));
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
if(zpf) {
glColor3ub(255, 255, 255);
- sprintf(str, " Z:%-.3f |", *zpf);
+ BLI_snprintf(str, sizeof(str), " Z:%-.3f |", *zpf);
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -2334,33 +2334,33 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
if(channels >= 3) {
glColor3ubv(red);
if (fp)
- sprintf(str, " R:%-.4f", fp[0]);
+ BLI_snprintf(str, sizeof(str), " R:%-.4f", fp[0]);
else if (cp)
- sprintf(str, " R:%-3d", cp[0]);
+ BLI_snprintf(str, sizeof(str), " R:%-3d", cp[0]);
else
- sprintf(str, " R:-");
+ BLI_snprintf(str, sizeof(str), " R:-");
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
glColor3ubv(green);
if (fp)
- sprintf(str, " G:%-.4f", fp[1]);
+ BLI_snprintf(str, sizeof(str), " G:%-.4f", fp[1]);
else if (cp)
- sprintf(str, " G:%-3d", cp[1]);
+ BLI_snprintf(str, sizeof(str), " G:%-3d", cp[1]);
else
- sprintf(str, " G:-");
+ BLI_snprintf(str, sizeof(str), " G:-");
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
glColor3ubv(blue);
if (fp)
- sprintf(str, " B:%-.4f", fp[2]);
+ BLI_snprintf(str, sizeof(str), " B:%-.4f", fp[2]);
else if (cp)
- sprintf(str, " B:%-3d", cp[2]);
+ BLI_snprintf(str, sizeof(str), " B:%-3d", cp[2]);
else
- sprintf(str, " B:-");
+ BLI_snprintf(str, sizeof(str), " B:-");
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -2368,11 +2368,11 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
if(channels == 4) {
glColor3ub(255, 255, 255);
if (fp)
- sprintf(str, " A:%-.4f", fp[3]);
+ BLI_snprintf(str, sizeof(str), " A:%-.4f", fp[3]);
else if (cp)
- sprintf(str, " A:%-3d", cp[3]);
+ BLI_snprintf(str, sizeof(str), " A:%-3d", cp[3]);
else
- sprintf(str, "- ");
+ BLI_snprintf(str, sizeof(str), "- ");
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -2440,12 +2440,12 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
rgb_to_yuv((float)cp[0]/255.0f, (float)cp[0]/255.0f, (float)cp[0]/255.0f, &lum, &u, &v);
}
- sprintf(str, "V:%-.4f", val);
+ BLI_snprintf(str, sizeof(str), "V:%-.4f", val);
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
- sprintf(str, " L:%-.4f", lum);
+ BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -2460,22 +2460,22 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
rgb_to_yuv((float)cp[0]/255.0f, (float)cp[1]/255.0f, (float)cp[2]/255.0f, &lum, &u, &v);
}
- sprintf(str, "H:%-.4f", hue);
+ BLI_snprintf(str, sizeof(str), "H:%-.4f", hue);
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
- sprintf(str, " S:%-.4f", sat);
+ BLI_snprintf(str, sizeof(str), " S:%-.4f", sat);
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
- sprintf(str, " V:%-.4f", val);
+ BLI_snprintf(str, sizeof(str), " V:%-.4f", val);
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
- sprintf(str, " L:%-.4f", lum);
+ BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
BLF_position(blf_mono_font, dx, 6, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index ea9a8b1ef32..a82ea9e9046 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -201,7 +201,7 @@ static void node_uiblocks_init(const bContext *C, bNodeTree *ntree)
for (node= ntree->nodes.first; node; node= node->next) {
/* ui block */
- sprintf(uiblockstr, "node buttons %p", (void *)node);
+ BLI_snprintf(uiblockstr, sizeof(uiblockstr), "node buttons %p", (void *)node);
node->block= uiBeginBlock(C, CTX_wm_region(C), uiblockstr, UI_EMBOSS);
uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node);
@@ -673,7 +673,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
//if(node->flag & NODE_MUTED)
- // sprintf(showname, "[%s]", showname);
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - dont print into self!
uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(rct->ymax-NODE_DY),
(int)(iconofs - rct->xmin-18.0f), NODE_DY, NULL, 0, 0, 0, 0, "");
@@ -835,7 +835,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
//if(node->flag & NODE_MUTED)
- // sprintf(showname, "[%s]", showname);
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - dont print into self!
uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(centy-10),
(int)(rct->xmax - rct->xmin-18.0f -12.0f), NODE_DY, NULL, 0, 0, 0, 0, "");
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 084e48c0d6e..a45b493ffb3 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1342,7 +1342,7 @@ static int outliner_filter_has_name(TreeElement *te, const char *name, int flags
}
else {
char fn_name[sizeof(((struct SpaceOops *)NULL)->search_string) + 2];
- sprintf(fn_name, "*%s*", name);
+ BLI_snprintf(fn_name, sizeof(fn_name), "*%s*", name);
found= fnmatch(fn_name, te->name, fn_flag)==0;
}
return found;
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 18c4b32398d..176ffd91e3b 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -392,11 +392,11 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
if(G.moving || (seq->flag & whichsel)) {
const char col[4]= {255, 255, 255, 255};
if (direction == SEQ_LEFTHANDLE) {
- sprintf(numstr, "%d", seq->startdisp);
+ BLI_snprintf(numstr, sizeof(numstr),"%d", seq->startdisp);
x1= rx1;
y1 -= 0.45f;
} else {
- sprintf(numstr, "%d", seq->enddisp - 1);
+ BLI_snprintf(numstr, sizeof(numstr), "%d", seq->enddisp - 1);
x1= x2 - handsize*0.75f;
y1= y2 + 0.05f;
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 26bf25d281d..25b9c2f2864 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1766,7 +1766,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
else
UI_ThemeColor(TH_TEXT);
- sprintf(linenr, "%*d", st->linenrs_tot, i + linecount + 1);
+ BLI_snprintf(linenr, sizeof(linenr), "%*d", st->linenrs_tot, i + linecount + 1);
/* itoa(i + linecount + 1, linenr, 10); */ /* not ansi-c :/ */
text_font_draw(st, TXT_OFFSET - 7, y, linenr);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 30337551fe5..9c9c55dd273 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2559,9 +2559,9 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
outputNumInput(&(t->num), tvec);
}
else {
- sprintf(&tvec[0], "%.4f", vec[0]);
- sprintf(&tvec[20], "%.4f", vec[1]);
- sprintf(&tvec[40], "%.4f", vec[2]);
+ BLI_snprintf(&tvec[0], 20, "%.4f", vec[0]);
+ BLI_snprintf(&tvec[20], 20, "%.4f", vec[1]);
+ BLI_snprintf(&tvec[40], 20, "%.4f", vec[2]);
}
if (t->con.mode & CON_APPLY) {
diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h
index 5ea82709239..cee8e5cd8d7 100644
--- a/source/blender/makesdna/DNA_dynamicpaint_types.h
+++ b/source/blender/makesdna/DNA_dynamicpaint_types.h
@@ -111,7 +111,7 @@ typedef struct DynamicPaintSurface {
/* initial color */
float init_color[4];
struct Tex *init_texture;
- char init_layername[40];
+ char init_layername[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
int dry_speed, diss_speed;
float depth_clamp, disp_factor;
@@ -126,8 +126,8 @@ typedef struct DynamicPaintSurface {
char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
char image_output_path[240];
- char output_name[40];
- char output_name2[40]; /* some surfaces have 2 outputs */
+ char output_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ char output_name2[64]; /* MAX_CUSTOMDATA_LAYER_NAME */ /* some surfaces have 2 outputs */
} DynamicPaintSurface;