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>2011-09-16 10:47:01 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-16 10:47:01 +0400
commit0abe1911d57b4d4a806a5de6f8cdf4f421abb7cf (patch)
tree984a52b0b297130fd01c8c7179fbabfc419a8782 /source/blender/editors
parent862aababb300fc366628a302931c38a6201262db (diff)
- fix for access past the buffer size (paint / sculpt used some 2d vecs as 3d)
- remove redundant NULL checks on old code where it would crash if the result was NULL later on. - add some missing NULL checks.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/editors/object/object_modifier.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c13
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/space_file/file_ops.c27
6 files changed, 26 insertions, 22 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index a55ee01202c..f31c16cd020 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1235,7 +1235,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
ysize= block->maxy - block->miny+4;
/*aspect/= (float)xsize;*/ /*UNUSED*/
- if(but) {
+ {
int left=0, right=0, top=0, down=0;
int winx, winy;
// int offscreen;
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 8813b0027cd..17f174a5069 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -724,7 +724,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- int mode_orig = ob->mode;
+ int mode_orig = ob ? ob->mode : 0;
if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 79a3251cdf1..7f563b1c80c 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -749,7 +749,7 @@ static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], floa
static int project_paint_occlude_ptv_clip(
const ProjPaintState *ps, const MFace *mf,
- float pt[3], float v1[3], float v2[3], float v3[3],
+ float pt[3], float v1[4], float v2[4], float v3[4],
const int side )
{
float w[3], wco[3];
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 9500c7f663c..73a6e4fad20 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -683,7 +683,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
/* TODO: as sculpt and other paint modes are unified, this
separation will go away */
if(stroke->vc.obact->sculpt) {
- float delta[3];
+ float delta[2];
brush_jitter_pos(brush, mouse_in, mouse);
@@ -691,13 +691,14 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
brush_jitter_pos isn't written in the best way to
be reused here */
if(brush->flag & BRUSH_JITTER_PRESSURE) {
- sub_v3_v3v3(delta, mouse, mouse_in);
- mul_v3_fl(delta, pressure);
- add_v3_v3v3(mouse, mouse_in, delta);
+ sub_v2_v2v2(delta, mouse, mouse_in);
+ mul_v2_fl(delta, pressure);
+ add_v2_v2v2(mouse, mouse_in, delta);
}
}
- else
- copy_v3_v3(mouse, mouse_in);
+ else {
+ copy_v2_v2(mouse, mouse_in);
+ }
/* TODO: can remove the if statement once all modes have this */
if(stroke->get_location)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 92bc60e8b77..0bdb027a903 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2996,7 +2996,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
copy_v3_v3(cache->true_location, cache->orig_grab_location);
sd->draw_anchored = 1;
- copy_v3_v3(sd->anchored_initial_mouse, cache->initial_mouse);
+ copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
sd->anchored_size = cache->pixel_radius;
}
}
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 1b0893e50e0..43d5a5c9b4b 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -164,22 +164,26 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
SpaceFile *sfile= CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
int numfiles = filelist_numfiles(sfile->files);
+ struct direntry* file;
/* make the selected file active */
- if ( (selected_idx >= 0) && (selected_idx < numfiles)) {
- struct direntry* file = filelist_file(sfile->files, selected_idx);
+ if ( (selected_idx >= 0) &&
+ (selected_idx < numfiles) &&
+ (file= filelist_file(sfile->files, selected_idx)))
+ {
params->active_file = selected_idx;
- if(file && S_ISDIR(file->type)) {
+ if(S_ISDIR(file->type)) {
/* the path is too long and we are not going up! */
- if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX )
- {
+ if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) {
// XXX error("Path too long, cannot enter this directory");
- } else {
- if (strcmp(file->relname, "..")==0) {
- /* avoids /../../ */
- BLI_parent_dir(params->dir);
- } else {
+ }
+ else {
+ if (strcmp(file->relname, "..")==0) {
+ /* avoids /../../ */
+ BLI_parent_dir(params->dir);
+ }
+ else {
BLI_cleanup_dir(G.main->name, params->dir);
strcat(params->dir, file->relname);
BLI_add_slash(params->dir);
@@ -189,8 +193,7 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
retval = FILE_SELECT_DIR;
}
}
- else if (file)
- {
+ else {
if (file->relname) {
BLI_strncpy(params->file, file->relname, FILE_MAXFILE);
}