[gimp] app: fix cast bug.



commit 8caef4ea0baa8eda595eece70075178c9aecc94a
Author: Jehan <jehan girinstud io>
Date:   Mon Apr 20 01:21:22 2020 +0200

    app: fix cast bug.
    
    When building (at least on 32-bit), fixes this warning:
    > app/widgets/gimpdashboard.c:3840:58: warning: cast to pointer from integer of different size 
[-Wint-to-pointer-cast]
    
    Unsigned long long is specified in the C99 standard to be at least
    64-bit. So it's normal that the compiler complains, as a cast from
    unsigned long long to a pointer has chances to go very wrong.
    Yet gimp_backtrace_get_frame_address() actually returns a guintptr which
    is type-compatible with gpointer so let's not give the compiler false
    information and just use this type. Then cast it to unsigned long long
    just for printing to dashboard log.

 app/widgets/gimpdashboard.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimpdashboard.c b/app/widgets/gimpdashboard.c
index 6a10a998d6..2f3f13dc91 100644
--- a/app/widgets/gimpdashboard.c
+++ b/app/widgets/gimpdashboard.c
@@ -3828,14 +3828,14 @@ gimp_dashboard_log_sample (GimpDashboard *dashboard,
 
               for (frame = n_head; frame < n_frames - n_tail; frame++)
                 {
-                  unsigned long long      address;
+                  guintptr address;
 
                   address = gimp_backtrace_get_frame_address (backtrace,
                                                               thread, frame);
 
                   gimp_dashboard_log_printf (dashboard,
                                              "<frame address=\"0x%llx\" />\n",
-                                             address);
+                                             (unsigned long long) address);
 
                   g_hash_table_add (priv->log_addresses, (gpointer) address);
                 }


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