diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-08 16:55:31 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-08 16:55:31 +0300 |
commit | ec7df03c867d28316708e9b91bec5cef0aee832e (patch) | |
tree | 3f560939b745032e235d9ac789c4117d669d6462 /source/blender/editors | |
parent | 4c318539b2f6abdf8f2a02376b6fcb8d30a4b12e (diff) |
Warning fixes, one actual bug found in sequencer sound wave drawing. Also
changed some malloc to MEM_mallocN while trying to track down a memory leak.
Diffstat (limited to 'source/blender/editors')
12 files changed, 24 insertions, 20 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index b8760a85108..9f82275390b 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4982,7 +4982,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) } else { /* perform clamping using euler form (3-components) */ - float eul[3], oldeul[3], quat1[4]; + float eul[3], oldeul[3], quat1[4] = {0}; if (pchan->rotmode == ROT_MODE_QUAT) { QUATCOPY(quat1, pchan->quat); diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index eee56070e91..75e7e9a3db8 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -1074,7 +1074,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok DepthPeel *p1, *p2; float *last_p = NULL; float dist = FLT_MAX; - float p[3]; + float p[3] = {0}; float size = 0; float mvalf[2]; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 6c4f5564fd7..7608014b150 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -573,8 +573,8 @@ static void init_iconfile_list(struct ListBase *list) if(!BLI_getwdN(olddir)) restoredir = 0; totfile = BLI_getdir(icondirstr, &dir); - if (restoredir) - chdir(olddir); + if (restoredir && !chdir(olddir)) + ; /* fix warning about checking return value */ for(i=0; i<totfile; i++) { if( (dir[i].type & S_IFREG) ) { diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 269fc278581..62af987c966 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -732,7 +732,7 @@ void sort_faces(Scene *scene, View3D *v3d) if (event == 1) { /* sort on view axis */ mul_m4_v3(mat, vec); face_sort_floats[i] = vec[2] * reverse; - } else { /* distance from cursor*/ + } else if(event == 2) { /* distance from cursor*/ face_sort_floats[i] = len_v3v3(cur, vec) * reverse; /* back to front */ } } diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 15ed20c783e..82e72136daf 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -181,7 +181,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) } else { /* perform clamping using euler form (3-components) */ - float eul[3], oldeul[3], quat1[4]; + float eul[3], oldeul[3], quat1[4] = {0}; if (ob->rotmode == ROT_MODE_QUAT) { QUATCOPY(quat1, ob->quat); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index c5dc6f74f58..81e2b1caea2 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3578,7 +3578,7 @@ static void *do_projectpaint_thread(void *ph_v) rctf bucket_bounds; /* for smear only */ - float pos_ofs[2]; + float pos_ofs[2] = {0}; float co[2]; float mask = 1.0f; /* airbrush wont use mask */ unsigned short mask_short; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 1914c40f817..129d10050a5 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1276,7 +1276,7 @@ static void do_flatten_clay_brush(Sculpt *sd, SculptSession *ss, PBVHNode **node Brush *brush = paint_brush(&sd->paint); float bstrength= ss->cache->bstrength; float area_normal[3]; - float cntr[3], cntr2[3], bstr = 0; + float cntr[3], cntr2[3] = {0}, bstr = 0; int n, flip = 0; calc_area_normal(sd, ss, area_normal, nodes, totnode); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index dbe9417fd2a..556ab13654b 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -801,7 +801,7 @@ static void filelist_read_dir(struct FileList* filelist) BLI_hide_dot_files(filelist->hide_dot); filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist)); - chdir(wdir); + if(!chdir(wdir)) /* fix warning about not checking return value */; filelist_setfiletypes(filelist, G.have_quicktime); filelist_filter(filelist); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 5339acf74d9..0955652c30f 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -186,12 +186,12 @@ static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, f int length = floor((x2-x1)/stepsize)+1; float ymid = (y1+y2)/2; float yscale = (y2-y1)/2; - float* samples = malloc(length * sizeof(float) * 2); + float* samples = MEM_mallocN(length * sizeof(float) * 2, "seqwave_samples"); if(!samples) return; if(sound_read_sound_buffer(seq->sound, samples, length) != length) { - free(samples); + MEM_freeN(samples); return; } glBegin(GL_LINES); @@ -201,7 +201,7 @@ static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, f glVertex2f(x1+i*stepsize, ymid + samples[i * 2 + 1] * yscale); } glEnd(); - free(samples); + MEM_freeN(samples); } } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 4f19cfa86af..11bdbcb5314 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2223,11 +2223,13 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot) /* view_all operator */ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); bScreen *sc= CTX_wm_screen(C); ScrArea *area= CTX_wm_area(C); +#if 0 ARegion *ar= CTX_wm_region(C); SpaceSeq *sseq= area->spacedata.first; + Scene *scene= CTX_data_scene(C); +#endif View2D *v2d= UI_view2d_fromcontext(C); v2d->cur= v2d->tot; @@ -2528,6 +2530,7 @@ static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb) calc_sequence(scene, seqa); } +#if 0 static Sequence* sequence_find_parent(Scene* scene, Sequence* child) { Editing *ed= seq_give_editing(scene, FALSE); @@ -2542,9 +2545,10 @@ static Sequence* sequence_find_parent(Scene* scene, Sequence* child) break; } } - return parent; + return parent; } +#endif static int sequencer_swap_exec(bContext *C, wmOperator *op) { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index c33f8723231..e744252889a 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -738,7 +738,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d) char *printable = NULL; if (v3d->localvd) { - printable = malloc(strlen(name) + strlen(" (Local)_")); /* '_' gives space for '\0' */ + printable = MEM_mallocN(strlen(name) + strlen(" (Local)_"), "viewport_name"); /* '_' gives space for '\0' */ strcpy(printable, name); strcat(printable, " (Local)"); } else { @@ -751,7 +751,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d) } if (v3d->localvd) { - free(printable); + MEM_freeN(printable); } } diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 85ccef5cd7d..2de3c60f54c 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -1376,11 +1376,11 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent if (nnewpoints*2 > size) { size *= 2; - free(oldpoints); - oldpoints = malloc(sizeof(float)*2*size); + MEM_freeN(oldpoints); + oldpoints = MEM_mallocN(sizeof(float)*2*size, "oldpoints"); memcpy(oldpoints, newpoints, sizeof(float)*2*nnewpoints); - free(newpoints); - newpoints = malloc(sizeof(float)*2*size); + MEM_freeN(newpoints); + newpoints = MEM_mallocN(sizeof(float)*2*size, "newpoints"); } else { float (*sw_points)[2] = oldpoints; |