[gst-cvs] gstreamer: bytewriter: fix compiler warning

Tim Mueller tpm at kemper.freedesktop.org
Fri Nov 20 08:15:28 PST 2009


Module: gstreamer
Branch: master
Commit: 022970e9f911da45215ae4faa4cf40d0bf1ddce2
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=022970e9f911da45215ae4faa4cf40d0bf1ddce2

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Fri Nov 20 16:00:47 2009 +0000

bytewriter: fix compiler warning

Some gcc versions warn about bytewriter writing to memory accessed
via a const guint8 pointer, despite our explicit cast to guint8 *.
Work around that by using an intermediary variable.

Fixes #598526.

---

 libs/gst/base/gstbytewriter.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libs/gst/base/gstbytewriter.c b/libs/gst/base/gstbytewriter.c
index 7b5d3fa..375c410 100644
--- a/libs/gst/base/gstbytewriter.c
+++ b/libs/gst/base/gstbytewriter.c
@@ -437,12 +437,15 @@ gst_byte_writer_ensure_free_space (GstByteWriter * writer, guint size)
 gboolean \
 gst_byte_writer_put_##name (GstByteWriter *writer, type val) \
 { \
+  guint8 *write_data; \
+  \
   g_return_val_if_fail (writer != NULL, FALSE); \
   \
   if (G_UNLIKELY (!gst_byte_writer_ensure_free_space(writer, bits/8))) \
     return FALSE; \
   \
-  write_func ((guint8 *) &writer->parent.data[writer->parent.byte], val); \
+  write_data = (guint8 *) writer->parent.data + writer->parent.byte; \
+  write_func (write_data, val); \
   writer->parent.byte += bits/8; \
   writer->parent.size = MAX (writer->parent.size, writer->parent.byte); \
   \





More information about the Gstreamer-commits mailing list