GPid is a HANDLE on Windows
authorJonathan Boeing <jonathan@claws-mail.org>
Mon, 13 Sep 2021 07:30:27 +0000 (00:30 -0700)
committerJonathan Boeing <jonathan@claws-mail.org>
Tue, 14 Sep 2021 00:44:02 +0000 (17:44 -0700)
src/compose.c

index e140b4e06aac075da0bed7a4ec24e6f7873dc79a..1b6e83989055158ab8da63ce4482adb0e4ea91d2 100644 (file)
@@ -200,6 +200,12 @@ typedef enum {
                           "message."));                                                \
 }
 
+#ifdef G_OS_WIN32
+#define INVALID_PID INVALID_HANDLE_VALUE
+#else
+#define INVALID_PID -1
+#endif
+
 static GdkColor default_header_bgcolor = {
        (gulong)0,
        (gushort)0,
@@ -8276,7 +8282,7 @@ static Compose *compose_create(PrefsAccount *account,
        compose->sig_str = NULL;
 
        compose->exteditor_file    = NULL;
-       compose->exteditor_pid     = -1;
+       compose->exteditor_pid     = INVALID_PID;
        compose->exteditor_tag     = -1;
        compose->exteditor_socket  = NULL;
        compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_FORBIDDEN; /* inhibit auto-drafting while loading */
@@ -9770,7 +9776,7 @@ static void compose_ext_editor_closed_cb(GPid pid, gint exit_status, gpointer da
 
        g_free(compose->exteditor_file);
        compose->exteditor_file    = NULL;
-       compose->exteditor_pid     = -1;
+       compose->exteditor_pid     = INVALID_PID;
        compose->exteditor_tag     = -1;
        if (compose->exteditor_socket) {
                gtk_widget_destroy(compose->exteditor_socket);
@@ -9814,7 +9820,7 @@ static gboolean compose_ext_editor_kill(Compose *compose)
                msg = g_strdup_printf
                        (_("The external editor is still working.\n"
                           "Force terminating the process?\n"
-                          "process id: %d"), pid);
+                          "process id: %" G_PID_FORMAT), pid);
                val = alertpanel_full(_("Notice"), msg, GTK_STOCK_NO,
                                      GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST,
                                      FALSE, NULL, ALERT_WARNING);
@@ -9831,7 +9837,7 @@ static gboolean compose_ext_editor_kill(Compose *compose)
                        waitpid(compose->exteditor_pid, NULL, 0);
 #endif /* G_OS_WIN32 */
 
-                       g_warning("terminated process id: %d, "
+                       g_warning("terminated process id: %" G_PID_FORMAT ", "
                                  "temporary file: %s", pid, compose->exteditor_file);
                        g_spawn_close_pid(compose->exteditor_pid);
 
@@ -9839,7 +9845,7 @@ static gboolean compose_ext_editor_kill(Compose *compose)
 
                        g_free(compose->exteditor_file);
                        compose->exteditor_file    = NULL;
-                       compose->exteditor_pid     = -1;
+                       compose->exteditor_pid     = INVALID_PID;
                        compose->exteditor_tag     = -1;
                } else
                        return FALSE;