[glib] gio: Add some casts for printf() formatting statbufs on Solaris



commit e644bfa37ee7429cfca6a91c46b55cd402dfbf6d
Author: Philip Withnall <withnall endlessm com>
Date:   Fri Nov 17 14:24:10 2017 +0000

    gio: Add some casts for printf() formatting statbufs on Solaris
    
    Apparently Solaris defines statbuf fields as long when Linux doesn’t, in
    some cases. Cast down to the type expected by the printf() format
    placeholder.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749652

 gio/gdbusauthmechanismsha1.c |    2 +-
 gio/gdbusmessage.c           |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gio/gdbusauthmechanismsha1.c b/gio/gdbusauthmechanismsha1.c
index 47cef78..8fba5fd 100644
--- a/gio/gdbusauthmechanismsha1.c
+++ b/gio/gdbusauthmechanismsha1.c
@@ -273,7 +273,7 @@ ensure_keyring_directory (GError **error)
                            G_IO_ERROR_FAILED,
                            _("Permissions on directory “%s” are malformed. Expected mode 0700, got 0%o"),
                            path,
-                           statbuf.st_mode & 0777);
+                           (guint) (statbuf.st_mode & 0777));
               g_free (path);
               path = NULL;
               goto out;
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index 7dd458d..717f269 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -3481,10 +3481,10 @@ g_dbus_message_print (GDBusMessage *message,
                 {
 #ifndef MAJOR_MINOR_NOT_FOUND                       
                   g_string_append_printf (fs, "%s" "dev=%d:%d", fs->len > 0 ? "," : "",
-                                          major (statbuf.st_dev), minor (statbuf.st_dev));
+                                          (gint) major (statbuf.st_dev), (gint) minor (statbuf.st_dev));
 #endif                  
                   g_string_append_printf (fs, "%s" "mode=0%o", fs->len > 0 ? "," : "",
-                                          statbuf.st_mode);
+                                          (guint) statbuf.st_mode);
                   g_string_append_printf (fs, "%s" "ino=%" G_GUINT64_FORMAT, fs->len > 0 ? "," : "",
                                           (guint64) statbuf.st_ino);
                   g_string_append_printf (fs, "%s" "uid=%u", fs->len > 0 ? "," : "",
@@ -3493,7 +3493,7 @@ g_dbus_message_print (GDBusMessage *message,
                                           (guint) statbuf.st_gid);
 #ifndef MAJOR_MINOR_NOT_FOUND                     
                   g_string_append_printf (fs, "%s" "rdev=%d:%d", fs->len > 0 ? "," : "",
-                                          major (statbuf.st_rdev), minor (statbuf.st_rdev));
+                                          (gint) major (statbuf.st_rdev), (gint) minor (statbuf.st_rdev));
 #endif                  
                   g_string_append_printf (fs, "%s" "size=%" G_GUINT64_FORMAT, fs->len > 0 ? "," : "",
                                           (guint64) statbuf.st_size);


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