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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-02-12 19:54:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-12 19:54:24 +0300
commit55f68c36574779ae2fac3652466584628b22c633 (patch)
treee2f55301dda8897bf17f8b8459229d8fa5a67816 /source/blender/editors/space_image
parent9eee1f962d49f14d92c8da4e677e4ee140f4f440 (diff)
fix for more warnings.
- modifier code was using sizeof() without knowing the sizeof the array when clearing the modifier type array. - use BLI_snprintf rather then sprintf where the size of the string is known. - particle drawing code kept a reference to stack float values (not a problem at the moment but would crash if accessed later).
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_draw.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 3932caeeba6..0dcfa9e3bcc 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -41,6 +41,7 @@
#include "PIL_time.h"
#include "BLI_threads.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "IMB_imbuf.h"
@@ -129,26 +130,27 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar)
void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *fp, int *zp, float *zpf)
{
char str[256];
- int ofs;
-
- ofs= sprintf(str, "X: %4d Y: %4d ", x, y);
+ int ofs= 0;
+
+ ofs += BLI_snprintf(str, sizeof(str)-ofs, "X: %4d Y: %4d ", x, y);
if(cp)
- ofs+= sprintf(str+ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]);
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]);
if(fp) {
if(channels==4)
- ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]);
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]);
else if(channels==1)
- ofs+= sprintf(str+ofs, "| Val: %.3f ", fp[0]);
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Val: %.3f ", fp[0]);
else if(channels==3)
- ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]);
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]);
}
if(zp)
- ofs+= sprintf(str+ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff));
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff));
if(zpf)
- ofs+= sprintf(str+ofs, "| Z: %.3f ", *zpf);
-
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.3f ", *zpf);
+ (void)ofs;
+
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);