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.
This commit is contained in:
Brecht Van Lommel 2016-07-04 17:30:05 +02:00
parent 439fe6568f
commit 1ba90582f5
8 changed files with 14 additions and 24 deletions

View File

@ -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),

View File

@ -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

View File

@ -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;

View File

@ -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) {

View File

@ -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.

View File

@ -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,

View File

@ -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);

View File

@ -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)