+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>
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));
GstBin *bin;
GstIterator *it;
gpointer val;
+ GstClock **provided_clock_p;
+ GstElement **clock_provider_p;
bin = GST_BIN (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,
}
case GST_MESSAGE_CLOCK_LOST:
{
+ GstClock **provided_clock_p;
+ GstElement **clock_provider_p;
gboolean playing, provided, forward;
GstClock *clock;
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);
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);
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);
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);
{
GstElementClass *oclass;
gboolean res = TRUE;
+ GstClock **clock_p;
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
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;
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");
}
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");
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);
}
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);
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);
}
/**
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);
}
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)
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);
}
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,
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");
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);
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--;
}
GstCollectPads *pads;
guint64 size;
GstFlowReturn ret;
+ GstBuffer **buffer_p;
GST_DEBUG ("Got buffer for pad %s:%s", GST_DEBUG_PAD_NAME (pad));
/* 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))
const GValue * value, GParamSpec * pspec)
{
GstNetTimeProvider *self = GST_NET_TIME_PROVIDER (object);
+ GstClock **clock_p = &self->clock;
switch (prop_id) {
case PROP_PORT:
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: