diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-11 16:33:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-11 16:33:51 +0400 |
commit | e10fd04db0bdcdbc326fce6cddc8af1179a5de5c (patch) | |
tree | a8f3a08b35101e30a0e5d4d1a94e0b2ef50c7122 /source/blender/editors/armature | |
parent | dcef7346eb3f16c27b3f952b6452396e66f5e996 (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/armature')
-rw-r--r-- | source/blender/editors/armature/editarmature_retarget.c | 2 | ||||
-rw-r--r-- | source/blender/editors/armature/meshlaplacian.c | 5 | ||||
-rw-r--r-- | source/blender/editors/armature/poseSlide.c | 2 | ||||
-rw-r--r-- | source/blender/editors/armature/poselib.c | 19 | ||||
-rw-r--r-- | source/blender/editors/armature/reeb.c | 5 |
5 files changed, 21 insertions, 12 deletions
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index a928976d695..9ec27b69835 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -1453,7 +1453,7 @@ static void RIG_printCtrl(RigControl *ctrl, char *indent) printf("%sBone: %s\n", indent, ctrl->bone->name); printf("%sLink: %s\n", indent, ctrl->link ? ctrl->link->name : "!NONE!"); - sprintf(text, "%soffset", indent); + BLI_snprintf(text, sizeof(text), "%soffset", indent); print_v3(text, ctrl->offset); printf("%sFlag: %i\n", indent, ctrl->flag); diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 502da1be8ac..e33b778a168 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -45,6 +45,7 @@ #include "BLI_edgehash.h" #include "BLI_memarena.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_DerivedMesh.h" #include "BKE_modifier.h" @@ -1613,7 +1614,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind NLContext *context; float vec[3], gridvec[3]; int a, b, x, y, z, totvar; - char message[1024]; + char message[256]; /* setup variable indices */ mdb->varidx= MEM_callocN(sizeof(int)*mdb->size3, "MeshDeformDSvaridx"); @@ -1715,7 +1716,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind break; } - sprintf(message, "Mesh deform solve %d / %d |||", a+1, mdb->totcagevert); + BLI_snprintf(message, sizeof(message), "Mesh deform solve %d / %d |||", a+1, mdb->totcagevert); progress_bar((float)(a+1)/(float)(mdb->totcagevert), message); } diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 6a9323107d7..c28b688e377 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -543,7 +543,7 @@ static void pose_slide_draw_status (tPoseSlideOp *pso) break; } - sprintf(status_str, "%s: %d %%", mode_str, (int)(pso->percentage*100.0f)); + BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%", mode_str, (int)(pso->percentage*100.0f)); ED_area_headerprint(pso->sa, status_str); } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 5cdb9c76396..dcddde207f0 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -977,7 +977,9 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) /* do header print - if interactively previewing */ if (pld->state == PL_PREVIEW_RUNNING) { if (pld->flag & PL_PREVIEW_SHOWORIGINAL) { - sprintf(pld->headerstr, "PoseLib Previewing Pose: [Showing Original Pose] | Use Tab to start previewing poses again"); + BLI_strncpy(pld->headerstr, + "PoseLib Previewing Pose: [Showing Original Pose] | Use Tab to start previewing poses again", + sizeof(pld->headerstr)); ED_area_headerprint(pld->sa, pld->headerstr); } else if (pld->searchstr[0]) { @@ -988,10 +990,10 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) /* get search-string */ index= pld->search_cursor; - if (index >= 0 && index <= 64) { + if (index >= 0 && index <= sizeof(tempstr) - 1) { memcpy(&tempstr[0], &pld->searchstr[0], index); tempstr[index]= '|'; - memcpy(&tempstr[index+1], &pld->searchstr[index], 64-index); + memcpy(&tempstr[index+1], &pld->searchstr[index], (sizeof(tempstr) - 1) - index); } else { BLI_strncpy(tempstr, pld->searchstr, sizeof(tempstr)); @@ -1000,11 +1002,18 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) /* get marker name */ BLI_strncpy(markern, pld->marker ? pld->marker->name : "No Matches", sizeof(markern)); - sprintf(pld->headerstr, "PoseLib Previewing Pose: Filter - [%s] | Current Pose - \"%s\" | Use ScrollWheel or PageUp/Down to change", tempstr, markern); + BLI_snprintf(pld->headerstr, sizeof(pld->headerstr), + "PoseLib Previewing Pose: Filter - [%s] | " + "Current Pose - \"%s\" | " + "Use ScrollWheel or PageUp/Down to change", + tempstr, markern); ED_area_headerprint(pld->sa, pld->headerstr); } else { - sprintf(pld->headerstr, "PoseLib Previewing Pose: \"%s\" | Use ScrollWheel or PageUp/Down to change", pld->marker->name); + BLI_snprintf(pld->headerstr, sizeof(pld->headerstr), + "PoseLib Previewing Pose: \"%s\" | " + "Use ScrollWheel or PageUp/Down to change", + pld->marker->name); ED_area_headerprint(pld->sa, pld->headerstr); } } diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 80278c95d05..fe9eb6dcd01 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -2035,10 +2035,9 @@ void REEB_exportGraph(ReebGraph *rg, int count) if (count == -1) { - sprintf(filename, "test.txt"); + strcpy(filename, "test.txt"); } - else - { + else { sprintf(filename, "test%05i.txt", count); } f = fopen(filename, "w"); |