Index: gst/gstbin.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstbin.c,v
retrieving revision 1.329
diff -u -p -r1.329 gstbin.c
--- gst/gstbin.c	13 Mar 2006 11:04:38 -0000	1.329
+++ gst/gstbin.c	19 Mar 2006 17:05:45 -0000
@@ -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 *
   GstBin *bin;
   GstIterator *it;
   gpointer val;
+  GstClock **provided_clock_p;
+  GstElement **clock_provider_p;
 
   bin = GST_BIN (element);
 
@@ -546,9 +551,12 @@ gst_bin_provide_clock_func (GstElement *
       gst_object_unref (child);
     }
   }
-  gst_object_replace ((GstObject **) & bin->provided_clock,
+
+  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 **) & bin->clock_provider,
+  gst_object_replace ((GstObject **) clock_provider_p,
       (GstObject *) provider);
   bin->clock_dirty = FALSE;
   GST_DEBUG_OBJECT (bin,
@@ -2131,6 +2139,8 @@ gst_bin_handle_message_func (GstBin * bi
     }
     case GST_MESSAGE_CLOCK_LOST:
     {
+      GstClock **provided_clock_p;
+      GstElement **clock_provider_p;
       gboolean playing, provided, forward;
       GstClock *clock;
 
@@ -2147,8 +2157,10 @@ gst_bin_handle_message_func (GstBin * bi
         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);
Index: gst/gstbuffer.h
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstbuffer.h,v
retrieving revision 1.107
diff -u -p -r1.107 gstbuffer.h
--- gst/gstbuffer.h	15 Mar 2006 16:29:02 -0000	1.107
+++ gst/gstbuffer.h	19 Mar 2006 17:05:45 -0000
@@ -287,7 +287,14 @@ G_STMT_START {						\
  *
  * Increases the refcount of the given buffer by one.
  */
-#define		gst_buffer_ref(buf)		GST_BUFFER_CAST (gst_mini_object_ref (GST_MINI_OBJECT (buf)))
+static inline GstBuffer *
+gst_buffer_ref (GstBuffer * buf)
+{
+  /* not using a macro here because gcc-4.1 will complain
+   * if the return value isn't used (because of the cast) */
+  return GST_BUFFER (gst_mini_object_ref (GST_MINI_OBJECT (buf)));
+}
+
 /**
  * gst_buffer_unref:
  * @buf: a #GstBuffer.
Index: gst/gstclock.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstclock.c,v
retrieving revision 1.89
diff -u -p -r1.89 gstclock.c
--- gst/gstclock.c	15 Mar 2006 20:17:40 -0000	1.89
+++ gst/gstclock.c	19 Mar 2006 17:05:45 -0000
@@ -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 * mas
 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, 
     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);
Index: gst/gstelement.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstelement.c,v
retrieving revision 1.424
diff -u -p -r1.424 gstelement.c
--- gst/gstelement.c	13 Mar 2006 11:04:38 -0000	1.424
+++ gst/gstelement.c	19 Mar 2006 17:05:46 -0000
@@ -399,6 +399,7 @@ gst_element_set_clock (GstElement * elem
 {
   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 * elem
 
   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,12 +2616,14 @@ gst_element_restore_thyself (GstObject *
 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),
+  bus_p = & GST_ELEMENT_BUS (element);
+  gst_object_replace ((GstObject **) bus_p,
       GST_OBJECT_CAST (bus));
   GST_OBJECT_UNLOCK (element);
 }
Index: gst/gstevent.h
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstevent.h,v
retrieving revision 1.92
diff -u -p -r1.92 gstevent.h
--- gst/gstevent.h	7 Mar 2006 16:21:02 -0000	1.92
+++ gst/gstevent.h	19 Mar 2006 17:05:46 -0000
@@ -325,7 +325,14 @@ GType		gst_event_get_type		(void);
  *
  * Increase the refcount of this event.
  */
-#define         gst_event_ref(ev)		GST_EVENT (gst_mini_object_ref (GST_MINI_OBJECT (ev)))
+static inline GstEvent *
+gst_event_ref (GstEvent * ev)
+{
+  /* not using a macro here because gcc-4.1 will complain
+   * if the return value isn't used (because of the cast) */
+  return GST_EVENT (gst_mini_object_ref (GST_MINI_OBJECT (ev)));
+}
+
 /**
  * gst_event_unref:
  * @ev: The event to refcount
Index: gst/gstghostpad.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstghostpad.c,v
retrieving revision 1.33
diff -u -p -r1.33 gstghostpad.c
--- gst/gstghostpad.c	29 Jan 2006 17:37:08 -0000	1.33
+++ gst/gstghostpad.c	19 Mar 2006 17:05:46 -0000
@@ -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);
Index: gst/gstmessage.h
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstmessage.h,v
retrieving revision 1.35
diff -u -p -r1.35 gstmessage.h
--- gst/gstmessage.h	13 Feb 2006 11:19:32 -0000	1.35
+++ gst/gstmessage.h	19 Mar 2006 17:05:46 -0000
@@ -199,7 +199,14 @@ GQuark		gst_message_type_to_quark	(GstMe
  * Convenience macro to increase the reference count of the message. Returns the
  * reffed message.
  */
-#define         gst_message_ref(msg)		GST_MESSAGE (gst_mini_object_ref (GST_MINI_OBJECT (msg)))
+static inline GstMessage *
+gst_message_ref (GstMessage * msg)
+{
+  /* not using a macro here because gcc-4.1 will complain
+   * if the return value isn't used (because of the cast) */
+  return GST_MESSAGE (gst_mini_object_ref (GST_MINI_OBJECT (msg)));
+}
+
 /**
  * gst_message_unref:
  * @msg: the message to unref
Index: gst/gstminiobject.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstminiobject.c,v
retrieving revision 1.24
diff -u -p -r1.24 gstminiobject.c
--- gst/gstminiobject.c	28 Feb 2006 10:52:02 -0000	1.24
+++ gst/gstminiobject.c	19 Mar 2006 17:05:46 -0000
@@ -397,10 +397,13 @@ gst_value_mini_object_lcopy (const GValu
 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,
+  pointer_p = & value->data[0].v_pointer;
+  gst_mini_object_replace ((GstMiniObject **) pointer_p,
       mini_object);
 }
 
@@ -417,10 +420,13 @@ gst_value_set_mini_object (GValue * valu
 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,
+  pointer_p = & value->data[0].v_pointer;
+  gst_mini_object_replace ((GstMiniObject **) pointer_p,
       mini_object);
   gst_mini_object_unref (mini_object);
 }
Index: gst/gstpad.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstpad.c,v
retrieving revision 1.501
diff -u -p -r1.501 gstpad.c
--- gst/gstpad.c	17 Mar 2006 19:27:51 -0000	1.501
+++ gst/gstpad.c	19 Mar 2006 17:05:47 -0000
@@ -1780,10 +1780,12 @@ 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)
Index: gst/gstpipeline.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstpipeline.c,v
retrieving revision 1.131
diff -u -p -r1.131 gstpipeline.c
--- gst/gstpipeline.c	14 Mar 2006 16:32:58 -0000	1.131
+++ gst/gstpipeline.c	19 Mar 2006 17:05:47 -0000
@@ -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,12 +706,15 @@ gst_pipeline_get_clock (GstPipeline * pi
 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,
+  clock_p = &pipeline->fixed_clock;
+  gst_object_replace ((GstObject **) clock_p,
       (GstObject *) clock);
   GST_OBJECT_UNLOCK (pipeline);
 
@@ -757,13 +761,16 @@ gst_pipeline_set_clock (GstPipeline * pi
 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");
Index: libs/gst/base/gstcollectpads.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstcollectpads.c,v
retrieving revision 1.24
diff -u -p -r1.24 gstcollectpads.c
--- libs/gst/base/gstcollectpads.c	7 Feb 2006 15:49:39 -0000	1.24
+++ libs/gst/base/gstcollectpads.c	19 Mar 2006 17:05:48 -0000
@@ -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 * p
 
   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, Gs
   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, Gs
 
   /* 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))
Index: libs/gst/net/gstnettimeprovider.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/libs/gst/net/gstnettimeprovider.c,v
retrieving revision 1.8
diff -u -p -r1.8 gstnettimeprovider.c
--- libs/gst/net/gstnettimeprovider.c	12 Mar 2006 20:40:19 -0000	1.8
+++ libs/gst/net/gstnettimeprovider.c	19 Mar 2006 17:05:48 -0000
@@ -291,6 +291,7 @@ gst_net_time_provider_set_property (GObj
     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 (GObj
         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:
Index: tests/check/gst/gstevent.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/tests/check/gst/gstevent.c,v
retrieving revision 1.12
diff -u -p -r1.12 gstevent.c
--- tests/check/gst/gstevent.c	22 Nov 2005 11:48:57 -0000	1.12
+++ tests/check/gst/gstevent.c	19 Mar 2006 17:05:49 -0000
@@ -208,7 +208,7 @@ event_probe (GstPad * pad, GstMiniObject
       case GST_EVENT_CUSTOM_BOTH_OOB:
         if (got_event_before_q != NULL)
           break;
-        gst_event_ref (data);
+        gst_event_ref (GST_EVENT(data));
         g_get_current_time (&got_event_time);
         got_event_before_q = GST_EVENT (data);
         break;
@@ -223,7 +223,7 @@ event_probe (GstPad * pad, GstMiniObject
       case GST_EVENT_CUSTOM_BOTH_OOB:
         if (got_event_after_q != NULL)
           break;
-        gst_event_ref (data);
+        gst_event_ref (GST_EVENT(data));
         g_get_current_time (&got_event_time);
         got_event_after_q = GST_EVENT (data);
         break;
