rmutils: fix byteswapping

fix the byteswapping code that was wrong because of the side effects of the
READ/WRITE macros.

Fixes #599676
This commit is contained in:
Wim Taymans 2009-10-27 12:33:24 +01:00
parent 0a36965808
commit 3784de031d

View file

@ -124,7 +124,7 @@ gst_rm_utils_read_tags (const guint8 * data, guint datalen,
GstBuffer * GstBuffer *
gst_rm_utils_descramble_dnet_buffer (GstBuffer * buf) gst_rm_utils_descramble_dnet_buffer (GstBuffer * buf)
{ {
guint8 *data, *end; guint8 *data, *end, tmp;
buf = gst_buffer_make_writable (buf); buf = gst_buffer_make_writable (buf);
@ -132,8 +132,10 @@ gst_rm_utils_descramble_dnet_buffer (GstBuffer * buf)
data = GST_BUFFER_DATA (buf); data = GST_BUFFER_DATA (buf);
end = GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf); end = GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf);
while ((data + 1) < end) { while ((data + 1) < end) {
/* byte-swap in an alignment-safe way */ /* byte-swap */
GST_WRITE_UINT16_BE (data, GST_READ_UINT16_LE (data)); tmp = data[0];
data[0] = data[1];
data[1] = tmp;
data += sizeof (guint16); data += sizeof (guint16);
} }
return buf; return buf;