[gimp] app, plug-ins: (Win32) fix calls to ShellExecute().



commit a2c92c576d686dc900e2671b1285248e655fa417
Author: Jehan <jehan girinstud io>
Date:   Sun Sep 22 14:09:09 2019 +0200

    app, plug-ins: (Win32) fix calls to ShellExecute().
    
    This function returns a HINSTANCE (which is technically a pointer if I
    understand correctly) for backward compatibility reason. But this is
    actually meant to be used as an int only according to the docs.
    Yet casting to gint outputs "cast from pointer to integer of different
    size" warnings.
    We should use intptr_t instead for such cases, since it is a type made
    explicitly to hold a pointer as int, hence should always be right on any
    platform.
    
    https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutea

 app/widgets/gimpcriticaldialog.c | 4 ++--
 plug-ins/common/web-browser.c    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpcriticaldialog.c b/app/widgets/gimpcriticaldialog.c
index e8293b39b2..b3c178b26c 100644
--- a/app/widgets/gimpcriticaldialog.c
+++ b/app/widgets/gimpcriticaldialog.c
@@ -220,11 +220,11 @@ browser_open_url (GtkWindow    *window,
   HINSTANCE hinst = ShellExecute (GetDesktopWindow(),
                                   "open", url, NULL, NULL, SW_SHOW);
 
-  if ((gint) hinst <= 32)
+  if ((intptr_t) hinst <= 32)
     {
       const gchar *err;
 
-      switch ((gint) hinst)
+      switch ((intptr_t) hinst)
         {
           case 0 :
             err = _("The operating system is out of memory or resources.");
diff --git a/plug-ins/common/web-browser.c b/plug-ins/common/web-browser.c
index 4e790d1ae0..d37f0773f3 100644
--- a/plug-ins/common/web-browser.c
+++ b/plug-ins/common/web-browser.c
@@ -165,11 +165,11 @@ browser_open_url (GtkWindow    *window,
   HINSTANCE hinst = ShellExecute (GetDesktopWindow(),
                                   "open", url, NULL, NULL, SW_SHOW);
 
-  if ((gint) hinst <= 32)
+  if ((intptr_t) hinst <= 32)
     {
       const gchar *err;
 
-      switch ((gint) hinst)
+      switch ((intptr_t) hinst)
         {
           case 0 :
             err = _("The operating system is out of memory or resources.");


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