[glib/glib-2-54] tests: data-input-stream: fix -Wduplicated-branches



commit 0510bf4cd57ea023e23d781d3e1f38b2ea473df0
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 58a3b3ac2..ce232b37e 100644
--- a/gio/tests/data-input-stream.c
+++ b/gio/tests/data-input-stream.c
@@ -333,14 +333,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]