From 4e6c35366586487a18a591812b0a9fb31858ca1e Mon Sep 17 00:00:00 2001 From: Wook Song Date: Fri, 29 Mar 2019 09:08:30 +0900 Subject: [PATCH] [IIO] Change functions used for byte order conversion Without defining _BSD_SOURCE and __USE_BSD macros, the functions such as be16toh, le16toh, be32toh, le32toh, be64toh and le64toh are not compatible with c89. In order to fix this issue, this patch replaces such functions with byte order macros from glib-2.0. Signed-off-by: Wook Song --- gst/nnstreamer/tensor_source/tensor_src_iio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gst/nnstreamer/tensor_source/tensor_src_iio.c b/gst/nnstreamer/tensor_source/tensor_src_iio.c index d58644d..e42e5aa 100644 --- a/gst/nnstreamer/tensor_source/tensor_src_iio.c +++ b/gst/nnstreamer/tensor_source/tensor_src_iio.c @@ -1748,11 +1748,11 @@ gst_tensor_src_iio_process_scanned_data (GList * channels, gchar * data, { guint16 value = *(guint16 *) (data + prop->location); if (prop->big_endian) { - value = be16toh (value); + value = GUINT16_FROM_BE (value); /** right shift the extra storage bits for big endian */ value >>= (16 - prop->storage_bits); } else { - value = le16toh (value); + value = GUINT16_FROM_LE (value); /** mask out the extra storage bits for little endian */ storage_mask = (G_GUINT64_CONSTANT (1) << prop->storage_bits) - 1; value &= storage_mask; @@ -1767,11 +1767,11 @@ gst_tensor_src_iio_process_scanned_data (GList * channels, gchar * data, { guint32 value = *(guint32 *) (data + prop->location); if (prop->big_endian) { - value = be32toh (value); + value = GUINT32_FROM_BE (value); /** right shift the extra storage bits for big endian */ value >>= (32 - prop->storage_bits); } else { - value = le32toh (value); + value = GUINT32_FROM_LE (value); /** mask out the extra storage bits for little endian */ storage_mask = (G_GUINT64_CONSTANT (1) << prop->storage_bits) - 1; value &= storage_mask; @@ -1790,11 +1790,11 @@ gst_tensor_src_iio_process_scanned_data (GList * channels, gchar * data, { guint64 value = *(guint64 *) (data + prop->location); if (prop->big_endian) { - value = be64toh (value); + value = GUINT64_FROM_BE (value); /** right shift the extra storage bits for big endian */ value >>= (64 - prop->storage_bits); } else { - value = le64toh (value); + value = GUINT64_FROM_LE (value); /** mask out the extra storage bits for little endian */ storage_mask = (G_GUINT64_CONSTANT (1) << prop->storage_bits) - 1; value &= storage_mask; -- 2.7.4