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 19:04:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-11 19:04:54 +0400
commita7b0a11811ccdbf83301891c03a50c1d5daf4776 (patch)
tree165521a6533e9069c455dbccda87b944ae7a1c25 /source/blender/editors/util
parentb308e613126f8c89e954705aa512a3ef6a1f551d (diff)
parent6ce92d09f77351b3ad882e8d8f6d6b1511e91844 (diff)
svn merge ^/trunk/blender -r43278:43294
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/ed_util.c18
-rw-r--r--source/blender/editors/util/numinput.c19
2 files changed, 19 insertions, 18 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 169135478f6..b46ca538896 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -179,18 +179,18 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
BLI_strncpy(local_name, abs_name, sizeof(local_name));
BLI_splitdirstring(local_name, fi);
- sprintf(local_name, "//%s/%s", folder, fi);
+ BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
if(strcmp(abs_name, local_name)!=0) {
switch(checkPackedFile(local_name, pf)) {
case PF_NOFILE:
- sprintf(line, "Create %s", local_name);
+ BLI_snprintf(line, sizeof(line), "Create %s", local_name);
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
RNA_string_set(&props_ptr, "id", id_name);
break;
case PF_EQUAL:
- sprintf(line, "Use %s (identical)", local_name);
+ BLI_snprintf(line, sizeof(line), "Use %s (identical)", local_name);
//uiItemEnumO(layout, opname, line, 0, "method", PF_USE_LOCAL);
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
@@ -198,13 +198,13 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
break;
case PF_DIFFERS:
- sprintf(line, "Use %s (differs)", local_name);
+ BLI_snprintf(line, sizeof(line), "Use %s (differs)", local_name);
//uiItemEnumO(layout, opname, line, 0, "method", PF_USE_LOCAL);
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
RNA_string_set(&props_ptr, "id", id_name);
- sprintf(line, "Overwrite %s", local_name);
+ BLI_snprintf(line, sizeof(line), "Overwrite %s", local_name);
//uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_LOCAL);
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
@@ -216,27 +216,27 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
switch(checkPackedFile(abs_name, pf)) {
case PF_NOFILE:
- sprintf(line, "Create %s", abs_name);
+ BLI_snprintf(line, sizeof(line), "Create %s", abs_name);
//uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_ORIGINAL);
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
RNA_string_set(&props_ptr, "id", id_name);
break;
case PF_EQUAL:
- sprintf(line, "Use %s (identical)", abs_name);
+ BLI_snprintf(line, sizeof(line), "Use %s (identical)", abs_name);
//uiItemEnumO(layout, opname, line, 0, "method", PF_USE_ORIGINAL);
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
RNA_string_set(&props_ptr, "id", id_name);
break;
case PF_DIFFERS:
- sprintf(line, "Use %s (differs)", abs_name);
+ BLI_snprintf(line, sizeof(line), "Use %s (differs)", abs_name);
//uiItemEnumO(layout, opname, line, 0, "method", PF_USE_ORIGINAL);
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
RNA_string_set(&props_ptr, "id", id_name);
- sprintf(line, "Overwrite %s", abs_name);
+ BLI_snprintf(line, sizeof(line), "Overwrite %s", abs_name);
//uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_ORIGINAL);
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
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);
}
}
}