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>2012-01-11 16:33:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-11 16:33:51 +0400
commite10fd04db0bdcdbc326fce6cddc8af1179a5de5c (patch)
treea8f3a08b35101e30a0e5d4d1a94e0b2ef50c7122 /source/blender/editors/util/numinput.c
parentdcef7346eb3f16c27b3f952b6452396e66f5e996 (diff)
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.
Diffstat (limited to 'source/blender/editors/util/numinput.c')
-rw-r--r--source/blender/editors/util/numinput.c19
1 files changed, 10 insertions, 9 deletions
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 <math.h> /* fabs */
-#include <stdio.h> /* for sprintf */
+#include <stdio.h> /* 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);
}
}
}