[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43288] trunk/blender/source/blender: dynamicpaint had some incorrect string sizes for layers names, use BLI string functions in more places too.
Campbell Barton
ideasman42 at gmail.com
Wed Jan 11 13:56:34 CET 2012
Revision: 43288
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43288
Author: campbellbarton
Date: 2012-01-11 12:56:31 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
dynamicpaint had some incorrect string sizes for layers names, use BLI string functions in more places too.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/dynamicpaint.c
trunk/blender/source/blender/editors/space_nla/nla_draw.c
trunk/blender/source/blender/editors/space_node/drawnode.c
trunk/blender/source/blender/editors/space_node/node_draw.c
trunk/blender/source/blender/editors/space_outliner/outliner_tree.c
trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
trunk/blender/source/blender/editors/space_text/text_draw.c
trunk/blender/source/blender/editors/transform/transform.c
trunk/blender/source/blender/makesdna/DNA_dynamicpaint_types.h
Modified: trunk/blender/source/blender/blenkernel/intern/dynamicpaint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/dynamicpaint.c 2012-01-11 12:33:51 UTC (rev 43287)
+++ trunk/blender/source/blender/blenkernel/intern/dynamicpaint.c 2012-01-11 12:56:31 UTC (rev 43288)
@@ -1877,7 +1877,8 @@
* 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
Modified: trunk/blender/source/blender/editors/space_nla/nla_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_draw.c 2012-01-11 12:33:51 UTC (rev 43287)
+++ trunk/blender/source/blender/editors/space_nla/nla_draw.c 2012-01-11 12:56:31 UTC (rev 43288)
@@ -514,7 +514,7 @@
{
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 @@
* 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);
}
/* ---------------------- */
Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c 2012-01-11 12:33:51 UTC (rev 43287)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c 2012-01-11 12:56:31 UTC (rev 43288)
@@ -2308,7 +2308,7 @@
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 @@
#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 @@
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 @@
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 @@
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 @@
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);
Modified: trunk/blender/source/blender/editors/space_node/node_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_draw.c 2012-01-11 12:33:51 UTC (rev 43287)
+++ trunk/blender/source/blender/editors/space_node/node_draw.c 2012-01-11 12:56:31 UTC (rev 43288)
@@ -201,7 +201,7 @@
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 @@
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 @@
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, "");
Modified: trunk/blender/source/blender/editors/space_outliner/outliner_tree.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_tree.c 2012-01-11 12:33:51 UTC (rev 43287)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_tree.c 2012-01-11 12:56:31 UTC (rev 43288)
@@ -1342,7 +1342,7 @@
}
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;
Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c 2012-01-11 12:33:51 UTC (rev 43287)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c 2012-01-11 12:56:31 UTC (rev 43288)
@@ -392,11 +392,11 @@
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;
}
Modified: trunk/blender/source/blender/editors/space_text/text_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_draw.c 2012-01-11 12:33:51 UTC (rev 43287)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list