Code cleanup: fix a few warnings (>= 0 and == -1 tests on unsigned types).
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 17 Dec 2011 01:13:02 +0000 (01:13 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 17 Dec 2011 01:13:02 +0000 (01:13 +0000)
source/blender/blenkernel/intern/image.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/imbuf/intern/anim_movie.c

index 7c2542b33be7e5ce3f163c145f48a07e614542a2..25ff7b5fa04d3d19f193314dadff84fd86602fea 100644 (file)
@@ -1508,10 +1508,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 
        int ok;
 
-       if(imtype == -1) {
-               /* use whatever existing image type is set by 'ibuf' */
-       }
-       else if(imtype== R_IMF_IMTYPE_IRIS) {
+       if(imtype== R_IMF_IMTYPE_IRIS) {
                ibuf->ftype= IMAGIC;
        }
 #ifdef WITH_HDR
index 50fe9d26cf9c1202a60ca7bece06ee35d4705c2f..e117a934cd78af4bf238918b640035898001b306 100644 (file)
@@ -2599,8 +2599,8 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
        int nr= RNA_enum_get(op->ptr, "group");
 
+       BLI_assert(nr+1 >= 0);
        ob->actdef= nr+1;
-       BLI_assert(ob->actdef >= 0);
 
        DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
@@ -2733,8 +2733,8 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
        sort_map_update[0]= 0;
        vgroup_remap_update_users(ob, sort_map_update);
 
+       BLI_assert(sort_map_update[ob->actdef] >= 0);
        ob->actdef= sort_map_update[ob->actdef];
-       BLI_assert(ob->actdef >= 0);
        
        MEM_freeN(sort_map_update);
 
index a5da5938f827ec9df644970f04b634cfccc9e697..c0e3d00343bd2dfa3317f7212db775631d5d5fda 100644 (file)
@@ -1023,8 +1023,8 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op)
        ViewContext vc;
        view3d_set_viewcontext(C, &vc);
 
+       BLI_assert(type + 1 >= 0);
        vc.obact->actdef= type + 1;
-       BLI_assert(vc.obact->actdef >= 0);
 
        DAG_id_tag_update(&vc.obact->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, vc.obact);
@@ -1918,8 +1918,9 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
                                                dg= ED_vgroup_add_name(ob, pchan->name);        /* sets actdef */
                                        }
                                        else {
-                                               ob->actdef= 1 + BLI_findindex(&ob->defbase, dg);
-                                               BLI_assert(ob->actdef >= 0);
+                                               int actdef = 1 + BLI_findindex(&ob->defbase, dg);
+                                               BLI_assert(actdef >= 0);
+                                               ob->actdef= actdef;
                                        }
                                }
                        }
index 89547edaafab67a8ffc9320578ff3f84f73984c8..e728267f45ff189aa49cd17ee4adad0a33f46164 100644 (file)
@@ -396,8 +396,8 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
        /* id in tselem is object */
        ob= (Object *)tselem->id;
        if(set) {
+               BLI_assert(te->index+1 >= 0);
                ob->actdef= te->index+1;
-               BLI_assert(ob->actdef >= 0);
 
                DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
                WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
index 7d0c201a07c48656f2b1790c919438f5988bfc4f..45264fa862beb7f34b5047495bf264489eecbe4f 100644 (file)
@@ -703,7 +703,6 @@ static void ffmpeg_postprocess(struct anim * anim)
                int dstStride2[4] = { -dstStride[0], 0, 0, 0 };
                uint8_t* dst2[4]  = { dst[0] + (anim->y - 1)*dstStride[0],
                                      0, 0, 0 };
-               int i;
                
                sws_scale(anim->img_convert_ctx,
                          (const uint8_t * const *)input->data,