Series of fixes for dereferenced pointers that gcc 4.1 complains about.

Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_handle_message_func):
* gst/gstclock.c: (gst_clock_dispose), (gst_clock_set_master):
* gst/gstelement.c: (gst_element_set_clock), (gst_element_dispose),
(gst_element_set_bus_func):
* gst/gstghostpad.c: (gst_proxy_pad_dispose):
* gst/gstminiobject.c: (gst_value_set_mini_object),
(gst_value_take_mini_object):
* gst/gstpad.c: (gst_pad_set_pad_template):
* gst/gstpipeline.c: (gst_pipeline_dispose),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_pop),
(gst_collect_pads_chain):
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_set_property):
Series of fixes for dereferenced pointers that gcc 4.1 complains about.
It's in fact all issues with gst_*object_replace().
This commit is contained in:
Edward Hervey 2006-03-21 14:14:49 +00:00
parent 88b5b1082e
commit ac377b0cdc
10 changed files with 94 additions and 29 deletions

View file

@ -1,3 +1,25 @@
2006-03-21 Edward Hervey <edward@fluendo.com>
reviewed by: <delete if not using a buddy>
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_handle_message_func):
* gst/gstclock.c: (gst_clock_dispose), (gst_clock_set_master):
* gst/gstelement.c: (gst_element_set_clock), (gst_element_dispose),
(gst_element_set_bus_func):
* gst/gstghostpad.c: (gst_proxy_pad_dispose):
* gst/gstminiobject.c: (gst_value_set_mini_object),
(gst_value_take_mini_object):
* gst/gstpad.c: (gst_pad_set_pad_template):
* gst/gstpipeline.c: (gst_pipeline_dispose),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_pop),
(gst_collect_pads_chain):
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_set_property):
Series of fixes for dereferenced pointers that gcc 4.1 complains about.
It's in fact all issues with gst_*object_replace().
2006-03-21 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Loïc Minier <lool + gnome at via dot ecp dot fr>

View file

@ -417,14 +417,17 @@ static void
gst_bin_dispose (GObject * object)
{
GstBin *bin = GST_BIN (object);
GstBus **child_bus_p = &bin->child_bus;
GstClock **provided_clock_p = &bin->provided_clock;
GstElement **clock_provider_p = &bin->clock_provider;
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose");
bin_remove_messages (bin, NULL, GST_MESSAGE_ANY);
gst_object_replace ((GstObject **) & bin->child_bus, NULL);
gst_object_replace ((GstObject **) & bin->provided_clock, NULL);
gst_object_replace ((GstObject **) & bin->clock_provider, NULL);
gst_object_replace ((GstObject **) child_bus_p, NULL);
gst_object_replace ((GstObject **) provided_clock_p, NULL);
gst_object_replace ((GstObject **) clock_provider_p, NULL);
while (bin->children) {
gst_bin_remove (bin, GST_ELEMENT_CAST (bin->children->data));
@ -517,6 +520,8 @@ gst_bin_provide_clock_func (GstElement * element)
GstBin *bin;
GstIterator *it;
gpointer val;
GstClock **provided_clock_p;
GstElement **clock_provider_p;
bin = GST_BIN (element);
@ -546,10 +551,11 @@ gst_bin_provide_clock_func (GstElement * element)
gst_object_unref (child);
}
}
gst_object_replace ((GstObject **) & bin->provided_clock,
(GstObject *) result);
gst_object_replace ((GstObject **) & bin->clock_provider,
(GstObject *) provider);
provided_clock_p = &bin->provided_clock;
clock_provider_p = &bin->clock_provider;
gst_object_replace ((GstObject **) provided_clock_p, (GstObject *) result);
gst_object_replace ((GstObject **) clock_provider_p, (GstObject *) provider);
bin->clock_dirty = FALSE;
GST_DEBUG_OBJECT (bin,
"provided new clock %" GST_PTR_FORMAT " by provider %" GST_PTR_FORMAT,
@ -2131,6 +2137,8 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
}
case GST_MESSAGE_CLOCK_LOST:
{
GstClock **provided_clock_p;
GstElement **clock_provider_p;
gboolean playing, provided, forward;
GstClock *clock;
@ -2147,8 +2155,10 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
GST_DEBUG_OBJECT (bin,
"Lost clock %" GST_PTR_FORMAT " provided by %" GST_PTR_FORMAT,
bin->provided_clock, bin->clock_provider);
gst_object_replace ((GstObject **) & bin->provided_clock, NULL);
gst_object_replace ((GstObject **) & bin->clock_provider, NULL);
provided_clock_p = &bin->provided_clock;
clock_provider_p = &bin->clock_provider;
gst_object_replace ((GstObject **) provided_clock_p, NULL);
gst_object_replace ((GstObject **) clock_provider_p, NULL);
}
GST_DEBUG_OBJECT (bin, "provided %d, playing %d, forward %d",
provided, playing, forward);

View file

