Commit: 1ba90582f532081dc4b980e79e732e268e2ca96a
Author: Brecht Van Lommel
Date:   Mon Jul 4 17:30:05 2016 +0200
Branches: master
https://developer.blender.org/rB1ba90582f532081dc4b980e79e732e268e2ca96a

Fix a few compiler warnings on OS X / clang.

Two were actual bugs, though they existed only in unused code:
* In Freestyle it was unintentionally copying a scene rather than referencing 
it.
* In BLI_array_store_is_valid there was use of uninitialized memory.

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

M       source/blender/blenkernel/intern/colortools.c
M       source/blender/blenkernel/intern/constraint.c
M       source/blender/blenkernel/intern/dynamicpaint.c
M       source/blender/blenlib/intern/array_store.c
M       source/blender/editors/curve/editfont_undo.c
M       source/blender/editors/mesh/editmesh_undo.c
M       source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h
M       source/blender/gpu/intern/gpu_material.c

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

diff --git a/source/blender/blenkernel/intern/colortools.c 
b/source/blender/blenkernel/intern/colortools.c
index c1f1f01..2932939 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -1322,7 +1322,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const 
ColorManagedViewSettings *
                .cm_processor = cm_processor, .display_buffer = display_buffer, 
.ycc_mode = ycc_mode,
                .bin_lum = bin_lum, .bin_r = bin_r, .bin_g = bin_g, .bin_b = 
bin_b, .bin_a = bin_a,
        };
-       ScopesUpdateDataChunk data_chunk = {0};
+       ScopesUpdateDataChunk data_chunk = {{0}};
        INIT_MINMAX(data_chunk.min, data_chunk.max);
 
        BLI_task_parallel_range_finalize(0, ibuf->y, &data, &data_chunk, 
sizeof(data_chunk),
diff --git a/source/blender/blenkernel/intern/constraint.c 
b/source/blender/blenkernel/intern/constraint.c
index a591d53..c88b24a 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -2195,7 +2195,7 @@ static void actcon_get_tarmat(bConstraint *con, 
bConstraintOb *cob, bConstraintT
                }
                else if (cob->type == CONSTRAINT_OBTYPE_BONE) {
                        Object workob;
-                       bPose pose = {0};
+                       bPose pose = {{0}};
                        bPoseChannel *pchan, *tchan;
 
                        /* make a copy of the bone of interest in the temp pose 
before evaluating action, so that it can get set 
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 6207217..2c596ea 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -3830,7 +3830,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface 
*surface,
                const float brush_radius = brush->paint_distance * 
surface->radius_scale;
                int numOfVerts;
                int ii;
-               Bounds3D mesh_bb = {0};
+               Bounds3D mesh_bb = {{0}};
                VolumeGrid *grid = bData->grid;
 
                dm = CDDM_copy(brush->dm);
@@ -4100,7 +4100,7 @@ static int 
dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 
        const float range = solidradius + smooth;
 
-       Bounds3D part_bb = {0};
+       Bounds3D part_bb = {{0}};
 
        if (psys->totpart < 1)
                return 1;
diff --git a/source/blender/blenlib/intern/array_store.c 
b/source/blender/blenlib/intern/array_store.c
index 3356559..6000c1a 100644
--- a/source/blender/blenlib/intern/array_store.c
+++ b/source/blender/blenlib/intern/array_store.c
@@ -249,7 +249,7 @@ typedef struct BArrayMemory {
 /**
  * Main storage for all states
  */
-typedef struct BArrayStore {
+struct BArrayStore {
        /* static */
        BArrayInfo info;
 
@@ -260,7 +260,7 @@ typedef struct BArrayStore {
         * #BArrayState may be in any order (logic should never depend on state 
order).
         */
        ListBase states;
-} BArrayStore;
+};
 
 /**
  * A single instance of an array.
@@ -272,13 +272,13 @@ typedef struct BArrayStore {
  * While this could be moved to a memory pool,
  * it makes it easier to trace invalid usage, so leave as-is for now.
  */
-typedef struct BArrayState {
+struct BArrayState {
        /** linked list in #BArrayStore.states */
        struct BArrayState *next, *prev;
 
        struct BChunkList *chunk_list;  /* BChunkList's */
 
-} BArrayState;
+};
 
 typedef struct BChunkList {
        ListBase chunk_refs;      /* BChunkRef's */
@@ -1750,10 +1750,11 @@ bool BLI_array_store_is_valid(
                } \
        } ((void)0)
 
-
                /* count chunk_list's */
-               int totrefs = 0;
                GHash *chunk_list_map = BLI_ghash_ptr_new(__func__);
+               GHash *chunk_map = BLI_ghash_ptr_new(__func__);
+
+               int totrefs = 0;
                for (BArrayState *state = bs->states.first; state; state = 
state->next) {
                        GHASH_PTR_ADD_USER(chunk_list_map, state->chunk_list);
                }
@@ -1771,7 +1772,6 @@ bool BLI_array_store_is_valid(
                }
 
                /* count chunk's */
-               GHash *chunk_map = BLI_ghash_ptr_new(__func__);
                GHASH_ITER (gh_iter, chunk_list_map) {
                        const struct BChunkList *chunk_list = 
BLI_ghashIterator_getKey(&gh_iter);
                        for (const BChunkRef *cref = 
chunk_list->chunk_refs.first; cref; cref = cref->next) {
diff --git a/source/blender/editors/curve/editfont_undo.c 
b/source/blender/editors/curve/editfont_undo.c
index a0453f9..a61f863 100644
--- a/source/blender/editors/curve/editfont_undo.c
+++ b/source/blender/editors/curve/editfont_undo.c
@@ -77,7 +77,7 @@ static struct {
        /* We could have the undo API pass in the previous state, for now store 
a local list */
        ListBase local_links;
 
-} uf_arraystore = {NULL};
+} uf_arraystore = {{NULL}};
 
 /**
  * \param create: When false, only free the arrays.
diff --git a/source/blender/editors/mesh/editmesh_undo.c 
b/source/blender/editors/mesh/editmesh_undo.c
index b44fbc3..c9814d1 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -114,7 +114,7 @@ static struct {
                TaskPool *task_pool;
 #endif
 
-} um_arraystore = {NULL};
+} um_arraystore = {{NULL}};
 
 static void um_arraystore_cd_compact(
         struct CustomData *cdata, const size_t data_len,
diff --git a/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h 
b/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h
index 4b079df..8dc93d8 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h
@@ -52,16 +52,6 @@ public:
                return _SceneRenderLayer;
        }
 
-       inline void setSceneRenderLayer(Scene& scene)
-       {
-               _Scene = scene;
-       }
-
-       inline void setSceneRenderLayer(SceneRenderLayer& srl)
-       {
-               _SceneRenderLayer = srl;
-       }
-
        /*! Accept the corresponding visitor */
        virtual void accept(SceneVisitor& v);
 
diff --git a/source/blender/gpu/intern/gpu_material.c 
b/source/blender/gpu/intern/gpu_material.c
index 095a5b1..fd7f205 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -2585,7 +2585,7 @@ int GPU_lamp_shadow_bind_code(GPULamp *lamp)
 
 float *GPU_lamp_dynpersmat(GPULamp *lamp)
 {
-       return lamp->dynpersmat ? (float *)lamp->dynpersmat : NULL;
+       return (float*)lamp->dynpersmat;
 }
 
 int GPU_lamp_shadow_layer(GPULamp *lamp)

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

Reply via email to