diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h
index 49ad3d5..8d5ff2f 100644
--- a/gst/gstbuffer.h
+++ b/gst/gstbuffer.h
@@ -37,7 +37,7 @@ typedef struct _GstBufferPool GstBufferPool;
 
 #define GST_TYPE_BUFFER                         (_gst_buffer_type)
 #define GST_IS_BUFFER(obj)                      (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_BUFFER))
-#define GST_BUFFER_CAST(obj)                    ((GstBuffer *)(obj))
+#define GST_BUFFER_CAST(obj)                    ((GstBuffer *)(void *)(obj))
 #define GST_BUFFER(obj)                         (GST_BUFFER_CAST(obj))
 
 /**
@@ -330,7 +330,7 @@ G_INLINE_FUNC GstBuffer * gst_buffer_ref (GstBuffer * buf);
 static inline GstBuffer *
 gst_buffer_ref (GstBuffer * buf)
 {
-  return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf));
+  return GST_BUFFER (gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf)));
 }
 
 /**
diff --git a/gst/gstevent.h b/gst/gstevent.h
index 7907a69..660494f 100644
--- a/gst/gstevent.h
+++ b/gst/gstevent.h
@@ -187,7 +187,7 @@ GST_EXPORT GType _gst_event_type;
 
 #define GST_TYPE_EVENT                  (_gst_event_type)
 #define GST_IS_EVENT(obj)               (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_EVENT))
-#define GST_EVENT_CAST(obj)             ((GstEvent *)(obj))
+#define GST_EVENT_CAST(obj)             ((GstEvent *)(void *)(obj))
 #define GST_EVENT(obj)                  (GST_EVENT_CAST(obj))
 
 /**
@@ -404,7 +404,7 @@ G_INLINE_FUNC GstEvent * gst_event_ref (GstEvent * event);
 static inline GstEvent *
 gst_event_ref (GstEvent * event)
 {
-  return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (event));
+  return GST_EVENT_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (event)));
 }
 
 /**
diff --git a/gst/gstmessage.h b/gst/gstmessage.h
index 0328667..b039201 100644
--- a/gst/gstmessage.h
+++ b/gst/gstmessage.h
@@ -149,7 +149,7 @@ typedef enum
 
 #define GST_TYPE_MESSAGE                         (gst_message_get_type())
 #define GST_IS_MESSAGE(obj)                      (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_MESSAGE))
-#define GST_MESSAGE_CAST(obj)                    ((GstMessage*)(obj))
+#define GST_MESSAGE_CAST(obj)                    ((GstMessage*)(void*)(obj))
 #define GST_MESSAGE(obj)                         (GST_MESSAGE_CAST(obj))
 
 /* the lock is used to handle the synchronous handling of messages,
@@ -312,7 +312,7 @@ G_INLINE_FUNC GstMessage * gst_message_ref (GstMessage * msg);
 static inline GstMessage *
 gst_message_ref (GstMessage * msg)
 {
-  return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg));
+  return GST_MESSAGE_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg)));
 }
 
 /**
diff --git a/gst/gstminiobject.h b/gst/gstminiobject.h
index f873b7a..a88929e 100644
--- a/gst/gstminiobject.h
+++ b/gst/gstminiobject.h
@@ -30,7 +30,7 @@
 G_BEGIN_DECLS
 
 #define GST_IS_MINI_OBJECT_TYPE(obj,type)  ((obj) && GST_MINI_OBJECT_TYPE(obj) == (type))
-#define GST_MINI_OBJECT_CAST(obj)          ((GstMiniObject*)(obj))
+#define GST_MINI_OBJECT_CAST(obj)          ((GstMiniObject*)(void*)(obj))
 #define GST_MINI_OBJECT_CONST_CAST(obj)    ((const GstMiniObject*)(obj))
 #define GST_MINI_OBJECT(obj)               (GST_MINI_OBJECT_CAST(obj))
 
diff --git a/gst/gstobject.h b/gst/gstobject.h
index 6c9f9f5..2d09d3c 100644
--- a/gst/gstobject.h
+++ b/gst/gstobject.h
@@ -36,7 +36,7 @@ G_BEGIN_DECLS
 #define GST_OBJECT_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_OBJECT, GstObjectClass))
 #define GST_OBJECT(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OBJECT, GstObject))
 #define GST_OBJECT_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_OBJECT, GstObjectClass))
-#define GST_OBJECT_CAST(obj)            ((GstObject*)(obj))
+#define GST_OBJECT_CAST(obj)            ((GstObject*)(void*)(obj))
 #define GST_OBJECT_CLASS_CAST(klass)    ((GstObjectClass*)(klass))
 
 /**
