diff gtk3/dw.c @ 2132:42f8ad7a89e8

Added DW_POINTER_TO_(U)LONGLONG and DW_(U)LONGLONG_TO_POINTER macros. This allows casting with intermediate (u)intptr_t cast to avoid compiler warnings on different systems. Use these macros where necessary in the code. Might need to check the compiler supports LONG LONG... since some compilers we support might not, like old versions of VisualAge C and Watcom.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 04 Jul 2020 17:51:46 +0000
parents 663467f6eee4
children 2090d7f46de5
line wrap: on
line diff
--- a/gtk3/dw.c	Tue Jun 30 20:10:23 2020 +0000
+++ b/gtk3/dw.c	Sat Jul 04 17:51:46 2020 +0000
@@ -1963,10 +1963,10 @@
    int (*func)(HWND, void *);
    void *data;
    
-   snprintf(textbuf, 100, "dw-notification-%llu-func", (unsigned long long)g_variant_get_uint64(param));
+   snprintf(textbuf, 100, "dw-notification-%llu-func", DW_POINTER_TO_ULONGLONG(g_variant_get_uint64(param)));
    func = g_object_get_data(G_OBJECT(_DWApp), textbuf);
    g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL);
-   snprintf(textbuf, 100, "dw-notification-%llu-data", (unsigned long long)g_variant_get_uint64(param));
+   snprintf(textbuf, 100, "dw-notification-%llu-data", DW_POINTER_TO_ULONGLONG(g_variant_get_uint64(param)));
    data = g_object_get_data(G_OBJECT(_DWApp), textbuf);
    g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL);  
    
@@ -11128,7 +11128,7 @@
       /* Generate a unique ID based on the notification handle,
        * so we can use it to remove the notification in dw_window_destroy().
        */
-      snprintf(id, 100, "dw-notification-%llu", (unsigned long long)notification);
+      snprintf(id, 100, "dw-notification-%llu", DW_POINTER_TO_ULONGLONG(notification));
       g_application_send_notification(_DWApp, id, (GNotification *)notification);
       return DW_ERROR_NONE;
    }
@@ -12064,9 +12064,9 @@
    if (G_IS_NOTIFICATION(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0)
    {
       char textbuf[101] = {0};
-      snprintf(textbuf, 100, "dw-notification-%llu-func", (unsigned long long)thiswindow);
+      snprintf(textbuf, 100, "dw-notification-%llu-func", DW_POINTER_TO_ULONGLONG(thiswindow));
       g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(sigfunc));
-      snprintf(textbuf, 100, "dw-notification-%llu-data", (unsigned long long)thiswindow);
+      snprintf(textbuf, 100, "dw-notification-%llu-data", DW_POINTER_TO_ULONGLONG(thiswindow));
       g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(data)); 
       DW_MUTEX_UNLOCK;     
       return;