@ -622,9 +622,11 @@ static void
gst_clock_dispose (GObject * object)
{
GstClock *clock = GST_CLOCK (object);
GstClock **master_p;
GST_OBJECT_LOCK (clock);
gst_object_replace ((GstObject **) & clock->master, NULL);
master_p = &clock->master;
gst_object_replace ((GstObject **) master_p, NULL);
GST_OBJECT_UNLOCK (clock);
G_OBJECT_CLASS (parent_class)->dispose (object);
@ -938,6 +940,8 @@ gst_clock_slave_callback (GstClock * master, GstClockTime time,
gboolean
gst_clock_set_master (GstClock * clock, GstClock * master)
{
GstClock **master_p;
g_return_val_if_fail (GST_IS_CLOCK (clock), FALSE);
g_return_val_if_fail (master != clock, FALSE);
@ -947,7 +951,8 @@ gst_clock_set_master (GstClock * clock, GstClock * master)
goto not_supported;
GST_DEBUG_OBJECT (clock, "slaving to master clock %p", master);
gst_object_replace ((GstObject **) & clock->master, (GstObject *) master);
master_p = &clock->master;
gst_object_replace ((GstObject **) master_p, (GstObject *) master);
GST_OBJECT_UNLOCK (clock);
GST_CLOCK_SLAVE_LOCK (clock);

View file

@ -399,6 +399,7 @@ gst_element_set_clock (GstElement * element, GstClock * clock)
{
GstElementClass *oclass;
gboolean res = TRUE;
GstClock **clock_p;
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
@ -411,7 +412,8 @@ gst_element_set_clock (GstElement * element, GstClock * clock)
if (res) {
GST_OBJECT_LOCK (element);
gst_object_replace ((GstObject **) & element->clock, (GstObject *) clock);
clock_p = &element->clock;
gst_object_replace ((GstObject **) clock_p, (GstObject *) clock);
GST_OBJECT_UNLOCK (element);
}
return res;
@ -2416,6 +2418,8 @@ static void
gst_element_dispose (GObject * object)
{
GstElement *element = GST_ELEMENT (object);
GstClock **clock_p;
GstBus **bus_p;
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "dispose");
@ -2441,8 +2445,10 @@ gst_element_dispose (GObject * object)
}
GST_OBJECT_LOCK (element);
gst_object_replace ((GstObject **) & element->clock, NULL);
gst_object_replace ((GstObject **) & element->bus, NULL);
clock_p = &element->clock;
bus_p = &element->bus;
gst_object_replace ((GstObject **) clock_p, NULL);
gst_object_replace ((GstObject **) bus_p, NULL);
GST_OBJECT_UNLOCK (element);
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "parent class dispose");
@ -2610,13 +2616,15 @@ gst_element_restore_thyself (GstObject * object, xmlNodePtr self)
static void
gst_element_set_bus_func (GstElement * element, GstBus * bus)
{
GstBus **bus_p;
g_return_if_fail (GST_IS_ELEMENT (element));
GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element, "setting bus to %p", bus);
GST_OBJECT_LOCK (element);
gst_object_replace ((GstObject **) & GST_ELEMENT_BUS (element),
GST_OBJECT_CAST (bus));
bus_p = &GST_ELEMENT_BUS (element);
gst_object_replace ((GstObject **) bus_p, GST_OBJECT_CAST (bus));
GST_OBJECT_UNLOCK (element);
}

View file

@ -383,9 +383,11 @@ static void
gst_proxy_pad_dispose (GObject * object)
{
GstPad *pad = GST_PAD (object);
GstPad **target_p;
GST_PROXY_LOCK (pad);
gst_object_replace ((GstObject **) & GST_PROXY_PAD_TARGET (pad), NULL);
target_p = &GST_PROXY_PAD_TARGET (pad);
gst_object_replace ((GstObject **) target_p, NULL);
GST_PROXY_UNLOCK (pad);
G_OBJECT_CLASS (gst_proxy_pad_parent_class)->dispose (object);

View file

@ -397,11 +397,13 @@ gst_value_mini_object_lcopy (const GValue * value, guint n_collect_values,
void
gst_value_set_mini_object (GValue * value, GstMiniObject * mini_object)
{
gpointer *pointer_p;
g_return_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value));
g_return_if_fail (mini_object == NULL || GST_IS_MINI_OBJECT (mini_object));
gst_mini_object_replace ((GstMiniObject **) & value->data[0].v_pointer,
mini_object);
pointer_p = &value->data[0].v_pointer;
gst_mini_object_replace ((GstMiniObject **) pointer_p, mini_object);
}
/**
@ -417,11 +419,13 @@ gst_value_set_mini_object (GValue * value, GstMiniObject * mini_object)
void
gst_value_take_mini_object (GValue * value, GstMiniObject * mini_object)
{
gpointer *pointer_p;
g_return_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value));
g_return_if_fail (mini_object == NULL || GST_IS_MINI_OBJECT (mini_object));
gst_mini_object_replace ((GstMiniObject **) & value->data[0].v_pointer,
mini_object);
pointer_p = &value->data[0].v_pointer;
gst_mini_object_replace ((GstMiniObject **) pointer_p, mini_object);
gst_mini_object_unref (mini_object);
}

View file

@ -1780,10 +1780,13 @@ prepare_failed:
static void
gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ)
{
GstPadTemplate **template_p;
/* this function would need checks if it weren't static */
GST_OBJECT_LOCK (pad);
gst_object_replace ((GstObject **) & pad->padtemplate, (GstObject *) templ);
template_p = &pad->padtemplate;
gst_object_replace ((GstObject **) template_p, (GstObject *) templ);
GST_OBJECT_UNLOCK (pad);
if (templ)

View file

@ -257,11 +257,12 @@ static void
gst_pipeline_dispose (GObject * object)
{
GstPipeline *pipeline = GST_PIPELINE (object);
GstClock **clock_p = &pipeline->fixed_clock;
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, pipeline, "dispose");
/* clear and unref any fixed clock */
gst_object_replace ((GstObject **) & pipeline->fixed_clock, NULL);
gst_object_replace ((GstObject **) clock_p, NULL);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@ -705,13 +706,15 @@ gst_pipeline_get_clock (GstPipeline * pipeline)
void
gst_pipeline_use_clock (GstPipeline * pipeline, GstClock * clock)
{
GstClock **clock_p;
g_return_if_fail (GST_IS_PIPELINE (pipeline));
GST_OBJECT_LOCK (pipeline);
GST_OBJECT_FLAG_SET (pipeline, GST_PIPELINE_FLAG_FIXED_CLOCK);
gst_object_replace ((GstObject **) & pipeline->fixed_clock,
(GstObject *) clock);
clock_p = &pipeline->fixed_clock;
gst_object_replace ((GstObject **) clock_p, (GstObject *) clock);
GST_OBJECT_UNLOCK (pipeline);
GST_CAT_DEBUG (GST_CAT_CLOCK, "pipeline using fixed clock %p (%s)", clock,
@ -757,13 +760,16 @@ gst_pipeline_set_clock (GstPipeline * pipeline, GstClock * clock)
void
gst_pipeline_auto_clock (GstPipeline * pipeline)
{
GstClock **clock_p;
g_return_if_fail (pipeline != NULL);
g_return_if_fail (GST_IS_PIPELINE (pipeline));
GST_OBJECT_LOCK (pipeline);
GST_OBJECT_FLAG_UNSET (pipeline, GST_PIPELINE_FLAG_FIXED_CLOCK);
gst_object_replace ((GstObject **) & pipeline->fixed_clock, NULL);
clock_p = &pipeline->fixed_clock;
gst_object_replace ((GstObject **) clock_p, NULL);
GST_OBJECT_UNLOCK (pipeline);
GST_CAT_DEBUG (GST_CAT_CLOCK, "pipeline using automatic clock");

View file

@ -472,6 +472,7 @@ GstBuffer *
gst_collect_pads_pop (GstCollectPads * pads, GstCollectData * data)
{
GstBuffer *result;
GstBuffer **buffer_p;
g_return_val_if_fail (pads != NULL, NULL);
g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), NULL);
@ -479,7 +480,8 @@ gst_collect_pads_pop (GstCollectPads * pads, GstCollectData * data)
result = data->buffer;
if (result) {
gst_buffer_replace (&data->buffer, NULL);
buffer_p = &data->buffer;
gst_buffer_replace (buffer_p, NULL);
data->pos = 0;
pads->queuedpads--;
}
@ -768,6 +770,7 @@ gst_collect_pads_chain (GstPad * pad, GstBuffer * buffer)
GstCollectPads *pads;
guint64 size;
GstFlowReturn ret;
GstBuffer **buffer_p;
GST_DEBUG ("Got buffer for pad %s:%s", GST_DEBUG_PAD_NAME (pad));
@ -793,7 +796,8 @@ gst_collect_pads_chain (GstPad * pad, GstBuffer * buffer)
/* One more pad has data queued */
pads->queuedpads++;
gst_buffer_replace (&data->buffer, buffer);
buffer_p = &data->buffer;
gst_buffer_replace (buffer_p, buffer);
if (data->segment.format == GST_FORMAT_TIME
&& GST_BUFFER_TIMESTAMP_IS_VALID (buffer))

View file

@ -291,6 +291,7 @@ gst_net_time_provider_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstNetTimeProvider *self = GST_NET_TIME_PROVIDER (object);
GstClock **clock_p = &self->clock;
switch (prop_id) {
case PROP_PORT:
@ -304,7 +305,7 @@ gst_net_time_provider_set_property (GObject * object, guint prop_id,
self->address = g_strdup (g_value_get_string (value));
break;
case PROP_CLOCK:
gst_object_replace ((GstObject **) & self->clock,
gst_object_replace ((GstObject **) clock_p,
(GstObject *) g_value_get_object (value));
break;
case PROP_ACTIVE: