code cleanup: replace strcpy with BLI_strncpy for fixed size strings, and correct some harmless but incorrect sizeof() use
This commit is contained in:
parent
41721e11fb
commit
78d69a1e15
|
@ -2080,6 +2080,8 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT
|
|||
axis = data->type - 20;
|
||||
}
|
||||
|
||||
BLI_assert((unsigned int)axis < 3);
|
||||
|
||||
/* Target defines the animation */
|
||||
s = (vec[axis] - data->min) / (data->max - data->min);
|
||||
CLAMP(s, 0, 1);
|
||||
|
|
|
@ -487,7 +487,7 @@ void sk_endContinuousStroke(SK_Stroke *stk)
|
|||
void sk_updateNextPoint(SK_Sketch *sketch, SK_Stroke *stk)
|
||||
{
|
||||
if (stk) {
|
||||
memcpy(&sketch->next_point, stk->points[stk->nb_points - 1].p, sizeof(SK_Point));
|
||||
memcpy(&(sketch->next_point), &(stk->points[stk->nb_points - 1]), sizeof(SK_Point));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
|
|||
|
||||
/* will over-alloc, but makes for easy lookups by index to keep aligned */
|
||||
BMVert **verts_boundary = use_boundary ?
|
||||
MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__) : NULL;
|
||||
MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__) : NULL;
|
||||
|
||||
float *verts_relfac = use_relative_offset ?
|
||||
MEM_mallocN(sizeof(float) * totvert_orig, __func__) : NULL;
|
||||
|
|
|
@ -1953,7 +1953,7 @@ void init_userdef_do_versions(void)
|
|||
if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 4)) {
|
||||
bTheme *btheme;
|
||||
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
|
||||
if (btheme->tseq.movieclip[0] == 0) {
|
||||
if (btheme->tseq.movieclip[3] == 0) {
|
||||
rgba_char_args_set(btheme->tseq.movieclip, 32, 32, 143, 255);
|
||||
}
|
||||
}
|
||||
|
@ -2002,7 +2002,7 @@ void init_userdef_do_versions(void)
|
|||
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 11)) {
|
||||
bTheme *btheme;
|
||||
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
|
||||
if (btheme->tseq.movieclip[0] == 0) {
|
||||
if (btheme->tseq.mask[3] == 0) {
|
||||
rgba_char_args_set(btheme->tseq.mask, 152, 78, 62, 255);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2787,9 +2787,9 @@ static void update_glsl_display_processor(const ColorManagedViewSettings *view_s
|
|||
check_glsl_display_processor_changed(view_settings, display_settings, from_colorspace))
|
||||
{
|
||||
/* Store settings of processor for further comparison. */
|
||||
strcpy(global_glsl_state.view, view_settings->view_transform);
|
||||
strcpy(global_glsl_state.display, display_settings->display_device);
|
||||
strcpy(global_glsl_state.input, from_colorspace);
|
||||
BLI_strncpy(global_glsl_state.view, view_settings->view_transform, MAX_COLORSPACE_NAME);
|
||||
BLI_strncpy(global_glsl_state.display, display_settings->display_device, MAX_COLORSPACE_NAME);
|
||||
BLI_strncpy(global_glsl_state.input, from_colorspace, MAX_COLORSPACE_NAME);
|
||||
global_glsl_state.exposure = view_settings->exposure;
|
||||
global_glsl_state.gamma = view_settings->gamma;
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ static Frame **collect_hull_frames(int v, SkinNode *frames,
|
|||
int nbr, i;
|
||||
|
||||
(*tothullframe) = emap[v].count;
|
||||
hull_frames = MEM_callocN(sizeof(Frame * *) * (*tothullframe),
|
||||
hull_frames = MEM_callocN(sizeof(Frame *) * (*tothullframe),
|
||||
"hull_from_frames.hull_frames");
|
||||
i = 0;
|
||||
for (nbr = 0; nbr < emap[v].count; nbr++) {
|
||||
|
|
|
@ -379,7 +379,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
|
|||
// to the original file working directory
|
||||
|
||||
if (exitstring != "")
|
||||
strcpy(basedpath, exitstring.Ptr());
|
||||
BLI_strncpy(basedpath, exitstring.ReadPtr(), sizeof(basedpath));
|
||||
|
||||
// load relative to the last loaded file, this used to be relative
|
||||
// to the first file but that makes no sense, relative paths in
|
||||
|
|
Loading…
Reference in New Issue