Commit: 40f45a7eac620fd8b99b3f29f3d0cac3c855dc84
Author: Campbell Barton
Date:   Sat Dec 1 19:36:57 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB40f45a7eac620fd8b99b3f29f3d0cac3c855dc84

Cleanup: redundant NULL checks

Also use unsigned shifting for values not in int range.

===================================================================

M       source/blender/blenkernel/intern/rigidbody.c
M       source/blender/editors/include/UI_interface.h
M       source/blender/editors/screen/area.c
M       source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M       source/blender/editors/transform/transform_snap_object.c
M       source/blender/gpu/GPU_batch.h
M       source/blender/makesdna/DNA_scene_types.h
M       source/blender/render/intern/source/bake_api.c

===================================================================

diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index 9ba3593f6b8..919a0c5fa02 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -148,7 +148,7 @@ void BKE_rigidbody_free_world(Scene *scene)
 void BKE_rigidbody_free_object(Object *ob, RigidBodyWorld *rbw)
 {
        bool is_orig = (ob->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0;
-       RigidBodyOb *rbo = (ob) ? ob->rigidbody_object : NULL;
+       RigidBodyOb *rbo = ob->rigidbody_object;
 
        /* sanity check */
        if (rbo == NULL)
diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index dac1ca95eff..776c9459acc 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -195,7 +195,7 @@ enum {
        UI_BUT_TEXTEDIT_UPDATE = (1 << 29),  /* when widget is in textedit 
mode, update value on each char stroke */
        UI_BUT_VALUE_CLEAR     = (1 << 30),  /* show 'x' icon to clear/unlink 
value of text or search button */
 
-       UI_BUT_OVERRIDEN       = (1 << 31),  /* RNA property of the button is 
overridden from linked reference data. */
+       UI_BUT_OVERRIDEN       = (1u << 31u),  /* RNA property of the button is 
overridden from linked reference data. */
 };
 
 #define UI_PANEL_WIDTH          340
diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 94b30f8e3b0..9e73fea12ce 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1354,7 +1354,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion 
*ar, rcti *remainder, rct
        if (ar->winy > 1) ar->sizey = (ar->winy + 0.5f) /  UI_DPI_FAC;
 
        /* exception for multiple overlapping regions on same spot */
-       if (ar->overlap & (alignment != RGN_ALIGN_FLOAT)) {
+       if (ar->overlap && (alignment != RGN_ALIGN_FLOAT)) {
                region_overlap_fix(sa, ar);
        }
 
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c 
b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index 96fbe1d48a6..83db61f9e5a 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -306,13 +306,13 @@ static bool view3d_ruler_item_mousemove(
         RulerInfo *ruler_info, RulerItem *ruler_item, const int mval[2],
         const bool do_thickness, const bool do_snap)
 {
-       RulerInteraction *inter = ruler_item->gz.interaction_data;
        const float eps_bias = 0.0002f;
        float dist_px = MVAL_MAX_PX_DIST * U.pixelsize;  /* snap dist */
 
        ruler_info->snap_flag &= ~RULER_SNAP_OK;
 
        if (ruler_item) {
+               RulerInteraction *inter = ruler_item->gz.interaction_data;
                float *co = ruler_item->co[inter->co_index];
                /* restore the initial depth */
                copy_v3_v3(co, inter->drag_start_co);
diff --git a/source/blender/editors/transform/transform_snap_object.c 
b/source/blender/editors/transform/transform_snap_object.c
index 176e1852b01..5a54e4153cb 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -1253,10 +1253,7 @@ static short snap_mesh_polygon(
                        normalize_v3(r_no);
                }
 
-               if (r_index) {
-                       *r_index = nearest.index;
-               }
-
+               *r_index = nearest.index;
                return elem;
        }
 
@@ -1355,9 +1352,7 @@ static short snap_mesh_edge_verts_mixed(
                        normalize_v3(r_no);
                }
 
-               if (r_index) {
-                       *r_index = nearest.index;
-               }
+               *r_index = nearest.index;
        }
 
        return elem;
diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h
index cf69af11aa6..5f87523829a 100644
--- a/source/blender/gpu/GPU_batch.h
+++ b/source/blender/gpu/GPU_batch.h
@@ -95,7 +95,7 @@ enum {
        GPU_BATCH_OWNS_VBO = (1 << 0),
        /* each vbo index gets bit-shifted */
        GPU_BATCH_OWNS_INSTANCES = (1 << 30),
-       GPU_BATCH_OWNS_INDEX = (1 << 31),
+       GPU_BATCH_OWNS_INDEX = (1u << 31u),
 };
 
 GPUBatch *GPU_batch_create_ex(GPUPrimType, GPUVertBuf *, GPUIndexBuf *, uint 
owns_flag);
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 1b31e45b30e..c34bf32d0cb 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -263,7 +263,7 @@ typedef enum eScenePassType {
        SCE_PASS_SUBSURFACE_DIRECT        = (1 << 28),
        SCE_PASS_SUBSURFACE_INDIRECT      = (1 << 29),
        SCE_PASS_SUBSURFACE_COLOR         = (1 << 30),
-       SCE_PASS_ROUGHNESS                = (1 << 31),
+       SCE_PASS_ROUGHNESS                = (1u << 31u),
 } eScenePassType;
 
 #define RE_PASSNAME_COMBINED "Combined"
diff --git a/source/blender/render/intern/source/bake_api.c 
b/source/blender/render/intern/source/bake_api.c
index 181d3744ad7..c906413d7d7 100644
--- a/source/blender/render/intern/source/bake_api.c
+++ b/source/blender/render/intern/source/bake_api.c
@@ -432,7 +432,7 @@ static TriTessFace *mesh_calc_tri_tessface(
                    me->totloop, me->totpoly,
                    looptri);
 
-       const float *precomputed_normals = me ? 
CustomData_get_layer(&me->pdata, CD_NORMAL) : NULL;
+       const float *precomputed_normals = CustomData_get_layer(&me->pdata, 
CD_NORMAL);
        const bool calculate_normal = precomputed_normals ? false : true;
 
        for (i = 0; i < tottri; i++) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to