Fix compiler warnings
When dereferencing GArray.data to a C structure you need a double cast from guint8* to void*, and then from void* to the actual type. This avoids compiler warnings, especially when using clang on OSX.
This commit is contained in:
parent
eb489a40de
commit
1dfc503df1
@ -2000,6 +2000,7 @@ _clutter_script_construct_object (ClutterScript *script,
|
||||
else
|
||||
{
|
||||
GList *properties = oinfo->properties;
|
||||
GParameter *parameters = (GParameter *) (void *) params->data;
|
||||
|
||||
/* every other object: first, we get the construction parameters */
|
||||
oinfo->properties =
|
||||
@ -2011,7 +2012,7 @@ _clutter_script_construct_object (ClutterScript *script,
|
||||
|
||||
oinfo->object = g_object_newv (oinfo->gtype,
|
||||
params->len,
|
||||
(GParameter *) params->data);
|
||||
parameters);
|
||||
|
||||
/* by sinking the floating reference, we make sure that the reference
|
||||
* count is correct whether the object is referenced from somewhere
|
||||
|
@ -1537,9 +1537,8 @@ clutter_state_get_animator (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name)
|
||||
{
|
||||
State *target_state;
|
||||
StateAnimator *animators;
|
||||
gint i;
|
||||
State *target_state;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL);
|
||||
|
||||
@ -1552,13 +1551,14 @@ clutter_state_get_animator (ClutterState *state,
|
||||
target_state = clutter_state_fetch_state (state, target_state_name, FALSE);
|
||||
if (target_state == NULL)
|
||||
return NULL;
|
||||
|
||||
animators = (StateAnimator*)target_state->animators->data;
|
||||
|
||||
for (i = 0; animators[i].animator; i++)
|
||||
for (i = 0; i < target_state->animators->len; i++)
|
||||
{
|
||||
if (animators[i].source_state_name == source_state_name)
|
||||
return animators[i].animator;
|
||||
const StateAnimator *animator;
|
||||
|
||||
animator = &g_array_index (target_state->animators, StateAnimator, i);
|
||||
if (animator->source_state_name == source_state_name)
|
||||
return animator->animator;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -1592,8 +1592,7 @@ clutter_state_set_animator (ClutterState *state,
|
||||
ClutterAnimator *animator)
|
||||
{
|
||||
State *target_state;
|
||||
StateAnimator *animators;
|
||||
gint i;
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STATE (state));
|
||||
|
||||
@ -1604,15 +1603,17 @@ clutter_state_set_animator (ClutterState *state,
|
||||
if (target_state == NULL)
|
||||
return;
|
||||
|
||||
animators = (StateAnimator *) target_state->animators->data;
|
||||
for (i = 0; animators[i].animator; i++)
|
||||
for (i = 0; target_state->animators->len; i++)
|
||||
{
|
||||
if (animators[i].source_state_name == source_state_name)
|
||||
StateAnimator *a;
|
||||
|
||||
a = &g_array_index (target_state->animators, StateAnimator, i);
|
||||
if (a->source_state_name == source_state_name)
|
||||
{
|
||||
g_object_unref (animators[i].animator);
|
||||
g_object_unref (a->animator);
|
||||
|
||||
if (animator != NULL)
|
||||
animators[i].animator = g_object_ref (animator);
|
||||
a->animator = g_object_ref (animator);
|
||||
else
|
||||
{
|
||||
/* remove the matched animator if passed NULL */
|
||||
|
@ -759,7 +759,7 @@ calculate_col_widths (ClutterTableLayout *self,
|
||||
update_row_col (self, container);
|
||||
g_array_set_size (priv->columns, 0);
|
||||
g_array_set_size (priv->columns, priv->n_cols);
|
||||
columns = (DimensionData *) priv->columns->data;
|
||||
columns = (DimensionData *) (void *) priv->columns->data;
|
||||
|
||||
/* reset the visibility of all columns */
|
||||
priv->visible_cols = 0;
|
||||
@ -1032,8 +1032,8 @@ calculate_row_heights (ClutterTableLayout *self,
|
||||
g_array_set_size (priv->rows, 0);
|
||||
g_array_set_size (priv->rows, self->priv->n_rows);
|
||||
|
||||
rows = (DimensionData *) priv->rows->data;
|
||||
columns = (DimensionData *) priv->columns->data;
|
||||
rows = (DimensionData *) (void *) priv->rows->data;
|
||||
columns = (DimensionData *) (void *) priv->columns->data;
|
||||
|
||||
/* reset the visibility of all rows */
|
||||
priv->visible_rows = 0;
|
||||
@ -1334,7 +1334,7 @@ clutter_table_layout_get_preferred_width (ClutterLayoutManager *layout,
|
||||
}
|
||||
|
||||
calculate_table_dimensions (self, container, -1, for_height);
|
||||
columns = (DimensionData *) priv->columns->data;
|
||||
columns = (DimensionData *) (void *) priv->columns->data;
|
||||
|
||||
total_min_width = (priv->visible_cols - 1) * (float) priv->col_spacing;
|
||||
total_pref_width = total_min_width;
|
||||
@ -1374,7 +1374,7 @@ clutter_table_layout_get_preferred_height (ClutterLayoutManager *layout,
|
||||
}
|
||||
|
||||
calculate_table_dimensions (self, container, for_width, -1);
|
||||
rows = (DimensionData *) priv->rows->data;
|
||||
rows = (DimensionData *) (void *) priv->rows->data;
|
||||
|
||||
total_min_height = (priv->visible_rows - 1) * (float) priv->row_spacing;
|
||||
total_pref_height = total_min_height;
|
||||
@ -1439,8 +1439,8 @@ clutter_table_layout_allocate (ClutterLayoutManager *layout,
|
||||
box->x2 - box->x1,
|
||||
box->y2 - box->y1);
|
||||
|
||||
rows = (DimensionData *) priv->rows->data;
|
||||
columns = (DimensionData *) priv->columns->data;
|
||||
rows = (DimensionData *) (void *) priv->rows->data;
|
||||
columns = (DimensionData *) (void *) priv->columns->data;
|
||||
|
||||
for (child = clutter_actor_get_first_child (actor);
|
||||
child != NULL;
|
||||
|
@ -1631,7 +1631,7 @@ clutter_timeline_list_markers (ClutterTimeline *timeline,
|
||||
&data);
|
||||
|
||||
i = data.markers->len;
|
||||
retval = (gchar **) g_array_free (data.markers, FALSE);
|
||||
retval = (gchar **) (void *) g_array_free (data.markers, FALSE);
|
||||
}
|
||||
|
||||
if (n_markers)
|
||||
|
Loading…
x
Reference in New Issue
Block a user