summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey S. Smith <whydoubt@yahoo.com>2010-09-02 00:01:25 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-09-02 00:09:08 +0100
commit4375e998eed1571638e66a9eaff2110c2306a2b9 (patch)
tree5174d98dbbcad932f2003b0fa7429f643a95e3bf
parentf9204d5d70d126557cce0175e8ce9ce382d7fbc5 (diff)
Fix casts in a bunch of inline functions to maintain correct const-ness
Make code including GStreamer headers compile with -Wcast-qual by maintaining const-ness when casting. Also fix function signature of gst_byte_writer_set_pos(): the byte writer should not be marked as const. https://bugzilla.gnome.org/show_bug.cgi?id=627910
-rw-r--r--docs/gst/gstreamer-sections.txt1
-rw-r--r--gst/gstbuffer.h2
-rw-r--r--gst/gstbufferlist.h2
-rw-r--r--gst/gstevent.h2
-rw-r--r--gst/gstmessage.h2
-rw-r--r--gst/gstminiobject.h1
-rw-r--r--gst/gstquery.h2
-rw-r--r--gst/gstutils.h2
-rw-r--r--libs/gst/base/gstbytewriter.h8
9 files changed, 12 insertions, 10 deletions
diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt
index 448898377c..361ed23a0a 100644
--- a/docs/gst/gstreamer-sections.txt
+++ b/docs/gst/gstreamer-sections.txt
@@ -1263,6 +1263,7 @@ GST_MINI_OBJECT_GET_CLASS
GST_TYPE_MINI_OBJECT
GST_TYPE_MINI_OBJECT_FLAGS
GST_MINI_OBJECT_CAST
+GST_MINI_OBJECT_CONST_CAST
GST_IS_PARAM_SPEC_MINI_OBJECT
GST_PARAM_SPEC_MINI_OBJECT
diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h
index 44c32109e9..730ff81bd6 100644
--- a/gst/gstbuffer.h
+++ b/gst/gstbuffer.h
@@ -380,7 +380,7 @@ G_INLINE_FUNC GstBuffer * gst_buffer_copy (const GstBuffer * buf);
static inline GstBuffer *
gst_buffer_copy (const GstBuffer * buf)
{
- return GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CAST (buf)));
+ return GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
}
diff --git a/gst/gstbufferlist.h b/gst/gstbufferlist.h
index c75a07b3ea..635817e017 100644
--- a/gst/gstbufferlist.h
+++ b/gst/gstbufferlist.h
@@ -179,7 +179,7 @@ G_INLINE_FUNC GstBufferList * gst_buffer_list_copy (const GstBufferList * list);
static inline GstBufferList *
gst_buffer_list_copy (const GstBufferList * list)
{
- return GST_BUFFER_LIST_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (list)));
+ return GST_BUFFER_LIST_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (list)));
}
/**
diff --git a/gst/gstevent.h b/gst/gstevent.h
index 6fc809fa48..7ee460d533 100644
--- a/gst/gstevent.h
+++ b/gst/gstevent.h
@@ -400,7 +400,7 @@ G_INLINE_FUNC GstEvent * gst_event_copy (const GstEvent * event);
static inline GstEvent *
gst_event_copy (const GstEvent * event)
{
- return GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (event)));
+ return GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (event)));
}
diff --git a/gst/gstmessage.h b/gst/gstmessage.h
index 83c280f005..d845c32972 100644
--- a/gst/gstmessage.h
+++ b/gst/gstmessage.h
@@ -341,7 +341,7 @@ G_INLINE_FUNC GstMessage * gst_message_copy (const GstMessage * msg);
static inline GstMessage *
gst_message_copy (const GstMessage * msg)
{
- return GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (msg)));
+ return GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (msg)));
}
/**
diff --git a/gst/gstminiobject.h b/gst/gstminiobject.h
index da05a31411..9bb56d6dec 100644
--- a/gst/gstminiobject.h
+++ b/gst/gstminiobject.h
@@ -36,6 +36,7 @@ G_BEGIN_DECLS
#define GST_MINI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MINI_OBJECT, GstMiniObject))
#define GST_MINI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MINI_OBJECT, GstMiniObjectClass))
#define GST_MINI_OBJECT_CAST(obj) ((GstMiniObject*)(obj))
+#define GST_MINI_OBJECT_CONST_CAST(obj) ((const GstMiniObject*)(obj))
typedef struct _GstMiniObject GstMiniObject;
typedef struct _GstMiniObjectClass GstMiniObjectClass;
diff --git a/gst/gstquery.h b/gst/gstquery.h
index ae9b07bc86..7077dc650d 100644
--- a/gst/gstquery.h
+++ b/gst/gstquery.h
@@ -237,7 +237,7 @@ G_INLINE_FUNC GstQuery * gst_query_copy (const GstQuery * q);
static inline GstQuery *
gst_query_copy (const GstQuery * q)
{
- return GST_QUERY_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (q)));
+ return GST_QUERY_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (q)));
}
/**
diff --git a/gst/gstutils.h b/gst/gstutils.h
index f91b77749a..fad4ff56b5 100644
--- a/gst/gstutils.h
+++ b/gst/gstutils.h
@@ -270,7 +270,7 @@ GST_BOILERPLATE_FULL (type, type_as_function, parent_type, \
/* Define PUT and GET functions for unaligned memory */
#define _GST_GET(__data, __idx, __size, __shift) \
- (((guint##__size) (((guint8 *) (__data))[__idx])) << (__shift))
+ (((guint##__size) (((const guint8 *) (__data))[__idx])) << (__shift))
#define _GST_PUT(__data, __idx, __size, __shift, __num) \
(((guint8 *) (__data))[__idx] = (((guint##__size) (__num)) >> (__shift)) & 0xff)
diff --git a/libs/gst/base/gstbytewriter.h b/libs/gst/base/gstbytewriter.h
index 743e9dbcd2..fe1881fb79 100644
--- a/libs/gst/base/gstbytewriter.h
+++ b/libs/gst/base/gstbytewriter.h
@@ -94,17 +94,17 @@ GstBuffer *gst_byte_writer_reset_and_get_buffer (GstByteWriter *writer);
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC guint gst_byte_writer_get_pos (const GstByteWriter *writer);
-G_INLINE_FUNC gboolean gst_byte_writer_set_pos (const GstByteWriter *writer, guint pos);
+G_INLINE_FUNC gboolean gst_byte_writer_set_pos (GstByteWriter *writer, guint pos);
G_INLINE_FUNC guint gst_byte_writer_get_size (const GstByteWriter *writer);
#else
static inline guint
gst_byte_writer_get_pos (const GstByteWriter *writer)
{
- return gst_byte_reader_get_pos (GST_BYTE_READER (writer));
+ return gst_byte_reader_get_pos ((const GstByteReader *) writer);
}
static inline gboolean
-gst_byte_writer_set_pos (const GstByteWriter *writer, guint pos)
+gst_byte_writer_set_pos (GstByteWriter *writer, guint pos)
{
return gst_byte_reader_set_pos (GST_BYTE_READER (writer), pos);
}
@@ -112,7 +112,7 @@ gst_byte_writer_set_pos (const GstByteWriter *writer, guint pos)
static inline guint
gst_byte_writer_get_size (const GstByteWriter *writer)
{
- return gst_byte_reader_get_size (GST_BYTE_READER (writer));
+ return gst_byte_reader_get_size ((const GstByteReader *) writer);
}
#endif