[glib: 1/2] gdbusmessage: Fix comparisons out of range for enum types



commit 25636e50e00bb27422a5a7183a07039e1a093fa3
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Jun 17 15:45:30 2019 +0100

    gdbusmessage: Fix comparisons out of range for enum types
    
    This was warning on macOS.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Fixes: #887

 gio/gdbusmessage.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index 9b89dc5b6..852a70430 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -873,7 +873,7 @@ g_dbus_message_set_message_type (GDBusMessage      *message,
                                  GDBusMessageType   type)
 {
   g_return_if_fail (G_IS_DBUS_MESSAGE (message));
-  g_return_if_fail (type >=0 && type < 256);
+  g_return_if_fail ((guint) type >= 0 && (guint) type < 256);
 
   if (message->locked)
     {
@@ -920,7 +920,7 @@ g_dbus_message_set_flags (GDBusMessage       *message,
                           GDBusMessageFlags   flags)
 {
   g_return_if_fail (G_IS_DBUS_MESSAGE (message));
-  g_return_if_fail (flags >=0 && flags < 256);
+  g_return_if_fail ((guint) flags >= 0 && (guint) flags < 256);
 
   if (message->locked)
     {
@@ -998,7 +998,7 @@ g_dbus_message_get_header (GDBusMessage             *message,
                            GDBusMessageHeaderField   header_field)
 {
   g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
-  g_return_val_if_fail (header_field >=0 && header_field < 256, NULL);
+  g_return_val_if_fail ((guint) header_field >= 0 && (guint) header_field < 256, NULL);
   return g_hash_table_lookup (message->headers, GUINT_TO_POINTER (header_field));
 }
 
@@ -1020,7 +1020,7 @@ g_dbus_message_set_header (GDBusMessage             *message,
                            GVariant                 *value)
 {
   g_return_if_fail (G_IS_DBUS_MESSAGE (message));
-  g_return_if_fail (header_field >=0 && header_field < 256);
+  g_return_if_fail ((guint) header_field >= 0 && (guint) header_field < 256);
 
   if (message->locked)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]