[glib] tests: data-input-stream: fix -Wduplicated-branches
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] tests: data-input-stream: fix -Wduplicated-branches
- Date: Fri, 16 Feb 2018 17:39:47 +0000 (UTC)
commit c01c25589513c51f0063a72adfe7b8e543d621eb
Author: Ernestas Kulik <ernestask gnome org>
Date: Fri Feb 16 18:19:19 2018 +0200
tests: data-input-stream: fix -Wduplicated-branches
The fix makes things a bit awkward, but it seems to work just fine.
https://bugzilla.gnome.org/show_bug.cgi?id=793399
gio/tests/data-input-stream.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gio/tests/data-input-stream.c b/gio/tests/data-input-stream.c
index d82b3e3f1..0d59cac25 100644
--- a/gio/tests/data-input-stream.c
+++ b/gio/tests/data-input-stream.c
@@ -337,14 +337,15 @@ enum TestDataType {
TEST_DATA_UINT64
};
+/* The order is reversed to avoid -Wduplicated-branches. */
#define TEST_DATA_RETYPE_BUFF(a, t, v) \
- (a == TEST_DATA_BYTE ? (t) *(guchar*)v : \
- (a == TEST_DATA_INT16 ? (t) *(gint16*)v : \
- (a == TEST_DATA_UINT16 ? (t) *(guint16*)v : \
- (a == TEST_DATA_INT32 ? (t) *(gint32*)v : \
- (a == TEST_DATA_UINT32 ? (t) *(guint32*)v : \
- (a == TEST_DATA_INT64 ? (t) *(gint64*)v : \
- (t) *(guint64*)v ))))))
+ (a == TEST_DATA_UINT64 ? (t) *(guint64*)v : \
+ (a == TEST_DATA_INT64 ? (t) *(gint64*)v : \
+ (a == TEST_DATA_UINT32 ? (t) *(guint32*)v : \
+ (a == TEST_DATA_INT32 ? (t) *(gint32*)v : \
+ (a == TEST_DATA_UINT16 ? (t) *(guint16*)v : \
+ (a == TEST_DATA_INT16 ? (t) *(gint16*)v : \
+ (t) *(guchar*)v ))))))
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]