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>2013-07-15 02:08:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-15 02:08:56 +0400
commit9c8516703d24aa5e3f67d563c8f5dfd54592dc1d (patch)
tree54c013ed6f92050acbaecc8ceab22a898bcfb288
parent1c2ff55334c774cdcf0699387de6e450cef38e99 (diff)
replace strncpy with BLI_strncpy for cases we expect the string to be NULL terminated.
-rw-r--r--source/blender/compositor/operations/COM_KeyingScreenOperation.h3
-rw-r--r--source/blender/compositor/operations/COM_TrackPositionOperation.h5
-rw-r--r--source/blender/editors/space_clip/clip_ops.c5
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c2
-rw-r--r--source/blender/editors/transform/transform_orientations.c6
5 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.h b/source/blender/compositor/operations/COM_KeyingScreenOperation.h
index 8b1128a4da3..fa22ba668b9 100644
--- a/source/blender/compositor/operations/COM_KeyingScreenOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.h
@@ -32,6 +32,7 @@
#include "DNA_movieclip_types.h"
#include "BLI_listbase.h"
+#include "BLI_string.h"
extern "C" {
#include "BLI_voronoi.h"
@@ -76,7 +77,7 @@ public:
void deinitializeTileData(rcti *rect, void *data);
void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;}
- void setTrackingObject(const char *object) {strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject));}
+ void setTrackingObject(const char *object) { BLI_strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject)); }
void setFramenumber(int framenumber) {this->m_framenumber = framenumber;}
void executePixel(float output[4], int x, int y, void *data);
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.h b/source/blender/compositor/operations/COM_TrackPositionOperation.h
index 3f05b907ea0..b5499ab76b7 100644
--- a/source/blender/compositor/operations/COM_TrackPositionOperation.h
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.h
@@ -33,6 +33,7 @@
#include "DNA_tracking_types.h"
#include "BLI_listbase.h"
+#include "BLI_string.h"
/**
* Class with implementation of green screen gradient rasterization
@@ -60,8 +61,8 @@ public:
TrackPositionOperation();
void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;}
- void setTrackingObject(char *object) {strncpy(this->m_trackingObjectName, object, sizeof(this->m_trackingObjectName));}
- void setTrackName(char *track) {strncpy(this->m_trackName, track, sizeof(this->m_trackName));}
+ void setTrackingObject(char *object) { BLI_strncpy(this->m_trackingObjectName, object, sizeof(this->m_trackingObjectName)); }
+ void setTrackName(char *track) { BLI_strncpy(this->m_trackName, track, sizeof(this->m_trackName)); }
void setFramenumber(int framenumber) {this->m_framenumber = framenumber;}
void setAxis(int value) {this->m_axis = value;}
void setPosition(int value) {this->m_position = value;}
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 7a6da5d8896..de19df9abe2 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -50,6 +50,7 @@
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BLI_threads.h"
+#include "BLI_string.h"
#include "BLF_translation.h"
@@ -250,13 +251,13 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)
clip = ED_space_clip_get_clip(sc);
if (clip) {
- strncpy(path, clip->name, sizeof(path));
+ BLI_strncpy(path, clip->name, sizeof(path));
BLI_path_abs(path, G.main->name);
BLI_parent_dir(path);
}
else {
- strncpy(path, U.textudir, sizeof(path));
+ BLI_strncpy(path, U.textudir, sizeof(path));
}
if (RNA_struct_property_is_set(op->ptr, "files"))
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 65199ee9c3d..def907d5dc0 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -761,7 +761,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
BKE_sequencer_sort(scene);
/* last active name */
- strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR - 1);
+ BLI_strncpy(ed->act_imagedir, strip->dir, sizeof(ed->act_imagedir));
if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
if (BKE_sequence_test_overlap(ed->seqbasep, seq))
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 70e01ef3718..130e11d45aa 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -115,7 +115,7 @@ static TransformOrientation *createViewSpace(bContext *C, ReportList *UNUSED(rep
View3D *v3d = CTX_wm_view3d(C);
if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
/* If an object is used as camera, then this space is the same as object space! */
- strncpy(name, v3d->camera->id.name + 2, MAX_NAME);
+ BLI_strncpy(name, v3d->camera->id.name + 2, MAX_NAME);
}
else {
strcpy(name, "Custom View");
@@ -141,7 +141,7 @@ static TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(r
/* use object name if no name is given */
if (name[0] == 0) {
- strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2);
+ BLI_strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2);
}
return addMatrixSpace(C, mat, name, overwrite);
@@ -306,7 +306,7 @@ TransformOrientation *addMatrixSpace(bContext *C, float mat[3][3], char name[],
if (ts == NULL) {
ts = MEM_callocN(sizeof(TransformOrientation), "UserTransSpace from matrix");
BLI_addtail(transform_spaces, ts);
- strncpy(ts->name, name, sizeof(ts->name));
+ BLI_strncpy(ts->name, name, sizeof(ts->name));
}
/* copy matrix into transform space */