diff --git a/ChangeLog b/ChangeLog index 6ebd79f34..d35392aee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2008-08-04 Tor Lillqvist + * glib/giowin32.c + * glib/gmain.c + * glib/gspawn-win32.c + * glib/gspawn-win32-helper.c: Change gssize casts introduced on + 2008-07-28 to gintptr casts now that we have that. gssize is as + such the same as gintptr on both 32- and 64-bit Windows, but the + gintptr name indicates that it is used to hold pointers, i.e. also + HANDLEs. + * tests/testglib.c: Avoid warning on Win64 by using gintptr cast instead if long cast. diff --git a/glib/giowin32.c b/glib/giowin32.c index 17ba75942..7f00572da 100644 --- a/glib/giowin32.c +++ b/glib/giowin32.c @@ -1075,7 +1075,7 @@ g_io_win32_msg_create_watch (GIOChannel *channel, watch->condition = condition; - watch->pollfd.fd = (gssize) G_WIN32_MSG_HANDLE; + watch->pollfd.fd = (gintptr) G_WIN32_MSG_HANDLE; watch->pollfd.events = condition; g_source_add_poll (source, &watch->pollfd); @@ -1279,7 +1279,7 @@ g_io_win32_fd_create_watch (GIOChannel *channel, if (win32_channel->data_avail_event == NULL) create_events (win32_channel); - watch->pollfd.fd = (gssize) win32_channel->data_avail_event; + watch->pollfd.fd = (gintptr) win32_channel->data_avail_event; watch->pollfd.events = condition; if (win32_channel->debug) @@ -1332,7 +1332,7 @@ g_io_win32_console_create_watch (GIOChannel *channel, watch->condition = condition; - watch->pollfd.fd = (gssize) _get_osfhandle (win32_channel->fd); + watch->pollfd.fd = _get_osfhandle (win32_channel->fd); watch->pollfd.events = condition; g_source_add_poll (source, &watch->pollfd); @@ -1500,7 +1500,7 @@ g_io_win32_sock_create_watch (GIOChannel *channel, if (win32_channel->event == 0) win32_channel->event = WSACreateEvent (); - watch->pollfd.fd = (gssize) win32_channel->event; + watch->pollfd.fd = (gintptr) win32_channel->event; watch->pollfd.events = condition; if (win32_channel->debug) @@ -2045,7 +2045,7 @@ g_io_channel_win32_make_pollfd (GIOChannel *channel, if (win32_channel->data_avail_event == NULL) create_events (win32_channel); - fd->fd = (gssize) win32_channel->data_avail_event; + fd->fd = (gintptr) win32_channel->data_avail_event; if (win32_channel->thread_id == 0 && (condition & G_IO_IN)) { @@ -2057,15 +2057,15 @@ g_io_channel_win32_make_pollfd (GIOChannel *channel, break; case G_IO_WIN32_CONSOLE: - fd->fd = (gssize) _get_osfhandle (win32_channel->fd); + fd->fd = _get_osfhandle (win32_channel->fd); break; case G_IO_WIN32_SOCKET: - fd->fd = (gssize) WSACreateEvent (); + fd->fd = (gintptr) WSACreateEvent (); break; case G_IO_WIN32_WINDOWS_MESSAGES: - fd->fd = (gssize) G_WIN32_MSG_HANDLE; + fd->fd = G_WIN32_MSG_HANDLE; break; default: diff --git a/glib/gmain.c b/glib/gmain.c index ea6e6d7c4..c37562329 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -686,7 +686,7 @@ g_main_context_init_pipe (GMainContext *context) if (context->wake_up_semaphore == NULL) g_error ("Cannot create wake-up semaphore: %s", g_win32_error_message (GetLastError ())); - context->wake_up_rec.fd = (gssize) context->wake_up_semaphore; + context->wake_up_rec.fd = (gintptr) context->wake_up_semaphore; context->wake_up_rec.events = G_IO_IN; # ifdef G_MAIN_POLL_DEBUG if (g_main_poll_debug) @@ -4046,7 +4046,7 @@ g_child_watch_source_new (GPid pid) GChildWatchSource *child_watch_source = (GChildWatchSource *)source; #ifdef G_OS_WIN32 - child_watch_source->poll.fd = (gssize) pid; + child_watch_source->poll.fd = (gintptr) pid; child_watch_source->poll.events = G_IO_IN; g_source_add_poll (source, &child_watch_source->poll); diff --git a/glib/gspawn-win32-helper.c b/glib/gspawn-win32-helper.c index 3cf624abe..40108bb67 100644 --- a/glib/gspawn-win32-helper.c +++ b/glib/gspawn-win32-helper.c @@ -30,13 +30,13 @@ static void -write_err_and_exit (gint fd, - gssize msg) +write_err_and_exit (gint fd, + gintptr msg) { - gssize en = errno; + gintptr en = errno; - write (fd, &msg, sizeof(gssize)); - write (fd, &en, sizeof(gssize)); + write (fd, &msg, sizeof(gintptr)); + write (fd, &en, sizeof(gintptr)); _exit (1); } @@ -163,9 +163,9 @@ main (int ignored_argc, char **ignored_argv) int i; int fd; int mode; - gssize handle; + gintptr handle; int saved_errno; - gssize no_error = CHILD_NO_ERROR; + gintptr no_error = CHILD_NO_ERROR; gint argv_zero_offset = ARG_PROGRAM; wchar_t **new_wargv; int argc; diff --git a/glib/gspawn-win32.c b/glib/gspawn-win32.c index 24e9b5602..9eb21e77d 100644 --- a/glib/gspawn-win32.c +++ b/glib/gspawn-win32.c @@ -111,7 +111,7 @@ dup_noninherited (int fd, GetCurrentProcess (), &filehandle, 0, FALSE, DUPLICATE_SAME_ACCESS); close (fd); - return _open_osfhandle ((gssize) filehandle, mode | _O_NOINHERIT); + return _open_osfhandle ((gintptr) filehandle, mode | _O_NOINHERIT); } #ifndef GSPAWN_HELPER @@ -308,22 +308,22 @@ make_pipe (gint p[2], */ static gboolean read_helper_report (int fd, - gssize report[2], + gintptr report[2], GError **error) { gint bytes = 0; - while (bytes < sizeof(gssize)*2) + while (bytes < sizeof(gintptr)*2) { gint chunk; if (debug) g_print ("%s:read_helper_report: read %" G_GSIZE_FORMAT "...\n", __FILE__, - sizeof(gssize)*2 - bytes); + sizeof(gintptr)*2 - bytes); chunk = read (fd, ((gchar*)report) + bytes, - sizeof(gssize)*2 - bytes); + sizeof(gintptr)*2 - bytes); if (debug) g_print ("...got %d bytes\n", chunk); @@ -349,14 +349,14 @@ read_helper_report (int fd, bytes += chunk; } - if (bytes < sizeof(gssize)*2) + if (bytes < sizeof(gintptr)*2) return FALSE; return TRUE; } static void -set_child_error (gssize report[2], +set_child_error (gintptr report[2], const gchar *working_directory, GError **error) { @@ -429,7 +429,7 @@ do_spawn_directly (gint *exit_status, { const int mode = (exit_status == NULL) ? P_NOWAIT : P_WAIT; char **new_argv; - gssize rc = -1; + gintptr rc = -1; int saved_errno; GError *conv_error = NULL; gint conv_error_index; @@ -536,7 +536,7 @@ do_spawn_with_pipes (gint *exit_status, char args[ARG_COUNT][10]; char **new_argv; int i; - gssize rc = -1; + gintptr rc = -1; int saved_errno; int argc; int stdin_pipe[2] = { -1, -1 }; @@ -544,7 +544,7 @@ do_spawn_with_pipes (gint *exit_status, int stderr_pipe[2] = { -1, -1 }; int child_err_report_pipe[2] = { -1, -1 }; int helper_sync_pipe[2] = { -1, -1 }; - gssize helper_report[2]; + gintptr helper_report[2]; static gboolean warned_about_child_setup = FALSE; GError *conv_error = NULL; gint conv_error_index; @@ -1074,7 +1074,7 @@ g_spawn_sync_utf8 (const gchar *working_directory, /* Helper process was involved. Read its report now after the * grandchild has finished. */ - gssize helper_report[2]; + gintptr helper_report[2]; if (!read_helper_report (reportpipe, helper_report, error)) failed = TRUE;