From e10fd04db0bdcdbc326fce6cddc8af1179a5de5c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Jan 2012 12:33:51 +0000 Subject: use BLI_strncpy and BLI_snprintf when the size of the string is known. fix for sequencer unique naming which was missed with string length update. --- source/blender/editors/util/numinput.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'source/blender/editors/util/numinput.c') diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index 6c8713aa03e..52422d37f29 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -31,9 +31,10 @@ #include /* fabs */ -#include /* for sprintf */ +#include /* for size_t */ #include "BLI_utildefines.h" +#include "BLI_string.h" #include "WM_types.h" @@ -84,34 +85,34 @@ void outputNumInput(NumInput *n, char *str) inv[0] = 0; if( n->val[i] > 1e10f || n->val[i] < -1e10f ) - sprintf(&str[j*20], "%s%.4e%c", inv, n->val[i], cur); + BLI_snprintf(&str[j*20], 20, "%s%.4e%c", inv, n->val[i], cur); else switch (n->ctrl[i]) { case 0: - sprintf(&str[j*20], "%sNONE%c", inv, cur); + BLI_snprintf(&str[j*20], 20, "%sNONE%c", inv, cur); break; case 1: case -1: - sprintf(&str[j*20], "%s%.0f%c", inv, n->val[i], cur); + BLI_snprintf(&str[j*20], 20, "%s%.0f%c", inv, n->val[i], cur); break; case 10: case -10: - sprintf(&str[j*20], "%s%.f.%c", inv, n->val[i], cur); + BLI_snprintf(&str[j*20], 20, "%s%.f.%c", inv, n->val[i], cur); break; case 100: case -100: - sprintf(&str[j*20], "%s%.1f%c", inv, n->val[i], cur); + BLI_snprintf(&str[j*20], 20, "%s%.1f%c", inv, n->val[i], cur); break; case 1000: case -1000: - sprintf(&str[j*20], "%s%.2f%c", inv, n->val[i], cur); + BLI_snprintf(&str[j*20], 20, "%s%.2f%c", inv, n->val[i], cur); break; case 10000: case -10000: - sprintf(&str[j*20], "%s%.3f%c", inv, n->val[i], cur); + BLI_snprintf(&str[j*20], 20, "%s%.3f%c", inv, n->val[i], cur); break; default: - sprintf(&str[j*20], "%s%.4e%c", inv, n->val[i], cur); + BLI_snprintf(&str[j*20], 20, "%s%.4e%c", inv, n->val[i], cur); } } } -- cgit v1.2.3